[DEV] not draw to fast
This commit is contained in:
parent
c814aea10c
commit
35a43e70b8
@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
|
|
||||||
gale::Application::Application() :
|
gale::Application::Application() :
|
||||||
|
m_canDraw(false),
|
||||||
m_needRedraw(true),
|
m_needRedraw(true),
|
||||||
m_title("gale"),
|
m_title("gale"),
|
||||||
m_iconName(""),
|
m_iconName(""),
|
||||||
|
@ -23,6 +23,7 @@ namespace gale {
|
|||||||
Application();
|
Application();
|
||||||
virtual ~Application();
|
virtual ~Application();
|
||||||
public:
|
public:
|
||||||
|
bool m_canDraw;
|
||||||
/**
|
/**
|
||||||
* @brief The application is created.
|
* @brief The application is created.
|
||||||
* @param[in] _context Current gale context.
|
* @param[in] _context Current gale context.
|
||||||
|
@ -366,6 +366,7 @@ gale::Context::Context(gale::Application* _application, int32_t _argc, const cha
|
|||||||
appl->onCreate(_context);
|
appl->onCreate(_context);
|
||||||
appl->onStart(_context);
|
appl->onStart(_context);
|
||||||
appl->onResume(_context);
|
appl->onResume(_context);
|
||||||
|
appl->m_canDraw = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
// force a recalculation
|
// force a recalculation
|
||||||
@ -399,6 +400,7 @@ gale::Context::~Context() {
|
|||||||
// clean all widget and sub widget with their resources:
|
// clean all widget and sub widget with their resources:
|
||||||
//m_objectManager.cleanInternalRemoved();
|
//m_objectManager.cleanInternalRemoved();
|
||||||
// call application to uninit
|
// call application to uninit
|
||||||
|
m_application->m_canDraw = false;
|
||||||
m_application->onPause(*this);
|
m_application->onPause(*this);
|
||||||
m_application->onStop(*this);
|
m_application->onStop(*this);
|
||||||
m_application->onDestroy(*this);
|
m_application->onDestroy(*this);
|
||||||
@ -702,7 +704,9 @@ bool gale::Context::OS_Draw(bool _displayEveryTime) {
|
|||||||
m_FpsSystem.incrementCounter();
|
m_FpsSystem.incrementCounter();
|
||||||
// set the curent interface :
|
// set the curent interface :
|
||||||
lockContext();
|
lockContext();
|
||||||
m_application->onDraw(*this);
|
if (m_application->m_canDraw == true) {
|
||||||
|
m_application->onDraw(*this);
|
||||||
|
}
|
||||||
unLockContext();
|
unLockContext();
|
||||||
hasDisplayDone = true;
|
hasDisplayDone = true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user