From c1ea399448bdab12d6a7676453a42549ea741eff Mon Sep 17 00:00:00 2001 From: Anna Wiggins Date: Fri, 1 Jul 2011 23:47:24 -0400 Subject: [PATCH] Added menu area at the bottom of the game screen --- game.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/game.cpp b/game.cpp index 8629824..84dce84 100644 --- a/game.cpp +++ b/game.cpp @@ -103,7 +103,7 @@ void Game::render() 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) { Vertex* v = data.get_current_vertex(); @@ -111,6 +111,12 @@ void Game::render() 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); } @@ -119,7 +125,7 @@ void Game::draw_stats(Vertex* v) { int num_lines = 4; 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, dynamic_cast(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) { + if (y > display->h - 110) return; + if (!data.endgame()) data.handle_click(x, y); }