2011-06-28 02:07:52 +00:00
|
|
|
/* This is the heart of the application - the main game state where we are
|
|
|
|
actually playing.
|
2011-06-22 20:12:22 +00:00
|
|
|
|
2011-06-28 02:07:52 +00:00
|
|
|
This contains the basic game logic.
|
2011-06-22 20:12:22 +00:00
|
|
|
*/
|
|
|
|
|
2011-06-28 02:07:52 +00:00
|
|
|
#ifndef _GAME_H_
|
|
|
|
#define _GAME_H_
|
2011-06-22 20:12:22 +00:00
|
|
|
|
2011-06-23 21:28:49 +00:00
|
|
|
#include "gamedata.h"
|
2011-06-28 02:07:52 +00:00
|
|
|
#include "gamestate.h"
|
|
|
|
#include <stack>
|
2011-07-01 17:15:30 +00:00
|
|
|
#include <SDL_ttf.h>
|
2011-06-28 02:07:52 +00:00
|
|
|
|
|
|
|
using std::stack;
|
|
|
|
|
2011-06-23 19:10:40 +00:00
|
|
|
|
2011-06-28 02:07:52 +00:00
|
|
|
class Game : public GameState
|
2011-06-22 20:12:22 +00:00
|
|
|
{
|
|
|
|
public:
|
2011-06-30 21:21:46 +00:00
|
|
|
Game(stack<GameState*>* state_stack, SDL_Surface* display);
|
2011-06-28 02:07:52 +00:00
|
|
|
~Game();
|
|
|
|
|
|
|
|
bool init();
|
2011-06-22 20:12:22 +00:00
|
|
|
|
|
|
|
protected:
|
2011-06-29 01:38:18 +00:00
|
|
|
void render();
|
|
|
|
void iterate() {}
|
|
|
|
|
2011-06-22 20:12:22 +00:00
|
|
|
// event handlers
|
2011-06-22 21:57:44 +00:00
|
|
|
void on_lbutton_down(int x, int y);
|
2011-06-23 19:10:40 +00:00
|
|
|
void on_rbutton_down(int mX, int mY);
|
2011-06-24 13:48:59 +00:00
|
|
|
void on_key_down(SDLKey sym, SDLMod mod, Uint16 unicode);
|
|
|
|
|
2011-06-22 20:12:22 +00:00
|
|
|
private:
|
2011-07-01 22:04:15 +00:00
|
|
|
void draw_stats(Vertex* v);
|
2011-06-22 20:12:22 +00:00
|
|
|
|
2011-06-22 21:57:44 +00:00
|
|
|
// data
|
2011-06-23 21:28:49 +00:00
|
|
|
GameData data;
|
2011-06-23 02:32:33 +00:00
|
|
|
|
2011-06-23 16:36:40 +00:00
|
|
|
static int NODE_RADIUS;
|
2011-06-28 02:35:52 +00:00
|
|
|
|
|
|
|
// surfaces containing textures to draw
|
|
|
|
SDL_Surface* background;
|
2011-07-01 17:15:30 +00:00
|
|
|
TTF_Font* font;
|
2011-06-22 20:12:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|