Elevate Engine 1
Loading...
Searching...
No Matches
Application.h
Go to the documentation of this file.
1#pragma once
2
5#include <ElevateEngine/Renderer/FrameBuffer.h> // todo remove once the framebuffer is not present in this file anymore
7
8#ifdef EE_USES_WWISE
10#endif
11
12namespace Elevate {
13 class Event;
14 class KeyPressedEvent;
15 class KeyReleasedEvent;
16 class MouseButtonPressedEvent;
17 class MouseButtonReleasedEvent;
18 class WindowCloseEvent;
19 class WindowResizeEvent;
20 class WindowFocusEvent;
21
22 class Layer;
23 class ImGuiLayer;
24
25 namespace Editor
26 {
27 class EditorLayer;
28 }
29
31 {
32 int argc;
33 char** argv;
34
37 : argc(argc), argv(argv) { }
38 };
39
41 {
42 public:
44
46 virtual ~Application() = default;
47
48 static void Start(int argc, char** argv);
49 void Init();
50 void EngineFrame();
51 void Run();
52 void Exit();
53
54 void OnEvent(Event& e);
55
56 void PushLayer(Layer* layer);
57 void PushOverlay(Layer* overlay);
58
59 // TODO Maybe move somewhere else
60 std::unique_ptr<Framebuffer> FrameBuffer;
61
62 inline static Application& Get() { return *s_Instance; }
63 inline Window& GetWindow() { return *m_Window; }
65
66 // GameContextState
67 static const GameContextState& GetGameState();
68 static void SetGameState(GameContextState newState);
69
70 protected:
71 void OnStateChange(GameContextState oldState, GameContextState newState);
72
73 private:
75 //Keyboard
76 bool OnKeyPressedEvent(KeyPressedEvent& e);
77 bool OnKeyReleasedEvent(KeyReleasedEvent& e);
78 //Mouse
79 bool OnMouseButtonPressedEvent(MouseButtonPressedEvent& e);
80 bool OnMouseButtonReleasedEvent(MouseButtonReleasedEvent& e);
81 //Window
82 bool OnWindowClose(WindowCloseEvent& e);
83 bool OnWindowResize(WindowResizeEvent& e);
84 bool OnWindowFocusEvent(WindowFocusEvent& e);
85
86 std::unique_ptr<Window> m_Window;
87 ImGuiLayer* m_ImGuiLayer;
88 bool m_Running = true;
89 LayerStack m_LayerStack;
90
91 // TODO move somewhere else (renderer?)
92 std::shared_ptr<Framebuffer> m_FrameBuffer;
93
96
97 static Application* s_Instance;
98 };
99
100 // To be defined in CLIENT
102}
std::unique_ptr< Framebuffer > FrameBuffer
Definition Application.h:60
void PushLayer(Layer *layer)
static void SetGameState(GameContextState newState)
static const GameContextState & GetGameState()
virtual ~Application()=default
void OnEvent(Event &e)
static Application & Get()
Definition Application.h:62
void PushOverlay(Layer *overlay)
void OnStateChange(GameContextState oldState, GameContextState newState)
static void Start(int argc, char **argv)
static ApplicationArguments GetArguments()
friend class Elevate::Editor::EditorLayer
Definition Application.h:43
GameContextState
Definition GameContext.h:6
@ Initializing
Definition GameContext.h:7
Application * CreateApplication()
ApplicationArguments(int argc, char **argv)
Definition Application.h:36