Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2008-02-05 22:23:15 +0000
committerStijn Buys <ingar@osirion.org>2008-02-05 22:23:15 +0000
commit1ed2e8eb1f1909a35f6fc8d5d6065bcac37c27ea (patch)
treebb1007c12c205b265c1e7515cdc7924496e19cf3 /src/client/input.cc
parenta51deebd87036ceb87c77a20117977d077b771e3 (diff)
keyboard handling, cvar fixes
Diffstat (limited to 'src/client/input.cc')
-rw-r--r--src/client/input.cc40
1 files changed, 11 insertions, 29 deletions
diff --git a/src/client/input.cc b/src/client/input.cc
index 9bcf4fe..b7c02af 100644
--- a/src/client/input.cc
+++ b/src/client/input.cc
@@ -32,26 +32,14 @@ void shutdown()
con_print << "Shutting down input..." << std::endl;
}
-/*
-see
-http://docs.mandragor.org/files/Common_libs_documentation/SDL/SDL_Documentation_project_en/sdlevent.html
-*/
-// handle key_release events for the game world
-void handle_keyreleased(SDL_keysym* keysym)
+
+// handle pressed keys for the game world
+void keypressed(const SDL_keysym &keysym)
{
- switch( keysym->sym ) {
+ switch( keysym.sym) {
case SDLK_SPACE:
camera::nextmode();
break;
- default:
- break;
- }
-}
-
-// handle pressed keys for the game world
-void handle_keypressed(SDL_keysym* keysym)
-{
- switch( keysym->sym ) {
case SDLK_LEFT:
camera::rotate_left();
break;
@@ -94,27 +82,21 @@ void frame(float seconds)
switch( event.type ) {
case SDL_KEYDOWN:
- /*
- if (event.key.keysym.sym == SDLK_ESCAPE) {
+ /*if (event.key.keysym.sym == SDLK_ESCAPE) {
client::application.shutdown();
- }
- */
- if (console::visible()) {
+ } else */
+ if (event.key.keysym.sym == '`' || event.key.keysym.sym == '~') {
+ console::toggle();
+ } else if (console::visible()) {
// send key events to the console
- console::handle_keypressed( &event.key.keysym );
+ console::keypressed(event.key.keysym );
} else if (core::connected()) {
// send key events to the game world
- handle_keypressed( &event.key.keysym );
+ keypressed(event.key.keysym );
}
break;
case SDL_KEYUP:
- if (event.key.keysym.sym == '`' || event.key.keysym.sym == '~') {
- console::toggle();
- } else if (!console::visible() && core::connected()) {
- // send key events to the game world
- handle_keyreleased( &event.key.keysym );
- }
break;
case SDL_QUIT: