feuerkraft-cvs
[Top][All Lists]
Advanced

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

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


From: Ingo Ruhnke
Subject: [Feuerkraft-CVS] rev 318 - in trunk: data src/input src/scripting
Date: Tue, 09 Dec 2003 22:36:21 +0100

Author: grumbel
Date: 2003-12-09 22:36:20 +0100 (Tue, 09 Dec 2003)
New Revision: 318

Removed:
   trunk/src/input/input_manager_joystick.cxx
   trunk/src/input/input_manager_joystick.hxx
   trunk/src/input/input_manager_keyboard.cxx
   trunk/src/input/input_manager_keyboard.hxx
Modified:
   trunk/data/feuerkraft.scm
   trunk/src/input/Makefile.am
   trunk/src/input/input_manager.cxx
   trunk/src/scripting/input_commands.cxx
   trunk/src/scripting/input_commands.hxx
Log:
- removed obsolete hardcoded inputmanager code

Modified: trunk/data/feuerkraft.scm
===================================================================
--- trunk/data/feuerkraft.scm   2003-12-09 21:31:01 UTC (rev 317)
+++ trunk/data/feuerkraft.scm   2003-12-09 21:36:20 UTC (rev 318)
@@ -369,17 +369,6 @@
 ;; Make an endless list
 (list-cdr-set! editor-insert-funcs (1- (length editor-insert-funcs)) 
editor-insert-funcs)
 
-(input-register-callback "key_f2"
-                         (lambda ()
-                           (clanlib-set-post-keep-alive-func (lambda ()
-                                                               (display 
"Updating to keyboard\n")
-                                                               
(input-use-keyboard)))))
-(input-register-callback "key_f3"
-                         (lambda ()
-                           (clanlib-set-post-keep-alive-func (lambda ()
-                                                               (display 
"Updating to joystick\n")
-                                                               
(input-use-joystick)))))
-
 (input-register-callback "mouse_left"
                          (lambda ()
                            (let ((x (input-get-mouse-world-x))

Modified: trunk/src/input/Makefile.am
===================================================================
--- trunk/src/input/Makefile.am 2003-12-09 21:31:01 UTC (rev 317)
+++ trunk/src/input/Makefile.am 2003-12-09 21:36:20 UTC (rev 318)
@@ -10,10 +10,6 @@
   input_manager_impl.cxx \
   input_manager_custom.hxx \
   input_manager_custom.cxx \
-  input_manager_joystick.hxx \
-  input_manager_joystick.cxx \
-  input_manager_keyboard.hxx \
-  input_manager_keyboard.cxx \
   input_button.hxx \
   input_axis.hxx \
   input_button_input_device.hxx \

Modified: trunk/src/input/input_manager.cxx
===================================================================
--- trunk/src/input/input_manager.cxx   2003-12-09 21:31:01 UTC (rev 317)
+++ trunk/src/input/input_manager.cxx   2003-12-09 21:36:20 UTC (rev 318)
@@ -23,8 +23,6 @@
 #include <sstream>
 #include <ClanLib/Display/joystick.h>
 #include "../command_line_arguments.hxx"
-#include "input_manager_joystick.hxx"
-#include "input_manager_keyboard.hxx"
 #include "input_manager_custom.hxx"
 #include "input_manager_impl.hxx"
 #include "input_manager.hxx"

Deleted: trunk/src/input/input_manager_joystick.cxx
===================================================================
--- trunk/src/input/input_manager_joystick.cxx  2003-12-09 21:31:01 UTC (rev 
317)
+++ trunk/src/input/input_manager_joystick.cxx  2003-12-09 21:36:20 UTC (rev 
318)
@@ -1,125 +0,0 @@
-//  $Id: input_manager_clanlib.cxx,v 1.10 2003/10/31 23:24:41 grumbel Exp $
-//
-//  Pingus - A free Lemmings clone
-//  Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-//  This program is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU General Public License
-//  as published by the Free Software Foundation; either version 2
-//  of the License, or (at your option) any later version.
-//
-//  This program is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-//  GNU General Public License for more details.
-//
-//  You should have received a copy of the GNU General Public License
-//  along with this program; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-#include <iostream>
-#include <stdexcept>
-#include <ClanLib/Display/keyboard.h>
-#include <ClanLib/Display/joystick.h>
-#include <ClanLib/Display/display_iostream.h>
-#include <ClanLib/Display/keys.h>
-#include <ClanLib/Display/input_event.h>
-#include "input_manager_joystick.hxx"
-
-InputManagerJoystick::InputManagerJoystick()
-{
-  if (CL_Joystick::get_device_count() == 1)
-    {
-      dev = CL_Joystick::get_device(0);
-    }
-  else if (CL_Joystick::get_device_count() >= 2)
-    {
-      // FIXME: Hack for localhost...
-      dev = CL_Joystick::get_device(1);
-    }
-  else
-    {
-      throw std::runtime_error("Feuerkraft: No joystick found");
-    }
-  
-  slots.connect(dev.sig_axis_move(),this, &InputManagerJoystick::on_axis_move);
-  slots.connect(dev.sig_key_down(), this, 
&InputManagerJoystick::on_button_down);
-  slots.connect(dev.sig_key_up(),   this, &InputManagerJoystick::on_button_up);
-}
-
-InputManagerJoystick::~InputManagerJoystick()
-{
-}
-
-void
-InputManagerJoystick::on_axis_move(const CL_InputEvent& event)
-{
-  //std::cout << "Axis: " << event.id << " " << event.axis_pos << std::endl;
-  if (event.id == 0)
-    add_axis_event(ORIENTATION_AXIS, event.axis_pos); 
-  else if (event.id == 1)
-    add_axis_event(ACCELERATE_AXIS, event.axis_pos); 
-  else if (event.id == 2)
-    add_axis_event(STRAFE_AXIS, event.axis_pos); 
-}
-
-void
-InputManagerJoystick::on_button_down(const CL_InputEvent& event)
-{
-  switch (event.id)
-    {
-    case 9:
-      add_button_event(PRIMARY_FIRE_BUTTON, true);
-      break;
-    case 8:
-      add_button_event(SECONDARY_FIRE_BUTTON, true);
-      break;
-    case 3:
-      add_button_event(USE_BUTTON, true);
-      break;
-    }
-}
-
-void
-InputManagerJoystick::on_button_up(const CL_InputEvent& event)
-{
-}
-
-void
-InputManagerJoystick::add_axis_event(AxisName name, float pos)
-{
-  InputEvent event;
-  event.type = AXIS_EVENT;
-  event.axis.name = name;
-  event.axis.pos  = pos;
-  events.push_back(event);
-}
-
-void
-InputManagerJoystick::add_button_event(ButtonName name, bool down)
-{
-  InputEvent event;
-  event.type = BUTTON_EVENT;
-  event.button.name = name;
-  event.button.down = down;
-  events.push_back(event);
-}
-
-void
-InputManagerJoystick::update(float delta)
-{
-  CL_InputDevice dev = CL_Joystick::get_device(1);
-
-  controller.set_axis_state(ORIENTATION_AXIS, dev.get_axis(0));
-  controller.set_axis_state(ACCELERATE_AXIS,  dev.get_axis(1));
-  controller.set_axis_state(STRAFE_AXIS,      dev.get_axis(2));
-
-  controller.set_button_state(PRIMARY_FIRE_BUTTON, 
-                              dev.get_keycode(9));
-  controller.set_button_state(SECONDARY_FIRE_BUTTON, 
-                              dev.get_keycode(8));
-  controller.set_button_state(USE_BUTTON, 
-                              dev.get_keycode(3));
-}
-
-/* EOF */

Deleted: trunk/src/input/input_manager_joystick.hxx
===================================================================
--- trunk/src/input/input_manager_joystick.hxx  2003-12-09 21:31:01 UTC (rev 
317)
+++ trunk/src/input/input_manager_joystick.hxx  2003-12-09 21:36:20 UTC (rev 
318)
@@ -1,59 +0,0 @@
-//  $Id: input_manager_clanlib.hxx,v 1.5 2003/10/31 23:24:41 grumbel Exp $
-// 
-//  Pingus - A free Lemmings clone
-//  Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-//  This program is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU General Public License
-//  as published by the Free Software Foundation; either version 2
-//  of the License, or (at your option) any later version.
-//
-//  This program is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-//  GNU General Public License for more details.
-// 
-//  You should have received a copy of the GNU General Public License
-//  along with this program; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-#ifndef HEADER_INPUT_MANAGER_JOYSTICK_HXX
-#define HEADER_INPUT_MANAGER_JOYSTICK_HXX
-
-#include <ClanLib/Signals/slot.h>
-#include <ClanLib/Signals/slot_container.h>
-#include <ClanLib/Display/input_device.h>
-#include "controller.hxx"
-#include "input_manager_impl.hxx"
-
-class CL_InputEvent;
-
-/** */
-class InputManagerJoystick : public InputManagerImpl
-{
-private:
-  CL_InputDevice dev;
-
-  CL_SlotContainer slots;
-  
-  void on_axis_move(const CL_InputEvent& event);
-  void on_button_down(const CL_InputEvent& event);
-  void on_button_up(const CL_InputEvent& event);
-
-  void add_axis_event(AxisName name, float pos);
-  void add_button_event(ButtonName name, bool down);
-
-public:
-  InputManagerJoystick();
-  virtual ~InputManagerJoystick();
-
-  void update(float delta);
-
-private:
-  InputManagerJoystick (const InputManagerJoystick&);
-  InputManagerJoystick& operator= (const InputManagerJoystick&);
-};
-
-#endif
-
-/* EOF */

Deleted: trunk/src/input/input_manager_keyboard.cxx
===================================================================
--- trunk/src/input/input_manager_keyboard.cxx  2003-12-09 21:31:01 UTC (rev 
317)
+++ trunk/src/input/input_manager_keyboard.cxx  2003-12-09 21:36:20 UTC (rev 
318)
@@ -1,150 +0,0 @@
-//  $Id: input_manager_clanlib.cxx,v 1.10 2003/10/31 23:24:41 grumbel Exp $
-//
-//  Pingus - A free Lemmings clone
-//  Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-//  This program is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU General Public License
-//  as published by the Free Software Foundation; either version 2
-//  of the License, or (at your option) any later version.
-//
-//  This program is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-//  GNU General Public License for more details.
-//
-//  You should have received a copy of the GNU General Public License
-//  along with this program; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-#include <iostream>
-#include <ClanLib/Display/keyboard.h>
-#include <ClanLib/Display/joystick.h>
-#include <ClanLib/Display/display_iostream.h>
-#include <ClanLib/Display/keys.h>
-#include <ClanLib/Display/input_event.h>
-#include "input_manager_keyboard.hxx"
-
-InputManagerKeyboard::InputManagerKeyboard()
-{
-  slots.connect(CL_Keyboard::sig_key_down(), this, 
&InputManagerKeyboard::on_key_event);
-  slots.connect(CL_Keyboard::sig_key_up(),   this, 
&InputManagerKeyboard::on_key_event);
-}
-
-InputManagerKeyboard::~InputManagerKeyboard()
-{
-}
-
-void
-InputManagerKeyboard::on_key_event(const CL_InputEvent& event)
-{
-  switch (event.type)
-    {
-    case CL_InputEvent::released:
-      break;
-
-    case CL_InputEvent::pressed:
-      switch (event.id)
-        {
-          // Steering
-        case CL_KEY_DOWN:
-          add_axis_event(ACCELERATE_AXIS, 1.0f);
-          break;
-        case CL_KEY_UP:
-          add_axis_event(ACCELERATE_AXIS, -1.0f);
-          break;
-        case CL_KEY_RIGHT:
-          add_axis_event(ORIENTATION_AXIS, 1.0f);
-          break;
-        case CL_KEY_LEFT:
-          add_axis_event(ORIENTATION_AXIS, -1.0f);
-          break;
-
-        case CL_KEY_O:
-          add_axis_event(STRAFE_AXIS, -1.0f);
-          break;
-        case CL_KEY_U:
-          add_axis_event(STRAFE_AXIS, 1.0f);
-          break;
-
-        case CL_KEY_E:
-          add_button_event(PRIMARY_FIRE_BUTTON, true);
-          break;
-        default:
-          std::cout << "Unknown keypress: " << event << std::endl;
-          break;
-        }
-      break;
-
-    default:
-      break;
-    }
-}
-
-void
-InputManagerKeyboard::add_axis_event(AxisName name, float pos)
-{
-  InputEvent event;
-  event.type = AXIS_EVENT;
-  event.axis.name = name;
-  event.axis.pos  = pos;
-  events.push_back(event);
-}
-
-void
-InputManagerKeyboard::add_button_event(ButtonName name, bool down)
-{
-  InputEvent event;
-  event.type = BUTTON_EVENT;
-  event.button.name = name;
-  event.button.down = down;
-  events.push_back(event);
-}
-
-void
-InputManagerKeyboard::update(float delta)
-{
-  if (CL_Keyboard::get_keycode(CL_KEY_LEFT))
-    {
-      if (CL_Keyboard::get_keycode(CL_KEY_RIGHT))
-        controller.set_axis_state(ORIENTATION_AXIS, 0);
-      else
-        controller.set_axis_state(ORIENTATION_AXIS, -1.0);
-    }
-  else if (CL_Keyboard::get_keycode(CL_KEY_RIGHT))
-    {
-      controller.set_axis_state(ORIENTATION_AXIS, 1.0);
-    }
-  else
-    {
-      controller.set_axis_state(ORIENTATION_AXIS, 0);
-    }
-
-  if (CL_Keyboard::get_keycode(CL_KEY_UP))
-    {
-      if (CL_Keyboard::get_keycode(CL_KEY_DOWN))
-        controller.set_axis_state(ACCELERATE_AXIS, 0);
-      else
-        controller.set_axis_state(ACCELERATE_AXIS, -1.0);
-    }
-  else if (CL_Keyboard::get_keycode(CL_KEY_DOWN))
-    {
-      controller.set_axis_state(ACCELERATE_AXIS, 1.0);
-    }
-  else
-    {
-      controller.set_axis_state(ACCELERATE_AXIS, 0);
-    }
-
-  if (CL_Keyboard::get_keycode(CL_KEY_O) && 
!CL_Keyboard::get_keycode(CL_KEY_U))
-    controller.set_axis_state(STRAFE_AXIS, -1.0f);
-  else if (CL_Keyboard::get_keycode(CL_KEY_U) && 
!CL_Keyboard::get_keycode(CL_KEY_O))
-    controller.set_axis_state(STRAFE_AXIS, 1.0f);
-  else
-    controller.set_axis_state(STRAFE_AXIS, 0.0f);
-
-  controller.set_button_state(PRIMARY_FIRE_BUTTON, 
-                              CL_Keyboard::get_keycode(CL_KEY_E));
-}
-
-/* EOF */

Deleted: trunk/src/input/input_manager_keyboard.hxx
===================================================================
--- trunk/src/input/input_manager_keyboard.hxx  2003-12-09 21:31:01 UTC (rev 
317)
+++ trunk/src/input/input_manager_keyboard.hxx  2003-12-09 21:36:20 UTC (rev 
318)
@@ -1,53 +0,0 @@
-//  $Id: input_manager_clanlib.hxx,v 1.5 2003/10/31 23:24:41 grumbel Exp $
-// 
-//  Pingus - A free Lemmings clone
-//  Copyright (C) 2002 Ingo Ruhnke <address@hidden>
-//
-//  This program is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU General Public License
-//  as published by the Free Software Foundation; either version 2
-//  of the License, or (at your option) any later version.
-//
-//  This program is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-//  GNU General Public License for more details.
-// 
-//  You should have received a copy of the GNU General Public License
-//  along with this program; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-#ifndef HEADER_INPUT_MANAGER_KEYBOARD_HXX
-#define HEADER_INPUT_MANAGER_KEYBOARD_HXX
-
-#include <ClanLib/Signals/slot.h>
-#include <ClanLib/Signals/slot_container.h>
-#include "controller.hxx"
-#include "input_manager_impl.hxx"
-
-class CL_InputEvent;
-
-/** */
-class InputManagerKeyboard : public InputManagerImpl
-{
-private:
-  CL_SlotContainer slots;
-  
-  void on_key_event(const CL_InputEvent& event);
-
-  void add_axis_event(AxisName name, float pos);
-  void add_button_event(ButtonName name, bool down);
-
-public:
-  InputManagerKeyboard();
-  virtual ~InputManagerKeyboard();
-
-  void update(float delta);
-private:
-  InputManagerKeyboard (const InputManagerKeyboard&);
-  InputManagerKeyboard& operator= (const InputManagerKeyboard&);
-};
-
-#endif
-
-/* EOF */

Modified: trunk/src/scripting/input_commands.cxx
===================================================================
--- trunk/src/scripting/input_commands.cxx      2003-12-09 21:31:01 UTC (rev 
317)
+++ trunk/src/scripting/input_commands.cxx      2003-12-09 21:36:20 UTC (rev 
318)
@@ -23,8 +23,6 @@
 #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
@@ -59,16 +57,4 @@
                                                         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-09 21:31:01 UTC (rev 
317)
+++ trunk/src/scripting/input_commands.hxx      2003-12-09 21:36:20 UTC (rev 
318)
@@ -44,12 +44,6 @@
 /** 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





reply via email to

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