pingus-cvs
[Top][All Lists]
Advanced

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

[Pingus-CVS] r3060 - in trunk/pingus/src: . gui


From: grumbel at BerliOS
Subject: [Pingus-CVS] r3060 - in trunk/pingus/src: . gui
Date: Sun, 2 Sep 2007 06:26:03 +0200

Author: grumbel
Date: 2007-09-02 06:26:03 +0200 (Sun, 02 Sep 2007)
New Revision: 3060

Modified:
   trunk/pingus/src/SConscript
   trunk/pingus/src/client.cpp
   trunk/pingus/src/gui/gui_manager.cpp
   trunk/pingus/src/gui/gui_screen.cpp
   trunk/pingus/src/gui/screen_manager.cpp
Log:
- input2/ renamed to input/ and hooked up in the code

Modified: trunk/pingus/src/SConscript
===================================================================
--- trunk/pingus/src/SConscript 2007-09-02 03:48:52 UTC (rev 3059)
+++ trunk/pingus/src/SConscript 2007-09-02 04:26:03 UTC (rev 3060)
@@ -22,8 +22,9 @@
 
 env = Environment(# ENV = {'PKG_CONFIG_PATH' : os.getenv('PKG_CONFIG_PATH')},
                   CCFLAGS = ['-O2', '-Wall', '-Werror', '-g'],
-                  CPPDEFINES = ['ENABLE_BINRELOC'],
-                  CPPPATH = ['..', '.'])
+                  CPPDEFINES = ['ENABLE_BINRELOC', 'HAVE_CWIID'],
+                  CPPPATH = ['..', '.'],
+                  LIBS = ['cwiid']) # FIXME: Make this configurable
 
 env.ParseConfig('sdl-config  --cflags --libs')
 env['LIBS'] += ['SDL_image', 'SDL_mixer', 'png']
@@ -144,31 +145,40 @@
 'lisp/lisp.cpp',
 'lisp/parser.cpp',
 
-'input/axes/button_axis.cpp', 
-'input/axes/inverted_axis.cpp', 
-'input/axes/joystick_axis.cpp', 
-'input/axes/multiple_axis.cpp', 
-'input/axis_factory.cpp', 
-'input/button_factory.cpp', 
-'input/buttons/double_button.cpp', 
-'input/buttons/joystick_button.cpp', 
-'input/buttons/key_button.cpp', 
-'input/buttons/mouse_button.cpp', 
-'input/buttons/multiple_button.cpp', 
-'input/buttons/triple_button.cpp', 
-'input/controller.cpp', 
-'input/pointer_factory.cpp', 
-'input/pointers/axis_pointer.cpp', 
-'input/pointers/mouse_pointer.cpp', 
-'input/pointers/multiple_pointer.cpp', 
-'input/scroller_factory.cpp', 
-'input/scrollers/axis_scroller.cpp', 
-'input/scrollers/inverted_scroller.cpp', 
-'input/scrollers/joystick_scroller.cpp', 
-'input/scrollers/mouse_scroller.cpp', 
-'input/scrollers/multiple_scroller.cpp', 
-'input/scrollers/pointer_scroller.cpp', 
+'input/controller_description.cpp',
+'input/controller.cpp',
+'input/core_driver.cpp',
+'input/usbmouse_driver.cpp',
+'input/wiimote_driver.cpp',
+'input/wiimote.cpp',
+'input/sdl_driver.cpp',
+'input/manager.cpp',
 
+# 'input/axes/button_axis.cpp', 
+# 'input/axes/inverted_axis.cpp', 
+# 'input/axes/joystick_axis.cpp', 
+# 'input/axes/multiple_axis.cpp', 
+# 'input/axis_factory.cpp', 
+# 'input/button_factory.cpp', 
+# 'input/buttons/double_button.cpp', 
+# 'input/buttons/joystick_button.cpp', 
+# 'input/buttons/key_button.cpp', 
+# 'input/buttons/mouse_button.cpp', 
+# 'input/buttons/multiple_button.cpp', 
+# 'input/buttons/triple_button.cpp', 
+# 'input/controller.cpp', 
+# 'input/pointer_factory.cpp', 
+# 'input/pointers/axis_pointer.cpp', 
+# 'input/pointers/mouse_pointer.cpp', 
+# 'input/pointers/multiple_pointer.cpp', 
+# 'input/scroller_factory.cpp', 
+# 'input/scrollers/axis_scroller.cpp', 
+# 'input/scrollers/inverted_scroller.cpp', 
+# 'input/scrollers/joystick_scroller.cpp', 
+# 'input/scrollers/mouse_scroller.cpp', 
+# 'input/scrollers/multiple_scroller.cpp', 
+# 'input/scrollers/pointer_scroller.cpp', 
+
 'layer_manager.cpp', 
 'components/menu_button.cpp', 
 'mover.cpp', 

Modified: trunk/pingus/src/client.cpp
===================================================================
--- trunk/pingus/src/client.cpp 2007-09-02 03:48:52 UTC (rev 3059)
+++ trunk/pingus/src/client.cpp 2007-09-02 04:26:03 UTC (rev 3060)
@@ -127,21 +127,21 @@
 
       switch (i->type)
        {
-       case Input::ButtonEventType:
+          case Input::BUTTON_EVENT_TYPE:
           {
             const Input::ButtonEvent& ev = i->button;
 
-            if (ev.state == Input::pressed)
+            if (ev.state == Input::BUTTON_PRESSED)
               {
-                if (ev.name >= Input::action_1 && ev.name <= Input::action_10)
+                if (ev.name >= Input::ACTION_1_BUTTON && ev.name <= 
Input::ACTION_10_BUTTON)
                   {
-                    button_panel->set_button(ev.name - Input::action_1);
+                    button_panel->set_button(ev.name - Input::ACTION_1_BUTTON);
                   }
-                else if (ev.name == Input::action_down)
+                else if (ev.name == Input::ACTION_DOWN_BUTTON)
                   {
                     button_panel->next_action();
                   }
-                else if (ev.name == Input::action_up)
+                else if (ev.name == Input::ACTION_UP_BUTTON)
                   {
                     button_panel->previous_action();
                   }
@@ -149,20 +149,20 @@
           }
          break;
 
-       case Input::PointerEventType:
+       case Input::POINTER_EVENT_TYPE:
                                        // Ignore, is handled in GUIScreen
          break;
 
-       case Input::AxisEventType:
+       case Input::AXIS_EVENT_TYPE:
           // ???
          process_axis_event (i->axis);
          break;
 
-        case Input::ScrollEventType:
+        case Input::SCROLLER_EVENT_TYPE:
           process_scroll_event(i->scroll);
           break;
 
-        case Input::KeyboardEventType:
+        case Input::KEYBOARD_EVENT_TYPE:
           break;
 
        default:

Modified: trunk/pingus/src/gui/gui_manager.cpp
===================================================================
--- trunk/pingus/src/gui/gui_manager.cpp        2007-09-02 03:48:52 UTC (rev 
3059)
+++ trunk/pingus/src/gui/gui_manager.cpp        2007-09-02 04:26:03 UTC (rev 
3060)
@@ -79,26 +79,26 @@
     {
       switch (i->type)
        {
-       case Input::PointerEventType:
-          process_pointer_event (i->pointer);
-          break;
+          case Input::POINTER_EVENT_TYPE:
+            process_pointer_event (i->pointer);
+            break;
 
-       case Input::ButtonEventType:
-          process_button_event (delta.get_absolute_time(), i->button);
-          break;
+          case Input::BUTTON_EVENT_TYPE:
+            process_button_event (delta.get_absolute_time(), i->button);
+            break;
 
-       case Input::AxisEventType:
-          // AxisEvents can be ignored in the GUI, they are handled elsewhere
-          pout (PINGUS_DEBUG_GUI) << "GUIManager: AxisEvent: " << i->axis.dir 
<< std::endl;
-          break;
+          case Input::AXIS_EVENT_TYPE:
+            // AxisEvents can be ignored in the GUI, they are handled elsewhere
+            pout (PINGUS_DEBUG_GUI) << "GUIManager: AxisEvent: " << 
i->axis.dir << std::endl;
+            break;
        
-       case Input::KeyboardEventType:
-          process_keyboard_event(i->keyboard);
-          break;
+          case Input::KEYBOARD_EVENT_TYPE:
+            process_keyboard_event(i->keyboard);
+            break;
 
-       default:
-         pwarn (PINGUS_DEBUG_GUI) << "GUIManager: unhandled event type " << 
i->type << std::endl;
-         break;
+          default:
+            pwarn (PINGUS_DEBUG_GUI) << "GUIManager: unhandled event type " << 
i->type << std::endl;
+            break;
        }
     }
 }
@@ -196,7 +196,7 @@
 
   if (comp)
     {
-      if (event.name == primary && event.state == Input::pressed)
+      if (event.name == PRIMARY_BUTTON && event.state == Input::BUTTON_PRESSED)
        {
          primary_pressed_component = comp;
                change_focussed_comp(comp);
@@ -204,7 +204,7 @@
 
           // FIXME: add double click detection here
        }
-      else if (event.name == primary && event.state == Input::released)
+      else if (event.name == PRIMARY_BUTTON && event.state == 
Input::BUTTON_RELEASED)
        {
          /** Send the release event to the same component
              which got the press event */
@@ -236,13 +236,13 @@
        }
 
       // Secondary button
-      if (event.name == secondary && event.state == Input::pressed)
+      if (event.name == SECONDARY_BUTTON && event.state == 
Input::BUTTON_PRESSED)
        {
          secondary_pressed_component = comp;
                change_focussed_comp(comp);
          comp->on_secondary_button_press (x_pos, y_pos);
        }
-      else if (event.name == secondary && event.state == Input::released)
+      else if (event.name == SECONDARY_BUTTON && event.state == 
Input::BUTTON_RELEASED)
        {
          /** Send the release event to the same component
              which got the press event */

Modified: trunk/pingus/src/gui/gui_screen.cpp
===================================================================
--- trunk/pingus/src/gui/gui_screen.cpp 2007-09-02 03:48:52 UTC (rev 3059)
+++ trunk/pingus/src/gui/gui_screen.cpp 2007-09-02 04:26:03 UTC (rev 3060)
@@ -57,42 +57,42 @@
     {
       switch (i->type)
        {
-       case Input::PointerEventType:
-         {
-           // ignored cause this is handled in the gui_manager
-         }
-         break;
+          case Input::POINTER_EVENT_TYPE:
+            {
+              // ignored cause this is handled in the gui_manager
+            }
+            break;
 
-       case Input::ButtonEventType:
-         {
-           process_button_event (i->button);
-         }
-         break;
+          case Input::BUTTON_EVENT_TYPE:
+            {
+              process_button_event (i->button);
+            }
+            break;
 
-       case Input::AxisEventType:
-         {
-           if (i->axis.name == Input::action)
-             {
-               on_action_axis_move (i->axis.dir);
-             }
-         }
-         break;
+          case Input::AXIS_EVENT_TYPE:
+            {
+              if (i->axis.name == Input::ACTION_AXIS)
+                {
+                  on_action_axis_move (i->axis.dir);
+                }
+            }
+            break;
 
-       case Input::ScrollEventType:
-         {
+          case Input::SCROLLER_EVENT_TYPE:
+            {
 
-         }
-         break;
+            }
+            break;
                
-       case Input::KeyboardEventType:
-       {
+          case Input::KEYBOARD_EVENT_TYPE:
+            {
                
-       }
-       break;
+            }
+            break;
 
-       default:
-         std::cout << "GUIScreen::update (): unhandled event type: " << 
i->type << std::endl;
-         break;
+          default:
+            std::cout << "GUIScreen::update (): unhandled event type: " << 
i->type << std::endl;
+            break;
        }
     }
 }
@@ -102,26 +102,26 @@
 {
   //std::cout << "GUIScreen::process_button_event (Input::ButtonEvent* event)" 
<< std::endl;
 
-  if (event.state == Input::pressed)
+  if (event.state == Input::BUTTON_PRESSED)
     {
       switch (event.name)
        {
-       case Input::primary:
+       case Input::PRIMARY_BUTTON:
          // ignoring, handled in the gui_manager
          break;
-       case Input::secondary:
+       case Input::SECONDARY_BUTTON:
          // ignoring, handled in the gui_manager
          break;
-       case Input::pause:
+       case Input::PAUSE_BUTTON:
          on_pause_press ();
          break;
-       case Input::fast_forward:
+       case Input::FAST_FORWARD_BUTTON:
          on_fast_forward_press ();
          break;
-       case Input::armageddon:
+       case Input::ARMAGEDDON_BUTTON:
          on_armageddon_press ();
          break;
-       case Input::escape:
+       case Input::ESCAPE_BUTTON:
          on_escape_press ();
          break;
        default:
@@ -129,26 +129,26 @@
          break;
        }
     }
-  else if (event.state == Input::released)
+  else if (event.state == Input::BUTTON_RELEASED)
     {
       switch (event.name)
        {
-       case Input::primary:
+       case Input::PRIMARY_BUTTON:
          // ignoring, handled in the gui_manager
          break;
-       case Input::secondary:
+       case Input::SECONDARY_BUTTON:
          // ignoring, handled in the gui_manager
          break;
-       case Input::pause:
+       case Input::PAUSE_BUTTON:
          on_pause_release ();
          break;
-       case Input::fast_forward:
+       case Input::FAST_FORWARD_BUTTON:
          on_fast_forward_release ();
          break;
-       case Input::armageddon:
+       case Input::ARMAGEDDON_BUTTON:
          on_armageddon_release ();
          break;
-       case Input::escape:
+       case Input::ESCAPE_BUTTON:
          on_escape_release ();
          break;
        default:

Modified: trunk/pingus/src/gui/screen_manager.cpp
===================================================================
--- trunk/pingus/src/gui/screen_manager.cpp     2007-09-02 03:48:52 UTC (rev 
3059)
+++ trunk/pingus/src/gui/screen_manager.cpp     2007-09-02 04:26:03 UTC (rev 
3060)
@@ -27,8 +27,8 @@
 #include "screenshot.hpp"
 #include "../display/drawing_context.hpp"
 #include "../input/controller.hpp"
+#include "../input/manager.hpp"
 
-
 ScreenManager* ScreenManager::instance_ = 0;
 
 ScreenManager::ScreenManager()
@@ -46,15 +46,15 @@
 void
 ScreenManager::display()
 {
+  Input::Manager input_manager;
+
   Input::Controller* input_controller = 0;
 
   if (controller_file.empty())
-    input_controller = new Input::Controller("controller/default.scm");
+    input_controller = 
input_manager.create_controller("data/controller/default.scm");
   else
-    input_controller = new Input::Controller(controller_file);
+    input_controller = input_manager.create_controller(controller_file);
 
-  Input::Controller::set_current(input_controller);
-
   Cursor* cursor = 0;
   if (swcursor_enabled)
     {
@@ -68,7 +68,7 @@
   // Main loop for the menu
   while (!screens.empty())
     {
-      float time_delta = delta_manager.getset ();
+      float time_delta = delta_manager.getset();
 
       if (time_delta > 1.0)
        {
@@ -78,13 +78,11 @@
          continue;
        }
 
-      // Get new events from ClanLib
-      input_controller->update(time_delta);
+      input_manager.update(time_delta);
 
       // Fill the delta with values
       GameDelta delta(time_delta, delta_manager.get_absolute(),  
-                      input_controller->get_events());
-      input_controller->clear();
+                      input_controller->poll_events());
 
       last_screen = get_current_screen();
 





reply via email to

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