/*] Copyright (c) 2009-2010, Charles McGarvey [************************** **] All rights reserved. * * vi:ts=4 sw=4 tw=75 * * Distributable under the terms and conditions of the 2-clause BSD license; * see the file COPYING for a complete text of the license. * **************************************************************************/ #ifndef _HUD_HH_ #define _HUD_HH_ /** * @file Hud.hh * Heads-up Display */ #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::Texture& tilemap, Mf::Texture::TileIndex index); void resize(const Mf::Rectangle& rect); void setProgress(Mf::Scalar progress); void draw(Mf::Scalar alpha = 0.0) const; private: Mf::Scalar mProgress; Mf::Vector2 mVertices[8]; Mf::Scalar mWidth; Mf::Texture mTilemap; Mf::Scalar mTexCoords[8]; Mf::Scalar mMidCoords[2]; }; class Hud; typedef boost::shared_ptr HudP; class Hud : public Mf::Layer { public: Hud(GameState& state); static HudP alloc(GameState& state) { return HudP(new Hud(state)); } void setBar1Progress(Mf::Scalar progress) { // pass through mBar1.setProgress(progress); } void setBar2Progress(Mf::Scalar progress) { // pass through 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(const Mf::Event& event); private: GameState& mState; ProgressBar mBar1; ProgressBar mBar2; unsigned mNumber; Mf::Texture mFont; Mf::Matrix4 mProjection; }; #endif // _HUD_HH_