/* * DebugController.cpp * * Created on: Nov 30, 2016 * Author: tibi */ #include #include #include #include #include using namespace farmlands::input; namespace farmlands { namespace components { static const float ScaleVelocity = 0.5f; static const float ScaleShiftVelocity = 2.0f; DebugController::DebugController() : m_camera(nullptr) { } DebugController::~DebugController() { } model::Component* DebugController::clone() { return new DebugController(); } void DebugController::onInitialize() { m_camera = GameState::current().renderContext.camera(); } void DebugController::onUpdateLogic() { // Compute velocity float vel = ScaleVelocity; if (Input::instance().pressed(GameKey::Run)) vel = ScaleShiftVelocity; // Time independent vel *= GameState::current().elapsedTime; if (Input::instance().pressed(GameKey::Debug_ZoomIn)) m_camera->scale *= 1 + vel; if (Input::instance().pressed(GameKey::Debug_ZoomOut)) m_camera->scale *= 1 - vel; } void DebugController::dump(unsigned level) { for (unsigned i = 0; i < level; i++) std::cout<<" "; std::cout << " .Component: DebugController\n"; } } /* namespace controller */ } /* namespace farmlands */