Sdk/Application: Fix AddWindow<Window>
Former-commit-id: fcd114b7edb92a74d0d646d0f758bde8f40a045d [formerly b6a240aac5a470cd151fcf6b30c65e117bdcc03a] [formerly c44cc9a535703ddb7c64e32fa7f7dedbf1c043c3 [formerly c0d51f049a1df8908dbbf4390d8ecc7d14ae0e79]] Former-commit-id: 951f1d7658aa40e12efa41056f087c1968e19bb5 [formerly 54703326cf2c80ab154610149a2d26fc8e484444] Former-commit-id: 72a5ac27a30818ab77281d3219d0e954958c294a
This commit is contained in:
parent
27ceb07e55
commit
cba0190f03
|
|
@ -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