[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] r3399 - in trunk/pingus/src: . worldobjs
From: |
grumbel at BerliOS |
Subject: |
[Pingus-CVS] r3399 - in trunk/pingus/src: . worldobjs |
Date: |
Tue, 30 Oct 2007 08:44:42 +0100 |
Author: grumbel
Date: 2007-10-30 08:44:42 +0100 (Tue, 30 Oct 2007)
New Revision: 3399
Modified:
trunk/pingus/src/smallmap_image.cpp
trunk/pingus/src/surface.cpp
trunk/pingus/src/worldobjs/entrance.hpp
Log:
- added workaround for Surface::clone() bug
Modified: trunk/pingus/src/smallmap_image.cpp
===================================================================
--- trunk/pingus/src/smallmap_image.cpp 2007-10-30 07:29:10 UTC (rev 3398)
+++ trunk/pingus/src/smallmap_image.cpp 2007-10-30 07:44:42 UTC (rev 3399)
@@ -150,15 +150,11 @@
canvas.unlock();
- Surface s = canvas.clone();
- std::cout << "========================================" << std::endl;
- canvas.print(std::cout);
- std::cout << "----------------------------------------" << std::endl;
- s.print(std::cout);
- std::cout << "========================================\n" << std::endl;
+ // Manually clone the Surface due to the way SDL handle RGBA->RGBA blits
+ Surface s(canvas.get_width(), canvas.get_height());
+ SDL_SetAlpha(canvas.get_surface(), 0, 0);
+ s.blit(canvas, 0, 0);
- // FIXME: Should do: sur = Sprite(canvas.clone());
- // but doesn't work, gives transparent surface as result
sur = Sprite(s);
}
Modified: trunk/pingus/src/surface.cpp
===================================================================
--- trunk/pingus/src/surface.cpp 2007-10-30 07:29:10 UTC (rev 3398)
+++ trunk/pingus/src/surface.cpp 2007-10-30 07:44:42 UTC (rev 3399)
@@ -91,7 +91,7 @@
Surface::Surface(int width, int height)
: impl(new SurfaceImpl())
{
- impl->surface = SDL_CreateRGBSurface(SDL_SWSURFACE, width, height, 32,
+ impl->surface = SDL_CreateRGBSurface(SDL_SWSURFACE | SDL_SRCALPHA, width,
height, 32,
0x000000ff,
0x0000ff00,
0x00ff0000,
@@ -363,13 +363,27 @@
% ((impl->surface->flags & SDL_SRCCOLORKEY) ? "SRCCOLORKEY " : "")
% ((impl->surface->flags & SDL_SRCALPHA) ? "SRCALPHA " : "")
% impl->surface->format->palette
- % impl->surface->format->BitsPerPixel;
+ % static_cast<int>(impl->surface->format->BitsPerPixel);
if (impl->surface->flags & SDL_SRCCOLORKEY)
out << "Colorkey: " << (int)impl->surface->format->colorkey << std::endl;
if (impl->surface->flags & SDL_SRCALPHA)
out << "Alpha: " << (int)impl->surface->format->alpha << std::endl;
+
+ if (0)
+ {
+ SDL_LockSurface(impl->surface);
+ Uint8* pixels = static_cast<Uint8*>(impl->surface->pixels);
+ for(int i = 0; i < impl->surface->pitch * impl->surface->h; i += 4)
+ out << boost::format("(%3d %3d %3d %3d) ")
+ % (int)pixels[i+0]
+ % (int)pixels[i+1]
+ % (int)pixels[i+2]
+ % (int)pixels[i+3];
+ out << std::endl;
+ SDL_UnlockSurface(impl->surface);
+ }
}
/* EOF */
Modified: trunk/pingus/src/worldobjs/entrance.hpp
===================================================================
--- trunk/pingus/src/worldobjs/entrance.hpp 2007-10-30 07:29:10 UTC (rev
3398)
+++ trunk/pingus/src/worldobjs/entrance.hpp 2007-10-30 07:44:42 UTC (rev
3399)
@@ -41,7 +41,7 @@
enum EntranceDirection { LEFT, RIGHT, MISC };
protected:
EntranceDirection direction;
- Vector3f pos;
+ Vector3f pos;
int release_rate;
int owner_id;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] r3399 - in trunk/pingus/src: . worldobjs,
grumbel at BerliOS <=