2011-06-22 20:12:22 +00:00
|
|
|
/* This is the heart of the application.
|
|
|
|
This contains the basic game looping code, sets up event handlers, etc.
|
|
|
|
|
|
|
|
All the hard work will eventually get farmed out to other objects, for now,
|
|
|
|
we're doing almost everything in here.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef _GAME_CORE_H_
|
|
|
|
#define _GAME_CORE_H_
|
|
|
|
|
|
|
|
#include "mainevent.h"
|
2011-06-23 21:28:49 +00:00
|
|
|
#include "gamedata.h"
|
2011-06-24 13:40:13 +00:00
|
|
|
#include "sdlrenderer.h"
|
2011-06-23 19:10:40 +00:00
|
|
|
|
2011-06-22 20:12:22 +00:00
|
|
|
class GameCore : public MainEvent
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
GameCore();
|
|
|
|
int execute();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
// event handlers
|
|
|
|
void on_exit();
|
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:
|
|
|
|
bool init();
|
|
|
|
|
|
|
|
void render();
|
|
|
|
void cleanup();
|
|
|
|
|
|
|
|
bool is_running;
|
|
|
|
|
2011-06-24 13:40:13 +00:00
|
|
|
SDLRenderer renderer;
|
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;
|
|
|
|
static int MAX_MOVE_DISTANCE;
|
2011-06-22 20:12:22 +00:00
|
|
|
};
|
|
|
|
|
2011-06-23 19:10:40 +00:00
|
|
|
|
2011-06-22 20:12:22 +00:00
|
|
|
#endif
|