aboutsummaryrefslogtreecommitdiff
path: root/source/App.cpp
diff options
context:
space:
mode:
authorrtk0c <[email protected]>2022-04-06 20:52:51 -0700
committerrtk0c <[email protected]>2022-04-06 20:52:51 -0700
commitf163e8f37123e651ea80b690793845b31ddb8639 (patch)
treee2c9f14d600f073533c9d01cfb90c4d60938127c /source/App.cpp
parent11edae3fbf770695d1b263712ca4f3a40bdd70e3 (diff)
Changeset: 2 Work on moving infrastruture to this project
Diffstat (limited to 'source/App.cpp')
-rw-r--r--source/App.cpp30
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);
+ }
+ }
+ }
}