pingus-cvs
[Top][All Lists]
Advanced

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

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


From: grumbel at BerliOS
Subject: [Pingus-CVS] r3309 - in trunk/pingus: data/data data/images/core/menu src src/components
Date: Tue, 23 Oct 2007 07:22:37 +0200

Author: grumbel
Date: 2007-10-23 07:22:35 +0200 (Tue, 23 Oct 2007)
New Revision: 3309

Added:
   trunk/pingus/data/images/core/menu/menuitem.png
Modified:
   trunk/pingus/data/data/core.res
   trunk/pingus/src/components/menu_button.cpp
   trunk/pingus/src/components/menu_button.hpp
   trunk/pingus/src/pingus_menu.cpp
   trunk/pingus/src/pingus_menu.hpp
Log:
- added new main menu

Modified: trunk/pingus/data/data/core.res
===================================================================
--- trunk/pingus/data/data/core.res     2007-10-23 04:35:54 UTC (rev 3308)
+++ trunk/pingus/data/data/core.res     2007-10-23 05:22:35 UTC (rev 3309)
@@ -343,6 +343,11 @@
 
           (section (name "menu")
                    (sprite
+                    (name "menuitem")
+                    (origin "center")
+                    (image-file "../images/core/menu/menuitem.png"))
+
+                   (sprite
                     (name "marker")
                     (image-file "../images/core/menu/marker.png"))
 

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


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

Modified: trunk/pingus/src/components/menu_button.cpp
===================================================================
--- trunk/pingus/src/components/menu_button.cpp 2007-10-23 04:35:54 UTC (rev 
3308)
+++ trunk/pingus/src/components/menu_button.cpp 2007-10-23 05:22:35 UTC (rev 
3309)
@@ -28,20 +28,20 @@
 
 
 MenuButton::MenuButton(PingusMenu* menu_,
-                       const Vector2i& pos_, const Sprite& sprite_, 
+                       const Vector2i& pos_,
                        const std::string& text_, const std::string& desc_)
   : menu(menu_)
 {
+  surface_p = Resource::load_sprite("core/menu/menuitem");
+
   text = text_;
   desc  = desc_;
 
   x_pos = pos_.x;
   y_pos = pos_.y;
 
-  surface_p = sprite_;
-  
   font       = Fonts::pingus_small;
-  font_large = Fonts::pingus_large;
+  font_large = Fonts::chalk_large;
 
   mouse_over = false;
   pressed    = false;
@@ -76,32 +76,20 @@
 void
 MenuButton::draw (DrawingContext& gc)
 {
-  if (mouse_over && !pressed)
+  if (mouse_over) // pressed
     {
-      gc.draw(surface_p, Vector2i(x_pos - surface_p.get_width()/2,
-                                  y_pos - surface_p.get_height()/2));
-
-      gc.print_center(font_large, x_pos + 32,
-                      y_pos - 32 - font_large.get_height()/2,
-                      text);
+      gc.draw(surface_p,Vector3f(x_pos, y_pos));
+      gc.print_center(font_large, x_pos, y_pos - 28, text);
+      // poor mans bold formating
+      gc.print_center(font_large, x_pos-1, y_pos - 28 - 1, text);
+      gc.print_center(font_large, x_pos+1, y_pos - 28 + 1, text);
+      gc.print_center(font_large, x_pos+1, y_pos - 28 - 1, text);
+      gc.print_center(font_large, x_pos-1, y_pos - 28 + 1, text);
     }
-  else if (mouse_over && pressed)
-    {
-      float shrink = 0.9f;
-      gc.draw(surface_p,
-              Vector3f(x_pos - surface_p.get_width()/2 * shrink,
-                       y_pos - surface_p.get_height()/2 * shrink));
-
-      gc.print_center(font_large,
-                      x_pos + 32,
-                      y_pos - 32 - font_large.get_height()/2,
-                      text);
-    }
   else
     {
-      gc.draw(surface_p,
-              Vector2i(x_pos - surface_p.get_width()/2,
-                       y_pos - surface_p.get_height()/2));
+      gc.draw(surface_p, Vector2i(x_pos, y_pos));
+      gc.print_center(font_large, x_pos, y_pos - 28, text);
     }
   UNUSED_ARG(gc);
 }

Modified: trunk/pingus/src/components/menu_button.hpp
===================================================================
--- trunk/pingus/src/components/menu_button.hpp 2007-10-23 04:35:54 UTC (rev 
3308)
+++ trunk/pingus/src/components/menu_button.hpp 2007-10-23 05:22:35 UTC (rev 
3309)
@@ -47,10 +47,8 @@
   bool mouse_over;
   bool pressed;
 
-  ////CL_Signal_v0 click;
-
 public:
-  MenuButton(PingusMenu* menu, const Vector2i& pos, const Sprite& sprite, 
+  MenuButton(PingusMenu* menu, const Vector2i& pos, 
              const std::string& text, const std::string& desc);
   MenuButton();
   virtual ~MenuButton();
@@ -68,7 +66,7 @@
   void on_primary_button_click (int x, int y) { on_click (); UNUSED_ARG(x); 
UNUSED_ARG(y); }
 
   virtual void on_click ();
-  ////CL_Signal_v0& sig_click() { return click; }
+
 private:
   MenuButton (const MenuButton&);
   MenuButton& operator= (const MenuButton&);

Modified: trunk/pingus/src/pingus_menu.cpp
===================================================================
--- trunk/pingus/src/pingus_menu.cpp    2007-10-23 04:35:54 UTC (rev 3308)
+++ trunk/pingus/src/pingus_menu.cpp    2007-10-23 05:22:35 UTC (rev 3309)
@@ -45,38 +45,35 @@
 {
   is_init = false;
     
-  start_button = new MenuButton(this, Vector2i(Display::get_width() * 400 / 
800,
-                                        Display::get_height() * 390 / 600),
-                                Resource::load_sprite("core/menu/play_on"),
-                                _("Start"),
+  start_button = new MenuButton(this, Vector2i(Display::get_width()  * 250 / 
800,
+                                               Display::get_height() * 330 / 
600),
+                                _("Story"),
                                 _("..:: Start the game ::.."));
 
-  quit_button = new MenuButton(this, Vector2i(Display::get_width() * 650 / 800,
-                                       Display::get_height() * 390 / 600),
-                               Resource::load_sprite("core/menu/exit_on"),
+
+  editor_button = new MenuButton(this, Vector2i(Display::get_width()  * 550 / 
800,
+                                                Display::get_height() * 330 / 
600),
+                                 _("Editor"),
+                                 _("..:: Create your own levels ::.."));
+
+  quit_button = new MenuButton(this, Vector2i(Display::get_width()  * 550 / 
800,
+                                              Display::get_height() * 410 / 
600),
                                _("Exit"),
                                _("..:: Bye, bye ::.."));
 
-  editor_button = new MenuButton(this, Vector2i(Display::get_width() * 150 / 
800,
-                                          Display::get_height() * 390 / 600),
-                                  Resource::load_sprite("core/menu/create_on"),
-                                  _("Level Editor"),
-                                 _("..:: Create your own levels ::.."));
-#ifdef NEW_MENU
-  contrib_button = new MenuButton(this, Vector2i(Display::get_width() * 150 / 
800,
-                                          Display::get_height() * 450 / 600),
-                                  
Resource::load_sprite("core/menu/options_on"),
-                                  _("Contrib\nLevels"),
+  contrib_button = new MenuButton(this, Vector2i(Display::get_width()  * 250 / 
800,
+                                                 Display::get_height() * 410 / 
600),
+                                  _("Levelsets"),
                                   _("..:: Play User Built levels ::.."));
 
+#ifdef NEW_MENU
   story_button  = new MenuButton(this, Vector2i(Display::get_width() * 400 / 
800,
-                                         Display::get_height() * 340 / 600),
-                                 Resource::load_sprite("core/menu/credits_on"),
+                                                Display::get_height() * 340 / 
600),
                                  _("Story"),
                                  _("..:: Start the story ::.."));
   
   multiplayer_button = new MenuButton(this, Vector2i(Display::get_width() * 
150 / 800,
-                                              Display::get_height() * 340 / 
600),
+                                                     Display::get_height() * 
340 / 600),
                                       
Resource::load_sprite("core/menu/multi_on"),
                                       _("Multiplayer"),
                                       _("..:: Multiplayer Match ::.."));
@@ -96,6 +93,7 @@
 #endif
 
   gui_manager->add(quit_button, false);
+  gui_manager->add(contrib_button, false);
   gui_manager->add(start_button, false);
   gui_manager->add(editor_button, false);
 }

Modified: trunk/pingus/src/pingus_menu.hpp
===================================================================
--- trunk/pingus/src/pingus_menu.hpp    2007-10-23 04:35:54 UTC (rev 3308)
+++ trunk/pingus/src/pingus_menu.hpp    2007-10-23 05:22:35 UTC (rev 3309)
@@ -48,9 +48,9 @@
   MenuButton* start_button;
   MenuButton* quit_button;
   MenuButton* editor_button;
+  MenuButton* contrib_button;
 
 #ifdef NEW_MENU
-  MenuButton* contrib_button;
   MenuButton* story_button;
   MenuButton* multiplayer_button;
 #endif





reply via email to

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