Browse Source

Default out some things.

Sam Jaffe 6 years ago
parent
commit
018b9b577a
2 changed files with 7 additions and 8 deletions
  1. 5 5
      engine/include/game/engine/entity.hpp
  2. 2 3
      engine/src/entity.cxx

+ 5 - 5
engine/include/game/engine/entity.hpp

@@ -30,17 +30,17 @@ namespace engine {
     std::weak_ptr<scene> in_scene;
 
     // Position info
-    math::vec2 last_position;
+    math::vec2 last_position{{-1, -1}};
     math::vec2 velocity;
-    math::vec2 acceleration;
-    float angular_velocity;
+    math::vec2 acceleration{{0, 0}};
+    float angular_velocity{0.f};
     // A mix of position and graphics info
     graphics::object render_info_;
     // Graphics info
-    std::size_t frame_index;
+    std::size_t frame_index{0};
     std::vector<math::vec2> frame_texture_coords;
 
-    float scale;
+    float scale{1.f};
 
     collision_t collides_with;
     collision_t collides_as;

+ 2 - 3
engine/src/entity.cxx

@@ -22,9 +22,8 @@ static unsigned int next_id() {
 }
 
 entity::entity(Json::Value const & json, graphics::manager const & mgr)
-    : 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, mgr)), frame_index(0),
+    : identity<entity>(next_id()), velocity(to_vec2(json["velocity"])),
+      render_info_(to_object(json, mgr)),
       frame_texture_coords({make_vector(0.f, 0.f)}),
       scale(json["size"].asFloat()), collides_with(0), collides_as(0) {
   render_info_.location.size *= scale;