aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/cpp/Subconscious.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/cpp/Subconscious.cpp')
-rw-r--r--src/main/cpp/Subconscious.cpp27
1 files changed, 22 insertions, 5 deletions
diff --git a/src/main/cpp/Subconscious.cpp b/src/main/cpp/Subconscious.cpp
index 542e580..9765f2f 100644
--- a/src/main/cpp/Subconscious.cpp
+++ b/src/main/cpp/Subconscious.cpp
@@ -34,17 +34,29 @@ void Subconscious::run()
case sf::Event::KeyPressed:
switch (event.key.code) {
case sf::Keyboard::Up:
- _currentScene->pan(0, 10);
+ if (_currentScene->type == Scene::Type::WORLD) {
+ static_cast<WorldScene*>(_currentScene)->pan(0, 10);
+ }
break;
+
case sf::Keyboard::Down:
- _currentScene->pan(0, -10);
+ if (_currentScene->type == Scene::Type::WORLD) {
+ static_cast<WorldScene*>(_currentScene)->pan(0, -10);
+ }
break;
+
case sf::Keyboard::Left:
- _currentScene->pan(10, 0);
+ if (_currentScene->type == Scene::Type::WORLD) {
+ static_cast<WorldScene*>(_currentScene)->pan(10, 0);
+ }
break;
+
case sf::Keyboard::Right:
- _currentScene->pan(-10, 0);
+ if (_currentScene->type == Scene::Type::WORLD) {
+ static_cast<WorldScene*>(_currentScene)->pan(-10, 0);
+ }
break;
+
default:
break;
}
@@ -71,7 +83,11 @@ void Subconscious::run()
//
// std::cout << std::fixed << std::setprecision(3)
// << event.mouseWheelScroll.delta << std::endl;
- _currentScene->zoom(event.mouseWheelScroll.delta/10.0);
+
+ if (_currentScene->type == Scene::Type::WORLD) {
+ static_cast<WorldScene*>(_currentScene)->zoom(event.mouseWheelScroll.delta/10.0);
+ }
+
break;
/*** Window Events ***/
@@ -82,6 +98,7 @@ void Subconscious::run()
case sf::Event::Resized:
_currentScene->resize(event.size);
break;
+
default:
break;
}