feuerkraft-cvs
[Top][All Lists]
Advanced

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

[Feuerkraft-CVS] rev 310 - trunk/src/input


From: Ingo Ruhnke
Subject: [Feuerkraft-CVS] rev 310 - trunk/src/input
Date: Mon, 08 Dec 2003 19:11:30 +0100

Author: grumbel
Date: 2003-12-08 19:11:29 +0100 (Mon, 08 Dec 2003)
New Revision: 310

Added:
   trunk/src/input/input_manager_joystick.cxx
   trunk/src/input/input_manager_joystick.hxx
Removed:
   trunk/src/input/input_manager_clanlib.cxx
   trunk/src/input/input_manager_clanlib.hxx
Modified:
   trunk/src/input/Makefile.am
   trunk/src/input/input_manager.cxx
Log:
- renamed input_manager_clanlib to input_manager_joystick

Modified: trunk/src/input/Makefile.am
===================================================================
--- trunk/src/input/Makefile.am 2003-12-07 20:54:11 UTC (rev 309)
+++ trunk/src/input/Makefile.am 2003-12-08 18:11:29 UTC (rev 310)
@@ -7,8 +7,8 @@
   input_manager.hxx \
   input_manager.cxx \
   input_manager_impl.hxx \
-  input_manager_clanlib.hxx \
-  input_manager_clanlib.cxx \
+  input_manager_joystick.hxx \
+  input_manager_joystick.cxx \
   input_manager_keyboard.hxx \
   input_manager_keyboard.cxx
 

Modified: trunk/src/input/input_manager.cxx
===================================================================
--- trunk/src/input/input_manager.cxx   2003-12-07 20:54:11 UTC (rev 309)
+++ trunk/src/input/input_manager.cxx   2003-12-08 18:11:29 UTC (rev 310)
@@ -23,7 +23,7 @@
 #include <sstream>
 #include <ClanLib/Display/joystick.h>
 #include "../command_line_arguments.hxx"
-#include "input_manager_clanlib.hxx"
+#include "input_manager_joystick.hxx"
 #include "input_manager_keyboard.hxx"
 #include "input_manager_impl.hxx"
 #include "input_manager.hxx"
@@ -43,7 +43,7 @@
       if (args->joystick < CL_Joystick::get_device_count())
         {
           std::cout << "InputManager: Using joystick " << args->joystick << 
std::endl;
-          impl = new InputManagerClanLib();
+          impl = new InputManagerJoystick();
         }
       else
         {

Deleted: trunk/src/input/input_manager_clanlib.cxx
===================================================================
--- trunk/src/input/input_manager_clanlib.cxx   2003-12-07 20:54:11 UTC (rev 
309)
+++ trunk/src/input/input_manager_clanlib.cxx   2003-12-08 18:11:29 UTC (rev 
310)
@@ -1,145 +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_clanlib.hxx"
-
-InputManagerClanLib::InputManagerClanLib()
-{
-  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, &InputManagerClanLib::on_axis_move);
-  slots.connect(dev.sig_key_down(), this, 
&InputManagerClanLib::on_button_down);
-  slots.connect(dev.sig_key_up(),   this, &InputManagerClanLib::on_button_up);
-}
-
-InputManagerClanLib::~InputManagerClanLib()
-{
-}
-
-void
-InputManagerClanLib::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
-InputManagerClanLib::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
-InputManagerClanLib::on_button_up(const CL_InputEvent& event)
-{
-}
-
-void
-InputManagerClanLib::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
-InputManagerClanLib::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
-InputManagerClanLib::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));
-}
-
-InputEventLst
-InputManagerClanLib::get_events()
-{
-  InputEventLst old_events = events;
-  return old_events;
-}
-
-Controller
-InputManagerClanLib::get_controller()
-{
-  controller.events = events;
-  return controller;
-}
-
-void
-InputManagerClanLib::clear()
-{
-  events.clear();
-}
-
-/* EOF */

Deleted: trunk/src/input/input_manager_clanlib.hxx
===================================================================
--- trunk/src/input/input_manager_clanlib.hxx   2003-12-07 20:54:11 UTC (rev 
309)
+++ trunk/src/input/input_manager_clanlib.hxx   2003-12-08 18:11:29 UTC (rev 
310)
@@ -1,64 +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_CLANLIB_HXX
-#define HEADER_INPUT_MANAGER_CLANLIB_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 InputManagerClanLib : public InputManagerImpl
-{
-private:
-  CL_InputDevice dev;
-
-  Controller controller;
-  InputEventLst events;
-
-  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:
-  InputManagerClanLib();
-  virtual ~InputManagerClanLib();
-
-  void update(float delta);
-  InputEventLst get_events();
-  Controller get_controller();
-  void clear();
-private:
-  InputManagerClanLib (const InputManagerClanLib&);
-  InputManagerClanLib& operator= (const InputManagerClanLib&);
-};
-
-#endif
-
-/* EOF */

Copied: trunk/src/input/input_manager_joystick.cxx (from rev 306, 
trunk/src/input/input_manager_clanlib.cxx)
===================================================================
--- trunk/src/input/input_manager_clanlib.cxx   2003-12-07 19:54:13 UTC (rev 
306)
+++ trunk/src/input/input_manager_joystick.cxx  2003-12-08 18:11:29 UTC (rev 
310)
@@ -0,0 +1,145 @@
+//  $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));
+}
+
+InputEventLst
+InputManagerJoystick::get_events()
+{
+  InputEventLst old_events = events;
+  return old_events;
+}
+
+Controller
+InputManagerJoystick::get_controller()
+{
+  controller.events = events;
+  return controller;
+}
+
+void
+InputManagerJoystick::clear()
+{
+  events.clear();
+}
+
+/* EOF */

Copied: trunk/src/input/input_manager_joystick.hxx (from rev 306, 
trunk/src/input/input_manager_clanlib.hxx)
===================================================================
--- trunk/src/input/input_manager_clanlib.hxx   2003-12-07 19:54:13 UTC (rev 
306)
+++ trunk/src/input/input_manager_joystick.hxx  2003-12-08 18:11:29 UTC (rev 
310)
@@ -0,0 +1,64 @@
+//  $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;
+
+  Controller controller;
+  InputEventLst events;
+
+  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);
+  InputEventLst get_events();
+  Controller get_controller();
+  void clear();
+private:
+  InputManagerJoystick (const InputManagerJoystick&);
+  InputManagerJoystick& operator= (const InputManagerJoystick&);
+};
+
+#endif
+
+/* EOF */





reply via email to

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