Elevate Engine 1
Loading...
Searching...
No Matches
CameraManager.cpp
Go to the documentation of this file.
1#include "eepch.h"
2
3#include "CameraManager.h"
5
7
8#ifdef EE_EDITOR_BUILD
11#endif
12
13namespace Elevate
14{
15 Camera* CameraManager::s_currentCamera = nullptr;
16
18 {
19#ifdef EE_EDITOR_BUILD
21 {
22 return GetEditor();
23 }
24#endif
25
26 Camera* runtime = GetRuntime();
27 if (!runtime)
28 {
29 EE_CORE_ASSERT(false, "ERROR : There is no active camera! - CameraManager::GetCurrent()");
30 }
31
32 return runtime;
33 }
34
35#ifdef EE_EDITOR_BUILD
36 Camera* CameraManager::GetEditor()
37 {
38 return Editor::EditorLayer::Get().GetCamera();
39 }
40#endif
41
43 {
44 if (s_currentCamera)
45 {
46 return s_currentCamera;
47 }
48 return nullptr;
49 }
50
52 {
53 s_currentCamera = current;
54 }
55
57 {
58 if (s_currentCamera && camera == s_currentCamera)
59 {
60 s_currentCamera = nullptr;
61 }
62 }
63}
static const GameContextState & GetGameState()
static void NotifyDestruction(Camera *camera)
static Camera * GetCurrent()
static Camera * GetRuntime()
static void SetCurrent(Camera *current)
@ EditorMode
Definition GameContext.h:8