X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=examples%2Fbassteroids%2Fsource%2Fphysics.h;h=fcf4b0dce534396434b5d6667a654f9aeb73e502;hb=4014851ac2ed8e86b5a781dcc3056088d40465a1;hp=a611789ebd1cfa9b16d2c15f1d841ec7b181de27;hpb=0636566dd84ca185d3e9a6fae02459569c42d220;p=libs%2Fgame.git diff --git a/examples/bassteroids/source/physics.h b/examples/bassteroids/source/physics.h index a611789..fcf4b0d 100644 --- a/examples/bassteroids/source/physics.h +++ b/examples/bassteroids/source/physics.h @@ -2,25 +2,34 @@ #define PHYSICS_H_ #include +#include #include #include #include #include #include +#include "events.h" class PhysicalEntity; class Physics: public Msp::Game::System { +public: + using EventSource = Msp::Game::EventSource; + private: struct SimulatedEntity { Msp::Game::Handle entity; float inverse_mass = 1.0f; + float inverse_momi = 1.0f; Msp::LinAl::Vector external_force; + float external_torque = 0.0f; Msp::LinAl::Vector position; + Msp::Geometry::Angle rotation; Msp::LinAl::Vector velocity; + Msp::Geometry::Angle angular_velocity; unsigned collision_count; Msp::LinAl::Vector position_adjust; @@ -35,6 +44,7 @@ private: Msp::LinAl::Vector normal; }; + EventSource event_source; Msp::Game::EventObserver observer; std::vector entities; unsigned fixture_count = 0; @@ -63,6 +73,7 @@ private: Collision &get_collision(unsigned, unsigned); void collide_circle_circle(unsigned, unsigned); + void collide_circle_box(unsigned, unsigned); }; #endif