diff --git a/icons/labels_off.png b/icons/labels_off.png new file mode 100644 index 0000000..d0303b9 Binary files /dev/null and b/icons/labels_off.png differ diff --git a/icons/labels_on.png b/icons/labels_on.png new file mode 100644 index 0000000..e3ce687 Binary files /dev/null and b/icons/labels_on.png differ diff --git a/src/player.cpp b/src/player.cpp index e222bd5..db28bf6 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -177,7 +177,7 @@ void Player::DrawHUD(const Frame* cam_frame) { Gui::Screen::EnterOrtho(); glColor3f(.7, .7, .7); - { + if(L3D::world_view->GetShowLabels()) { 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; };