aboutsummaryrefslogtreecommitdiff
path: root/source/App.hpp
blob: fbdbd431354214036c46d80e4d5866b9223bd3ee (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
#pragma once

#include "EditorCore.hpp"
#include "Player.hpp"
#include "PodVector.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;
	std::unique_ptr<GameWorld> mCurrentWorld;
	bool mEditorShown = true;
	bool mInitialized = false;

public:
	void Init();
	void Shutdown();

	// Do ImGui calls
	void Show();
	// Do regular calls
	void Update();
	void Draw();

	void HandleMouse(int button, int action);
	void HandleMouseMotion(double xOff, double yOff);
	void HandleKey(GLFWkeyboard* keyboard, int key, int action);

	void PushKeyCaptureCallback(KeyCaptureCallback callback);
};