pingus-cvs
[Top][All Lists]
Advanced

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

[Pingus-CVS] r3055 - in trunk/pingus/src: . input


From: grumbel at BerliOS
Subject: [Pingus-CVS] r3055 - in trunk/pingus/src: . input
Date: Sun, 2 Sep 2007 02:15:20 +0200

Author: grumbel
Date: 2007-09-02 02:15:17 +0200 (Sun, 02 Sep 2007)
New Revision: 3055

Removed:
   trunk/pingus/src/input_event.hpp
Modified:
   trunk/pingus/src/file_reader.cpp
   trunk/pingus/src/file_reader.hpp
   trunk/pingus/src/input/controller.hpp
   trunk/pingus/src/input/event.hpp
   trunk/pingus/src/pingus.hpp
   trunk/pingus/src/pingus_main.cpp
   trunk/pingus/src/string_util.hpp
   trunk/pingus/src/system.cpp
Log:
- some minor cleanup

Modified: trunk/pingus/src/file_reader.cpp
===================================================================
--- trunk/pingus/src/file_reader.cpp    2007-09-02 00:13:11 UTC (rev 3054)
+++ trunk/pingus/src/file_reader.cpp    2007-09-02 00:15:17 UTC (rev 3055)
@@ -150,6 +150,12 @@
     return std::vector<FileReader>();
 }
 
+int
+FileReader::get_num_sections() const
+{
+  return int(impl->get_sections().size());
+}
+
 FileReader
 FileReader::read_section(const char* name)   const
 {

Modified: trunk/pingus/src/file_reader.hpp
===================================================================
--- trunk/pingus/src/file_reader.hpp    2007-09-02 00:13:11 UTC (rev 3054)
+++ trunk/pingus/src/file_reader.hpp    2007-09-02 00:15:17 UTC (rev 3055)
@@ -70,7 +70,8 @@
   }
 
   std::vector<std::string> get_section_names() const;
-  std::vector<FileReader> get_sections() const;
+  std::vector<FileReader>  get_sections() const;
+  int  get_num_sections() const;
 
   static FileReader parse(const std::string& filename);
 private:

Modified: trunk/pingus/src/input/controller.hpp
===================================================================
--- trunk/pingus/src/input/controller.hpp       2007-09-02 00:13:11 UTC (rev 
3054)
+++ trunk/pingus/src/input/controller.hpp       2007-09-02 00:15:17 UTC (rev 
3055)
@@ -51,15 +51,13 @@
   float std_pointer_x;
   float std_pointer_y;
 
-  ////  std::vector<CL_Slot> slots;
-
 public:
   Controller(const std::string& configfile);
   ~Controller();
 
   std::vector<Event>& get_events() { return events; }
        
-  const Pointer * get_pointer() const { return standard_pointer; }
+  const Pointer * get_pointer() const  { return standard_pointer; }
   const Scroller* get_scroller() const { return scroller; }
 
   /// returns the requested Buttons::Button or 0 if it doesn't exist (e.g. 
undefined action Buttons::Button)
@@ -68,6 +66,9 @@
   void update(float delta);
   void clear();
 
+  Controller(const Controller&);
+  Controller& operator= (const Controller&);
+
   static void set_current(Controller* controller) { current_controller = 
controller; }
   static Controller* get_current() { return current_controller; }
 
@@ -80,7 +81,6 @@
   static void on_button_down(void*);
   static void on_button_up(void*);
   void create_action_buttons(FileReader reader);
-  ////void key_pressed(const CL_InputEvent &event);
 
   struct key_callback_info {
     key_callback_func callback;
@@ -93,9 +93,6 @@
     void *userdata;
   };
   static std::vector<mouse_callback_info> mouse_callbacks;
-
-  Controller(const Controller&);
-  Controller& operator= (const Controller&);
 };
 
 } // namespace Input

Modified: trunk/pingus/src/input/event.hpp
===================================================================
--- trunk/pingus/src/input/event.hpp    2007-09-02 00:13:11 UTC (rev 3054)
+++ trunk/pingus/src/input/event.hpp    2007-09-02 00:15:17 UTC (rev 3055)
@@ -25,13 +25,14 @@
 #include "../pingus.hpp"
 
 namespace Input {
-
+
 enum EventType { ButtonEventType, PointerEventType, AxisEventType, 
ScrollEventType, KeyboardEventType };
 
 enum ButtonName { primary, secondary, pause, fast_forward, armageddon, escape, 
action_1, action_2,
                   action_3, action_4, action_5, action_6, action_7, action_8, 
action_9, action_10,
                   action_up, action_down, max_button };
 
+
 enum State { pressed, released };
 
 struct ButtonEvent
@@ -39,7 +40,7 @@
   ButtonName name;
   State      state;
 };
-
+
 enum PointerName { standard };
 
 struct PointerEvent
@@ -48,7 +49,7 @@
   float x;
   float y;
 };
-
+
 enum AxisName  { action };
 
 struct AxisEvent
@@ -56,18 +57,18 @@
   float     dir;
   AxisName  name;
 };
-
+
 struct ScrollEvent
 {
   float x_delta;
   float y_delta;
 };
-
+
 struct KeyboardEvent
 {
   unsigned short key;
 };
-
+
 struct Event
 {
   EventType type;
@@ -82,7 +83,7 @@
 };
 
 typedef std::vector<Event> EventLst;
-
+
 inline Event makeButtonEvent(ButtonName name, State state)
 {
   Event event;
@@ -137,7 +138,7 @@
        
   return event;
 }
-
+
 } // namespace Input
 
 #endif

Deleted: trunk/pingus/src/input_event.hpp
===================================================================
--- trunk/pingus/src/input_event.hpp    2007-09-02 00:13:11 UTC (rev 3054)
+++ trunk/pingus/src/input_event.hpp    2007-09-02 00:15:17 UTC (rev 3055)
@@ -1,84 +0,0 @@
-//  $Id$
-//
-//  Pingus - A free Lemmings clone
-//  Copyright (C) 2000 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_PINGUS_INPUT_EVENT_HXX
-#define HEADER_PINGUS_INPUT_EVENT_HXX
-
-#error "Don't used this the moment, its underdevelopment and not compilable"
-
-#include "pingus.hpp"
-#include "vector.hpp"
-
-
-/** This will need some^H^H^H^H a lot of work */
-typedef enum {
-  /** Pointer Events (pos contains the move-delta) */
-  MOUSE_MOVE,
-
-  /** The scroll controll has been move, in theory this could be a
-      second mouse, an second analog stick or a combination of button
-      press and cursor movement */
-  SCROLL_MOVE,
-
-  /** The button that turns the MOUSE_MOVE into a SCROLL_MOVE */
-  SCROLL_MODIFIER,
-
-  /*** Generic button events (pos contains position) */
-  PRIMARY_BUTTON_PRESSED,
-  SECONDARY_BUTTON_PRESSED,
-
-  /** Escape is pressed */
-  ESCAPE_TRIGGERED,
-
-  /** 'p' or 'Pause' got pressed */
-  PAUSE_PRESSED,
-  FASTFORWARD_TRIGGERED,
-
-  /** Buttons for switching to the next/previous Action */
-  ACTION_UP,
-  ACTION_DOWN,
-
-  /** Action selected, Most likly one of the F1-F?? buttons is
-      pressed, this could also be a combination of shift-button or
-      something else */
-  ACTION_SELECTED
-
-} InputEventType;
-
-
-class InputEvent
-{
-public:
-  /** Position or movement */
-  Vector pos;
-
-  /** integer data */
-  int data;
-
-  /** The type of event */
-  EventType type;
-
-  /** The 'owner' or player of this event */
-  int owner;
-};
-
-
-#endif
-
-/* EOF */

Modified: trunk/pingus/src/pingus.hpp
===================================================================
--- trunk/pingus/src/pingus.hpp 2007-09-02 00:13:11 UTC (rev 3054)
+++ trunk/pingus/src/pingus.hpp 2007-09-02 00:15:17 UTC (rev 3055)
@@ -18,6 +18,7 @@
 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
 #include <config.h>
+
 #ifndef HEADER_PINGUS_PINGUS_HXX
 #define HEADER_PINGUS_PINGUS_HXX
 

Modified: trunk/pingus/src/pingus_main.cpp
===================================================================
--- trunk/pingus/src/pingus_main.cpp    2007-09-02 00:13:11 UTC (rev 3054)
+++ trunk/pingus/src/pingus_main.cpp    2007-09-02 00:15:17 UTC (rev 3055)
@@ -372,7 +372,7 @@
                     << std::endl;
             
           std::cout << "\n"
-            "Copyright (C) 2003 Ingo Ruhnke <address@hidden>\n"
+            "Copyright (C) 2003 Ingo Ruhnke <address@hidden>, see AUTHORS for 
a complete list\n"
             "There is NO warranty.  You may redistribute this software\n"
             "under the terms of the GNU General Public License.\n"
             "For more information about these matters, see the files named 
COPYING." << std::endl;

Modified: trunk/pingus/src/string_util.hpp
===================================================================
--- trunk/pingus/src/string_util.hpp    2007-09-02 00:13:11 UTC (rev 3054)
+++ trunk/pingus/src/string_util.hpp    2007-09-02 00:15:17 UTC (rev 3055)
@@ -65,6 +65,14 @@
     return str.str();
   }
 
+  static bool has_suffix(const std::string& str, const std::string& suffix)
+  {
+    if (str.length() >= suffix.length())
+      return str.compare(str.length() - suffix.length(), suffix.length(), 
suffix) == 0;
+    else
+      return false;
+  }
+
 private:
   StringUtil ();
   StringUtil (const StringUtil&);

Modified: trunk/pingus/src/system.cpp
===================================================================
--- trunk/pingus/src/system.cpp 2007-09-02 00:13:11 UTC (rev 3054)
+++ trunk/pingus/src/system.cpp 2007-09-02 00:15:17 UTC (rev 3055)
@@ -318,7 +318,7 @@
     }
   else
     {
-      throw PingusError(_("Environment variable $HOME not set, fix that and 
start again."));
+      throw PingusError("Environment variable $HOME not set, fix that and 
start again.");
     }
 #endif
 }





reply via email to

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