Commit bc6ed7c8 authored by cutealien's avatar cutealien

Allow to freeze the IGUIProfiler interface.


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@4970 dfc29bdd-3216-0410-991c-e03cc46cb475
parent ea6ee609
......@@ -156,6 +156,9 @@ public:
case KEY_F11:
getProfiler().resetAll();
break;
case KEY_KEY_F:
GuiProfiler->setFrozen(!GuiProfiler->getFrozen());
break;
default:
break;
}
......@@ -337,16 +340,17 @@ int main()
Show some info about the controls used in this example
*/
IGUIStaticText * staticText = env->addStaticText(
L"F1 to show/hide the profiling display\n"
L"F2 to show the next page\n"
L"F3 to show the previous page\n"
L"F4 to show the first page\n"
L"F5 to flip between including the group overview\n"
L"F6 to flip between ignoring and showing uncalled data\n"
L"F8 to change our scene\n"
L"F9 to reset the \"grp runtime\" data\n"
L"F10 to reset the scope 3 data\n"
L"F11 to reset all data\n"
L"<F1> to show/hide the profiling display\n"
L"<F2> to show the next page\n"
L"<F3> to show the previous page\n"
L"<F4> to show the first page\n"
L"<F5> to flip between including the group overview\n"
L"<F6> to flip between ignoring and showing uncalled data\n"
L"<F8> to change our scene\n"
L"<F9> to reset the \"grp runtime\" data\n"
L"<F10> to reset the scope 3 data\n"
L"<F11> to reset all data\n"
L"<f> to freeze/unfreeze the display\n"
, recti(10,10, 250, 120), true, true, 0, -1, true);
staticText->setWordWrap(false);
......
......@@ -63,6 +63,13 @@ namespace gui
//! Checks if background drawing is enabled
/** \return true if background drawing is enabled, false otherwise */
virtual bool isDrawBackgroundEnabled() const = 0;
//! Allows to freeze updates which makes it easier to read the numbers
/** Numbers are updated once when you switch pages. */
virtual void setFrozen(bool freeze) = 0;
//! Are updates currently frozen
virtual bool getFrozen() const = 0;
};
} // end namespace gui
......
......@@ -20,7 +20,7 @@ CGUIProfiler::CGUIProfiler(IGUIEnvironment* environment, IGUIElement* parent, s3
: IGUIProfiler(environment, parent, id, rectangle, profiler)
, Profiler(profiler)
, DisplayTable(0), CurrentGroupIdx(0), CurrentGroupPage(0), NumGroupPages(1), IgnoreUncalled(false)
, DrawBackground(false)
, DrawBackground(false), Frozen(false), UnfreezeOnce(false)
{
if ( !Profiler )
Profiler = &getProfiler();
......@@ -168,14 +168,19 @@ void CGUIProfiler::draw()
{
if ( isVisible() )
{
if (!Frozen || UnfreezeOnce)
{
UnfreezeOnce = false;
updateDisplay();
}
}
IGUIElement::draw();
}
void CGUIProfiler::nextPage(bool includeOverview)
{
UnfreezeOnce = true;
if ( CurrentGroupPage < NumGroupPages-1 )
++CurrentGroupPage;
else
......@@ -193,6 +198,7 @@ void CGUIProfiler::nextPage(bool includeOverview)
void CGUIProfiler::previousPage(bool includeOverview)
{
UnfreezeOnce = true;
if ( CurrentGroupPage > 0 )
{
--CurrentGroupPage;
......@@ -216,6 +222,7 @@ void CGUIProfiler::previousPage(bool includeOverview)
void CGUIProfiler::firstPage(bool includeOverview)
{
UnfreezeOnce = true;
if ( includeOverview )
CurrentGroupIdx = 0;
else
......@@ -274,6 +281,18 @@ bool CGUIProfiler::isDrawBackgroundEnabled() const
return DrawBackground;
}
//! Allows to freeze updates which makes it easier to read the numbers
void CGUIProfiler::setFrozen(bool freeze)
{
Frozen = freeze;
}
//! Are updates currently frozen
bool CGUIProfiler::getFrozen() const
{
return Frozen;
}
} // end namespace gui
} // end namespace irr
......
......@@ -59,6 +59,13 @@ namespace gui
/** \return true if background drawing is enabled, false otherwise */
virtual bool isDrawBackgroundEnabled() const _IRR_OVERRIDE_;
//! Allows to freeze updates which makes it easier to read the numbers
virtual void setFrozen(bool freeze) _IRR_OVERRIDE_;
//! Are updates currently frozen
virtual bool getFrozen() const _IRR_OVERRIDE_;
virtual IGUIElement* getElementFromPoint(const core::position2d<s32>& point) _IRR_OVERRIDE_
{
// This element should never get focus from mouse-clicks
......@@ -80,6 +87,8 @@ namespace gui
irr::s32 NumGroupPages;
bool IgnoreUncalled;
bool DrawBackground;
bool Frozen;
bool UnfreezeOnce;
};
} // end namespace gui
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment