From f138311d2d2e0cc9ba0496d523bb46f2c1c9fb73 Mon Sep 17 00:00:00 2001 From: rtk0c Date: Wed, 20 Sep 2023 23:58:58 -0700 Subject: Copy from the PlasticSCM repo, replace vendored glm wtih conan --- source/30-game/App.hpp | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 source/30-game/App.hpp (limited to 'source/30-game/App.hpp') diff --git a/source/30-game/App.hpp b/source/30-game/App.hpp new file mode 100644 index 0000000..c73c5a1 --- /dev/null +++ b/source/30-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 + +#include +#include +#include +#include + +using KeyCaptureCallback = std::function; + +class App { +private: + std::deque mKeyCaptureCallbacks; + PodVector mPlayers; + std::unique_ptr 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); +}; -- cgit v1.2.3-70-g09d2