[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] r2588 - trunk/src
From: |
jave27 |
Subject: |
[Pingus-CVS] r2588 - trunk/src |
Date: |
Wed, 11 Jan 2006 19:06:45 +0100 |
Author: jave27
Date: 2006-01-11 19:06:35 +0100 (Wed, 11 Jan 2006)
New Revision: 2588
Modified:
trunk/src/layer_manager.cxx
trunk/src/layer_manager.hxx
trunk/src/pingus_menu_manager.cxx
Log:
Fixed the line between scaled background images - it's an artifact of how
ClanLib treats CL_Surface's vs. CL_Sprite's. I changed it to use sprites
instead, plus now it doesn't scale unless the resolution is other than 800x600.
Modified: trunk/src/layer_manager.cxx
===================================================================
--- trunk/src/layer_manager.cxx 2006-01-11 17:44:51 UTC (rev 2587)
+++ trunk/src/layer_manager.cxx 2006-01-11 18:06:35 UTC (rev 2588)
@@ -18,6 +18,8 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <iostream>
+#include <ClanLib/Display/sprite.h>
+#include <ClanLib/Display/sprite_description.h>
#include "layer_manager.hxx"
namespace Pingus {
@@ -33,7 +35,9 @@
void
LayerManager::add_layer (const CL_PixelBuffer& sur, float x_o, float y_o,
float x_u, float y_u)
{
- layers.push_back (Layer(CL_Surface(sur), x_o, y_o, x_u, y_u));
+ CL_SpriteDescription desc;
+ desc.add_frame(sur);
+ layers.push_back (Layer(CL_Sprite(desc), x_o, y_o, x_u, y_u));
}
void
Modified: trunk/src/layer_manager.hxx
===================================================================
--- trunk/src/layer_manager.hxx 2006-01-11 17:44:51 UTC (rev 2587)
+++ trunk/src/layer_manager.hxx 2006-01-11 18:06:35 UTC (rev 2588)
@@ -22,7 +22,7 @@
#include "pingus.hxx"
#include <cmath>
-#include <ClanLib/Display/surface.h>
+#include <ClanLib/Display/sprite.h>
#include <ClanLib/Display/display.h>
#include "display/drawing_context.hxx"
@@ -34,7 +34,7 @@
class Layer
{
private:
- CL_Surface sur;
+ CL_Sprite sur;
float x_pos;
float y_pos;
@@ -52,7 +52,7 @@
x_offset(0), y_offset(0)
{}
- Layer (const CL_Surface& arg_sur, float x_o, float y_o, float x_u, float
y_u)
+ Layer (const CL_Sprite& arg_sur, float x_o, float y_o, float x_u, float
y_u)
: sur(arg_sur),
x_pos(0), y_pos(0),
x_update(x_u), y_update(y_u),
Modified: trunk/src/pingus_menu_manager.cxx
===================================================================
--- trunk/src/pingus_menu_manager.cxx 2006-01-11 17:44:51 UTC (rev 2587)
+++ trunk/src/pingus_menu_manager.cxx 2006-01-11 18:06:35 UTC (rev 2588)
@@ -35,17 +35,29 @@
{
int w = (int)CL_Display::get_width();
int h = (int)CL_Display::get_height();
- background.add_layer (Blitter::scale_surface_to_canvas(
- Resource::load_pixelbuffer("core/menu/layer1"), w, 185 * h /
600), 0, 0, 12, 0);
- background.add_layer (Blitter::scale_surface_to_canvas(
- Resource::load_pixelbuffer("core/menu/layer2"), w, 362 * h /
600), 0, 150 * (float)h / 600, 25, 0);
- background.add_layer (Blitter::scale_surface_to_canvas(
- Resource::load_pixelbuffer("core/menu/layer3"), w, 306 * h /
600), 0, 200 * (float)h / 600, 50, 0);
- background.add_layer (Blitter::scale_surface_to_canvas(
- Resource::load_pixelbuffer("core/menu/layer4"), w, 171 * h /
600), 0, 429 * (float)h / 600, 100, 0);
- background.add_layer (Blitter::scale_surface_to_canvas(
- Resource::load_pixelbuffer("core/menu/layer5"), 302 * w / 800,
104 * h / 600), 0, 500 * (float)h / 600, 200, 0);
-
+ // We only need to scale the background main menu images if the screen
+ // resolution is not default
+ if (w != 800 && h != 600)
+ {
+ background.add_layer (Blitter::scale_surface_to_canvas(
+ Resource::load_pixelbuffer("core/menu/layer1"), w, 185
* h / 600), 0, 0, 12, 0);
+ background.add_layer (Blitter::scale_surface_to_canvas(
+ Resource::load_pixelbuffer("core/menu/layer2"), w, 362
* h / 600), 0, 150 * (float)h / 600, 25, 0);
+ background.add_layer (Blitter::scale_surface_to_canvas(
+ Resource::load_pixelbuffer("core/menu/layer3"), w, 306
* h / 600), 0, 200 * (float)h / 600, 50, 0);
+ background.add_layer (Blitter::scale_surface_to_canvas(
+ Resource::load_pixelbuffer("core/menu/layer4"), w, 171
* h / 600), 0, 429 * (float)h / 600, 100, 0);
+ background.add_layer (Blitter::scale_surface_to_canvas(
+ Resource::load_pixelbuffer("core/menu/layer5"), 302 * w
/ 800, 104 * h / 600), 0, 500 * (float)h / 600, 200, 0);
+ }
+ else
+ {
+
background.add_layer(Resource::load_pixelbuffer("core/menu/layer1"), 0, 0, 12,
0);
+
background.add_layer(Resource::load_pixelbuffer("core/menu/layer2"), 0, 150,
25, 0);
+
background.add_layer(Resource::load_pixelbuffer("core/menu/layer3"), 0, 200,
50, 0);
+
background.add_layer(Resource::load_pixelbuffer("core/menu/layer4"), 0, 429,
100, 0);
+
background.add_layer(Resource::load_pixelbuffer("core/menu/layer5"), 0, 500,
200, 0);
+ }
push_menu (&mainmenu);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] r2588 - trunk/src,
jave27 <=