pingus-cvs
[Top][All Lists]
Advanced

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

[Pingus-CVS] r3460 - in trunk/pingus/src: . components input


From: plouj at BerliOS
Subject: [Pingus-CVS] r3460 - in trunk/pingus/src: . components input
Date: Fri, 2 Nov 2007 00:08:39 +0100

Author: plouj
Date: 2007-11-02 00:08:38 +0100 (Fri, 02 Nov 2007)
New Revision: 3460

Modified:
   trunk/pingus/src/components/playfield.cpp
   trunk/pingus/src/globals.hpp
   trunk/pingus/src/input/usbmouse_driver.cpp
   trunk/pingus/src/level_menu.cpp
   trunk/pingus/src/pingus_menu.cpp
   trunk/pingus/src/pingus_menu_manager.cpp
   trunk/pingus/src/start_screen.cpp
Log:
removed hard-coded default screen values


Modified: trunk/pingus/src/components/playfield.cpp
===================================================================
--- trunk/pingus/src/components/playfield.cpp   2007-11-01 18:41:02 UTC (rev 
3459)
+++ trunk/pingus/src/components/playfield.cpp   2007-11-01 23:08:38 UTC (rev 
3460)
@@ -149,7 +149,7 @@
   if (auto_scrolling && (fullscreen_enabled || 
SDL_WM_GrabInput(SDL_GRAB_QUERY) == SDL_GRAB_ON))
     {
       // FIXME: May need to modify this function if it's not gradient enough.
-      scroll_speed = static_cast<int>(800 * delta);
+      scroll_speed = static_cast<int>(screen_width * delta);
       //std::cout << "scroll_speed: " << scroll_speed << std::endl;
     
       if (mouse_pos.x < 10)

Modified: trunk/pingus/src/globals.hpp
===================================================================
--- trunk/pingus/src/globals.hpp        2007-11-01 18:41:02 UTC (rev 3459)
+++ trunk/pingus/src/globals.hpp        2007-11-01 23:08:38 UTC (rev 3460)
@@ -46,8 +46,8 @@
 extern int         tile_size;                       ///< --tile-size
 extern bool        fullscreen_enabled;              ///< --enable-fullscreen
 extern bool        resize_enabled;                  ///< --resize-fullscreen
-extern int         screen_width;                    ///<
-extern int         screen_height;                   ///<
+extern int         screen_width;                    ///< default screen width
+extern int         screen_height;                   ///< default screen height
 extern bool        draw_collision_map;              ///<
 extern bool        swcursor_enabled;                ///< --enable-swcursor
 

Modified: trunk/pingus/src/input/usbmouse_driver.cpp
===================================================================
--- trunk/pingus/src/input/usbmouse_driver.cpp  2007-11-01 18:41:02 UTC (rev 
3459)
+++ trunk/pingus/src/input/usbmouse_driver.cpp  2007-11-01 23:08:38 UTC (rev 
3460)
@@ -113,13 +113,13 @@
 
             if (mouse_pos.x < 0) 
               mouse_pos.x = 0;
-            else if (mouse_pos.x > 800) // FIXME: Shouldn't hardcore 800x600 
resolution
-              mouse_pos.x = 800 - 1;
+            else if (mouse_pos.x > screen_width)
+              mouse_pos.x = screen_width - 1;
 
             if (mouse_pos.y < 0) 
               mouse_pos.y = 0;
-            else if (mouse_pos.y > 600)
-              mouse_pos.y = 600 - 1;
+            else if (mouse_pos.y > screen_height)
+              mouse_pos.y = screen_height - 1;
 
             for(std::vector<Pointer*>::iterator i = pointer_bindings.begin(); 
i != pointer_bindings.end(); ++i)
               (*i)->set_pos(mouse_pos);

Modified: trunk/pingus/src/level_menu.cpp
===================================================================
--- trunk/pingus/src/level_menu.cpp     2007-11-01 18:41:02 UTC (rev 3459)
+++ trunk/pingus/src/level_menu.cpp     2007-11-01 23:08:38 UTC (rev 3460)
@@ -251,8 +251,8 @@
 };
 
 LevelMenu::LevelMenu()
-  : x_pos((Display::get_width()  - 800)/2),
-    y_pos((Display::get_height() - 600)/2)
+  : x_pos((Display::get_width()  - screen_width)/2),
+    y_pos((Display::get_height() - screen_height)/2)
 {
   //background = Resource::load_sprite("core/menu/filedialog");
   background = Resource::load_sprite("core/menu/startscreenbg");

Modified: trunk/pingus/src/pingus_menu.cpp
===================================================================
--- trunk/pingus/src/pingus_menu.cpp    2007-11-01 18:41:02 UTC (rev 3459)
+++ trunk/pingus/src/pingus_menu.cpp    2007-11-01 23:08:38 UTC (rev 3460)
@@ -45,35 +45,35 @@
 {
   is_init = false;
     
-  start_button = new MenuButton(this, Vector2i(Display::get_width()  * 250 / 
800,
-                                               Display::get_height() * 330 / 
600),
+  start_button = new MenuButton(this, Vector2i(Display::get_width()  * 250 / 
screen_width,
+                                               Display::get_height() * 330 / 
screen_height),
                                 _("Story"),
                                 _("..:: Start the game ::.."));
 
 
-  editor_button = new MenuButton(this, Vector2i(Display::get_width()  * 550 / 
800,
-                                                Display::get_height() * 330 / 
600),
+  editor_button = new MenuButton(this, Vector2i(Display::get_width()  * 550 / 
screen_width,
+                                                Display::get_height() * 330 / 
screen_height),
                                  _("Editor"),
                                  _("..:: Create your own levels ::.."));
 
-  quit_button = new MenuButton(this, Vector2i(Display::get_width()  * 550 / 
800,
-                                              Display::get_height() * 410 / 
600),
+  quit_button = new MenuButton(this, Vector2i(Display::get_width()  * 550 / 
screen_width,
+                                              Display::get_height() * 410 / 
screen_height),
                                _("Exit"),
                                _("..:: Bye, bye ::.."));
 
-  contrib_button = new MenuButton(this, Vector2i(Display::get_width()  * 250 / 
800,
-                                                 Display::get_height() * 410 / 
600),
+  contrib_button = new MenuButton(this, Vector2i(Display::get_width()  * 250 / 
screen_width,
+                                                 Display::get_height() * 410 / 
screen_height),
                                   _("Levelsets"),
                                   _("..:: Play User Built levels ::.."));
 
 #ifdef NEW_MENU
-  story_button  = new MenuButton(this, Vector2i(Display::get_width() * 400 / 
800,
-                                                Display::get_height() * 340 / 
600),
+  story_button  = new MenuButton(this, Vector2i(Display::get_width() * 400 / 
screen_width,
+                                                Display::get_height() * 340 / 
screen_height),
                                  _("Story"),
                                  _("..:: Start the story ::.."));
   
-  multiplayer_button = new MenuButton(this, Vector2i(Display::get_width() * 
150 / 800,
-                                                     Display::get_height() * 
340 / 600),
+  multiplayer_button = new MenuButton(this, Vector2i(Display::get_width() * 
150 / screen_width,
+                                                     Display::get_height() * 
340 / screen_height),
                                       
Resource::load_sprite("core/menu/multi_on"),
                                       _("Multiplayer"),
                                       _("..:: Multiplayer Match ::.."));

Modified: trunk/pingus/src/pingus_menu_manager.cpp
===================================================================
--- trunk/pingus/src/pingus_menu_manager.cpp    2007-11-01 18:41:02 UTC (rev 
3459)
+++ trunk/pingus/src/pingus_menu_manager.cpp    2007-11-01 23:08:38 UTC (rev 
3460)
@@ -23,6 +23,7 @@
 #include "resource.hpp"
 #include "blitter.hpp"
 #include "pingus_menu_manager.hpp"
+#include "globals.hpp"
 
 
 PingusMenuManager* PingusMenuManager::instance_ = 0;
@@ -35,18 +36,18 @@
        int h = Display::get_height();
        // We only need to scale the background main menu images if the screen 
        // resolution is not default
-       if (w != 800 && h != 600)
+       if (w != screen_width && h != screen_height)
        {
                background.add_layer (Blitter::scale_surface_to_canvas(
-                       Resource::load_surface("core/menu/layer1"), w, 185 * h 
/ 600), 0, 0, 12, 0);
+                       Resource::load_surface("core/menu/layer1"), w, 185 * h 
/ screen_height), 0, 0, 12, 0);
                background.add_layer (Blitter::scale_surface_to_canvas(
-                       Resource::load_surface("core/menu/layer2"), w, 362 * h 
/ 600), 0, 150 * (float)h / 600, 25, 0);
+                       Resource::load_surface("core/menu/layer2"), w, 362 * h 
/ screen_height), 0, 150 * (float)h / screen_height, 25, 0);
                background.add_layer (Blitter::scale_surface_to_canvas(
-                       Resource::load_surface("core/menu/layer3"), w, 306 * h 
/ 600), 0, 200 * (float)h / 600, 50, 0);
+                       Resource::load_surface("core/menu/layer3"), w, 306 * h 
/ screen_height), 0, 200 * (float)h / screen_height, 50, 0);
                background.add_layer (Blitter::scale_surface_to_canvas(
-                       Resource::load_surface("core/menu/layer4"), w, 171 * h 
/ 600), 0, 429 * (float)h / 600, 100, 0);
+                       Resource::load_surface("core/menu/layer4"), w, 171 * h 
/ screen_height), 0, 429 * (float)h / screen_height, 100, 0);
                background.add_layer (Blitter::scale_surface_to_canvas(
-                       Resource::load_surface("core/menu/layer5"), 302 * w / 
800, 104 * h / 600), 0, 500 * (float)h / 600, 200, 0);
+                       Resource::load_surface("core/menu/layer5"), 302 * w / 
screen_width, 104 * h / screen_height), 0, 500 * (float)h / screen_height, 200, 
0);
        }
        else
        {

Modified: trunk/pingus/src/start_screen.cpp
===================================================================
--- trunk/pingus/src/start_screen.cpp   2007-11-01 18:41:02 UTC (rev 3459)
+++ trunk/pingus/src/start_screen.cpp   2007-11-01 23:08:38 UTC (rev 3460)
@@ -155,7 +155,7 @@
   gc.print_left(Fonts::chalk_normal,
                 Display::get_width()/2 - 290,
                 Display::get_height()/2 - 150,
-                format_description(800 - 230));
+                format_description(screen_width - 230));
 
   y += 32;
   y += 30;





reply via email to

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