pingus-cvs
[Top][All Lists]
Advanced

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

[Pingus-CVS] CVS: Games/Pingus/src credits.cxx,1.20,1.21 result_screen.c


From: grumbel
Subject: [Pingus-CVS] CVS: Games/Pingus/src credits.cxx,1.20,1.21 result_screen.cxx,1.13,1.14 start_screen.cxx,1.12,1.13
Date: 10 Apr 2003 16:59:59 -0000

Update of /var/lib/cvs/Games/Pingus/src
In directory dark:/tmp/cvs-serv31397

Modified Files:
        credits.cxx result_screen.cxx start_screen.cxx 
Log Message:
fixed start, result and credits screen for 640x480


Index: credits.cxx
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/credits.cxx,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- credits.cxx 10 Apr 2003 11:51:32 -0000      1.20
+++ credits.cxx 10 Apr 2003 16:59:57 -0000      1.21
@@ -61,7 +61,7 @@
   credits.push_back("_Alberto Curro");
   credits.push_back("_Björn Christoph Fischer");
   credits.push_back("_Kenneth Gangstø");
-  credits.push_back("_Michael KŽäser");
+  credits.push_back("_Michael KŽäser");
   credits.push_back("_Neil Mitchell");
   credits.push_back("n");
 
@@ -195,7 +195,9 @@
   x = CL_Display::get_width()/2;
   y = int(offset);
 
-  gc.draw(background, 0, 0);
+  gc.draw(background,
+          gc.get_width()/2 - background.get_width()/2,
+          gc.get_height()/2 - background.get_height()/2);
   
   gc.draw(pingu, (gc.get_width() / 2) - (pingu.get_width() / 2),
           (gc.get_height() / 2) - (pingu.get_height() / 2) - 20);
@@ -204,7 +206,7 @@
                        CL_Display::get_width(), CL_Display::get_height(),
                        0.0, 0.0, 0.0, 1.0);*/
 
-  CL_Display::push_clip_rect(CL_ClipRect(0, 75, 600, 500));
+  CL_Display::push_clip_rect(CL_ClipRect(0, gc.get_height()/2-225, 600, 
gc.get_height()/2+200));
   yof = 0;
   for (std::vector<std::string>::iterator i = credits.begin(); i != 
credits.end(); ++i)
     {

Index: result_screen.cxx
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/result_screen.cxx,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- result_screen.cxx   9 Apr 2003 21:57:24 -0000       1.13
+++ result_screen.cxx   10 Apr 2003 16:59:57 -0000      1.14
@@ -19,6 +19,7 @@
 
 #include <iostream>
 #include "my_gettext.hxx"
+#include "sprite.hxx"
 #include "gui/surface_button.hxx"
 #include "gui/gui_manager.hxx"
 #include "gui/screen_manager.hxx"
@@ -37,7 +38,7 @@
 {
 public:
   Result result;
-  CL_Surface background;
+  Sprite background;
   std::string time_str;
 
   std::vector<CL_Surface> chalk_pingus;
@@ -54,7 +55,8 @@
   ResultScreen* parent;
 public:
   ResultScreenOkButton(ResultScreen* p)
-    : GUI::SurfaceButton(625, 425, 
+    : GUI::SurfaceButton(CL_Display::get_width()/2 + 225,
+                         CL_Display::get_height()/2 + 125, 
                          ResDescriptor("start/ok", "core", 
ResDescriptor::RD_RESOURCE),
                          ResDescriptor("start/ok_clicked", "core", 
ResDescriptor::RD_RESOURCE),
                          ResDescriptor("start/ok_hover", "core", 
ResDescriptor::RD_RESOURCE)),
@@ -81,7 +83,8 @@
   ResultScreen* parent;
 public:
   ResultScreenAbortButton(ResultScreen* p)
-    : GUI::SurfaceButton(122, 444, 
+    : GUI::SurfaceButton(CL_Display::get_width()/2 - 278,
+                         CL_Display::get_height()/2 + 144, 
                          ResDescriptor("start/back", "core", 
ResDescriptor::RD_RESOURCE),
                          ResDescriptor("start/back_clicked", "core", 
ResDescriptor::RD_RESOURCE),
                          ResDescriptor("start/back_hover", "core", 
ResDescriptor::RD_RESOURCE)),
@@ -113,7 +116,8 @@
   ResultScreen* parent;
 public:
   ResultScreenRetryButton(ResultScreen* p)
-    : GUI::SurfaceButton(625, 425, 
+    : GUI::SurfaceButton(CL_Display::get_width()/2 + 225,
+                         CL_Display::get_height()/2 + 125, 
                          ResDescriptor("start/ok", "core", 
ResDescriptor::RD_RESOURCE),
                          ResDescriptor("start/ok_clicked", "core", 
ResDescriptor::RD_RESOURCE),
                          ResDescriptor("start/ok_hover", "core", 
ResDescriptor::RD_RESOURCE)),
@@ -136,7 +140,8 @@
 ResultScreenComponent::ResultScreenComponent(Result arg_result)
   : result(arg_result)
 {
-  background = PingusResource::load_surface("menu/startscreenbg", "core");
+  background = Sprite("menu/startscreenbg", "core");
+  background.set_align_center();
 
   chalk_pingus.push_back(PingusResource::load_surface("misc/chalk_pingu1", 
"core"));
   chalk_pingus.push_back(PingusResource::load_surface("misc/chalk_pingu2", 
"core"));
@@ -152,23 +157,27 @@
 void
 ResultScreenComponent::draw(GraphicContext& gc) 
 {
-  gc.draw(background, 0, 0);
+  gc.draw(background, Vector(gc.get_width()/2, gc.get_height()/2));
 
   if (!result.success())
-    gc.print_right(Fonts::chalk_normal, 675, 410, _("Retry"));
+    gc.print_right(Fonts::chalk_normal, 
+                   CL_Display::get_width()/2 + 275,
+                   CL_Display::get_height()/2 + 110, _("Retry"));
 
-  gc.print_center(Fonts::chalk_large, gc.get_width()/2, 100, 
+  gc.print_center(Fonts::chalk_large, gc.get_width()/2, 
CL_Display::get_height()/2 - 200, 
                   System::translate(result.plf->get_levelname()));
 
   if (result.success())
     {
-      gc.print_center(Fonts::chalk_large, gc.get_width()/2, 160, 
_("Success!"));
+      gc.print_center(Fonts::chalk_large, gc.get_width()/2,
+                      CL_Display::get_height()/2 - 140, _("Success!"));
       /*gc.print_center(Fonts::pingus_small, gc.get_width()/2, 
gc.get_height()-30,
         "..:: Press Space to continue ::..");*/
     }
   else
     {
-      gc.print_center(Fonts::chalk_large, gc.get_width()/2, 160, 
_("Failure!"));
+      gc.print_center(Fonts::chalk_large, gc.get_width()/2, 
CL_Display::get_height()/2 - 140,
+                      _("Failure!"));
       /*gc.print_center(Fonts::pingus_normal, gc.get_width()/2, 
gc.get_height()-30,
                       "..:: Press Space to retry the level ::..");*/
     }
@@ -204,7 +213,8 @@
       else
         message = _("Better luck next time!");
     }
-  gc.print_center(Fonts::chalk_normal, gc.get_width()/2, 230, message);
+  gc.print_center(Fonts::chalk_normal, gc.get_width()/2, 
+                  CL_Display::get_height()/2 - 70, message);
 
 
 #if 0
@@ -213,16 +223,20 @@
       gc.draw(chalk_pingus[rand() % chalk_pingus.size()], 230 + i * 15, 210);
     }
 #endif
-  gc.print_left(Fonts::chalk_normal,  300, 310, _("Saved: "));
-  gc.print_right(Fonts::chalk_normal, 500, 310, to_string(result.saved) 
+  int left_x  = CL_Display::get_width()/2 - 100;
+  int right_x = CL_Display::get_width()/2 + 100;
+  int y = CL_Display::get_height()/2 + 10;
+    
+  gc.print_left(Fonts::chalk_normal,  left_x,  y, _("Saved: "));
+  gc.print_right(Fonts::chalk_normal, right_x, y, to_string(result.saved) 
                  + "/" + to_string(result.needed));;
 
-  gc.print_left(Fonts::chalk_normal,  300, 340, _("Killed: "));
-  gc.print_right(Fonts::chalk_normal, 500, 340, to_string(result.killed));
+  gc.print_left(Fonts::chalk_normal,  left_x,  y+=30, _("Killed: "));
+  gc.print_right(Fonts::chalk_normal, right_x, y, to_string(result.killed));
 
 
-  gc.print_left(Fonts::chalk_normal,   300, 370, _("Time left: "));
-  gc.print_right(Fonts::chalk_normal, 500, 370, time_str);
+  gc.print_left(Fonts::chalk_normal,   left_x, y+=30, _("Time left: "));
+  gc.print_right(Fonts::chalk_normal, right_x, y, time_str);
 }
 
 ResultScreen::ResultScreen(Result arg_result)

Index: start_screen.cxx
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/start_screen.cxx,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- start_screen.cxx    9 Apr 2003 21:57:24 -0000       1.12
+++ start_screen.cxx    10 Apr 2003 16:59:57 -0000      1.13
@@ -18,6 +18,7 @@
 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
 #include <iostream>
+#include "sprite.hxx"
 #include "gui/gui_manager.hxx"
 #include "gui/surface_button.hxx"
 #include "gui/component.hxx"
@@ -38,7 +39,7 @@
 {
 private:
   PLFHandle plf;
-  CL_Surface background;
+  Sprite background;
   std::string time_str;
  
 public:
@@ -56,7 +57,8 @@
   StartScreen* parent;
 public:
   StartScreenOkButton(StartScreen* p)
-    : GUI::SurfaceButton(625, 425, 
+    : GUI::SurfaceButton(CL_Display::get_width()/2 + 225,
+                         CL_Display::get_height()/2 + 125, 
                          ResDescriptor("start/ok", "core", 
ResDescriptor::RD_RESOURCE),
                          ResDescriptor("start/ok_clicked", "core", 
ResDescriptor::RD_RESOURCE),
                          ResDescriptor("start/ok_hover", "core", 
ResDescriptor::RD_RESOURCE)),
@@ -91,7 +93,8 @@
   StartScreen* parent;
 public:
   StartScreenAbortButton(StartScreen* p)
-    : GUI::SurfaceButton(122, 444, 
+    : GUI::SurfaceButton(CL_Display::get_width()/2 - 278,
+                         CL_Display::get_height()/2 + 144, 
                          ResDescriptor("start/back", "core", 
ResDescriptor::RD_RESOURCE),
                          ResDescriptor("start/back_clicked", "core", 
ResDescriptor::RD_RESOURCE),
                          ResDescriptor("start/back_hover", "core", 
ResDescriptor::RD_RESOURCE)),
@@ -123,7 +126,8 @@
 StartScreenComponent::StartScreenComponent(PLFHandle p)
   : plf(p)
 {
-  background = PingusResource::load_surface("menu/startscreenbg", "core");
+  background = Sprite("menu/startscreenbg", "core");
+  background.set_align_center();
   time_str = GameTime::ticks_to_realtime_string(plf->get_time());
 }
 
@@ -131,28 +135,40 @@
 StartScreenComponent::draw(GraphicContext& gc)
 {
   //gc.clear(0,0,0);
-  background.put_screen(0,0);
+  background.put_screen(CL_Display::get_width()/2,CL_Display::get_height()/2);
   
-  gc.print_center(Fonts::chalk_large, gc.get_width()/2, 100, 
System::translate(plf->get_levelname()));
-  gc.print_left(Fonts::chalk_normal, 130, 160, 
format_description(gc.get_width() - 260));
+  int left_x  = CL_Display::get_width()/2 - 120;
+  int right_x = CL_Display::get_width()/2 + 120;
+  int y = CL_Display::get_height()/2 + 10;
 
-  gc.print_left (Fonts::chalk_normal, 280, 310, _("Number of Pingus: "));
-  gc.print_right(Fonts::chalk_normal, 520, 310, to_string(plf->get_pingus()));
+  gc.print_center(Fonts::chalk_large, 
+                  gc.get_width()/2, 
+                  CL_Display::get_height()/2 - 200,
+                  System::translate(plf->get_levelname()));
 
-  gc.print_left (Fonts::chalk_normal, 280, 340, _("Number to Save: "));
-  gc.print_right(Fonts::chalk_normal, 520, 340, 
to_string(plf->get_number_to_save()));
+  gc.print_left(Fonts::chalk_normal,
+                CL_Display::get_width()/2 - 270,
+                CL_Display::get_height()/2 - 140,
+                format_description(800 - 260));
 
-  gc.print_left (Fonts::chalk_normal, 280, 370, _("Time: "));
-  gc.print_right(Fonts::chalk_normal, 520, 370, time_str);
+  gc.print_left (Fonts::chalk_normal, left_x,  y, _("Number of Pingus: "));
+  gc.print_right(Fonts::chalk_normal, right_x, y, 
to_string(plf->get_pingus()));
+
+  gc.print_left (Fonts::chalk_normal, left_x,  y += 30, _("Number to Save: "));
+  gc.print_right(Fonts::chalk_normal, right_x, y, 
to_string(plf->get_number_to_save()));
+
+  gc.print_left (Fonts::chalk_normal, left_x,  y += 30, _("Time: "));
+  gc.print_right(Fonts::chalk_normal, right_x, y, time_str);
   
-  gc.print_left (Fonts::chalk_normal, 280, 400, _("Difficulty:"));
-  gc.print_right(Fonts::chalk_normal, 520, 400, 
to_string(plf->get_difficulty()) + "/100");
+  gc.print_left (Fonts::chalk_normal, left_x,  y += 30, _("Difficulty:"));
+  gc.print_right(Fonts::chalk_normal, right_x, y, 
to_string(plf->get_difficulty()) + "/100");
 
   /*for (int i = 0; plf->get_difficulty())
     {
     }*/
 
-  gc.print_center(Fonts::chalk_small, 400, 470, _("Author: ") + 
plf->get_author());
+  gc.print_center(Fonts::chalk_small, CL_Display::get_width()/2,
+                  CL_Display::get_height()/2 + 270, _("Author: ") + 
plf->get_author());
 
   if (maintainer_mode)
     gc.print_left(Fonts::chalk_small, 110, 430, _("Filename: ") + 
plf->get_resname());





reply via email to

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