[DEV] add dynamic enable of the fps view
This commit is contained in:
parent
7a8cabb625
commit
e434ab4f8a
@ -223,6 +223,7 @@ void ewol::eContext::SetArchiveDir(int mode, const char* str)
|
|||||||
ewol::eContext::eContext(int32_t _argc, const char* _argv[]) :
|
ewol::eContext::eContext(int32_t _argc, const char* _argv[]) :
|
||||||
m_previousDisplayTime(0),
|
m_previousDisplayTime(0),
|
||||||
m_input(*this),
|
m_input(*this),
|
||||||
|
m_displayFps(false),
|
||||||
m_FpsSystemEvent( "Event ", false),
|
m_FpsSystemEvent( "Event ", false),
|
||||||
m_FpsSystemContext("Context ", false),
|
m_FpsSystemContext("Context ", false),
|
||||||
m_FpsSystem( "Draw ", true),
|
m_FpsSystem( "Draw ", true),
|
||||||
@ -253,6 +254,8 @@ ewol::eContext::eContext(int32_t _argc, const char* _argv[]) :
|
|||||||
|| m_commandLine.Get(iii) == "-l8"
|
|| m_commandLine.Get(iii) == "-l8"
|
||||||
|| m_commandLine.Get(iii) == "-l9") {
|
|| m_commandLine.Get(iii) == "-l9") {
|
||||||
GeneralDebugSetLevel(etk::LOG_LEVEL_VERBOSE);
|
GeneralDebugSetLevel(etk::LOG_LEVEL_VERBOSE);
|
||||||
|
} else if (m_commandLine.Get(iii) == "-fps") {
|
||||||
|
m_displayFps=true;
|
||||||
} else {
|
} else {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -444,7 +447,9 @@ bool ewol::eContext::OS_Draw(bool _displayEveryTime)
|
|||||||
m_previousDisplayTime = currentTime;
|
m_previousDisplayTime = currentTime;
|
||||||
|
|
||||||
// process the events
|
// process the events
|
||||||
m_FpsSystemEvent.Tic();
|
if (m_displayFps==true) {
|
||||||
|
m_FpsSystemEvent.Tic();
|
||||||
|
}
|
||||||
bool needRedraw = false;
|
bool needRedraw = false;
|
||||||
//! Event management section ...
|
//! Event management section ...
|
||||||
{
|
{
|
||||||
@ -462,8 +467,10 @@ bool ewol::eContext::OS_Draw(bool _displayEveryTime)
|
|||||||
// Redraw all needed elements
|
// Redraw all needed elements
|
||||||
m_windowsCurrent->OnRegenerateDisplay();
|
m_windowsCurrent->OnRegenerateDisplay();
|
||||||
}
|
}
|
||||||
m_FpsSystemEvent.IncrementCounter();
|
if (m_displayFps==true) {
|
||||||
m_FpsSystemEvent.Toc();
|
m_FpsSystemEvent.IncrementCounter();
|
||||||
|
m_FpsSystemEvent.Toc();
|
||||||
|
}
|
||||||
//! bool needRedraw = ewol::widgetManager::IsDrawingNeeded();
|
//! bool needRedraw = ewol::widgetManager::IsDrawingNeeded();
|
||||||
needRedraw = m_widgetManager.IsDrawingNeeded();
|
needRedraw = m_widgetManager.IsDrawingNeeded();
|
||||||
// release the curent interface :
|
// release the curent interface :
|
||||||
@ -474,16 +481,22 @@ bool ewol::eContext::OS_Draw(bool _displayEveryTime)
|
|||||||
{
|
{
|
||||||
// Lock OpenGl context:
|
// Lock OpenGl context:
|
||||||
ewol::openGL::Lock();
|
ewol::openGL::Lock();
|
||||||
m_FpsSystemContext.Tic();
|
if (m_displayFps==true) {
|
||||||
|
m_FpsSystemContext.Tic();
|
||||||
|
}
|
||||||
if (NULL != m_windowsCurrent) {
|
if (NULL != m_windowsCurrent) {
|
||||||
if( true == needRedraw
|
if( true == needRedraw
|
||||||
|| true == _displayEveryTime) {
|
|| true == _displayEveryTime) {
|
||||||
m_resourceManager.UpdateContext();
|
m_resourceManager.UpdateContext();
|
||||||
m_FpsSystemContext.IncrementCounter();
|
if (m_displayFps==true) {
|
||||||
|
m_FpsSystemContext.IncrementCounter();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_FpsSystemContext.Toc();
|
if (m_displayFps==true) {
|
||||||
m_FpsSystem.Tic();
|
m_FpsSystemContext.Toc();
|
||||||
|
m_FpsSystem.Tic();
|
||||||
|
}
|
||||||
if (NULL != m_windowsCurrent) {
|
if (NULL != m_windowsCurrent) {
|
||||||
if( true == needRedraw
|
if( true == needRedraw
|
||||||
|| true == _displayEveryTime) {
|
|| true == _displayEveryTime) {
|
||||||
@ -492,20 +505,25 @@ bool ewol::eContext::OS_Draw(bool _displayEveryTime)
|
|||||||
hasDisplayDone = true;
|
hasDisplayDone = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_FpsSystem.Toc();
|
if (m_displayFps==true) {
|
||||||
|
m_FpsSystem.Toc();
|
||||||
m_FpsFlush.Tic();
|
m_FpsFlush.Tic();
|
||||||
m_FpsFlush.IncrementCounter();
|
m_FpsFlush.IncrementCounter();
|
||||||
|
}
|
||||||
glFlush();
|
glFlush();
|
||||||
//glFinish();
|
//glFinish();
|
||||||
m_FpsFlush.Toc();
|
if (m_displayFps==true) {
|
||||||
|
m_FpsFlush.Toc();
|
||||||
|
}
|
||||||
// Release Open GL Context
|
// Release Open GL Context
|
||||||
ewol::openGL::UnLock();
|
ewol::openGL::UnLock();
|
||||||
}
|
}
|
||||||
m_FpsSystemEvent.Draw();
|
if (m_displayFps==true) {
|
||||||
m_FpsSystemContext.Draw();
|
m_FpsSystemEvent.Draw();
|
||||||
m_FpsSystem.Draw();
|
m_FpsSystemContext.Draw();
|
||||||
m_FpsFlush.Draw();
|
m_FpsSystem.Draw();
|
||||||
|
m_FpsFlush.Draw();
|
||||||
|
}
|
||||||
return hasDisplayDone;
|
return hasDisplayDone;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,6 +123,7 @@ namespace ewol
|
|||||||
int64_t m_previousDisplayTime; // this is to limit framerate ... in case...
|
int64_t m_previousDisplayTime; // this is to limit framerate ... in case...
|
||||||
ewol::eInput m_input;
|
ewol::eInput m_input;
|
||||||
etk::MessageFifo<eSystemMessage> m_msgSystem;
|
etk::MessageFifo<eSystemMessage> m_msgSystem;
|
||||||
|
bool m_displayFps;
|
||||||
ewol::Fps m_FpsSystemEvent;
|
ewol::Fps m_FpsSystemEvent;
|
||||||
ewol::Fps m_FpsSystemContext;
|
ewol::Fps m_FpsSystemContext;
|
||||||
ewol::Fps m_FpsSystem;
|
ewol::Fps m_FpsSystem;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user