[Add] Add toggle labels button.
This commit is contained in:
parent
96e36dab61
commit
50726de102
BIN
icons/labels_off.png
Normal file
BIN
icons/labels_off.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 689 B |
BIN
icons/labels_on.png
Normal file
BIN
icons/labels_on.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 250 B |
@ -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<Body*>::iterator i = Space::bodies.begin(); i != Space::bodies.end(); ++i) {
|
||||
if((L3D::GetCamType() != L3D::CAM_EXTERNAL) && (*i == this)) continue;
|
||||
Body* b = *i;
|
||||
|
@ -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. */) {
|
||||
|
@ -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;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user