From 2eeaeafb40a6b04b811714c793fb97ce4de41254 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 30 Jan 2021 14:14:01 +0000 Subject: Split into main app and library the rest for testing --- application/manualCameraController.cpp | 65 ---------------------------------- 1 file changed, 65 deletions(-) delete mode 100644 application/manualCameraController.cpp (limited to 'application/manualCameraController.cpp') diff --git a/application/manualCameraController.cpp b/application/manualCameraController.cpp deleted file mode 100644 index 36f3312..0000000 --- a/application/manualCameraController.cpp +++ /dev/null @@ -1,65 +0,0 @@ -#include "manualCameraController.h" -#include -#include - -bool -ManualCameraController::handleInput(SDL_Event & e) -{ - switch (e.type) { - case SDL_KEYDOWN: - switch (e.key.keysym.sym) { - case SDLK_LCTRL: - case SDLK_RCTRL: - ctrl = true; - return true; - } - break; - case SDL_KEYUP: - switch (e.key.keysym.sym) { - case SDLK_LCTRL: - case SDLK_RCTRL: - ctrl = false; - return true; - } - break; - case SDL_MOUSEBUTTONDOWN: - switch (e.button.button) { - case SDL_BUTTON_RIGHT: - SDL_SetRelativeMouseMode(SDL_TRUE); - mrb = true; - return true; - } - break; - case SDL_MOUSEBUTTONUP: - switch (e.button.button) { - case SDL_BUTTON_RIGHT: - SDL_SetRelativeMouseMode(SDL_FALSE); - mrb = false; - return true; - } - break; - case SDL_MOUSEMOTION: - if (mrb) { - motion = e.motion; - } - return true; - } - return false; -} - -void -ManualCameraController::updateCamera(Camera * camera, Shader * shader) const -{ - if (motion) { - if (ctrl) { - camera->RotateY(-0.01F * motion->xrel); - camera->Pitch(-0.01F * motion->yrel); - } - else { - camera->MoveRight(motion->xrel); - camera->SlideForward(motion->yrel); - } - shader->setView(camera->GetViewProjection()); - motion.reset(); - } -} -- cgit v1.2.3