X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=examples%2Fbassteroids%2Fsource%2Fhitpoints.h;h=f6000d7abab3c6dc54782d4fc2c413817c8263e8;hb=bfbcfa2678c70d661cb9104b2ef677d7d7b5a637;hp=a11d961783674e1b13b5043ca74c840cf4003525;hpb=a99b57a74252fd3de649d544d070b747f91fcf4d;p=libs%2Fgame.git diff --git a/examples/bassteroids/source/hitpoints.h b/examples/bassteroids/source/hitpoints.h index a11d961..f6000d7 100644 --- a/examples/bassteroids/source/hitpoints.h +++ b/examples/bassteroids/source/hitpoints.h @@ -13,21 +13,25 @@ struct HitPointsSetup unsigned vulnerable_to = ~0U; }; -class HitPoints: public Msp::Game::Component +struct HitPointsData +{ + unsigned remaining_hits; +}; + +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