summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormobserveur <mobserveur@gmail.com>2024-05-27 04:33:20 +0200
committermobserveur <mobserveur@gmail.com>2024-05-27 04:51:43 +0200
commit9760b960c503d8f1742aab514212bc571e532164 (patch)
treecdfa920211ffb759cf39b92c4b6aaf28ca94e356
parent95841a4807eed32cfb9589db949b42ac94840256 (diff)
added a fps counter in the status bar
it displays an fps counter on the status bar
-rw-r--r--indra/newview/llstatusbar.cpp12
-rw-r--r--indra/newview/llstatusbar.h2
-rw-r--r--indra/newview/skins/default/colors.xml3
-rw-r--r--indra/newview/skins/default/xui/en/panel_status_bar.xml16
4 files changed, 33 insertions, 0 deletions
diff --git a/indra/newview/llstatusbar.cpp b/indra/newview/llstatusbar.cpp
index f8bb4f3351..a0a625c5fc 100644
--- a/indra/newview/llstatusbar.cpp
+++ b/indra/newview/llstatusbar.cpp
@@ -109,6 +109,7 @@ static void onClickVolume(void*);
LLStatusBar::LLStatusBar(const LLRect& rect)
: LLPanel(),
mTextTime(NULL),
+ mTextFps(NULL),
mSGBandwidth(NULL),
mSGPacketLoss(NULL),
mBtnVolume(NULL),
@@ -127,6 +128,7 @@ LLStatusBar::LLStatusBar(const LLRect& rect)
mBalanceTimer = new LLFrameTimer();
mHealthTimer = new LLFrameTimer();
+ mFpsUpdateTimer = new LLFrameTimer();
buildFromFile("panel_status_bar.xml");
}
@@ -164,6 +166,7 @@ BOOL LLStatusBar::postBuild()
gMenuBarView->setRightMouseDownCallback(boost::bind(&show_navbar_context_menu, _1, _2, _3));
mTextTime = getChild<LLTextBox>("TimeText" );
+ mTextFps = getChild<LLTextBox>("FpsText");
getChild<LLUICtrl>("buyL")->setCommitCallback(
boost::bind(&LLStatusBar::onClickBuyCurrency, this));
@@ -297,6 +300,15 @@ void LLStatusBar::refresh()
//mSGBandwidth->setThreshold(2, bwtotal);
}
+ if(mFpsUpdateTimer->getElapsedTimeF32() >= 1.0f)
+ {
+ mFpsUpdateTimer->reset();
+
+ S32 fps = (S32) llround(LLTrace::get_frame_recording().getPeriodMedianPerSec(LLStatViewer::FPS, 50));
+ std::string fpsStr = std::to_string(fps);
+ mTextFps->setText(fpsStr);
+ }
+
// update clock every 10 seconds
if(mClockUpdateTimer.getElapsedTimeF32() > 10.f)
{
diff --git a/indra/newview/llstatusbar.h b/indra/newview/llstatusbar.h
index fb923d3d09..da3c4a71f1 100644
--- a/indra/newview/llstatusbar.h
+++ b/indra/newview/llstatusbar.h
@@ -121,6 +121,7 @@ private:
private:
LLTextBox *mTextTime;
+ LLTextBox *mTextFps;
LLStatGraph *mSGBandwidth;
LLStatGraph *mSGPacketLoss;
@@ -131,6 +132,7 @@ private:
LLTextBox *mBoxBalance;
LLButton *mMediaToggle;
LLFrameTimer mClockUpdateTimer;
+ LLFrameTimer *mFpsUpdateTimer;
S32 mBalance;
S32 mHealth;
diff --git a/indra/newview/skins/default/colors.xml b/indra/newview/skins/default/colors.xml
index 64c61ff278..3968f9809f 100644
--- a/indra/newview/skins/default/colors.xml
+++ b/indra/newview/skins/default/colors.xml
@@ -383,6 +383,9 @@
name="FolderViewLoadingMessageTextColor"
value="0.3344 0.545 0.645 1" />
<color
+ name="FpsTextColor"
+ value="0.3344 0.7 1.0 1" />
+ <color
name="GridFocusPointColor"
reference="White_50" />
<color
diff --git a/indra/newview/skins/default/xui/en/panel_status_bar.xml b/indra/newview/skins/default/xui/en/panel_status_bar.xml
index 4501e0df3a..dbc181855f 100644
--- a/indra/newview/skins/default/xui/en/panel_status_bar.xml
+++ b/indra/newview/skins/default/xui/en/panel_status_bar.xml
@@ -185,4 +185,20 @@
top="2"
name="volume_btn"
width="16" />
+ <text
+ type="string"
+ font="SansSerif"
+ text_color="FpsTextColor"
+ follows="right|top"
+ halign="center"
+ valign="center"
+ height="18"
+ top="1"
+ v_pad="0"
+ left_pad="0"
+ name="FpsText"
+ tool_tip="fps"
+ width="40">
+ 60
+ </text>
</panel>