#include "game.h" #include "mathutils.h" #include "debug.h" #include int Game::NODE_RADIUS = 12; Game::~Game() { renderer.cleanup(); } void Game::execute(stack &state_stack) throw(StateExit) { SDL_Event event; while(SDL_PollEvent(&event)) handle_event(&event); renderer.render(data); } bool Game::init() { return renderer.init(); } void Game::on_exit() { throw StateExit(); } void Game::on_lbutton_down(int x, int y) { data.do_vertex(x, y, NODE_RADIUS); } void Game::on_rbutton_down(int mX, int mY) { data.clear_current_vertex(); } void Game::on_key_down(SDLKey sym, SDLMod mod, Uint16 unicode) { if (sym == SDLK_q && mod & KMOD_CTRL) throw StateExit(); if (sym == SDLK_a) data.set_mode(MODE_ATTACK); if (sym == SDLK_m) data.set_mode(MODE_MOVE); }