Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Codechange] Hiding the GUI will also hide the notice messages #728

Merged
merged 1 commit into from
Feb 6, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions source/main/gameplay/RoRFrameListener.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1781,14 +1781,14 @@ void RoRFrameListener::pauseSim(bool value)
}
}

void RoRFrameListener::hideGUI(bool visible)
void RoRFrameListener::hideGUI(bool hidden)
{
#ifdef USE_MYGUI
Beam *curr_truck = BeamFactory::getSingleton().getCurrentTruck();
//Console *c = RoR::Application::GetConsole();
//if (c) c->setVisible(!visible);

if (visible)
if (hidden)
{
if (RoR::Application::GetOverlayWrapper()) RoR::Application::GetOverlayWrapper()->showDashboardOverlays(false, curr_truck);
if (RoR::Application::GetOverlayWrapper()) RoR::Application::GetOverlayWrapper()->truckhud->show(false);
Expand All @@ -1809,6 +1809,7 @@ void RoRFrameListener::hideGUI(bool visible)
if (gEnv->network) GUI_Multiplayer::getSingleton().setVisible(true);
#endif // USE_SOCKETW
}
Application::GetGuiManager()->hideGUI(hidden);
#endif // USE_MYGUI
}

Expand All @@ -1818,7 +1819,6 @@ void RoRFrameListener::setNetPointToUID(int uid)
netPointToUID = uid;
}


void RoRFrameListener::checkRemoteStreamResultsChanged()
{
#ifdef USE_MYGUI
Expand Down
2 changes: 1 addition & 1 deletion source/main/gameplay/RoRFrameListener.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ class RoRFrameListener: public Ogre::FrameListener, public Ogre::WindowEventList
int getNetPointToUID() { return netPointToUID; }

void checkRemoteStreamResultsChanged();
void hideGUI(bool visible);
void hideGUI(bool hidden);
void hideMap();
void InitTrucks(
bool loadmanual,
Expand Down
14 changes: 14 additions & 0 deletions source/main/gui/GUIManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -503,3 +503,17 @@ void GUIManager::ToggleVehicleDescription()
else
HideVehicleDescription();
}

void GUIManager::hideGUI(bool hidden)
{
if (m_gui_SimUtils)
{
if (hidden)
{
m_gui_SimUtils->HideNotification();
m_gui_SimUtils->HideFPSBox();
m_gui_SimUtils->HideTruckInfoBox();
}
m_gui_SimUtils->DisableNotifications(hidden);
}
}
2 changes: 2 additions & 0 deletions source/main/gui/GUIManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ class GUIManager :
void HideVehicleDescription();
void ToggleVehicleDescription();

void hideGUI(bool visible);

virtual void UnfocusGui();

virtual void AddRigLoadingReport(std::string const & vehicle_name, std::string const & text, int num_errors, int num_warnings, int num_other);
Expand Down
20 changes: 20 additions & 0 deletions source/main/gui/panels/GUI_SimUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ CLASS::CLASS()

alpha = 1.0f;

m_notifications_disabled = false;

ShowMain(); //It's invisible and unclickable, so no worrys
}

Expand All @@ -103,15 +105,28 @@ void CLASS::ToggleFPSBox()
m_fpscounter_box->setVisible(b_fpsbox);
}

void CLASS::HideFPSBox()
{
if (b_fpsbox)
ToggleFPSBox();
}

void CLASS::ToggleTruckInfoBox()
{
b_truckinfo = !b_truckinfo;
m_truckinfo_box->setVisible(b_truckinfo);
}

void CLASS::HideTruckInfoBox()
{
if (b_truckinfo)
ToggleTruckInfoBox();
}

void CLASS::PushNotification(Ogre::String Title, Ogre::String text)
{
if (!MAIN_WIDGET->getVisible()) return;
if (m_notifications_disabled) return;

m_not_title->setCaption(Title);
m_not_text->setCaption(text);
Expand All @@ -124,6 +139,11 @@ void CLASS::HideNotification()
m_notification->setVisible(false);
}

void CLASS::DisableNotifications(bool disabled)
{
m_notifications_disabled = disabled;
}

void CLASS::framestep(float dt)
{
if (!MAIN_WIDGET->getVisible()) return;
Expand Down
6 changes: 6 additions & 0 deletions source/main/gui/panels/GUI_SimUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,18 @@ class SimUtils: public SimUtilsLayout
void HideMain();

void ToggleFPSBox();
void HideFPSBox();

void ToggleTruckInfoBox();
void HideTruckInfoBox();

void UpdateStats(float dt, Beam *truck); //different from Framestep!
void framestep(float dt);

void PushNotification(Ogre::String Title, Ogre::String text);
void HideNotification();

void DisableNotifications(bool disabled);

private:
bool b_fpsbox;
Expand Down Expand Up @@ -93,6 +98,7 @@ class SimUtils: public SimUtilsLayout
// logic
float alpha;
long pushTime;
bool m_notifications_disabled;
};

} // namespace GUI
Expand Down