blob: 26857db694a380b4d881769cdf0d3f2882d705e8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
#pragma once
#include "Camera.hpp"
#include "EditorCore.hpp"
#include "Player.hpp"
#include "PodVector.hpp"
#include "Renderer.hpp"
#include "World.hpp"
#define GLFW_INCLUDE_NONE
#include <GLFW/glfw3.h>
#include <deque>
#include <functional>
#include <memory>
#include <vector>
using KeyCaptureCallback = std::function<bool(int, int)>;
class App {
private:
std::deque<KeyCaptureCallback> mKeyCaptureCallbacks;
PodVector<Player*> mPlayers;
std::unique_ptr<EditorInstance> mEditor;
GameWorld mWorld;
Camera mGameCamera;
Camera mEditorCamera;
Renderer mRenderer;
// NOTE: should only be true when mEditor != nullptr
bool mEditorVisible = false;
bool mGameRunning = false;
public:
App();
~App();
EditorInstance* GetEditor() { return mEditor.get(); }
GameWorld* GetWorld() { return &mWorld; }
bool IsGameRunning() const;
void SetGameRunning(bool running);
bool IsEditorVisible() const;
void SetEditorVisible(bool visible);
// Do ImGui calls
void Show();
// Do regular calls
void Update();
void Draw(float currentTime, float deltaTime);
void HandleMouse(int button, int action);
void HandleMouseMotion(double xOff, double yOff);
void HandleKey(GLFWkeyboard* keyboard, int key, int action);
void PushKeyCaptureCallback(KeyCaptureCallback callback);
};
|