From 222751e772eba53ba2ff1c14ffb279d8706100a4 Mon Sep 17 00:00:00 2001 From: Rtch90 Date: Sun, 24 Dec 2017 18:45:22 +0000 Subject: [PATCH] [Add] Add toggle labels button. --- icons/labels_off.png | Bin 0 -> 689 bytes icons/labels_on.png | Bin 0 -> 250 bytes src/player.cpp | 2 +- src/world_view.cpp | 12 ++++++++++++ src/world_view.h | 3 +++ 5 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 icons/labels_off.png create mode 100644 icons/labels_on.png diff --git a/icons/labels_off.png b/icons/labels_off.png new file mode 100644 index 0000000000000000000000000000000000000000..d0303b9248082d14c2983cc01e92e9fbad6d8ea6 GIT binary patch literal 689 zcmV;i0#5yjP)Px#32;bRa{vGf6951U69E94oEQKA00(qQO+^RT2n`f31`zWx3IG5A8FWQhbVF}# zZDnqB07G(RVRU6=Aa`kWXdp*PO;A^X4i^9b0v<_3K~y-)V{B<^VW16QVxSoqH5v`D zAaiP%YZw?9TK?jUSdshpH4p3)xqttLqtkUqClZWiU|=x4&tSWEF4Nz?4-Ji8sHy+p z<%LTro<6O&Z41-izYGiv8vFN=W^~Kn7LB|6MDFinU|^oYaQSiGl)+rfc>f#Lnk znJ;#1`~UYZM5SnbeRXX$rg5#!tvFr%MnUn7qN32FM@)bJ{y2N~u7}4JH;>OEBBpCr zas2+xz`*cXRP>s&%QI$H1|(Ck0!FM^M)CA%on1Rve*R=&VEE6(^q-ND>F?iv%*>Ar zjjlU7A%_wPVGRNIO-(>pvS9bT%mXg0KHS78V8u2G$=xZ0FC_ z+`kX2#+IfQcrc(FU7ntr#_&%Arc<=OK7HPt>e}k4O&g@TyIBt9@4@8slua&cXEa>kmKuRA*3aCBl| zV7Ngjqocc;@!vm=FJIWcefz=7`;(iSyfP2s1N3zLpNZ)^AK!OAJ}MWglmHUaHRS*R X{xZ=mw47BD00000NkvXXu0mjfs1QEc literal 0 HcmV?d00001 diff --git a/icons/labels_on.png b/icons/labels_on.png new file mode 100644 index 0000000000000000000000000000000000000000..e3ce68707a9e3424940c8d23d93145fcb2e1b280 GIT binary patch literal 250 zcmeAS@N?(olHy`uVBq!ia0vp^azHG`!2~2D7;WJ+A? o*|H*4A#Zu|w1r+8mu=QC&YdTFyI^xfJGetShowLabels()) { for(std::list::iterator i = Space::bodies.begin(); i != Space::bodies.end(); ++i) { if((L3D::GetCamType() != L3D::CAM_EXTERNAL) && (*i == this)) continue; Body* b = *i; diff --git a/src/world_view.cpp b/src/world_view.cpp index 209aa8d..d261847 100644 --- a/src/world_view.cpp +++ b/src/world_view.cpp @@ -15,6 +15,7 @@ WorldView::WorldView(void): View() { float size[2]; GetSize(size); + labelsOn = true; SetTransparency(true); commsOptions = new Fixed(size[0], size[1]/2); @@ -28,6 +29,13 @@ WorldView::WorldView(void): View() { wheels_button->onClick.connect(sigc::mem_fun(this, &WorldView::OnChangeWheelsState)); m_rightButtonBar->Add(wheels_button, 34, 2); + Gui::MultiStateImageButton* labels_button = new Gui::MultiStateImageButton(); + labels_button->SetShortcut(SDLK_9, KMOD_NONE); + labels_button->AddState(1, "icons/labels_on.png"); + labels_button->AddState(0, "icons/labels_off.png"); + labels_button->onClick.connect(sigc::mem_fun(this, &WorldView::OnChangeLabelsState)); + m_rightButtonBar->Add(labels_button, 98, 2); + m_hyperspaceButton = new Gui::ImageButton("icons/hyperspace_f8.png"); m_hyperspaceButton->SetShortcut(SDLK_F8, KMOD_NONE); m_hyperspaceButton->onClick.connect(sigc::mem_fun(this, &WorldView::OnClickHyperspace)); @@ -59,6 +67,10 @@ void WorldView::OnChangeWheelsState(Gui::MultiStateImageButton* b) { L3D::player->SetWheelState(b->GetState()); } +void WorldView::OnChangeLabelsState(Gui::MultiStateImageButton* b) { + labelsOn = b->GetState(); +} + void WorldView::OnClickHyperspace(void) { StarSystem* s = L3D::GetSelectedSystem(); if(s /* && isn's current system. */) { diff --git a/src/world_view.h b/src/world_view.h index 31552e0..5e3531e 100644 --- a/src/world_view.h +++ b/src/world_view.h @@ -13,14 +13,17 @@ public: matrix4x4d viewingRotation; static const float PICK_OBJECT_RECT_SIZE; void UpdateCommsOptions(void); + bool GetShowLabels(void) { return labelsOn; } private: Gui::Button* AddCommsOption(const std::string msg, int ypos); void OnClickHyperspace(void); void OnChangeWheelsState(Gui::MultiStateImageButton* b); + void OnChangeLabelsState(Gui::MultiStateImageButton* b); virtual bool OnMouseDown(Gui::MouseButtonEvent* e); Body* PickBody(const float screenX, const float screenY) const; Gui::ImageButton* m_hyperspaceButton; GLuint m_bgstarsDlist; Gui::Fixed* commsOptions; + bool labelsOn; };