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: ...@@ -156,6 +156,9 @@ public:
case KEY_F11: case KEY_F11:
getProfiler().resetAll(); getProfiler().resetAll();
break; break;
case KEY_KEY_F:
GuiProfiler->setFrozen(!GuiProfiler->getFrozen());
break;
default: default:
break; break;
} }
...@@ -337,16 +340,17 @@ int main() ...@@ -337,16 +340,17 @@ int main()
Show some info about the controls used in this example Show some info about the controls used in this example
*/ */
IGUIStaticText * staticText = env->addStaticText( IGUIStaticText * staticText = env->addStaticText(
L"F1 to show/hide the profiling display\n" L"<F1> to show/hide the profiling display\n"
L"F2 to show the next page\n" L"<F2> to show the next page\n"
L"F3 to show the previous page\n" L"<F3> to show the previous page\n"
L"F4 to show the first page\n" L"<F4> to show the first page\n"
L"F5 to flip between including the group overview\n" L"<F5> to flip between including the group overview\n"
L"F6 to flip between ignoring and showing uncalled data\n" L"<F6> to flip between ignoring and showing uncalled data\n"
L"F8 to change our scene\n" L"<F8> to change our scene\n"
L"F9 to reset the \"grp runtime\" data\n" L"<F9> to reset the \"grp runtime\" data\n"
L"F10 to reset the scope 3 data\n" L"<F10> to reset the scope 3 data\n"
L"F11 to reset all 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); , recti(10,10, 250, 120), true, true, 0, -1, true);
staticText->setWordWrap(false); staticText->setWordWrap(false);
......
...@@ -63,6 +63,13 @@ namespace gui ...@@ -63,6 +63,13 @@ namespace gui
//! Checks if background drawing is enabled //! Checks if background drawing is enabled
/** \return true if background drawing is enabled, false otherwise */ /** \return true if background drawing is enabled, false otherwise */
virtual bool isDrawBackgroundEnabled() const = 0; 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 } // end namespace gui
......
...@@ -20,7 +20,7 @@ CGUIProfiler::CGUIProfiler(IGUIEnvironment* environment, IGUIElement* parent, s3 ...@@ -20,7 +20,7 @@ CGUIProfiler::CGUIProfiler(IGUIEnvironment* environment, IGUIElement* parent, s3
: IGUIProfiler(environment, parent, id, rectangle, profiler) : IGUIProfiler(environment, parent, id, rectangle, profiler)
, Profiler(profiler) , Profiler(profiler)
, DisplayTable(0), CurrentGroupIdx(0), CurrentGroupPage(0), NumGroupPages(1), IgnoreUncalled(false) , DisplayTable(0), CurrentGroupIdx(0), CurrentGroupPage(0), NumGroupPages(1), IgnoreUncalled(false)
, DrawBackground(false) , DrawBackground(false), Frozen(false), UnfreezeOnce(false)
{ {
if ( !Profiler ) if ( !Profiler )
Profiler = &getProfiler(); Profiler = &getProfiler();
...@@ -168,7 +168,11 @@ void CGUIProfiler::draw() ...@@ -168,7 +168,11 @@ void CGUIProfiler::draw()
{ {
if ( isVisible() ) if ( isVisible() )
{ {
updateDisplay(); if (!Frozen || UnfreezeOnce)
{
UnfreezeOnce = false;
updateDisplay();
}
} }
IGUIElement::draw(); IGUIElement::draw();
...@@ -176,6 +180,7 @@ void CGUIProfiler::draw() ...@@ -176,6 +180,7 @@ void CGUIProfiler::draw()
void CGUIProfiler::nextPage(bool includeOverview) void CGUIProfiler::nextPage(bool includeOverview)
{ {
UnfreezeOnce = true;
if ( CurrentGroupPage < NumGroupPages-1 ) if ( CurrentGroupPage < NumGroupPages-1 )
++CurrentGroupPage; ++CurrentGroupPage;
else else
...@@ -193,6 +198,7 @@ void CGUIProfiler::nextPage(bool includeOverview) ...@@ -193,6 +198,7 @@ void CGUIProfiler::nextPage(bool includeOverview)
void CGUIProfiler::previousPage(bool includeOverview) void CGUIProfiler::previousPage(bool includeOverview)
{ {
UnfreezeOnce = true;
if ( CurrentGroupPage > 0 ) if ( CurrentGroupPage > 0 )
{ {
--CurrentGroupPage; --CurrentGroupPage;
...@@ -216,6 +222,7 @@ void CGUIProfiler::previousPage(bool includeOverview) ...@@ -216,6 +222,7 @@ void CGUIProfiler::previousPage(bool includeOverview)
void CGUIProfiler::firstPage(bool includeOverview) void CGUIProfiler::firstPage(bool includeOverview)
{ {
UnfreezeOnce = true;
if ( includeOverview ) if ( includeOverview )
CurrentGroupIdx = 0; CurrentGroupIdx = 0;
else else
...@@ -274,6 +281,18 @@ bool CGUIProfiler::isDrawBackgroundEnabled() const ...@@ -274,6 +281,18 @@ bool CGUIProfiler::isDrawBackgroundEnabled() const
return DrawBackground; 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 gui
} // end namespace irr } // end namespace irr
......
...@@ -59,6 +59,13 @@ namespace gui ...@@ -59,6 +59,13 @@ namespace gui
/** \return true if background drawing is enabled, false otherwise */ /** \return true if background drawing is enabled, false otherwise */
virtual bool isDrawBackgroundEnabled() const _IRR_OVERRIDE_; 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_ virtual IGUIElement* getElementFromPoint(const core::position2d<s32>& point) _IRR_OVERRIDE_
{ {
// This element should never get focus from mouse-clicks // This element should never get focus from mouse-clicks
...@@ -80,6 +87,8 @@ namespace gui ...@@ -80,6 +87,8 @@ namespace gui
irr::s32 NumGroupPages; irr::s32 NumGroupPages;
bool IgnoreUncalled; bool IgnoreUncalled;
bool DrawBackground; bool DrawBackground;
bool Frozen;
bool UnfreezeOnce;
}; };
} // end namespace gui } // 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