From 2bfb32c5f3cbc180835f537c81ae3713466d9fa7 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Wed, 16 Oct 2013 20:59:41 +0000 Subject: Added free flight and formation flight buttons. --- src/client/gamewindow.cc | 36 ++++++++++++++++++++++++------------ src/client/gamewindow.h | 2 ++ src/client/keyboard.cc | 2 +- 3 files changed, 27 insertions(+), 13 deletions(-) (limited to 'src/client') diff --git a/src/client/gamewindow.cc b/src/client/gamewindow.cc index fb6c88d..2ad1db4 100644 --- a/src/client/gamewindow.cc +++ b/src/client/gamewindow.cc @@ -41,13 +41,16 @@ GameWindow::GameWindow(ui::Widget *parent) : ui::Window(parent) // icon buttons gamewindow_menubutton = new ui::IconButton(this, "bitmaps/icons/button_menu", "ui_menu"); - gamewindow_launchbutton = new ui::IconButton(this, "bitmaps/icons/button_launch", "launch"); - gamewindow_gotobutton = new TargetIconButton(this, "bitmaps/icons/button_goto", "goto"); - gamewindow_dockbutton = new TargetIconButton(this, "bitmaps/icons/button_dock", "dock", core::Entity::Dockable); + gamewindow_launchbutton = new ui::IconButton(this, "bitmaps/icons/button_launch", "launch"); - gamewindow_homebutton = new ui::IconButton(this, "bitmaps/icons/button_home", "view main"); + gamewindow_freeflightbutton = new ui::IconButton(this, "bitmaps/icons/button_freeflight", "freeflight"); + gamewindow_gotobutton = new TargetIconButton(this, "bitmaps/icons/button_goto", "goto"); + gamewindow_dockbutton = new TargetIconButton(this, "bitmaps/icons/button_dock", "dock", core::Entity::Dockable); + gamewindow_formationbutton = new TargetIconButton(this, "bitmaps/icons/button_formation", "formation"); + + gamewindow_homebutton = new ui::IconButton(this, "bitmaps/icons/button_home", "view main"); gamewindow_chatbutton = new ui::IconButton(this, "bitmaps/icons/button_chat", "ui_chat"); - gamewindow_mapbutton = new ui::IconButton(this, "bitmaps/icons/button_map", "ui_map"); + gamewindow_mapbutton = new ui::IconButton(this, "bitmaps/icons/button_map", "ui_map"); gamewindow_inventorybutton = new ui::IconButton(this, "bitmaps/icons/button_ship", "ui_inventory"); } @@ -269,18 +272,21 @@ void GameWindow::resize() // icons const float icon_margin = 4.0f; const float icon_size = 48.0f; - const float icon_count = 8; + const float icon_count = 10; const float l = (width() - ((icon_count + 1) * icon_margin) - (icon_count * icon_size)) * 0.5f; gamewindow_menubutton->set_geometry(l, icon_margin, icon_size, icon_size); // spacer - gamewindow_gotobutton->set_geometry(l + 2.0f *(icon_margin + icon_size), icon_margin, icon_size, icon_size); - gamewindow_dockbutton->set_geometry(l + 3.0f *(icon_margin + icon_size), icon_margin, icon_size, icon_size); + gamewindow_freeflightbutton->set_geometry(l + 2.0f *(icon_margin + icon_size), icon_margin, icon_size, icon_size); + gamewindow_gotobutton->set_geometry(l + 3.0f *(icon_margin + icon_size), icon_margin, icon_size, icon_size); + gamewindow_dockbutton->set_geometry(l + 4.0f *(icon_margin + icon_size), icon_margin, icon_size, icon_size); gamewindow_launchbutton->set_geometry(l + 4.0f *(icon_margin + icon_size), icon_margin, icon_size, icon_size); - gamewindow_homebutton->set_geometry(l + 5.0f *(icon_margin + icon_size), icon_margin, icon_size, icon_size); - gamewindow_inventorybutton->set_geometry(l + 6.0f *(icon_margin + icon_size), icon_margin, icon_size, icon_size); - gamewindow_chatbutton->set_geometry(l + 7.0f *(icon_margin + icon_size), icon_margin, icon_size, icon_size); - gamewindow_mapbutton->set_geometry(l + 8.0f *(icon_margin + icon_size), icon_margin, icon_size, icon_size); + gamewindow_formationbutton->set_geometry(l + 5.0f *(icon_margin + icon_size), icon_margin, icon_size, icon_size); + + gamewindow_homebutton->set_geometry(l + 6.0f *(icon_margin + icon_size), icon_margin, icon_size, icon_size); + gamewindow_inventorybutton->set_geometry(l + 7.0f *(icon_margin + icon_size), icon_margin, icon_size, icon_size); + gamewindow_chatbutton->set_geometry(l + 8.0f *(icon_margin + icon_size), icon_margin, icon_size, icon_size); + gamewindow_mapbutton->set_geometry(l + 9.0f *(icon_margin + icon_size), icon_margin, icon_size, icon_size); // reposition buy menu gamewindow_buymenu->event_resize(); @@ -313,12 +319,18 @@ void GameWindow::draw() if (core::localcontrol()->state() == core::Entity::Docked) { gamewindow_launchbutton->show(); + + gamewindow_freeflightbutton->hide(); gamewindow_gotobutton->hide(); gamewindow_dockbutton->hide(); + gamewindow_formationbutton->hide(); } else { gamewindow_launchbutton->hide(); + + gamewindow_freeflightbutton->show(); gamewindow_gotobutton->show(); gamewindow_dockbutton->show(); + gamewindow_formationbutton->show(); } if (core::localplayer()->view()) { diff --git a/src/client/gamewindow.h b/src/client/gamewindow.h index 24bc311..158e6ea 100644 --- a/src/client/gamewindow.h +++ b/src/client/gamewindow.h @@ -92,9 +92,11 @@ private: TradeMenu *gamewindow_trademenu; ui::IconButton *gamewindow_menubutton; + ui::IconButton *gamewindow_freeflightbutton; ui::IconButton *gamewindow_gotobutton; ui::IconButton *gamewindow_dockbutton; ui::IconButton *gamewindow_launchbutton; + ui::IconButton *gamewindow_formationbutton; ui::IconButton *gamewindow_homebutton; ui::IconButton *gamewindow_chatbutton; ui::IconButton *gamewindow_mapbutton; diff --git a/src/client/keyboard.cc b/src/client/keyboard.cc index 43d4e7e..7658041 100644 --- a/src/client/keyboard.cc +++ b/src/client/keyboard.cc @@ -181,7 +181,7 @@ Keyboard::Keyboard() add_key("f1", SDLK_F1); add_key("f2", SDLK_F2, 0, "@goto"); add_key("f3", SDLK_F3, 0, "@dock"); - key = add_key("f4", SDLK_F4); + key = add_key("f4", SDLK_F4, 0, "@formation"); #ifdef _WIN32 key->assign(Key::Alt, "quit"); #endif -- cgit v1.2.3