pingus-cvs
[Top][All Lists]
Advanced

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

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


From: grumbel at BerliOS
Subject: [Pingus-CVS] r3752 - in trunk/pingus/src: . gui worldmap
Date: Wed, 9 Jul 2008 05:01:09 +0200

Author: grumbel
Date: 2008-07-09 05:01:05 +0200 (Wed, 09 Jul 2008)
New Revision: 3752

Modified:
   trunk/pingus/src/credits.cpp
   trunk/pingus/src/gui/surface_button.cpp
   trunk/pingus/src/gui/surface_button.hpp
   trunk/pingus/src/level_menu.cpp
   trunk/pingus/src/res_descriptor.cpp
   trunk/pingus/src/res_descriptor.hpp
   trunk/pingus/src/result_screen.cpp
   trunk/pingus/src/start_screen.cpp
   trunk/pingus/src/story_screen.cpp
   trunk/pingus/src/worldmap/worldmap_screen.cpp
Log:
Removed some unneeded calls to ResDescriptor

Modified: trunk/pingus/src/credits.cpp
===================================================================
--- trunk/pingus/src/credits.cpp        2008-07-09 02:08:28 UTC (rev 3751)
+++ trunk/pingus/src/credits.cpp        2008-07-09 03:01:05 UTC (rev 3752)
@@ -37,9 +37,9 @@
   CreditsOkButton(Credits* p)
     : GUI::SurfaceButton(Display::get_width()/2 + 225,
                          Display::get_height()/2 + 125,
-                         ResDescriptor("core/start/ok"),
-                         ResDescriptor("core/start/ok_clicked"),
-                         ResDescriptor("core/start/ok_hover")),
+                         "core/start/ok",
+                         "core/start/ok_clicked",
+                         "core/start/ok_hover"),
       parent(p)
   {
   }

Modified: trunk/pingus/src/gui/surface_button.cpp
===================================================================
--- trunk/pingus/src/gui/surface_button.cpp     2008-07-09 02:08:28 UTC (rev 
3751)
+++ trunk/pingus/src/gui/surface_button.cpp     2008-07-09 03:01:05 UTC (rev 
3752)
@@ -19,13 +19,12 @@
 #include "../display/drawing_context.hpp"
 #include "surface_button.hpp"
 
-
 namespace GUI {
-
+
 SurfaceButton::SurfaceButton (int arg_x_pos, int arg_y_pos,
-                             const ResDescriptor& arg_button_surface,
-                             const ResDescriptor& arg_button_pressed_surface,
-                             const ResDescriptor& 
arg_button_mouse_over_surface)
+                             const std::string& arg_button_surface,
+                             const std::string& arg_button_pressed_surface,
+                             const std::string& arg_button_mouse_over_surface)
   : x_pos (arg_x_pos), y_pos (arg_y_pos), pressed (false), mouse_over (false)
 {
   button_surface            = Sprite(arg_button_surface);
@@ -103,7 +102,7 @@
   x_pos = x;
   y_pos = y;
 }
-
+
 } // namespace GUI
 
 /* EOF */

Modified: trunk/pingus/src/gui/surface_button.hpp
===================================================================
--- trunk/pingus/src/gui/surface_button.hpp     2008-07-09 02:08:28 UTC (rev 
3751)
+++ trunk/pingus/src/gui/surface_button.hpp     2008-07-09 03:01:05 UTC (rev 
3752)
@@ -20,10 +20,8 @@
 #include "../sprite.hpp"
 #include "component.hpp"
 
-class ResDescriptor;
-
 namespace GUI {
-
+
 /** A simple surface button, which different surfaces for pressed,
     released and mouse over */
 class SurfaceButton : public Component
@@ -41,9 +39,9 @@
 
 public:
   SurfaceButton (int x_pos, int y_pos,
-                 const ResDescriptor& button_surface,
-                 const ResDescriptor& button_pressed_surface,
-                 const ResDescriptor& button_mouse_over_surface);
+                 const std::string& button_surface,
+                 const std::string& button_pressed_surface,
+                 const std::string& button_mouse_over_surface);
   virtual ~SurfaceButton ();
 
   virtual void set_pos(int x, int y);
@@ -59,11 +57,12 @@
   virtual void on_pointer_leave ();
 
   virtual void on_click() {}
+
 private:
   SurfaceButton (const SurfaceButton&);
   SurfaceButton& operator= (const SurfaceButton&);
 };
-
+
 } // namespace GUI
 
 #endif

Modified: trunk/pingus/src/level_menu.cpp
===================================================================
--- trunk/pingus/src/level_menu.cpp     2008-07-09 02:08:28 UTC (rev 3751)
+++ trunk/pingus/src/level_menu.cpp     2008-07-09 03:01:05 UTC (rev 3752)
@@ -43,9 +43,9 @@
 public:
   LevelMenuAbortButton(LevelMenu* p, int x, int y)
     : GUI::SurfaceButton(x, y,
-                         ResDescriptor("core/start/back"),
-                         ResDescriptor("core/start/back_clicked"),
-                         ResDescriptor("core/start/back_hover")),
+                         "core/start/back",
+                         "core/start/back_clicked",
+                         "core/start/back_hover"),
       parent(p)
   {
   }
@@ -75,9 +75,9 @@
 public:
   LevelScrollButton(int x, int y, const std::string& str, boost::function<void 
(void)> callback_)
     : GUI::SurfaceButton(x, y,
-                         ResDescriptor(str),
-                         ResDescriptor(str + "_pressed"),
-                         ResDescriptor(str + "_hover")),
+                         str,
+                         str + "_pressed",
+                         str + "_hover"),
       callback(callback_)
   {
   }

Modified: trunk/pingus/src/res_descriptor.cpp
===================================================================
--- trunk/pingus/src/res_descriptor.cpp 2008-07-09 02:08:28 UTC (rev 3751)
+++ trunk/pingus/src/res_descriptor.cpp 2008-07-09 03:01:05 UTC (rev 3752)
@@ -28,16 +28,21 @@
 */
 
 ResDescriptor::ResDescriptor()
+  : modifier(ResourceModifierNS::ROT0)
 {
-  res_name = "";
-  modifier = ResourceModifierNS::ROT0;
 }
 
+ResDescriptor::ResDescriptor(const std::string& res_name_)
+  : res_name(res_name_),
+    modifier(ResourceModifierNS::ROT0)
+{
+}
+
 ResDescriptor::ResDescriptor(const std::string& arg_res_name,
                             ResourceModifierNS::ResourceModifier arg_modifier)
+  : res_name(arg_res_name),
+    modifier(arg_modifier)
 {
-  res_name = arg_res_name;
-  modifier = arg_modifier;
 }
 
 bool

Modified: trunk/pingus/src/res_descriptor.hpp
===================================================================
--- trunk/pingus/src/res_descriptor.hpp 2008-07-09 02:08:28 UTC (rev 3751)
+++ trunk/pingus/src/res_descriptor.hpp 2008-07-09 03:01:05 UTC (rev 3752)
@@ -29,8 +29,9 @@
   ResourceModifierNS::ResourceModifier modifier;
 
   ResDescriptor ();
+  ResDescriptor (const std::string& res_name);
   ResDescriptor (const std::string& res_name, 
-                ResourceModifierNS::ResourceModifier modifier = 
ResourceModifierNS::ROT0);
+                ResourceModifierNS::ResourceModifier modifier);
 
   bool operator< (const ResDescriptor&) const;
 };

Modified: trunk/pingus/src/result_screen.cpp
===================================================================
--- trunk/pingus/src/result_screen.cpp  2008-07-09 02:08:28 UTC (rev 3751)
+++ trunk/pingus/src/result_screen.cpp  2008-07-09 03:01:05 UTC (rev 3752)
@@ -52,9 +52,9 @@
 public:
   ResultScreenOkButton(ResultScreen* p, int x, int y)
     : GUI::SurfaceButton(x, y,
-                         ResDescriptor("core/start/ok"),
-                         ResDescriptor("core/start/ok_clicked"),
-                         ResDescriptor("core/start/ok_hover")),
+                         "core/start/ok",
+                         "core/start/ok_clicked",
+                         "core/start/ok_hover"),
       parent(p)
   {
   }
@@ -79,9 +79,9 @@
 public:
   ResultScreenAbortButton(ResultScreen* p, int x, int y)
     : GUI::SurfaceButton(x, y,
-                         ResDescriptor("core/start/back"),
-                         ResDescriptor("core/start/back_clicked"),
-                         ResDescriptor("core/start/back_hover")),
+                         "core/start/back",
+                         "core/start/back_clicked",
+                         "core/start/back_hover"),
       parent(p)
   {
   }
@@ -110,9 +110,9 @@
 public:
   ResultScreenRetryButton(ResultScreen* p, int x, int y)
     : GUI::SurfaceButton(x, y,
-                         ResDescriptor("core/start/ok"),
-                         ResDescriptor("core/start/ok_clicked"),
-                         ResDescriptor("core/start/ok_hover")),
+                         "core/start/ok",
+                         "core/start/ok_clicked",
+                         "core/start/ok_hover"),
       parent(p)
   {
   }
@@ -233,9 +233,6 @@
 ResultScreen::ResultScreen(Result arg_result)
   : result(arg_result)
 {
-  ResDescriptor ok_desc("core/result/ok");
-  ResDescriptor cancel_desc("core/result/retry");
-
   ResultScreenComponent* comp = new ResultScreenComponent(result);
   gui_manager->add(comp);
 

Modified: trunk/pingus/src/start_screen.cpp
===================================================================
--- trunk/pingus/src/start_screen.cpp   2008-07-09 02:08:28 UTC (rev 3751)
+++ trunk/pingus/src/start_screen.cpp   2008-07-09 03:01:05 UTC (rev 3752)
@@ -60,9 +60,9 @@
   StartScreenOkButton(StartScreen* p)
     : GUI::SurfaceButton(Display::get_width()/2 + 225,
                          Display::get_height()/2 + 125,
-                         ResDescriptor("core/start/ok"),
-                         ResDescriptor("core/start/ok_clicked"),
-                         ResDescriptor("core/start/ok_hover")),
+                         "core/start/ok",
+                         "core/start/ok_clicked",
+                         "core/start/ok_hover"),
       parent(p)
   {
   }
@@ -101,9 +101,9 @@
   StartScreenAbortButton(StartScreen* p)
     : GUI::SurfaceButton(Display::get_width()/2 - 300,
                          Display::get_height()/2 + 144,
-                         ResDescriptor("core/start/back"),
-                         ResDescriptor("core/start/back_clicked"),
-                         ResDescriptor("core/start/back_hover")),
+                         "core/start/back",
+                         "core/start/back_clicked",
+                         "core/start/back_hover"),
       parent(p)
   {
   }

Modified: trunk/pingus/src/story_screen.cpp
===================================================================
--- trunk/pingus/src/story_screen.cpp   2008-07-09 02:08:28 UTC (rev 3751)
+++ trunk/pingus/src/story_screen.cpp   2008-07-09 03:01:05 UTC (rev 3752)
@@ -70,9 +70,9 @@
 public:
   StoryScreenContinueButton(StoryScreenComponent* arg_story_comp, int x, int y)
     : GUI::SurfaceButton(x, y,
-                         ResDescriptor("core/misc/next"),
-                         ResDescriptor("core/misc/next"),
-                         ResDescriptor("core/misc/next_hover")),
+                         "core/misc/next",
+                         "core/misc/next",
+                         "core/misc/next_hover"),
       story_comp(arg_story_comp)
   {
   }
@@ -91,12 +91,11 @@
 
 class StoryScreenSkipButton : public GUI::SurfaceButton
 {
-private:
+private: 
   StoryScreenComponent* story_comp;
 public:
   StoryScreenSkipButton(StoryScreenComponent* arg_story_comp, int x, int y)
-    : GUI::SurfaceButton(x, y,
-                         ResDescriptor(), ResDescriptor(), ResDescriptor()),
+    : GUI::SurfaceButton(x, y, "", "", ""), // FIXME: Little fugly way to do a 
text button
       story_comp(arg_story_comp)
   {
   }

Modified: trunk/pingus/src/worldmap/worldmap_screen.cpp
===================================================================
--- trunk/pingus/src/worldmap/worldmap_screen.cpp       2008-07-09 02:08:28 UTC 
(rev 3751)
+++ trunk/pingus/src/worldmap/worldmap_screen.cpp       2008-07-09 03:01:05 UTC 
(rev 3752)
@@ -86,9 +86,9 @@
 
 WorldmapScreenCreditsButton::WorldmapScreenCreditsButton(WorldmapScreen* 
worldmap_screen)
   : GUI::SurfaceButton(Display::get_width() - 150, 0,
-                       ResDescriptor("core/worldmap/credits_button_normal"),
-                       ResDescriptor("core/worldmap/credits_button_pressed"),
-                       ResDescriptor("core/worldmap/credits_button_hover")),
+                       "core/worldmap/credits_button_normal",
+                       "core/worldmap/credits_button_pressed",
+                       "core/worldmap/credits_button_hover"),
     worldmap_screen(worldmap_screen)
 {
 }
@@ -115,9 +115,9 @@
 
 WorldmapScreenStoryButton::WorldmapScreenStoryButton(WorldmapScreen* 
worldmap_screen)
   : GUI::SurfaceButton(0, 0,
-                       ResDescriptor("core/worldmap/story_button_normal"),
-                       ResDescriptor("core/worldmap/story_button_pressed"),
-                       ResDescriptor("core/worldmap/story_button_hover")),
+                       "core/worldmap/story_button_normal",
+                       "core/worldmap/story_button_pressed",
+                       "core/worldmap/story_button_hover"),
     worldmap_screen(worldmap_screen)
 {
 }
@@ -144,9 +144,9 @@
 
 WorldmapScreenCloseButton::WorldmapScreenCloseButton(WorldmapScreen* 
worldmap_screen)
   : GUI::SurfaceButton(0, Display::get_height() - 37,
-                       ResDescriptor("core/worldmap/leave_button_normal"),
-                       ResDescriptor("core/worldmap/leave_button_pressed"),
-                       ResDescriptor("core/worldmap/leave_button_hover")),
+                       "core/worldmap/leave_button_normal",
+                       "core/worldmap/leave_button_pressed",
+                       "core/worldmap/leave_button_hover"),
     worldmap_screen(worldmap_screen)
 {
 }
@@ -173,9 +173,9 @@
 
 WorldmapScreenEnterButton::WorldmapScreenEnterButton(WorldmapScreen* 
worldmap_screen)
   : GUI::SurfaceButton(Display::get_width() - 119, Display::get_height() - 37,
-                       ResDescriptor("core/worldmap/enter_button_normal"),
-                       ResDescriptor("core/worldmap/enter_button_pressed"),
-                       ResDescriptor("core/worldmap/enter_button_hover")),
+                       "core/worldmap/enter_button_normal",
+                       "core/worldmap/enter_button_pressed",
+                       "core/worldmap/enter_button_hover"),
     worldmap_screen(worldmap_screen)
 {
 }





reply via email to

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