feuerkraft-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Feuerkraft-CVS] rev 311 - in trunk: . data src src/input src/scripting


From: Ingo Ruhnke
Subject: [Feuerkraft-CVS] rev 311 - in trunk: . data src src/input src/scripting
Date: Mon, 08 Dec 2003 19:56:28 +0100

Author: grumbel
Date: 2003-12-08 19:56:28 +0100 (Mon, 08 Dec 2003)
New Revision: 311

Modified:
   trunk/configure.ac
   trunk/data/feuerkraft.scm
   trunk/src/command_line_arguments.hxx
   trunk/src/input/input_manager.cxx
   trunk/src/input/input_manager_impl.hxx
   trunk/src/scripting/input_commands.cxx
   trunk/src/scripting/input_commands.hxx
Log:
- added in-game switch between keyboard and joystick controlls

Modified: trunk/configure.ac
===================================================================
--- trunk/configure.ac  2003-12-08 18:11:29 UTC (rev 310)
+++ trunk/configure.ac  2003-12-08 18:56:28 UTC (rev 311)
@@ -20,7 +20,7 @@
 dnl Check for Maintainer Mode
 dnl -------------------------
 AC_MSG_CHECKING(for maintainer mode)
-AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-maintainer-mode], [Enable 
maintainer mode]),, enable_maintainer_mode="no")
+AC_ARG_ENABLE(maintainer-mode, AC_HELP_STRING([--enable-maintainer-mode], 
[Enable maintainer mode]),, enable_maintainer_mode="no")
 
 if test "$enable_maintainer_mode" != "no"; then
     CXXFLAGS="$CXXFLAGS -g -O0 -Wall -Werror"

Modified: trunk/data/feuerkraft.scm
===================================================================
--- trunk/data/feuerkraft.scm   2003-12-08 18:11:29 UTC (rev 310)
+++ trunk/data/feuerkraft.scm   2003-12-08 18:56:28 UTC (rev 311)
@@ -369,6 +369,13 @@
 ;; Make an endless list
 (list-cdr-set! editor-insert-funcs (1- (length editor-insert-funcs)) 
editor-insert-funcs)
 
+(input-register-callback "key_f2"
+                         (lambda ()
+                           (input-use-keyboard)))
+(input-register-callback "key_f3"
+                         (lambda ()
+                           (input-use-joystick)))
+
 (input-register-callback "mouse_left"
                          (lambda ()
                            (let ((x (input-get-mouse-world-x))

Modified: trunk/src/command_line_arguments.hxx
===================================================================
--- trunk/src/command_line_arguments.hxx        2003-12-08 18:11:29 UTC (rev 
310)
+++ trunk/src/command_line_arguments.hxx        2003-12-08 18:56:28 UTC (rev 
311)
@@ -20,6 +20,7 @@
 #ifndef HEADER_FEUERKRAFT_COMMAND_LINE_ARGUMENTS_HXX
 #define HEADER_FEUERKRAFT_COMMAND_LINE_ARGUMENTS_HXX
 
+#include <argp.h>
 #include <string>
 
 /** */

Modified: trunk/src/input/input_manager.cxx
===================================================================
--- trunk/src/input/input_manager.cxx   2003-12-08 18:11:29 UTC (rev 310)
+++ trunk/src/input/input_manager.cxx   2003-12-08 18:56:28 UTC (rev 311)
@@ -34,6 +34,12 @@
 void
 InputManager::init(InputManagerImpl* arg_impl)
 {
+  if (impl)
+    {
+      delete impl;
+      impl = 0;
+    }
+
   if (arg_impl)
     { 
       impl = arg_impl;

Modified: trunk/src/input/input_manager_impl.hxx
===================================================================
--- trunk/src/input/input_manager_impl.hxx      2003-12-08 18:11:29 UTC (rev 
310)
+++ trunk/src/input/input_manager_impl.hxx      2003-12-08 18:56:28 UTC (rev 
311)
@@ -27,6 +27,7 @@
 {
 public:
   InputManagerImpl() {}
+
   virtual void update(float delta) =0;
   virtual InputEventLst get_events() =0;
   virtual Controller get_controller() =0;

Modified: trunk/src/scripting/input_commands.cxx
===================================================================
--- trunk/src/scripting/input_commands.cxx      2003-12-08 18:11:29 UTC (rev 
310)
+++ trunk/src/scripting/input_commands.cxx      2003-12-08 18:56:28 UTC (rev 
311)
@@ -22,6 +22,9 @@
 #include "../keys.hxx"
 #include "../view.hxx"
 #include "../keyboard_manager.hxx"
+#include "../input/input_manager.hxx"
+#include "../input/input_manager_joystick.hxx"
+#include "../input/input_manager_keyboard.hxx"
 #include "input_commands.hxx"
 
 void
@@ -56,4 +59,16 @@
                                                         CL_Mouse::get_y())).y;
 }
 
+void
+input_use_joystick()
+{
+  InputManager::init(new InputManagerJoystick());
+}
+
+void
+input_use_keyboard()
+{
+  InputManager::init(new InputManagerKeyboard());
+}
+
 /* EOF */

Modified: trunk/src/scripting/input_commands.hxx
===================================================================
--- trunk/src/scripting/input_commands.hxx      2003-12-08 18:11:29 UTC (rev 
310)
+++ trunk/src/scripting/input_commands.hxx      2003-12-08 18:56:28 UTC (rev 
311)
@@ -44,9 +44,14 @@
 /** Return the current mouse y position on the world */
 float input_get_mouse_world_y();
 
+/** Switch game controlls to joystick */
+void input_use_joystick();
+
+/** Switch game controlls to keyboard */
+void input_use_keyboard();
+
 //@}
 
-
 #endif
 
 /* EOF */





reply via email to

[Prev in Thread] Current Thread [Next in Thread]