From c2ecbf5c239446e858ade0249eded6b47ea7a53f Mon Sep 17 00:00:00 2001 From: Anna Wiggins Date: Mon, 4 Jul 2011 02:23:20 -0400 Subject: [PATCH] Moved buttons and info around --- game.cpp | 68 +++++++++++++++++++++++++++++--------------------------- 1 file changed, 35 insertions(+), 33 deletions(-) diff --git a/game.cpp b/game.cpp index 33ca154..1ed832d 100644 --- a/game.cpp +++ b/game.cpp @@ -53,27 +53,26 @@ bool Game::init() DrawUtils::transpare(producer_icon); int row1 = display->h - 95; - int row2 = display->h - 50; + int row2 = display->h - 65; + int row3 = display->h - 35; int col1 = 155; - int col2 = 260; - int col3 = 365; - int col4 = 470; - int col5 = 575; - int col6 = 680; + int col2 = 255; + int col3 = 355; + int col4 = 455; buttons.push_back(new MenuButton("Move (m)", font, col1, row1, BUTTON_MOVE)); buttons.push_back(new MenuButton("Build (b)", font, col1, row2, BUTTON_BUILD)); - buttons.push_back(new MenuButton("Attack (a)", font, col2, row1, + buttons.push_back(new MenuButton("Attack (a)", font, col1, row3, BUTTON_ATTACK)); - buttons.push_back(new MenuButton("Attacker (t)", font, col3, row1, + buttons.push_back(new MenuButton("Attacker (t)", font, col2, row1, BUTTON_BUILD_ATTACKER)); - buttons.push_back(new MenuButton("Defender (d)", font, col3, row2, + buttons.push_back(new MenuButton("Defender (d)", font, col2, row2, BUTTON_BUILD_DEFENDER)); - buttons.push_back(new MenuButton("Producer (p)", font, col4, row1, + buttons.push_back(new MenuButton("Producer (p)", font, col2, row3, BUTTON_BUILD_PRODUCER)); - buttons.push_back(new MenuButton("End Turn (e)", font, col6, row2, + buttons.push_back(new MenuButton("End Turn (e)", font, col4, row3, BUTTON_END_TURN)); @@ -148,29 +147,32 @@ void Game::render() DrawUtils::draw_line(display, 0, display->h - 100, display->w, display->h - 100, 2, 0x000000); - // vertical line to separate info pane from button pane + // vertical lines to separate info panes from button pane DrawUtils::draw_line(display, 150, display->h - 100, 150, display->h, 2, 0x000000); - + DrawUtils::draw_line(display, 540, display->h - 100, 540, display->h, 2, + 0x000000); + DrawUtils::draw_line(display, display->w - 100, display->h - 100, + display->w - 100, display->h, 2, + 0x000000); + + for (list::iterator cursor = buttons.begin(); + cursor != buttons.end(); cursor++) { - for (list::iterator cursor = buttons.begin(); - cursor != buttons.end(); cursor++) - { - MenuButton* button = *cursor; + MenuButton* button = *cursor; + + if (!(button->get_action() & BUTTON_END_TURN) && + (data.get_current_vertex() == NULL || + data.get_current_vertex()->player != data.get_turn())) + continue; - if (!(button->get_action() & BUTTON_END_TURN) && - (data.get_current_vertex() == NULL || - data.get_current_vertex()->player != data.get_turn())) - continue; + if ((button->get_action() & (BUTTON_BUILD_ATTACKER | + BUTTON_BUILD_DEFENDER | + BUTTON_BUILD_PRODUCER)) && + data.get_mode() != MODE_BUILD) + continue; - if ((button->get_action() & (BUTTON_BUILD_ATTACKER | - BUTTON_BUILD_DEFENDER | - BUTTON_BUILD_PRODUCER)) && - data.get_mode() != MODE_BUILD) - continue; - - draw_button(button); - } + draw_button(button); } draw_player_info(); @@ -228,12 +230,12 @@ void Game::draw_player_info() { Player* player = data.get_turn(); - DrawUtils::draw_text(display, player->get_name(), 680, display->h - 95, + DrawUtils::draw_text(display, player->get_name(), 10, display->h - 95, font); string temp = "Energy: "; temp += itos(player->get_energy()); - DrawUtils::draw_text(display, temp, 680, display->h - 80, font); + DrawUtils::draw_text(display, temp, 10, display->h - 80, font); } @@ -270,11 +272,11 @@ void Game::draw_stats(GameVertex* v) { int line_num = 0; int line_height = 14; - int x = 10; + int x = 550; int y = display->h - 95; int adj_y = y; - DrawUtils::draw_text(display, "player:", x, adj_y, font); + DrawUtils::draw_text(display, "owner:", x, adj_y, font); DrawUtils::draw_text(display, v->player->get_name(), x + 50, adj_y, font); line_num++;