|
|
@@ -24,22 +24,21 @@ static unsigned int next_id() {
|
|
|
entity::entity(Json::Value const & json)
|
|
|
: identity<entity>(next_id()), in_scene(), last_position({-1, -1}),
|
|
|
velocity(to_vec2(json["velocity"])), acceleration(),
|
|
|
- angular_velocity(0.f), render_info(to_object(json)), frame_index(0),
|
|
|
+ angular_velocity(0.f), render_info_(to_object(json)), frame_index(0),
|
|
|
frame_texture_coords({make_vector(0.f, 0.f)}),
|
|
|
scale(json["size"].asFloat()), collides_with(0), collides_as(0) {
|
|
|
- render_info.location.size *= scale;
|
|
|
- render_info.frame.origin = frame_texture_coords[frame_index];
|
|
|
+ render_info_.location.size *= scale;
|
|
|
+ render_info_.frame.origin = frame_texture_coords[frame_index];
|
|
|
}
|
|
|
|
|
|
-void entity::update(tick const & tk) {
|
|
|
- last_position = render_info.location.origin;
|
|
|
- float delta = tk.since.count();
|
|
|
+void entity::update(float delta) {
|
|
|
+ last_position = render_info_.location.origin;
|
|
|
auto delta_pos = velocity * delta;
|
|
|
- render_info.location.origin += delta_pos;
|
|
|
- render_info.points.ll += delta_pos;
|
|
|
- render_info.points.lr += delta_pos;
|
|
|
- render_info.points.ur += delta_pos;
|
|
|
- render_info.points.ul += delta_pos;
|
|
|
+ render_info_.location.origin += delta_pos;
|
|
|
+ render_info_.points.ll += delta_pos;
|
|
|
+ render_info_.points.lr += delta_pos;
|
|
|
+ render_info_.points.ur += delta_pos;
|
|
|
+ render_info_.points.ul += delta_pos;
|
|
|
velocity += acceleration * delta;
|
|
|
// render_info.angle += angular_velocity * delta;
|
|
|
}
|