pingus-cvs
[Top][All Lists]
Advanced

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

[Pingus-CVS] r3731 - in trunk/pingus: data/data data/images/core/menu sr


From: grumbel at BerliOS
Subject: [Pingus-CVS] r3731 - in trunk/pingus: data/data data/images/core/menu src src/editor src/gui src/screen
Date: Tue, 8 Jul 2008 06:43:21 +0200

Author: grumbel
Date: 2008-07-08 06:42:55 +0200 (Tue, 08 Jul 2008)
New Revision: 3731

Added:
   trunk/pingus/data/images/core/menu/blackboard.png
   trunk/pingus/data/images/core/menu/wood.png
Modified:
   trunk/pingus/data/data/core.res
   trunk/pingus/src/editor/editor_screen.cpp
   trunk/pingus/src/editor/editor_screen.hpp
   trunk/pingus/src/game_session.cpp
   trunk/pingus/src/gui/surface_button.cpp
   trunk/pingus/src/gui/surface_button.hpp
   trunk/pingus/src/screen/gui_screen.cpp
   trunk/pingus/src/screen/gui_screen.hpp
   trunk/pingus/src/start_screen.cpp
   trunk/pingus/src/start_screen.hpp
Log:
Implemented some better resize for the StartScreen and changed some resize 
behaviour in the progress

Modified: trunk/pingus/data/data/core.res
===================================================================
--- trunk/pingus/data/data/core.res     2008-07-08 04:41:41 UTC (rev 3730)
+++ trunk/pingus/data/data/core.res     2008-07-08 04:42:55 UTC (rev 3731)
@@ -477,6 +477,16 @@
                     (image-file "../images/core/menu/down_arrow.png"))
 
                    (sprite
+                    (name "wood")
+                    (image-file "../images/core/menu/wood.png"))
+
+                   (sprite
+                    (name "blackboard")
+                    (origin "center")
+                    (offset 0 0)
+                    (image-file "../images/core/menu/blackboard.png"))
+
+                   (sprite
                     (name "startscreenbg")
                     (origin "center")
                     (offset 0 0)

Added: trunk/pingus/data/images/core/menu/blackboard.png
===================================================================
(Binary files differ)


Property changes on: trunk/pingus/data/images/core/menu/blackboard.png
___________________________________________________________________
Name: svn:mime-type
   + image/png

Added: trunk/pingus/data/images/core/menu/wood.png
===================================================================
(Binary files differ)


Property changes on: trunk/pingus/data/images/core/menu/wood.png
___________________________________________________________________
Name: svn:mime-type
   + image/png

Modified: trunk/pingus/src/editor/editor_screen.cpp
===================================================================
--- trunk/pingus/src/editor/editor_screen.cpp   2008-07-08 04:41:41 UTC (rev 
3730)
+++ trunk/pingus/src/editor/editor_screen.cpp   2008-07-08 04:42:55 UTC (rev 
3731)
@@ -503,13 +503,6 @@
   file_save_dialog->set_rect(Rect(Vector2i(50, 50), Size(size.width  - 100, 
                                                          size.height - 100)));
 }
-
-void
-EditorScreen::resize(const Size& size)
-{
-  gui_manager->set_rect(Rect(Vector2i(0, 0), size));
-  update_layout();
-}
 
 } // namespace Editor 
 

Modified: trunk/pingus/src/editor/editor_screen.hpp
===================================================================
--- trunk/pingus/src/editor/editor_screen.hpp   2008-07-08 04:41:41 UTC (rev 
3730)
+++ trunk/pingus/src/editor/editor_screen.hpp   2008-07-08 04:42:55 UTC (rev 
3731)
@@ -138,9 +138,8 @@
 
   void exit();
 
-  void resize(const Size&);
-
   void update_layout();
+
 private:
   EditorScreen (const EditorScreen&);
   EditorScreen& operator= (const EditorScreen&);

Modified: trunk/pingus/src/game_session.cpp
===================================================================
--- trunk/pingus/src/game_session.cpp   2008-07-08 04:41:41 UTC (rev 3730)
+++ trunk/pingus/src/game_session.cpp   2008-07-08 04:42:55 UTC (rev 3731)
@@ -375,6 +375,8 @@
 void
 GameSession::resize(const Size& size)
 {
+  GUIScreen::resize(size);
+
   std::cout << "ReSize: " << size.width << ", " << size.height << std::endl;
 
   int world_width  = server->get_world()->get_width();

Modified: trunk/pingus/src/gui/surface_button.cpp
===================================================================
--- trunk/pingus/src/gui/surface_button.cpp     2008-07-08 04:41:41 UTC (rev 
3730)
+++ trunk/pingus/src/gui/surface_button.cpp     2008-07-08 04:42:55 UTC (rev 
3731)
@@ -97,6 +97,13 @@
   UNUSED_ARG(y);
 }
 
+void
+SurfaceButton::set_pos(int x, int y)
+{
+  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-08 04:41:41 UTC (rev 
3730)
+++ trunk/pingus/src/gui/surface_button.hpp     2008-07-08 04:42:55 UTC (rev 
3731)
@@ -46,6 +46,8 @@
                  const ResDescriptor& button_mouse_over_surface);
   virtual ~SurfaceButton ();
 
+  virtual void set_pos(int x, int y);
+
   virtual void draw (DrawingContext& gc);
   virtual bool is_at (int x, int y);
 

Modified: trunk/pingus/src/screen/gui_screen.cpp
===================================================================
--- trunk/pingus/src/screen/gui_screen.cpp      2008-07-08 04:41:41 UTC (rev 
3730)
+++ trunk/pingus/src/screen/gui_screen.cpp      2008-07-08 04:42:55 UTC (rev 
3731)
@@ -159,5 +159,10 @@
     }
 }
 
+void
+GUIScreen::resize(const Size& size) 
+{
+  gui_manager->set_rect(Rect(Vector2i(0, 0), size));
+}
 
 /* EOF */

Modified: trunk/pingus/src/screen/gui_screen.hpp
===================================================================
--- trunk/pingus/src/screen/gui_screen.hpp      2008-07-08 04:41:41 UTC (rev 
3730)
+++ trunk/pingus/src/screen/gui_screen.hpp      2008-07-08 04:42:55 UTC (rev 
3731)
@@ -56,6 +56,8 @@
 
   virtual void on_action_axis_move (float) {}
 
+  virtual void resize(const Size& size);
+
 private:
   void process_button_event (const Input::ButtonEvent& event);
 

Modified: trunk/pingus/src/start_screen.cpp
===================================================================
--- trunk/pingus/src/start_screen.cpp   2008-07-08 04:41:41 UTC (rev 3730)
+++ trunk/pingus/src/start_screen.cpp   2008-07-08 04:42:55 UTC (rev 3731)
@@ -39,6 +39,7 @@
 private:
   PingusLevel plf;
   Sprite background;
+  Sprite blackboard;
   std::string time_str;
   std::string description;
 
@@ -95,6 +96,7 @@
 {
 private:
   StartScreen* parent;
+
 public:
   StartScreenAbortButton(StartScreen* p)
     : GUI::SurfaceButton(Display::get_width()/2 - 300,
@@ -123,31 +125,36 @@
 };
 
 StartScreenComponent::StartScreenComponent(const PingusLevel& p)
-  : plf(p)
+  : plf(p),
+    background("core/menu/wood"),
+    blackboard("core/menu/blackboard")
 {
-  background = Sprite("core/menu/startscreenbg");
-  background.scale(Display::get_width(), Display::get_height());
   time_str = GameTime::ticks_to_realtime_string(plf.get_time());
 }
 
 void
 StartScreenComponent::draw(DrawingContext& gc)
 {
-  gc.draw(background, Display::get_width()/2.f, Display::get_height()/2.f);
+  // Paint the background wood panel
+  for(int y = 0; y < gc.get_height(); y += background.get_height())
+    for(int x = 0; x < gc.get_width(); x += background.get_width())
+      gc.draw(background, x, y);
 
-  int left_x  = Display::get_width()/2 - 150;
-  int right_x = Display::get_width()/2 + 150;
-  int y = Display::get_height()/2 + 40;
+  gc.draw(blackboard, gc.get_width()/2, gc.get_height()/2);
 
+  int left_x  = gc.get_width()/2 - 150;
+  int right_x = gc.get_width()/2 + 150;
+  int y = gc.get_height()/2 + 40;
+
   gc.print_center(Fonts::chalk_large,
-                  gc.get_width()/2,
-                  Display::get_height()/2 - 200,
+                  gc.get_width() /2,
+                  gc.get_height()/2 - 230,
                   _(plf.get_levelname()));
 
   gc.print_left(Fonts::chalk_normal,
-                Display::get_width()/2 - 290,
-                Display::get_height()/2 - 150,
-                format_description(800 - 230));
+                gc.get_width() /2 - 290,
+                gc.get_height()/2 - 170,
+                format_description(800 - 200));
 
   y += 32;
   y += 30;
@@ -164,8 +171,10 @@
   //gc.print_left (Fonts::chalk_normal, left_x,  (y += 30), _("Difficulty:"));
   //gc.print_right(Fonts::chalk_normal, right_x, y, 
StringUtil::to_string(plf.get_difficulty()) + "/100");
 
-  gc.print_center(Fonts::chalk_small, Display::get_width()/2,
-                  Display::get_height()/2 + 270, _("Author: ") + 
plf.get_author());
+  gc.print_center(Fonts::chalk_small, 
+                  gc.get_width()/2,
+                  gc.get_height()/2 + 215,
+                  _("Author: ") + plf.get_author());
 
   if (maintainer_mode)
     gc.print_left(Fonts::chalk_small, 110, 430, _("Filename: ") + 
plf.get_resname());
@@ -231,5 +240,17 @@
 {
   ScreenManager::instance()->pop_screen();
 }
+
+void
+StartScreen::update_layout()
+{
+  std::cout << gui_manager->get_rect() << std::endl;
+  //: GUI::SurfaceButton(Display::get_width()/2 - 300,
+  //Display::get_height()/2 + 144,
+
+
+  //: GUI::SurfaceButton(Display::get_width()/2 + 225,
+  //Display::get_height()/2 + 125,
+}
 
 /* EOF */

Modified: trunk/pingus/src/start_screen.hpp
===================================================================
--- trunk/pingus/src/start_screen.hpp   2008-07-08 04:41:41 UTC (rev 3730)
+++ trunk/pingus/src/start_screen.hpp   2008-07-08 04:42:55 UTC (rev 3731)
@@ -19,8 +19,7 @@
 
 #include "pingus_level.hpp"
 #include "screen/gui_screen.hpp"
-
-
+
 /** */
 class StartScreen : public GUIScreen
 {
@@ -38,13 +37,13 @@
   void on_fast_forward_press();
   void on_escape_press();
 
-private:
+  void update_layout();
 
+private:
   StartScreen (const StartScreen&);
   StartScreen& operator= (const StartScreen&);
 };
-
-
+
 #endif
 
 /* EOF */





reply via email to

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