pingus-cvs
[Top][All Lists]
Advanced

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

[Pingus-CVS] r3065 - in trunk/pingus/src: gui input worldmap


From: grumbel at BerliOS
Subject: [Pingus-CVS] r3065 - in trunk/pingus/src: gui input worldmap
Date: Sun, 2 Sep 2007 18:09:13 +0200

Author: grumbel
Date: 2007-09-02 18:09:13 +0200 (Sun, 02 Sep 2007)
New Revision: 3065

Modified:
   trunk/pingus/src/gui/cursor.cpp
   trunk/pingus/src/input/controller.cpp
   trunk/pingus/src/input/controller.hpp
   trunk/pingus/src/input/manager.cpp
   trunk/pingus/src/input/sdl_driver.cpp
   trunk/pingus/src/worldmap/level_dot.cpp
Log:
- fixed leveldot names and cursor that got broken in the input/ -> input2/ move

Modified: trunk/pingus/src/gui/cursor.cpp
===================================================================
--- trunk/pingus/src/gui/cursor.cpp     2007-09-02 06:00:36 UTC (rev 3064)
+++ trunk/pingus/src/gui/cursor.cpp     2007-09-02 16:09:13 UTC (rev 3065)
@@ -17,12 +17,11 @@
 //  along with this program; if not, write to the Free Software
 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
-//#include "../input/controller.hpp"
-//#include "../input/pointer.hpp"
+#include "../input/controller.hpp"
+#include "../input/control.hpp"
 #include "../resource.hpp"
 #include "cursor.hpp"
 
-
 Cursor::Cursor(const std::string& ident)
   : sprite(Resource::load_sprite(ident))
 {
@@ -41,10 +40,8 @@
 void
 Cursor::on_event()
 {
-  // FIXME: This should use the input framework
-  int x,y;
-  SDL_GetMouseState(&x, &y);
-  sprite.draw((float)x, (float)y, Display::get_screen());
+  Vector2f pos = 
Input::Controller::current()->get_pointer(Input::STANDARD_POINTER)->get_pos();
+  sprite.draw(pos.x, pos.y, Display::get_screen());
 }
 
 

Modified: trunk/pingus/src/input/controller.cpp
===================================================================
--- trunk/pingus/src/input/controller.cpp       2007-09-02 06:00:36 UTC (rev 
3064)
+++ trunk/pingus/src/input/controller.cpp       2007-09-02 16:09:13 UTC (rev 
3065)
@@ -29,8 +29,18 @@
 
 namespace Input {
 
+Controller* Controller::current_ = 0;
+
+Controller* 
+Controller::current()
+{
+  return current_;
+}
+
 Controller::Controller(const ControllerDescription& desc)
 {
+  current_ = this; 
+
   const std::vector<int>& button_lst = desc.get_buttons();
   for(std::vector<int>::const_iterator i = button_lst.begin(); i != 
button_lst.end(); ++i)
     {

Modified: trunk/pingus/src/input/controller.hpp
===================================================================
--- trunk/pingus/src/input/controller.hpp       2007-09-02 06:00:36 UTC (rev 
3064)
+++ trunk/pingus/src/input/controller.hpp       2007-09-02 16:09:13 UTC (rev 
3065)
@@ -34,7 +34,13 @@
 
 class Controller
 {
+
 private:
+  static Controller* current_;
+public:
+  static Controller* current();
+
+private:
   // State Stuff
   std::vector<ControllerButton*>   buttons;
   std::vector<ControllerAxis*>     axes;

Modified: trunk/pingus/src/input/manager.cpp
===================================================================
--- trunk/pingus/src/input/manager.cpp  2007-09-02 06:00:36 UTC (rev 3064)
+++ trunk/pingus/src/input/manager.cpp  2007-09-02 16:09:13 UTC (rev 3065)
@@ -59,24 +59,11 @@
   desc.add_button("action-10-button",    ACTION_10_BUTTON);
 }
 
-std::string get_non_driver_part(const std::string& fullname)
+static std::string get_driver_part(const std::string& fullname)
 {
   std::string::size_type i = fullname.find_first_of(':');
   if (i != std::string::npos)
     {
-      return fullname.substr(i+1);
-    }
-  else
-    {
-      return fullname;
-    }
-}
-
-std::string get_driver_part(const std::string& fullname)
-{
-  std::string::size_type i = fullname.find_first_of(':');
-  if (i != std::string::npos)
-    {
       return fullname.substr(0, i);
     }
   else
@@ -84,7 +71,7 @@
       return "core";
     }
 }
-
+
 Controller*
 Manager::create_controller(const std::string& filename)
 {
@@ -246,7 +233,7 @@
       return 0;
     }
 }
-
+
 Axis*
 Manager::create_axis(const FileReader& reader, Control* parent)
 {
@@ -263,7 +250,7 @@
       return 0;
     }
 }
-
+
 Pointer*
 Manager::create_pointer(const FileReader& reader, Control* parent)
 {
@@ -280,7 +267,7 @@
       return 0;
     }
 }
-
+
 Scroller*
 Manager::create_scroller(const FileReader& reader, Control* parent)
 {

Modified: trunk/pingus/src/input/sdl_driver.cpp
===================================================================
--- trunk/pingus/src/input/sdl_driver.cpp       2007-09-02 06:00:36 UTC (rev 
3064)
+++ trunk/pingus/src/input/sdl_driver.cpp       2007-09-02 16:09:13 UTC (rev 
3065)
@@ -31,7 +31,7 @@
     string2key[key_name] = static_cast<SDLKey>(i);
     
     // FIXME: Make the keynames somewhere user visible so that users can use 
them
-    // std::cout << key_name << std::endl;
+    // std::cout << "Key: '" << key_name << "'" << std::endl;
   }
 }
 

Modified: trunk/pingus/src/worldmap/level_dot.cpp
===================================================================
--- trunk/pingus/src/worldmap/level_dot.cpp     2007-09-02 06:00:36 UTC (rev 
3064)
+++ trunk/pingus/src/worldmap/level_dot.cpp     2007-09-02 16:09:13 UTC (rev 
3065)
@@ -32,6 +32,8 @@
 #include "../plf_res_mgr.hpp"
 #include "../savegame_manager.hpp"
 #include "../file_reader.hpp"
+#include "input/controller.hpp"
+#include "input/control.hpp"
 #include "level_dot.hpp"
 
 namespace WorldMapNS {
@@ -54,9 +56,8 @@
 void
 LevelDot::draw(DrawingContext& gc)
 {
-  Vector3f mpos; // FIXME: get the controller coordinates from somewhere
-  //= 
gc.screen_to_world(Vector3f(Input::Controller::get_current()->get_pointer()->get_x_pos(),
-  //Input::Controller::get_current()->get_pointer()->get_y_pos()));
+  Vector3f mpos
+    = 
gc.screen_to_world(Vector3f(Input::Controller::current()->get_pointer(Input::STANDARD_POINTER)->get_pos()));
 
   float x = mpos.x - pos.x;
   float y = mpos.y - pos.y;





reply via email to

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