Added some basic differences between vertex types
This commit is contained in:
65
game.cpp
65
game.cpp
@ -148,7 +148,9 @@ void Game::render()
|
||||
DrawUtils::draw_line(display, 150, display->h - 100, 150, display->h, 2,
|
||||
0x000000);
|
||||
|
||||
if (data.get_current_vertex() != NULL)
|
||||
if (data.get_current_vertex() != NULL &&
|
||||
dynamic_cast<GameVertex*>(data.get_current_vertex())->player ==
|
||||
data.get_turn())
|
||||
{
|
||||
for (list<MenuButton*>::iterator cursor = buttons.begin();
|
||||
cursor != buttons.end(); cursor++)
|
||||
@ -242,24 +244,61 @@ void Game::handle_button_press(ButtonAction action)
|
||||
|
||||
void Game::draw_stats(Vertex* v)
|
||||
{
|
||||
int num_lines = 4;
|
||||
int x = 20;
|
||||
int y = display->h - 76;
|
||||
int line_num = 0;
|
||||
int line_height = 14;
|
||||
int x = 10;
|
||||
int y = display->h - 95;
|
||||
int adj_y = y;
|
||||
|
||||
DrawUtils::draw_text(display, "player:", x, y, font);
|
||||
DrawUtils::draw_text(display, dynamic_cast<GameVertex*>(v)->player->get_name(), x + 50, y, font);
|
||||
DrawUtils::draw_text(display, "player:", x, adj_y, font);
|
||||
DrawUtils::draw_text(display,
|
||||
dynamic_cast<GameVertex*>(v)->player->get_name(),
|
||||
x + 50, adj_y, font);
|
||||
|
||||
DrawUtils::draw_text(display, "atk:", x, y + 14, font);
|
||||
DrawUtils::draw_text(display, itos(data.calculate_strength(v)),
|
||||
x + 50, y + 14, font);
|
||||
line_num++;
|
||||
adj_y = y + line_num * line_height;
|
||||
DrawUtils::draw_text(display, "type:", x, adj_y, font);
|
||||
VertexType vtype = dynamic_cast<GameVertex*>(v)->type;
|
||||
string type;
|
||||
switch(vtype)
|
||||
{
|
||||
case VERTEX_ATTACKER:
|
||||
type = "attacker";
|
||||
break;
|
||||
case VERTEX_DEFENDER:
|
||||
type = "defender";
|
||||
break;
|
||||
case VERTEX_PRODUCER:
|
||||
type = "producer";
|
||||
break;
|
||||
}
|
||||
DrawUtils::draw_text(display, type, x + 50, adj_y, font);
|
||||
|
||||
DrawUtils::draw_text(display, "armor:", x, y + 28, font);
|
||||
line_num++;
|
||||
adj_y = y + line_num * line_height;
|
||||
DrawUtils::draw_text(display, "atk:", x, adj_y, font);
|
||||
DrawUtils::draw_text(display, itos(data.calculate_attack(v)),
|
||||
x + 50, adj_y, font);
|
||||
|
||||
line_num++;
|
||||
adj_y = y + line_num * line_height;
|
||||
DrawUtils::draw_text(display, "armor:", x, adj_y, font);
|
||||
DrawUtils::draw_text(display, itos(data.calculate_armor(v)),
|
||||
x + 50, y + 28, font);
|
||||
x + 50, adj_y, font);
|
||||
|
||||
DrawUtils::draw_text(display, "hp:", x, y + 42, font);
|
||||
DrawUtils::draw_text(display, itos(v->score), x + 50, y + 42, font);
|
||||
line_num++;
|
||||
adj_y = y + line_num * line_height;
|
||||
DrawUtils::draw_text(display, "hp:", x, adj_y, font);
|
||||
DrawUtils::draw_text(display, itos(v->score), x + 50, adj_y, font);
|
||||
|
||||
if (vtype == VERTEX_PRODUCER)
|
||||
{
|
||||
line_num++;
|
||||
adj_y = y + line_num * line_height;
|
||||
|
||||
DrawUtils::draw_text(display, "energy:", x, adj_y, font);
|
||||
DrawUtils::draw_text(display, "25", x + 50, adj_y, font);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user