From 3fdc6eb4f2cbeffce9b250beec4d3a2d52a3f534 Mon Sep 17 00:00:00 2001 From: hnOsmium0001 Date: Wed, 6 Apr 2022 20:52:51 -0700 Subject: Work on moving infrastruture to this project --- source/App.cpp | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'source/App.cpp') 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 +#include + +void App::Init() { + mCurrentWorld = std::make_unique(); + 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); + } + } + } } -- cgit v1.2.3-70-g09d2