2010-04-05 23:38:59 +02:00
|
|
|
#ifndef _VIEW_H
|
|
|
|
#define _VIEW_H
|
|
|
|
|
|
|
|
#include "ViewBase.h"
|
2010-04-14 22:01:45 +02:00
|
|
|
#include "OverlayBase.h"
|
2010-04-05 23:38:59 +02:00
|
|
|
#include "mathlib.h"
|
|
|
|
#include "Sprite.h"
|
|
|
|
#include "EntityBase.h"
|
2010-04-14 22:01:45 +02:00
|
|
|
#include "SimpleConsoleOverlay.h"
|
2010-04-05 23:38:59 +02:00
|
|
|
|
|
|
|
namespace asteroids {
|
|
|
|
|
|
|
|
struct ShipEntity;
|
|
|
|
struct AsteroidEntity;
|
|
|
|
struct RocketEntity;
|
|
|
|
|
|
|
|
struct BackgroundStar {
|
|
|
|
vector3d position;
|
|
|
|
};
|
|
|
|
|
|
|
|
/** \brief Performs the actual drawing based on Camera and Model
|
|
|
|
*/
|
|
|
|
class View : public Engine::ViewBase {
|
2010-04-14 22:01:45 +02:00
|
|
|
public:
|
|
|
|
virtual ~View() {};
|
|
|
|
|
2010-04-05 23:38:59 +02:00
|
|
|
protected:
|
|
|
|
/** \brief Initializes the system */
|
2010-04-14 22:01:45 +02:00
|
|
|
virtual int OnInit (int argc, char* argv[]);
|
|
|
|
virtual void OnDestroy ();
|
2010-04-05 23:38:59 +02:00
|
|
|
|
|
|
|
/** \brief Updates the camera for further drawing */
|
|
|
|
virtual void UpdateCamera ();
|
|
|
|
|
|
|
|
private:
|
2010-09-16 00:04:39 +02:00
|
|
|
void DrawUi();
|
|
|
|
|
2010-11-13 18:45:15 +01:00
|
|
|
void DrawPageTitle(const std::string &title);
|
|
|
|
|
2010-09-16 00:04:39 +02:00
|
|
|
void DrawUiMainMenu();
|
|
|
|
void DrawUiGameRunning();
|
|
|
|
void DrawUiGameOver();
|
|
|
|
void DrawUiLevelComplete();
|
|
|
|
void DrawUiGamePaused();
|
|
|
|
void DrawUiPlayerDied();
|
2010-11-13 18:45:15 +01:00
|
|
|
void DrawHighscoreEntry(float x, float y, float entry_width, const std::string &name, unsigned int points);
|
2010-09-16 00:04:39 +02:00
|
|
|
void DrawUiHighscore();
|
|
|
|
void DrawUiEnterPlayername();
|
|
|
|
|
|
|
|
virtual void Draw ();
|
2010-04-05 23:38:59 +02:00
|
|
|
virtual void DrawWorld ();
|
|
|
|
void DrawStars ();
|
|
|
|
|
|
|
|
void DrawEntity (Engine::EntityBase *entity);
|
|
|
|
void DrawShip (ShipEntity *ship);
|
|
|
|
void DrawAsteroid (AsteroidEntity *asteroid);
|
|
|
|
void DrawRocket (RocketEntity *asteroid);
|
|
|
|
void DrawShipPart (Engine::EntityBase *entity);
|
|
|
|
|
2010-06-06 01:22:01 +02:00
|
|
|
// boost::shared_ptr<MenuOverlay> mMenuOverlay;
|
|
|
|
// boost::shared_ptr<Engine::SimpleConsoleOverlay> mConsoleOverlay;
|
2010-04-14 22:01:45 +02:00
|
|
|
|
2010-04-05 23:38:59 +02:00
|
|
|
std::vector<BackgroundStar> mBackgroundStars;
|
|
|
|
|
|
|
|
std::vector<unsigned int> mShipPartsEntityIds;
|
|
|
|
|
2010-09-16 00:04:39 +02:00
|
|
|
// \todo [high] add Resource Manager!
|
|
|
|
Engine::Sprite mGUIShipSprite;
|
2010-04-05 23:38:59 +02:00
|
|
|
Engine::Sprite mAsteroidSprite;
|
|
|
|
Engine::Sprite mShipSprite;
|
|
|
|
Engine::Sprite mShipThrustSprite;
|
|
|
|
Engine::Sprite mShipPartsSprite;
|
2010-09-16 00:04:39 +02:00
|
|
|
|
|
|
|
float screen_left;
|
|
|
|
float screen_right;
|
|
|
|
float screen_top;
|
|
|
|
float screen_bottom;
|
2010-04-05 23:38:59 +02:00
|
|
|
|
2010-11-13 18:45:15 +01:00
|
|
|
int button_width;
|
|
|
|
int button_height;
|
|
|
|
|
2010-07-28 18:02:12 +02:00
|
|
|
virtual bool OnReceiveEvent (const Engine::EventBasePtr &event);
|
2010-04-05 23:38:59 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // _VIEW_H
|