summaryrefslogtreecommitdiff
path: root/indra/newview/llstatusbar.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llstatusbar.cpp')
-rw-r--r--indra/newview/llstatusbar.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/indra/newview/llstatusbar.cpp b/indra/newview/llstatusbar.cpp
index bb93e2e79e..bf4ec14487 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,8 @@ LLStatusBar::LLStatusBar(const LLRect& rect)
// status bar can possible overlay menus?
setMouseOpaque(false);
+ mFpsUpdateTimer = new LLFrameTimer();
+
buildFromFile("panel_status_bar.xml");
}
@@ -158,6 +161,9 @@ bool LLStatusBar::postBuild()
mTextTime = getChild<LLTextBox>("TimeText" );
+ mTextFps = getChild<LLButton>("FpsText");
+ mTextFps->setClickedCallback( &LLStatusBar::onClickFps, this );
+
getChild<LLUICtrl>("buyL")->setCommitCallback(
boost::bind(&LLStatusBar::onClickBuyCurrency, this));
@@ -293,6 +299,16 @@ 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);
+ mTextFps->setLabel(fpsStr);
+ }
+
// update clock every 10 seconds
if(mClockUpdateTimer.getElapsedTimeF32() > 10.f)
{
@@ -656,6 +672,12 @@ void LLStatusBar::onClickMediaToggle(void* data)
LLViewerMedia::getInstance()->setAllMediaPaused(pause);
}
+//static
+void LLStatusBar::onClickFps(void* data)
+{
+ LLFloaterReg::toggleInstance("mpv_performance");
+}
+
bool can_afford_transaction(S32 cost)
{
return((cost <= 0)||((gStatusBar) && (gStatusBar->getBalance() >=cost)));