Skip to content

Commit

Permalink
3046: hide render stats by default (TrenchBroom#3054)
Browse files Browse the repository at this point in the history
Added a preference "Renderer/Show FPS"

FIxes TrenchBroom#3046
  • Loading branch information
ericwa authored Apr 5, 2020
1 parent 8f85bcc commit 66c01b9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 2 additions & 0 deletions common/src/Preferences.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ namespace TrenchBroom {
Preference<Color> PointFileColor(IO::Path("Renderer/Colors/Point file"), Color(0.0f, 1.0f, 0.0f, 1.0f));
Preference<Color> PortalFileBorderColor(IO::Path("Renderer/Colors/Portal file border"), Color(1.0f, 1.0f, 1.0f, 0.5f));
Preference<Color> PortalFileFillColor(IO::Path("Renderer/Colors/Portal file fill"), Color(1.0f, 0.4f, 0.4f, 0.2f));
Preference<bool> ShowFPS(IO::Path("Renderer/Show FPS"), false);

Preference<Color>& axisColor(vm::axis::type axis) {
switch (axis) {
Expand Down Expand Up @@ -194,6 +195,7 @@ namespace TrenchBroom {
&PointFileColor,
&PortalFileBorderColor,
&PortalFileFillColor,
&ShowFPS,
&CompassBackgroundColor,
&CompassBackgroundOutlineColor,
&CompassAxisOutlineColor,
Expand Down
3 changes: 3 additions & 0 deletions common/src/Preferences.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ namespace TrenchBroom {
// NOTE: any QKeySequence preferences must be functions like CameraFly*
// because QKeySequence docs specify that you can't create an instance before QApplication

// NOTE: When adding a new preference here, always update the staticPreferences() implementation

extern Preference<int> MapViewLayout;

extern Preference<bool> ShowAxes;
Expand All @@ -44,6 +46,7 @@ namespace TrenchBroom {
extern Preference<Color> PointFileColor;
extern Preference<Color> PortalFileBorderColor;
extern Preference<Color> PortalFileFillColor;
extern Preference<bool> ShowFPS;

Preference<Color>& axisColor(vm::axis::type axis);

Expand Down
6 changes: 4 additions & 2 deletions common/src/View/MapViewBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -956,9 +956,11 @@ namespace TrenchBroom {
}

void MapViewBase::renderFPS(Renderer::RenderContext& renderContext, Renderer::RenderBatch& renderBatch) {
Renderer::RenderService renderService(renderContext, renderBatch);
if (pref(Preferences::ShowFPS)) {
Renderer::RenderService renderService(renderContext, renderBatch);

renderService.renderHeadsUp(m_currentFPS);
renderService.renderHeadsUp(m_currentFPS);
}
}

void MapViewBase::processEvent(const KeyEvent& event) {
Expand Down

0 comments on commit 66c01b9

Please sign in to comment.