Sdk/Application: Fix AddWindow<Window>
Former-commit-id: 16b652d622e895dbb89dce0ce1a7cc4a4b19746c [formerly d34c513b12324c63a27d4baedb36e8ac41985710] [formerly 3f16d8cf446b553c3a4667efee3229c36c19f402 [formerly 0be44914271824bb2550ba775568c7efca8f9894]] Former-commit-id: b4ae45478a325782a2e7965e4f8115f4fd93ad90 [formerly 2c4f33beaa320b216274c325c87cdb7b0fa5e1d4] Former-commit-id: f68b68712b97356d50f76f3b444a81dddedbe210
This commit is contained in:
parent
303fe658cf
commit
8caeba0a48
|
|
@ -117,6 +117,9 @@ namespace Ndk
|
|||
void SetupFPSCounter(WindowInfo& info);
|
||||
void SetupOverlay(WindowInfo& info);
|
||||
|
||||
template<typename T> void SetupWindow(WindowInfo& info, T* renderTarget, std::true_type /*isRenderTarget*/);
|
||||
template<typename T> void SetupWindow(WindowInfo& /*info*/, T* /*renderTarget*/, std::false_type /*isNotRenderTarget*/);
|
||||
|
||||
std::vector<WindowInfo> m_windows;
|
||||
#endif
|
||||
std::list<World> m_worlds;
|
||||
|
|
|
|||
|
|
@ -85,21 +85,7 @@ namespace Ndk
|
|||
|
||||
T& window = static_cast<T&>(*info.window.get()); //< Warning: ugly
|
||||
|
||||
if (std::is_base_of<Nz::RenderTarget, T>())
|
||||
{
|
||||
info.renderTarget = &window;
|
||||
|
||||
if (m_overlayFlags)
|
||||
{
|
||||
SetupOverlay(info);
|
||||
|
||||
if (m_overlayFlags & OverlayFlags_Console)
|
||||
SetupConsole(info);
|
||||
|
||||
if (m_overlayFlags & OverlayFlags_FPSCounter)
|
||||
SetupFPSCounter(info);
|
||||
}
|
||||
}
|
||||
SetupWindow(info, &window, std::is_base_of<Nz::RenderTarget, T>());
|
||||
|
||||
return window;
|
||||
}
|
||||
|
|
@ -138,7 +124,10 @@ namespace Ndk
|
|||
}
|
||||
|
||||
for (WindowInfo& info : m_windows)
|
||||
{
|
||||
if (info.renderTarget)
|
||||
SetupConsole(info);
|
||||
}
|
||||
|
||||
m_overlayFlags |= OverlayFlags_Console;
|
||||
|
||||
|
|
@ -178,7 +167,10 @@ namespace Ndk
|
|||
}
|
||||
|
||||
for (WindowInfo& info : m_windows)
|
||||
{
|
||||
if (info.renderTarget)
|
||||
SetupFPSCounter(info);
|
||||
}
|
||||
|
||||
m_overlayFlags |= OverlayFlags_FPSCounter;
|
||||
|
||||
|
|
@ -310,6 +302,28 @@ namespace Ndk
|
|||
return s_application;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline void Application::SetupWindow(WindowInfo& info, T* renderTarget, std::true_type)
|
||||
{
|
||||
info.renderTarget = renderTarget;
|
||||
|
||||
if (m_overlayFlags)
|
||||
{
|
||||
SetupOverlay(info);
|
||||
|
||||
if (m_overlayFlags & OverlayFlags_Console)
|
||||
SetupConsole(info);
|
||||
|
||||
if (m_overlayFlags & OverlayFlags_FPSCounter)
|
||||
SetupFPSCounter(info);
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline void Application::SetupWindow(WindowInfo&, T*, std::false_type)
|
||||
{
|
||||
}
|
||||
|
||||
#ifndef NDK_SERVER
|
||||
inline Application::WindowInfo::WindowInfo(std::unique_ptr<Nz::Window>&& window) :
|
||||
window(std::move(window)),
|
||||
|
|
|
|||
Loading…
Reference in New Issue