Added menu area at the bottom of the game screen
This commit is contained in:
parent
306f3d0c17
commit
c1ea399448
12
game.cpp
12
game.cpp
|
@ -103,7 +103,7 @@ void Game::render()
|
||||||
0x00ff00, true, true);
|
0x00ff00, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Finally, ring the selected vertex and write info about it
|
// ring the selected vertex and write info about it
|
||||||
if (data.get_current_vertex() != NULL)
|
if (data.get_current_vertex() != NULL)
|
||||||
{
|
{
|
||||||
Vertex* v = data.get_current_vertex();
|
Vertex* v = data.get_current_vertex();
|
||||||
|
@ -111,6 +111,12 @@ void Game::render()
|
||||||
draw_stats(v);
|
draw_stats(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// draw the rest of the bottom menu
|
||||||
|
DrawUtils::draw_line(display, 0, display->h - 100,
|
||||||
|
display->w, display->h - 100, 2, 0x000000);
|
||||||
|
DrawUtils::draw_line(display, 150, display->h - 100, 150, display->h, 2,
|
||||||
|
0x000000);
|
||||||
|
|
||||||
SDL_Flip(display);
|
SDL_Flip(display);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,7 +125,7 @@ void Game::draw_stats(Vertex* v)
|
||||||
{
|
{
|
||||||
int num_lines = 4;
|
int num_lines = 4;
|
||||||
int x = 20;
|
int x = 20;
|
||||||
int y = display->h - (num_lines * 14) - 20;
|
int y = display->h - 76;
|
||||||
|
|
||||||
DrawUtils::draw_text(display, "player:", x, y, font);
|
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, dynamic_cast<GameVertex*>(v)->player->get_name(), x + 50, y, font);
|
||||||
|
@ -140,6 +146,8 @@ void Game::draw_stats(Vertex* v)
|
||||||
|
|
||||||
void Game::on_lbutton_down(int x, int y)
|
void Game::on_lbutton_down(int x, int y)
|
||||||
{
|
{
|
||||||
|
if (y > display->h - 110) return;
|
||||||
|
|
||||||
if (!data.endgame()) data.handle_click(x, y);
|
if (!data.endgame()) data.handle_click(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user