Sdk/Application: Fix AddWindow<Window>
Former-commit-id: 8ba1293663fe64f767043ec9b3d92b870cf9878d [formerly 07a62d5cc914005a8815ca3368d30e52f91ca7c7] [formerly cc643f08cfaa9c437c1583a6a364fe933fef14d4 [formerly f672cabe9b31d72381d086476106e210a509debb]] Former-commit-id: 89ae61c98b8c74acbdbae64f7c2143c399e97075 [formerly b9596061ae9a3f92a2ad8760b51f031aa5f7bf50] Former-commit-id: 465fbf70964ef0add7bdcb7ca976026be430d025
This commit is contained in:
parent
a3e9a303b6
commit
ab69578e72
|
|
@ -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)
|
||||
SetupConsole(info);
|
||||
{
|
||||
if (info.renderTarget)
|
||||
SetupConsole(info);
|
||||
}
|
||||
|
||||
m_overlayFlags |= OverlayFlags_Console;
|
||||
|
||||
|
|
@ -178,7 +167,10 @@ namespace Ndk
|
|||
}
|
||||
|
||||
for (WindowInfo& info : m_windows)
|
||||
SetupFPSCounter(info);
|
||||
{
|
||||
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