X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=blobdiff_plain;f=src%2FHud.hh;h=f386fd4b73731ec12918f260cf13b8624e706221;hp=813e67fcdee2b5bff28522e73eda4fa09c5b7383;hb=23d8f7a5fbd1eca7f46f2342c20ac5e28ae0128a;hpb=bfa6212d09d8735d8fd5e2638188e4a99f21ada4 diff --git a/src/Hud.hh b/src/Hud.hh index 813e67f..f386fd4 100644 --- a/src/Hud.hh +++ b/src/Hud.hh @@ -35,16 +35,18 @@ */ #include +#include #include #include -#include + +#include "Tilemap.hh" 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); @@ -59,25 +61,33 @@ private: Mf::Vector2 vertices_[8]; Mf::Scalar width_; - Mf::Tilemap tilemap_; + Tilemap tilemap_; Mf::Scalar texCoords_[8]; Mf::Scalar midCoords_[2]; }; -class Hud : public Mf::Drawable +class Hud; +typedef boost::shared_ptr HudP; + +class Hud : public Mf::Layer { public: Hud(); - inline void setBar1Progress(Mf::Scalar progress) + static HudP alloc() + { + return HudP(new Hud); + } + + void setBar1Progress(Mf::Scalar progress) { // pass through bar1_.setProgress(progress); } - inline void setBar2Progress(Mf::Scalar progress) + void setBar2Progress(Mf::Scalar progress) { // pass through bar2_.setProgress(progress); @@ -88,6 +98,7 @@ public: void resize(int width, int height); void draw(Mf::Scalar alpha = 0.0) const; + bool handleEvent(Mf::Event& event); private: @@ -95,7 +106,7 @@ private: ProgressBar bar2_; unsigned number_; - Mf::Tilemap font_; + Tilemap font_; Mf::Matrix4 projection_; };