X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=examples%2Fbassteroids%2Fsource%2Fhitpoints.h;h=49fb920d2d1aa5a50919d53f7b06c8e63d04d8ca;hb=239cd38de0ddbb5931151523530a5e7272e16f7f;hp=a11d961783674e1b13b5043ca74c840cf4003525;hpb=cb4e8bbe06dc64aff932784541a29493723fc03e;p=libs%2Fgame.git diff --git a/examples/bassteroids/source/hitpoints.h b/examples/bassteroids/source/hitpoints.h index a11d961..49fb920 100644 --- a/examples/bassteroids/source/hitpoints.h +++ b/examples/bassteroids/source/hitpoints.h @@ -2,32 +2,27 @@ #define HITPOINTS_H_ #include +#include "setups.h" -struct HitPointsSetup +struct HitPointsData { - /*class Loader: public Msp::DataFile::ObjectLoader - { - };*/ - - unsigned max_hits = 1; - unsigned vulnerable_to = ~0U; + unsigned remaining_hits; }; -class HitPoints: public Msp::Game::Component +class HitPoints: public Msp::Game::BufferedComponent { public: using Setup = HitPointsSetup; private: const Setup &setup; - unsigned remaining_hits; public: HitPoints(Msp::Game::Handle, const Setup &); void take_damage(unsigned, unsigned); - bool is_alive() const { return remaining_hits; } + bool is_alive() const { return read().remaining_hits; } }; #endif