diff options
author | rtk0c <[email protected]> | 2022-06-03 23:26:44 -0700 |
---|---|---|
committer | rtk0c <[email protected]> | 2022-06-03 23:26:44 -0700 |
commit | 60ccc62f4934e44ad5b905fdbcf458302b8d8a09 (patch) | |
tree | 02ec83cc8387abfd08bd5ee7ea4e8115f1bfb8d0 /source/Game/App.hpp | |
parent | c2ef7737536bf1f8c81fcfae95c0183b21c9753f (diff) |
Changeset: 63 [WIP] Rename directories
Diffstat (limited to 'source/Game/App.hpp')
-rw-r--r-- | source/Game/App.hpp | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/source/Game/App.hpp b/source/Game/App.hpp new file mode 100644 index 0000000..c73c5a1 --- /dev/null +++ b/source/Game/App.hpp @@ -0,0 +1,62 @@ +#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<IEditor> mEditor; + GameWorld mWorld; + Renderer mWorldRenderer; + Camera mMainCamera; + Camera* mActiveCamera; + // NOTE: should only be true when mEditor != nullptr + bool mEditorVisible = false; + bool mGameRunning = false; + +public: + App(); + ~App(); + + IEditor* GetEditor() { return mEditor.get(); } + GameWorld* GetWorld() { return &mWorld; } + Renderer* GetWorldRenderer() { return &mWorldRenderer; } + + Camera* GetActiveCamera() const; + void BindActiveCamera(Camera* camera); + void UnbindActiveCamera(); + + 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); +}; |