pingus-cvs
[Top][All Lists]
Advanced

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

[Pingus-CVS] r2484 - trunk/src


From: David Philippi at BerliOS
Subject: [Pingus-CVS] r2484 - trunk/src
Date: Sun, 6 Nov 2005 18:09:31 +0100

Author: torangan
Date: 2005-11-06 18:09:30 +0100 (Sun, 06 Nov 2005)
New Revision: 2484

Modified:
   trunk/src/credits.cxx
   trunk/src/credits.hxx
   trunk/src/menu_button.cxx
   trunk/src/story_screen.cxx
Log:
patch to add skip button to credits

Modified: trunk/src/credits.cxx
===================================================================
--- trunk/src/credits.cxx       2005-11-05 11:39:36 UTC (rev 2483)
+++ trunk/src/credits.cxx       2005-11-06 17:09:30 UTC (rev 2484)
@@ -21,14 +21,45 @@
 #include <ClanLib/Display/display.h>
 #include <ClanLib/Display/font.h>
 #include "gui/screen_manager.hxx"
+#include "gui/surface_button.hxx"
+#include "gui/gui_manager.hxx"
 #include "sound/sound.hxx"
 #include "resource.hxx"
+#include "res_descriptor.hxx"
 #include "credits.hxx"
 #include "fonts.hxx"
 #include "gettext.h"
 
 namespace Pingus {
 
+class CreditsOkButton
+  : public GUI::SurfaceButton
+{
+private:
+  Credits* parent;
+public:
+  CreditsOkButton(Credits* p)
+    : GUI::SurfaceButton(CL_Display::get_width()/2 + 225,
+                         CL_Display::get_height()/2 + 125,
+                         ResDescriptor("core/start/ok"),
+                         ResDescriptor("core/start/ok_clicked"),
+                         ResDescriptor("core/start/ok_hover")),
+      parent(p)
+  {
+  }
+
+  void on_pointer_enter ()
+  {
+    SurfaceButton::on_pointer_enter();
+    Sound::PingusSound::play_sound("tick");
+  }
+
+  void on_click() {
+    parent->on_escape_press();
+    Sound::PingusSound::play_sound("yipee");
+  }
+};
+
 Credits* Credits::instance_ = 0;
 
 Credits::Credits()
@@ -37,6 +68,8 @@
   background = Resource::load_sprite("core/menu/startscreenbg");
   pingu = Resource::load_sprite("core/misc/creditpingu");
 
+  gui_manager->add(new CreditsOkButton(this));
+
   background.set_alignment(origin_center);
   pingu.set_alignment(origin_center);
 
@@ -68,6 +101,7 @@
   credits.push_back("_Kenneth Gangst�");
   credits.push_back("_Michael K�ser");
   credits.push_back("_Neil Mitchell");
+       credits.push_back("_Jason Green");
   credits.push_back("n");
 
   credits.push_back(_("-Gfx"));
@@ -207,9 +241,9 @@
   else
     {
       if (fast_scrolling)
-        offset -= 450.0f * delta;
+        offset -= static_cast<int>(450.0f * delta);
       else
-        offset -= 35.0f * delta;
+        offset -= static_cast<int>(35.0f * delta);
     }
 }
 
@@ -225,6 +259,11 @@
 
   gc.draw(background, Vector(gc.get_width()/2, gc.get_height()/2));
   gc.draw(pingu, Vector(gc.get_width()/2, gc.get_height()/2 - 20));
+  
+  gc.print_right(Fonts::chalk_normal,
+                static_cast<float>(CL_Display::get_width()/2 + 275),
+                static_cast<float>(CL_Display::get_height()/2 + 110),
+                                                               _("Skip"));
 
   CL_Display::push_cliprect(CL_Rect(0, static_cast<int>(gc.get_height()/2-225),
                                     600, 
static_cast<int>(gc.get_height()/2+200)));
@@ -235,11 +274,13 @@
       switch ((*i)[0])
        {
        case '-':
-         gc.print_center(font, x, y + yof, i->substr(1));
+         gc.print_center(font, static_cast<float>(x), 
+                                                                               
static_cast<float>(y + yof), i->substr(1));
          yof += font.get_height() + 5;
          break;
        case '_':
-         gc.print_center(font_small, x, y + yof, i->substr(1));
+         gc.print_center(font_small, static_cast<float>(x),
+                                                                               
static_cast<float>(y + yof), i->substr(1));
          yof += font_small.get_height() + 5;
          break;
        case 'n':

Modified: trunk/src/credits.hxx
===================================================================
--- trunk/src/credits.hxx       2005-11-05 11:39:36 UTC (rev 2483)
+++ trunk/src/credits.hxx       2005-11-06 17:09:30 UTC (rev 2484)
@@ -29,8 +29,6 @@
 
 namespace Pingus {
 
-class GameDelta;
-
 class Credits : public GUIScreen
 {
 private:
@@ -45,8 +43,8 @@
 
   bool is_init;
 
-  float end_offset;
-  float offset;
+  int end_offset;
+  int offset;
 
   /** The string's which are shown in the scrolling text, the first
       character of the string can be used to apply a special format.

Modified: trunk/src/menu_button.cxx
===================================================================
--- trunk/src/menu_button.cxx   2005-11-05 11:39:36 UTC (rev 2483)
+++ trunk/src/menu_button.cxx   2005-11-06 17:09:30 UTC (rev 2484)
@@ -24,7 +24,6 @@
 #include "sound/sound.hxx"
 #include "resource.hxx"
 #include "pingus_menu_manager.hxx"
-#include "credits.hxx"
 #include "theme_selector.hxx"
 #include "menu_button.hxx"
 #include "gui/screen_manager.hxx"

Modified: trunk/src/story_screen.cxx
===================================================================
--- trunk/src/story_screen.cxx  2005-11-05 11:39:36 UTC (rev 2483)
+++ trunk/src/story_screen.cxx  2005-11-06 17:09:30 UTC (rev 2484)
@@ -81,7 +81,7 @@
   void on_pointer_enter()
   {
     SurfaceButton::on_pointer_enter();
-    Sound::PingusSound::play_sound ("tick", .3);
+    Sound::PingusSound::play_sound ("tick", 0.3f);
   }
 
   void on_click()
@@ -124,13 +124,14 @@
 {
   gc.draw(background, Vector(gc.get_width()/2, gc.get_height()/2));
 
-  gc.print_center(Fonts::chalk_large, CL_Display::get_width()/2,
-                  CL_Display::get_height()/2 - 200, story.title);
+  gc.print_center(Fonts::chalk_large, 
static_cast<float>(CL_Display::get_width()/2),
+                  static_cast<float>(CL_Display::get_height()/2 - 200), 
story.title);
   gc.draw(page_surface, Vector(gc.get_width()/2, gc.get_height()/2 - 65));
   
   gc.print_left(Fonts::chalk_normal,
-                CL_Display::get_width()/2  - 280,
-                CL_Display::get_height()/2 + 35, display_text);
+                static_cast<float>(CL_Display::get_width()/2  - 280),
+                static_cast<float>(CL_Display::get_height()/2 + 35),
+                                                               display_text);
 }
 
 void





reply via email to

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