43 float multiplier = 1.0f;
44 if (e.key.keysym.mod & KMOD_SHIFT)
47 if (e.key.keysym.sym == SDLK_UP)
48 CameraMan.moveRelative(0.0f, 0.0f, multiplier * -0.5f);
49 else if (e.key.keysym.sym == SDLK_DOWN)
50 CameraMan.moveRelative(0.0f, 0.0f, multiplier * 0.5f);
51 else if (e.key.keysym.sym == SDLK_RIGHT)
52 CameraMan.turn( 0.0f, 0.0f, multiplier * -5.0f);
53 else if (e.key.keysym.sym == SDLK_LEFT)
54 CameraMan.turn( 0.0f, 0.0f, multiplier * 5.0f);
55 else if (e.key.keysym.scancode == SDL_SCANCODE_W)
56 CameraMan.moveRelative(0.0f, 0.0f, multiplier * -0.5f);
57 else if (e.key.keysym.scancode == SDL_SCANCODE_S)
58 CameraMan.moveRelative(0.0f, 0.0f, multiplier * 0.5f);
59 else if (e.key.keysym.scancode == SDL_SCANCODE_D)
60 CameraMan.turn( 0.0f, 0.0f, multiplier * -5.0f);
61 else if (e.key.keysym.scancode == SDL_SCANCODE_A)
62 CameraMan.turn( 0.0f, 0.0f, multiplier * 5.0f);
63 else if (e.key.keysym.scancode == SDL_SCANCODE_Q)
64 CameraMan.moveRelative(multiplier * -0.5f, 0.0f, 0.0f);
65 else if (e.key.keysym.scancode == SDL_SCANCODE_E)
66 CameraMan.moveRelative(multiplier * 0.5f, 0.0f, 0.0f);
67 else if (e.key.keysym.sym == SDLK_INSERT)
68 CameraMan.moveRelative(0.0f, multiplier * 0.5f, 0.0f);
69 else if (e.key.keysym.sym == SDLK_DELETE)
70 CameraMan.moveRelative(0.0f, multiplier * -0.5f, 0.0f);
71 else if (e.key.keysym.sym == SDLK_PAGEUP)
72 CameraMan.turn(multiplier * 5.0f, 0.0f, 0.0f);
73 else if (e.key.keysym.sym == SDLK_PAGEDOWN)
74 CameraMan.turn(multiplier * -5.0f, 0.0f, 0.0f);
75 else if (e.key.keysym.sym == SDLK_END) {
76 const float *orient =
CameraMan.getOrientation();
78 CameraMan.setOrientation(90.0f, orient[1], orient[2]);
87 if (e.motion.state & SDL_BUTTON(2))
88 CameraMan.turn(-0.5f * e.motion.yrel, 0.0f, -0.5f * e.motion.xrel);
bool handleCameraMouseInput(const Events::Event &e)
Keyboard key was pressed.
bool handleCameraKeyboardInput(const Events::Event &e)
#define DECLARE_SINGLETON(T)
Note that you need to use this macro from the global namespace.
bool handleCameraInput(const Events::Event &e)
#define CameraMan
Shortcut for accessing the camera manager.
Engine utility class for free-roam camera handling.