From a32a8447028798ef05af33230fbcfa3195ab430c Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Mon, 8 Mar 2021 20:03:40 +0000 Subject: Initial commit of the orders/activities system Has the main window provide some control over our test train --- application/main.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'application') diff --git a/application/main.cpp b/application/main.cpp index c9caf74..1d961a0 100644 --- a/application/main.cpp +++ b/application/main.cpp @@ -2,6 +2,9 @@ #include #include #include +#include +#include +#include #include #include #include @@ -49,6 +52,7 @@ public: NO_COPY(SDL_Application); NO_MOVE(SDL_Application); + std::shared_ptr train; bool handleInput(SDL_Event & e) override { @@ -56,6 +60,18 @@ public: case SDL_QUIT: isRunning = false; return true; + case SDL_KEYUP: + switch (e.key.keysym.scancode) { + case SDL_SCANCODE_G: + train->currentActivity = std::make_unique(); + break; + case SDL_SCANCODE_I: + train->currentActivity = std::make_unique(); + break; + default: + return false; + } + return true; } return false; } @@ -81,7 +97,7 @@ public: rl->addLinksBetween(e1, j); auto e2 = rl->addLinksBetween(e, {-925, 10, -1075})->ends[0].first->pos; rl->addLinksBetween(e2, j); - const auto & train = world.create(l3); + train = world.create(l3); auto b47 = std::make_shared("brush47"); for (int n = 0; n < 6; n++) { train->create(b47); -- cgit v1.2.3