/* input.cc This file is part of the Osirion project and is distributed under the terms and conditions of the GNU General Public License version 2 */ //project headers #include "input.h" #include "view.h" #include "camera.h" #include "common/functions.h" #include "game/game.h" namespace client { void Input::init() { SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); } void Input::shutdown() { } void Input::handle_keydown(SDL_keysym* keysym) { switch( keysym->sym ) { case SDLK_ESCAPE: game::shutdown(); break; case SDLK_SPACE: Camera::nextmode(); break; case SDLK_LEFT: Camera::rotate_left(); break; case SDLK_RIGHT: Camera::rotate_right(); break; case SDLK_UP: Camera::rotate_up(); break; case SDLK_DOWN: Camera::rotate_down(); break; case SDLK_KP_PLUS: game::ship.thrust_increase(); break; case SDLK_KP_MINUS: game::ship.thrust_decrease(); break; case SDLK_KP4: game::ship.turn_left(); break; case SDLK_KP6: game::ship.turn_right(); break; default: break; } } void Input::process() { SDL_Event event; while( SDL_PollEvent( &event ) ) { switch( event.type ) { // case SDL_MOUSEBUTTONUP: case SDL_KEYDOWN: handle_keydown( &event.key.keysym ); break; case SDL_QUIT: game::shutdown(); break; } } } } // namespace client