X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=blobdiff_plain;f=src%2FHud.hh;h=59f0631a964dcf391de2aff2bdfbf45ffaf976a2;hp=8fec549278514ff98814a9799fb09cee494e7450;hb=c9e20ac06383b20ceb5404c9237e319c2e90d157;hpb=25aefe01ef7dbdb603c51411e04b0d6a6107684f diff --git a/src/Hud.hh b/src/Hud.hh index 8fec549..59f0631 100644 --- a/src/Hud.hh +++ b/src/Hud.hh @@ -35,16 +35,20 @@ */ #include +#include #include #include -#include +#include "Tilemap.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 Tilemap& tilemap, Tilemap::Index index); void resize(const Mf::Rectangle& rect); @@ -54,33 +58,41 @@ 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]; + Tilemap mTilemap; + Mf::Scalar mTexCoords[8]; + Mf::Scalar mMidCoords[2]; }; -class Hud : public Mf::Drawable +class Hud; +typedef boost::shared_ptr HudP; + +class Hud : public Mf::Layer { public: Hud(); + static HudP alloc() + { + return HudP(new Hud); + } + 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); @@ -88,16 +100,17 @@ public: void resize(int width, int height); void draw(Mf::Scalar alpha = 0.0) const; + bool handleEvent(Mf::Event& event); private: - ProgressBar bar1_; - ProgressBar bar2_; + ProgressBar mBar1; + ProgressBar mBar2; - unsigned number_; - Mf::Tilemap font_; + unsigned mNumber; + Tilemap mFont; - Mf::Matrix4 projection_; + Mf::Matrix4 mProjection; };