Added player names and some debug stuff

This commit is contained in:
2011-07-01 20:00:19 -04:00
parent bf151a928a
commit e221f1990c
6 changed files with 57 additions and 28 deletions

View File

@ -123,8 +123,8 @@ void Game::draw_stats(Vertex* v)
DrawUtils::draw_text(display, itos(data.calculate_strength(v)),
x + 50, y + 14, font);
DrawUtils::draw_text(display, "def:", x, y + 28, font);
DrawUtils::draw_text(display, itos(data.calculate_strength(v)),
DrawUtils::draw_text(display, "armor:", x, y + 28, font);
DrawUtils::draw_text(display, itos(data.calculate_armor(v)),
x + 50, y + 28, font);
DrawUtils::draw_text(display, "hp:", x, y + 42, font);
@ -148,8 +148,20 @@ void Game::on_rbutton_down(int mX, int mY)
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);
if (sym == SDLK_b) data.set_mode(MODE_BUILD);
if (sym == SDLK_s || sym == SDLK_ESCAPE) data.set_mode(MODE_SELECT);
else if (sym == SDLK_a) data.set_mode(MODE_ATTACK);
else if (sym == SDLK_m) data.set_mode(MODE_MOVE);
else if (sym == SDLK_b) data.set_mode(MODE_BUILD);
else if (sym == SDLK_s || sym == SDLK_ESCAPE) data.set_mode(MODE_SELECT);
#ifdef DEBUG
if (sym == SDLK_d && mod & (KMOD_ALT | KMOD_CTRL)) print_debug_info();
#endif
}
#ifdef DEBUG
void Game::print_debug_info()
{
fprintf(stderr, "Mode: %d\n", data.get_mode());
fprintf(stderr, "Turn: %s\n", data.get_turn()->get_name().c_str());
}
#endif