KarmaEngine
Game Engine for practical learning and research purposes
Loading...
Searching...
No Matches
Application.h
Go to the documentation of this file.
1
10#pragma once
11
12#include "Karma/Window.h"
15#include "Karma/LayerStack.h"
17#include "Karma/Input.h"
18#include "Scene.h"
20
21namespace Karma
22{
26 enum class RunningPlatform
27 {
31 Linux = 0,
32
37
42 };
43
48 {
49 public:
62
74
87 void Run();
88
100 void OnEvent(Event& e);
101
113 void PushLayer(Layer* layer);
114
123 void PushOverlay(Layer* layer);
124
137
144 void HookInputSystem(std::shared_ptr<Input> input);
145
154
162
170
176 inline static Application& Get() { return *s_Instance; }
177
183 inline Window& GetWindow() const { return *m_Window; }
184
190 void CloseApplication();
191
192 private:
199 bool OnWindowClose(WindowCloseEvent& event);
200
207 bool OnWindowResize(WindowResizeEvent& event);
208
215 bool OnControllerDeviceConnected(ControllerDeviceConnectedEvent& event);
216
223 bool OnControllerDeviceDisconnected(ControllerDeviceDisconnectedEvent& event);
224
225 // We are using raw pointers because we want necessary control over the lifetime of
226 // the objects. Especially for clearing up Vulkan relevant parts.
227 Window* m_Window;
228 LayerStack* m_LayerStack;
229
230 KarmaGuiLayer* m_KarmaGuiLayer;
231 bool m_Running = true;
232
233 static Application* s_Instance;
234
235 static RunningPlatform m_RPlatform;
236 };
237
238 extern KARMA_API KarmaSmriti m_MemoryManager;
239
240 // To be defined in the client application
250}
RunningPlatform
The type of platform application is running on.
Definition Application.h:27
@ Mac
For MacOS (a Unix based OS) support.
Definition Application.h:36
@ Windows
For Windows.
Definition Application.h:41
@ Linux
For Linux based OS support.
Definition Application.h:31
Application * CreateApplication()
Declaration of client definable routine.
This file contains the classes concerned with activity of Window.
This file contains the classes concerned with activity of game controller device.
#define KARMA_API
Defining Karma's API macro for storage class information.
Definition Core.h:41
This file contains input class and relevant data structures.
This file contains the class KarmaGuiLayer, a Layer between Engine and KarmaGui.
This file contains the class KarmaSmriti, an agnostic memory manager.
This file contains the LayerStack class.
This file contains the class Scene.
This file contains the Window class.
The class for Game + Editor in application form.
Definition Application.h:48
void DecommisionApplicationEngine()
Clean up all the KEngine relevant mess.
Definition Application.cpp:78
void OnEvent(Event &e)
For dispatching events and trickling down the call to Layer stack.
Definition Application.cpp:181
void Run()
Routine containing the main application loop.
Definition Application.cpp:95
void PushLayer(Layer *layer)
Places the Layer in the stack of layers and sends a notification.
Definition Application.cpp:157
void HookInputSystem(std::shared_ptr< Input > input)
Set an event callback to the given input system.
Definition Application.cpp:84
Window & GetWindow() const
Getter for the Window handle.
Definition Application.h:183
void PrepareApplicationForRun()
Do the preliminaries before the main loop run.
Definition Application.cpp:63
void PushOverlay(Layer *layer)
Places the Layer at the front most position, in the sense, after the last inserted layer.
Definition Application.cpp:163
static Application & Get()
Getter for the instance (s_Instance) of the Application.
Definition Application.h:176
Application()
A constructor for Application.
Definition Application.cpp:26
void InitializeApplicationEngine()
Instantiate the instance of KEngine.
Definition Application.cpp:73
void PrepareMemorySoftBed()
All the bulk memory allocation is done to prevent frequent calls to context switching new/delete oper...
Definition Application.cpp:89
Event triggered when the constroller device is connected.
Definition ControllerDeviceEvent.h:20
Event triggered when controller device is disconnected.
Definition ControllerDeviceEvent.h:59
The base class of all the events for Karma.
Definition Event.h:88
Definition KarmaGuiLayer.h:25
Base class of all Karma's Layers. For instance KarmaGuiLayer.
Definition Layer.h:21
Class concerned with the stacked Layer (what a way to frame the idea, if I may say so).
Definition LayerStack.h:20
Event triggered when window is closed.
Definition ApplicationEvent.h:73
The abstract base class of Karma's window (for platform specific purposes).
Definition Window.h:61
Event triggered when Window is resized.
Definition ApplicationEvent.h:20