Karma Engine
Loading...
Searching...
No Matches
Application.h
1#pragma once
2
3#include "krpch.h"
4
5#include "Karma/Window.h"
6#include "Karma/Events/ApplicationEvent.h"
7#include "Karma/Events/ControllerDeviceEvent.h"
8#include "Karma/LayerStack.h"
9#include "Karma/KarmaGui/KarmaGuiLayer.h"
10#include "Karma/Input.h"
11#include "Scene.h"
12#include "Core/TrueCore/KarmaSmriti.h"
13
14namespace Karma
15{
16 enum class RunningPlatform
17 {
18 Linux = 0,
19 Mac,
20 Windows
21 };
22
23 class KARMA_API Application
24 {
25 public:
28
29 void Run();
30
31 void OnEvent(Event& e);
32
33 void PushLayer(Layer* layer);
34 void PushOverlay(Layer* layer);
35
36 void PrepareApplicationForRun();
37
38 void HookInputSystem(std::shared_ptr<Input> input);
39
44 void PrepareMemorySoftBed();
45
46 void InitializeApplicationEngine();
47 void DecommisionApplicationEngine();
48
49 inline static Application& Get() { return *s_Instance; }
50 inline Window& GetWindow() const { return *m_Window; }
51
52 void CloseApplication();
53
54 private:
55 bool OnWindowClose(WindowCloseEvent& event);
56 bool OnWindowResize(WindowResizeEvent& event);
57 bool OnControllerDeviceConnected(ControllerDeviceConnectedEvent& event);
58 bool OnControllerDeviceDisconnected(ControllerDeviceDisconnectedEvent& event);
59
60 // We are using raw pointers because we want necessary control over the lifetime of
61 // the objects. Especially for clearing up Vulkan relevant parts.
62 Window* m_Window;
63 LayerStack* m_LayerStack;
64
65 KarmaGuiLayer* m_KarmaGuiLayer;
66 bool m_Running = true;
67
68 static Application* s_Instance;
69 static RunningPlatform m_RPlatform;
70 };
71
72 extern KARMA_API KarmaSmriti m_MemoryManager;
73
74 // To be defined in the client application
75 Application* CreateApplication();
76}
Definition Application.h:24
Definition ControllerDeviceEvent.h:10
Definition ControllerDeviceEvent.h:31
Definition Event.h:35
Definition KarmaGuiLayer.h:17
Definition KarmaSmriti.h:14
Definition LayerStack.h:10
Definition Layer.h:11
Definition ApplicationEvent.h:34
Definition ApplicationEvent.h:10
Definition Window.h:27