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 "krpch.h"
13
14#include "Karma/Window.h"
17#include "Karma/LayerStack.h"
19#include "Karma/Input.h"
20#include "Scene.h"
22
23namespace Karma
24{
28 enum class RunningPlatform
29 {
33 Linux = 0,
34
39
44 };
45
50 {
51 public:
64
76
89 void Run();
90
102 void OnEvent(Event& e);
103
115 void PushLayer(Layer* layer);
116
125 void PushOverlay(Layer* layer);
126
139
146 void HookInputSystem(std::shared_ptr<Input> input);
147
156
164
172
178 inline static Application& Get() { return *s_Instance; }
179
185 inline Window& GetWindow() const { return *m_Window; }
186
192 void CloseApplication();
193
194 private:
201 bool OnWindowClose(WindowCloseEvent& event);
202
209 bool OnWindowResize(WindowResizeEvent& event);
210
217 bool OnControllerDeviceConnected(ControllerDeviceConnectedEvent& event);
218
225 bool OnControllerDeviceDisconnected(ControllerDeviceDisconnectedEvent& event);
226
227 // We are using raw pointers because we want necessary control over the lifetime of
228 // the objects. Especially for clearing up Vulkan relevant parts.
229 Window* m_Window;
230 LayerStack* m_LayerStack;
231
232 KarmaGuiLayer* m_KarmaGuiLayer;
233 bool m_Running = true;
234
235 static Application* s_Instance;
236
237 static RunningPlatform m_RPlatform;
238 };
239
240 extern KARMA_API KarmaSmriti m_MemoryManager;
241
242 // To be defined in the client application
251 Application* CreateApplication();
252}
RunningPlatform
The type of platform application is running on.
Definition Application.h:29
@ Mac
For MacOS (a Unix based OS) support.
Definition Application.h:38
@ Windows
For Windows.
Definition Application.h:43
@ Linux
For Linux based OS support.
Definition Application.h:33
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:50
void DecommisionApplicationEngine()
Clean up all the KEngine relevant mess.
Definition Application.cpp:71
void OnEvent(Event &e)
For dispatching events and trickling down the call to Layer stack.
Definition Application.cpp:169
void Run()
Routine containing the main application loop.
Definition Application.cpp:88
void PushLayer(Layer *layer)
Places the Layer in the stack of layers and sends a notification.
Definition Application.cpp:145
void HookInputSystem(std::shared_ptr< Input > input)
Set an event callback to the given input system.
Definition Application.cpp:77
Window & GetWindow() const
Getter for the Window handle.
Definition Application.h:185
void PrepareApplicationForRun()
Do the preliminaries before the main loop run.
Definition Application.cpp:56
void PushOverlay(Layer *layer)
Places the Layer at the front most position, in the sense, after the last inserted layer.
Definition Application.cpp:151
static Application & Get()
Getter for the instance (s_Instance) of the Application.
Definition Application.h:178
Application()
A constructor for Application.
Definition Application.cpp:26
void InitializeApplicationEngine()
Instantiate the instance of KEngine.
Definition Application.cpp:66
void PrepareMemorySoftBed()
All the bulk memory allocation is done to prevent frequent calls to context switching new/delete oper...
Definition Application.cpp:82
Event triggered when the constroller device is connected.
Definition ControllerDeviceEvent.h:22
Event triggered when controller device is disconnected.
Definition ControllerDeviceEvent.h:61
The base class of all the events for Karma.
Definition Event.h:90
Definition KarmaGuiLayer.h:27
Base class of all Karma's Layers. For instance KarmaGuiLayer.
Definition Layer.h:23
Class concerned with the stacked Layer (what a way to frame the idea, if I may say so)
Definition LayerStack.h:22
Event triggered when window is closed.
Definition ApplicationEvent.h:75
The abstract base class of Karma's window (for platform specific purposes)
Definition Window.h:63
Event triggered when Window is resized.
Definition ApplicationEvent.h:22