Nui Engine
A game engine framework
Loading...
Searching...
No Matches
AppBase.h
1#pragma once
2#include "Core/Common/CommonHeaders.h"
3#include "Core/App/Window.h"
4#include "Core/Engine/World.h"
5
6namespace Nui
7{
13 class AppBase : public Window
14 {
15 friend class Engine;
16 public:
23 explicit AppBase(WStringView appName, Window::Style style, Window::Size size);
24
28 virtual ~AppBase() = default;
29
33 virtual void OnInit() {}
34
38 virtual void OnShutdown() {}
39
44 inline World* GetWorld() const { return m_world.get(); }
45
46 private:
47 AppBase(const AppBase&) = delete;
48 AppBase(AppBase&&) = delete;
49
53 void PreInit();
54
59 void Tick(const F64 dt);
60
64 void PostShutdown();
65
66 private:
70 std::unique_ptr<World> m_world;
71 };
72
73 namespace Internal
74 {
80 extern std::unique_ptr<Nui::AppBase> MakeApp();
81 }
82}
83
84#define NUI_DECLARE_APP(app, ...) \
85namespace Nui::Internal \
86{ \
87 std::unique_ptr<Nui::AppBase> MakeApp() \
88 { \
89 return std::make_unique<app>(__VA_ARGS__);\
90 } \
91}
Base class for all apps in Nui Engine.
Definition AppBase.h:14
virtual void OnInit()
Called when the app is initialized (to be implemented in derived class)
Definition AppBase.h:33
virtual void OnShutdown()
Called when the app is shutdown (to be implemented in derived class)
Definition AppBase.h:38
AppBase(WStringView appName, Window::Style style, Window::Size size)
Construct a new AppBase object.
Definition AppBase.cpp:5
World * GetWorld() const
Get the world of the app.
Definition AppBase.h:44
virtual ~AppBase()=default
Virtual destructor.
Core engine class for Nui Engine.
Definition Engine.h:12
Class representing a window in the application.
Definition Window.h:12
Style
Window styles.
Definition Window.h:19
World class - the main context for the engine.
Definition World.h:19
Window size.
Definition Window.h:46