]> Dogcows Code - chaz/yoink/blobdiff - src/Hud.hh
preliminary AM_SILENT_RULES support
[chaz/yoink] / src / Hud.hh
index 813e67fcdee2b5bff28522e73eda4fa09c5b7383..d3675a476c85b62dcb5782256dd2856bfce9f506 100644 (file)
  */
 
 #include <Moof/Drawable.hh>
+#include <Moof/Layer.hh>
 #include <Moof/Math.hh>
 #include <Moof/Rectangle.hh>
-#include <Moof/Tilemap.hh>
 
+#include "GameLayer.hh"
+#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,50 +59,62 @@ 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<Hud> HudP;
+
+class Hud : public Mf::Layer
 {
 public:
 
-       Hud();
+       Hud(GameLayer::State& state);
+
+       static HudP alloc(GameLayer::State& state)
+       {
+               return HudP(new Hud(state));
+       }
 
-       inline void setBar1Progress(Mf::Scalar progress)
+       void setBar1Progress(Mf::Scalar progress)
        {
                // pass through
-               bar1_.setProgress(progress);
+               mBar1.setProgress(progress);
        }
 
-       inline void setBar2Progress(Mf::Scalar 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 draw(Mf::Scalar alpha = 0.0) const;
+       void update(Mf::Engine& engine, Mf::Scalar t, Mf::Scalar dt);
+       void draw(Mf::Engine& engine, Mf::Scalar alpha = 0.0) const;
+       bool handleEvent(Mf::Engine& engine, const Mf::Event& event);
 
 private:
 
-       ProgressBar     bar1_;
-       ProgressBar     bar2_;
+       GameLayer::State&               mState;
+
+       ProgressBar     mBar1;
+       ProgressBar     mBar2;
 
-       unsigned        number_;
-       Mf::Tilemap     font_;
+       unsigned        mNumber;
+       Tilemap         mFont;
 
-       Mf::Matrix4     projection_;
+       Mf::Matrix4     mProjection;
 };
 
 
This page took 0.022989 seconds and 4 git commands to generate.