[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] r3464 - in trunk/pingus/src: . components input worldobjs
From: |
plouj at BerliOS |
Subject: |
[Pingus-CVS] r3464 - in trunk/pingus/src: . components input worldobjs |
Date: |
Fri, 2 Nov 2007 02:48:01 +0100 |
Author: plouj
Date: 2007-11-02 02:47:59 +0100 (Fri, 02 Nov 2007)
New Revision: 3464
Modified:
trunk/pingus/src/components/playfield.cpp
trunk/pingus/src/globals.cpp
trunk/pingus/src/globals.hpp
trunk/pingus/src/input/core_driver.cpp
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
trunk/pingus/src/worldobjs/snow_generator.cpp
trunk/pingus/src/worldobjs/starfield_background_stars.cpp
Log:
fixed previously soft-coded values and added missing includes
Modified: trunk/pingus/src/components/playfield.cpp
===================================================================
--- trunk/pingus/src/components/playfield.cpp 2007-11-01 23:34:49 UTC (rev
3463)
+++ trunk/pingus/src/components/playfield.cpp 2007-11-02 01:47:59 UTC (rev
3464)
@@ -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>(screen_width * delta);
+ scroll_speed = static_cast<int>(default_screen_width * delta);
//std::cout << "scroll_speed: " << scroll_speed << std::endl;
if (mouse_pos.x < 10)
Modified: trunk/pingus/src/globals.cpp
===================================================================
--- trunk/pingus/src/globals.cpp 2007-11-01 23:34:49 UTC (rev 3463)
+++ trunk/pingus/src/globals.cpp 2007-11-02 01:47:59 UTC (rev 3464)
@@ -34,8 +34,10 @@
bool drag_drop_scrolling = false;
int tile_size = 32;
-int screen_width = 800;
-int screen_height = 600;
+int default_screen_width = 800;
+int default_screen_height = 600;
+int screen_width = default_screen_width;
+int screen_height = default_screen_height;
bool draw_collision_map = false;
bool swcursor_enabled = false;
bool action_help = true;
Modified: trunk/pingus/src/globals.hpp
===================================================================
--- trunk/pingus/src/globals.hpp 2007-11-01 23:34:49 UTC (rev 3463)
+++ trunk/pingus/src/globals.hpp 2007-11-02 01:47:59 UTC (rev 3464)
@@ -46,8 +46,10 @@
extern int tile_size; ///< --tile-size
extern bool fullscreen_enabled; ///< --enable-fullscreen
extern bool resize_enabled; ///< --resize-fullscreen
-extern int screen_width; ///< default screen width
-extern int screen_height; ///< default screen height
+extern int default_screen_width; ///< default screen width
+extern int default_screen_height; ///< default screen height
+extern int screen_width; ///< user configured
screen width
+extern int screen_height; ///< user configured
screen height
extern bool draw_collision_map; ///<
extern bool swcursor_enabled; ///< --enable-swcursor
Modified: trunk/pingus/src/input/core_driver.cpp
===================================================================
--- trunk/pingus/src/input/core_driver.cpp 2007-11-01 23:34:49 UTC (rev
3463)
+++ trunk/pingus/src/input/core_driver.cpp 2007-11-02 01:47:59 UTC (rev
3464)
@@ -73,10 +73,9 @@
new_pos.x += x_axis->get_pos() * c_speed * delta;
new_pos.y += y_axis->get_pos() * c_speed * delta;
- // FIXME: Shouldn't be hardcored, but shouldn't depend on Display
- // either
- new_pos.x = Math::clamp(0.0f, new_pos.x, static_cast<float>(screen_width));
- new_pos.y = Math::clamp(0.0f, new_pos.y,
static_cast<float>(screen_height));
+ // FIXME: shouldn't depend on Display
+ new_pos.x = Math::clamp(0.0f, new_pos.x,
static_cast<float>(default_screen_width));
+ new_pos.y = Math::clamp(0.0f, new_pos.y,
static_cast<float>(default_screen_height));
if (new_pos != pos)
{
Modified: trunk/pingus/src/input/usbmouse_driver.cpp
===================================================================
--- trunk/pingus/src/input/usbmouse_driver.cpp 2007-11-01 23:34:49 UTC (rev
3463)
+++ trunk/pingus/src/input/usbmouse_driver.cpp 2007-11-02 01:47:59 UTC (rev
3464)
@@ -113,13 +113,13 @@
if (mouse_pos.x < 0)
mouse_pos.x = 0;
- else if (mouse_pos.x > screen_width)
- mouse_pos.x = screen_width - 1;
+ else if (mouse_pos.x > default_screen_width)
+ mouse_pos.x = default_screen_width - 1;
if (mouse_pos.y < 0)
mouse_pos.y = 0;
- else if (mouse_pos.y > screen_height)
- mouse_pos.y = screen_height - 1;
+ else if (mouse_pos.y > default_screen_height)
+ mouse_pos.y = default_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 23:34:49 UTC (rev 3463)
+++ trunk/pingus/src/level_menu.cpp 2007-11-02 01:47:59 UTC (rev 3464)
@@ -251,8 +251,8 @@
};
LevelMenu::LevelMenu()
- : x_pos((Display::get_width() - screen_width)/2),
- y_pos((Display::get_height() - screen_height)/2)
+ : x_pos((Display::get_width() - default_screen_width)/2),
+ y_pos((Display::get_height() - default_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 23:34:49 UTC (rev 3463)
+++ trunk/pingus/src/pingus_menu.cpp 2007-11-02 01:47:59 UTC (rev 3464)
@@ -45,35 +45,35 @@
{
is_init = false;
- start_button = new MenuButton(this, Vector2i(Display::get_width() * 250 /
screen_width,
- Display::get_height() * 330 /
screen_height),
+ start_button = new MenuButton(this, Vector2i(Display::get_width() * 250 /
default_screen_width,
+ Display::get_height() * 330 /
default_screen_height),
_("Story"),
_("..:: Start the game ::.."));
- editor_button = new MenuButton(this, Vector2i(Display::get_width() * 550 /
screen_width,
- Display::get_height() * 330 /
screen_height),
+ editor_button = new MenuButton(this, Vector2i(Display::get_width() * 550 /
default_screen_width,
+ Display::get_height() * 330 /
default_screen_height),
_("Editor"),
_("..:: Create your own levels ::.."));
- quit_button = new MenuButton(this, Vector2i(Display::get_width() * 550 /
screen_width,
- Display::get_height() * 410 /
screen_height),
+ quit_button = new MenuButton(this, Vector2i(Display::get_width() * 550 /
default_screen_width,
+ Display::get_height() * 410 /
default_screen_height),
_("Exit"),
_("..:: Bye, bye ::.."));
- contrib_button = new MenuButton(this, Vector2i(Display::get_width() * 250 /
screen_width,
- Display::get_height() * 410 /
screen_height),
+ contrib_button = new MenuButton(this, Vector2i(Display::get_width() * 250 /
default_screen_width,
+ Display::get_height() * 410 /
default_screen_height),
_("Levelsets"),
_("..:: Play User Built levels ::.."));
#ifdef NEW_MENU
- story_button = new MenuButton(this, Vector2i(Display::get_width() * 400 /
screen_width,
- Display::get_height() * 340 /
screen_height),
+ story_button = new MenuButton(this, Vector2i(Display::get_width() * 400 /
default_screen_width,
+ Display::get_height() * 340 /
default_screen_height),
_("Story"),
_("..:: Start the story ::.."));
- multiplayer_button = new MenuButton(this, Vector2i(Display::get_width() *
150 / screen_width,
- Display::get_height() *
340 / screen_height),
+ multiplayer_button = new MenuButton(this, Vector2i(Display::get_width() *
150 / default_screen_width,
+ Display::get_height() *
340 / default_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 23:34:49 UTC (rev
3463)
+++ trunk/pingus/src/pingus_menu_manager.cpp 2007-11-02 01:47:59 UTC (rev
3464)
@@ -36,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 != screen_width && h != screen_height)
+ if (w != default_screen_width && h != default_screen_height)
{
background.add_layer (Blitter::scale_surface_to_canvas(
- Resource::load_surface("core/menu/layer1"), w, 185 * h
/ screen_height), 0, 0, 12, 0);
+ Resource::load_surface("core/menu/layer1"), w, 185 * h
/ default_screen_height), 0, 0, 12, 0);
background.add_layer (Blitter::scale_surface_to_canvas(
- Resource::load_surface("core/menu/layer2"), w, 362 * h
/ screen_height), 0, 150 * (float)h / screen_height, 25, 0);
+ Resource::load_surface("core/menu/layer2"), w, 362 * h
/ default_screen_height), 0, 150 * (float)h / default_screen_height, 25, 0);
background.add_layer (Blitter::scale_surface_to_canvas(
- Resource::load_surface("core/menu/layer3"), w, 306 * h
/ screen_height), 0, 200 * (float)h / screen_height, 50, 0);
+ Resource::load_surface("core/menu/layer3"), w, 306 * h
/ default_screen_height), 0, 200 * (float)h / default_screen_height, 50, 0);
background.add_layer (Blitter::scale_surface_to_canvas(
- Resource::load_surface("core/menu/layer4"), w, 171 * h
/ screen_height), 0, 429 * (float)h / screen_height, 100, 0);
+ Resource::load_surface("core/menu/layer4"), w, 171 * h
/ default_screen_height), 0, 429 * (float)h / default_screen_height, 100, 0);
background.add_layer (Blitter::scale_surface_to_canvas(
- Resource::load_surface("core/menu/layer5"), 302 * w /
screen_width, 104 * h / screen_height), 0, 500 * (float)h / screen_height, 200,
0);
+ Resource::load_surface("core/menu/layer5"), 302 * w /
default_screen_width, 104 * h / default_screen_height), 0, 500 * (float)h /
default_screen_height, 200, 0);
}
else
{
Modified: trunk/pingus/src/start_screen.cpp
===================================================================
--- trunk/pingus/src/start_screen.cpp 2007-11-01 23:34:49 UTC (rev 3463)
+++ trunk/pingus/src/start_screen.cpp 2007-11-02 01:47:59 UTC (rev 3464)
@@ -155,7 +155,7 @@
gc.print_left(Fonts::chalk_normal,
Display::get_width()/2 - 290,
Display::get_height()/2 - 150,
- format_description(screen_width - 230));
+ format_description(800 - 230));
y += 32;
y += 30;
Modified: trunk/pingus/src/worldobjs/snow_generator.cpp
===================================================================
--- trunk/pingus/src/worldobjs/snow_generator.cpp 2007-11-01 23:34:49 UTC
(rev 3463)
+++ trunk/pingus/src/worldobjs/snow_generator.cpp 2007-11-02 01:47:59 UTC
(rev 3464)
@@ -23,6 +23,7 @@
#include "../world.hpp"
#include "../particles/snow_particle_holder.hpp"
#include "snow_generator.hpp"
+#include "globals.hpp"
namespace WorldObjs {
Modified: trunk/pingus/src/worldobjs/starfield_background_stars.cpp
===================================================================
--- trunk/pingus/src/worldobjs/starfield_background_stars.cpp 2007-11-01
23:34:49 UTC (rev 3463)
+++ trunk/pingus/src/worldobjs/starfield_background_stars.cpp 2007-11-02
01:47:59 UTC (rev 3464)
@@ -21,6 +21,7 @@
#include "../world.hpp"
#include "../resource.hpp"
#include "starfield_background_stars.hpp"
+#include "globals.hpp"
namespace WorldObjs {
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] r3464 - in trunk/pingus/src: . components input worldobjs,
plouj at BerliOS <=