Add current work

Former-commit-id: 06dd34f00951e334b330c067f61f69fc73dcc2d2
This commit is contained in:
Lynix
2016-03-15 23:00:03 +01:00
parent 3f9a4170f1
commit 83884015fc
3 changed files with 113 additions and 1 deletions

View File

@@ -3,3 +3,47 @@
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp
#include <NDK/Application.hpp>
namespace Ndk
{
bool Application::Run()
{
#ifndef NDK_SERVER
bool hasAtLeastOneActiveWindow = false;
auto it = m_windows.begin();
while (it != m_windows.end())
{
Nz::Window& window = **it;
if (!window.IsOpen(true))
{
it = m_windows.erase(it);
continue;
}
hasAtLeastOneActiveWindow = true;
++it;
}
#endif
float elapsedTime = m_updateClock.GetSeconds();
m_updateClock.Restart();
for (World& world : m_worlds)
world.Update(elapsedTime);
if (m_shouldQuit)
return false;
#ifndef NDK_SERVER
if (m_exitOnClosedWindows && !hasAtLeastOneActiveWindow)
return false;
#endif
return true;
}
Application* Application::s_application = nullptr;
}