X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2FHud.hh;h=2262b062983ae1d8faedc89bdc0cdcda21aaa270;hb=81ff940d1bea07447f8218ab9a764fbf393431e8;hp=966ae43bf54a553ace4aedefe65a98eed98c1d17;hpb=892da43bf5796e7c5f593a6d0f53bd797a36bd3e;p=chaz%2Fyoink diff --git a/src/Hud.hh b/src/Hud.hh index 966ae43..2262b06 100644 --- a/src/Hud.hh +++ b/src/Hud.hh @@ -38,14 +38,18 @@ #include #include #include -#include +#include +#include "GameState.hh" + + +// TODO this stuff is still just hacked up class ProgressBar : public Mf::Drawable { public: - ProgressBar(const Mf::Tilemap& tilemap, Mf::Tilemap::Index index); + ProgressBar(const Mf::Texture& tilemap, Mf::Texture::TileIndex index); void resize(const Mf::Rectangle& rect); @@ -55,14 +59,14 @@ public: private: - Mf::Scalar progress_; + Mf::Scalar mProgress; - Mf::Vector2 vertices_[8]; - Mf::Scalar width_; + Mf::Vector2 mVertices[8]; + Mf::Scalar mWidth; - Mf::Tilemap tilemap_; - Mf::Scalar texCoords_[8]; - Mf::Scalar midCoords_[2]; + Mf::Texture mTilemap; + Mf::Scalar mTexCoords[8]; + Mf::Scalar mMidCoords[2]; }; @@ -73,41 +77,44 @@ class Hud : public Mf::Layer { public: - Hud(); + Hud(GameState& state); - static HudP alloc() + static HudP alloc(GameState& state) { - return HudP(new Hud); + return HudP(new Hud(state)); } void setBar1Progress(Mf::Scalar progress) { // pass through - bar1_.setProgress(progress); + mBar1.setProgress(progress); } void setBar2Progress(Mf::Scalar progress) { // pass through - bar2_.setProgress(progress); + mBar2.setProgress(progress); } void setNumber(unsigned value); void resize(int width, int height); + void update(Mf::Scalar t, Mf::Scalar dt); void draw(Mf::Scalar alpha = 0.0) const; - bool handleEvent(Mf::Event& event); + bool handleEvent(const Mf::Event& event); private: - ProgressBar bar1_; - ProgressBar bar2_; + GameState& mState; + + ProgressBar mBar1; + ProgressBar mBar2; - unsigned number_; - Mf::Tilemap font_; + unsigned mNumber; + Mf::Texture mFont; - Mf::Matrix4 projection_; + Mf::Matrix4 mProjection; };