7 #ifndef NDK_APPLICATION_HPP 8 #define NDK_APPLICATION_HPP 10 #include <NDK/Prerequesites.hpp> 11 #include <NDK/World.hpp> 12 #include <Nazara/Core/Clock.hpp> 18 #include <NDK/Console.hpp> 19 #include <Nazara/Core/Log.hpp> 20 #include <Nazara/Lua/LuaInstance.hpp> 21 #include <Nazara/Graphics/TextSprite.hpp> 22 #include <Nazara/Renderer/RenderTarget.hpp> 23 #include <Nazara/Platform/Window.hpp> 32 struct ConsoleOverlay;
33 struct FPSCounterOverlay;
43 template<
typename T,
typename... Args> T& AddWindow(Args&&... args);
45 template<
typename... Args>
World& AddWorld(Args&&... args);
48 inline void EnableConsole(
bool enable);
49 inline void EnableFPSCounter(
bool enable);
51 inline ConsoleOverlay& GetConsoleOverlay(std::size_t windowIndex = 0U);
52 inline FPSCounterOverlay& GetFPSCounterOverlay(std::size_t windowIndex = 0U);
55 inline const std::set<Nz::String>& GetOptions()
const;
56 inline const std::map<Nz::String, Nz::String>& GetParameters()
const;
58 inline float GetUpdateTime()
const;
60 inline bool HasOption(
const Nz::String& option)
const;
64 inline bool IsConsoleEnabled()
const;
65 inline bool IsFPSCounterEnabled()
const;
71 inline void MakeExitOnLastWindowClosed(
bool exitOnClosedWindows);
84 std::unique_ptr<Console> console;
87 NazaraSlot(Nz::EventHandler, OnEvent, eventSlot);
88 NazaraSlot(Nz::EventHandler, OnKeyPressed, keyPressedSlot);
89 NazaraSlot(Nz::RenderTarget, OnRenderTargetSizeChange, resizedSlot);
90 NazaraSlot(
Nz::Log, OnLogWrite, logSlot);
93 struct FPSCounterOverlay
97 float elapsedTime = 0.f;
98 unsigned int frameCount = 0;
106 OverlayFlags_Console = 0x1,
107 OverlayFlags_FPSCounter = 0x2
112 inline WindowInfo(std::unique_ptr<Nz::Window>&& window);
114 Nz::RenderTarget* renderTarget;
115 std::unique_ptr<Nz::Window> window;
116 std::unique_ptr<ConsoleOverlay> console;
117 std::unique_ptr<FPSCounterOverlay> fpsCounter;
118 std::unique_ptr<World> overlayWorld;
121 void SetupConsole(WindowInfo& info);
122 void SetupFPSCounter(WindowInfo& info);
123 void SetupOverlay(WindowInfo& info);
125 template<
typename T>
void SetupWindow(WindowInfo& info, T* renderTarget, std::true_type );
126 template<
typename T>
void SetupWindow(WindowInfo& , T* , std::false_type );
128 std::vector<WindowInfo> m_windows;
131 std::map<Nz::String, Nz::String> m_parameters;
132 std::set<Nz::String> m_options;
133 std::list<World> m_worlds;
137 Nz::UInt32 m_overlayFlags;
138 bool m_exitOnClosedWindows;
147 #include <NDK/Application.inl> 149 #endif // NDK_APPLICATION_HPP Utility class that measure the elapsed time.
Definition: Clock.hpp:20
TODO: For now is unable to display different color in the history, it needs a RichTextDrawer to do so...
Definition: Algorithm.hpp:12
NDK class that represents the owner of the entity and so its lifetime.
Definition: EntityOwner.hpp:14
Core class that represents a string.
Definition: String.hpp:22
Core class that represents a reference to an object.
Definition: ObjectRef.hpp:18
Core class that represents a logger.
Definition: Log.hpp:32
NDK class that represents the application, it offers a set of tools to ease the development.
Definition: Application.hpp:28
NDK class that represents a world.
Definition: World.hpp:25