diff options
author | hnOsmium0001 <[email protected]> | 2022-04-06 20:52:51 -0700 |
---|---|---|
committer | hnOsmium0001 <[email protected]> | 2022-04-06 20:52:51 -0700 |
commit | 3fdc6eb4f2cbeffce9b250beec4d3a2d52a3f534 (patch) | |
tree | 05991741844aa2814b3ac71e2c843ebe07244845 /source/App.cpp | |
parent | ebd42760caaec8330a3c028f31adc7bc0b339d16 (diff) |
Work on moving infrastruture to this project
Diffstat (limited to 'source/App.cpp')
-rw-r--r-- | source/App.cpp | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/source/App.cpp b/source/App.cpp index 35fb5f7..c85dd9e 100644 --- a/source/App.cpp +++ b/source/App.cpp @@ -1,7 +1,35 @@ #include "App.hpp" #include <imgui.h> +#include <memory> + +void App::Init() { + mCurrentWorld = std::make_unique<GameWorld>(); + auto worldRoot = mCurrentWorld->GetRoot(); + + constexpr int kPlayerCount = 2; + for (int i = 0; i < kPlayerCount; ++i) { + auto player = new Player(mCurrentWorld.get()); + worldRoot.AddChild(player); + mPlayers.push_back(player); + } +} + +void App::Shutdown() { + mCurrentWorld = nullptr; + mPlayers.clear(); +} void App::Show() { - // Application goes here + mCurrentWorld->Draw(); +} + +void App::HandleKey(GLFWkeyboard* keyboard, int key, int action) { + for (auto& player : mPlayers) { + for (auto playerKeyboard : player->boundKeyboards) { + if (playerKeyboard == keyboard) { + player->HandleKeyInput(key, action); + } + } + } } |