[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] rev 2342 - in trunk: data/data data/levels/tutorial src src
From: |
Ingo Ruhnke |
Subject: |
[Pingus-CVS] rev 2342 - in trunk: data/data data/levels/tutorial src src/actions src/worldmap |
Date: |
Thu, 24 Jun 2004 16:09:17 +0200 |
Author: grumbel
Date: 2004-06-24 16:09:17 +0200 (Thu, 24 Jun 2004)
New Revision: 2342
Modified:
trunk/data/data/core.xml
trunk/data/levels/tutorial/snow14-grumbel.pingus
trunk/src/actions/bridger.cxx
trunk/src/actions/bridger.hxx
trunk/src/blitter.cxx
trunk/src/worldmap/pingus.cxx
Log:
- added fillrect for 24bit
Modified: trunk/data/data/core.xml
===================================================================
--- trunk/data/data/core.xml 2004-06-24 12:23:48 UTC (rev 2341)
+++ trunk/data/data/core.xml 2004-06-24 14:09:17 UTC (rev 2342)
@@ -308,7 +308,7 @@
<section name="worldmap">
<section name="pingus">
<sprite name="left">
- <animation speed="60" loop="no" />
+ <animation speed="60" />
<translation origin="bottom_center" x="0" y="2"/>
<image file="../images/core/worldmap/pingus.png">
<grid pos="0,0" size="24,24" array="8,1"/>
@@ -316,7 +316,7 @@
</sprite>
<sprite name="right">
- <animation speed="60" loop="no" />
+ <animation speed="60" />
<translation origin="bottom_center" x="0" y="2"/>
<image file="../images/core/worldmap/pingus.png">
<grid pos="0,24" size="24,24" array="8,1"/>
Modified: trunk/data/levels/tutorial/snow14-grumbel.pingus
===================================================================
--- trunk/data/levels/tutorial/snow14-grumbel.pingus 2004-06-24 12:23:48 UTC
(rev 2341)
+++ trunk/data/levels/tutorial/snow14-grumbel.pingus 2004-06-24 14:09:17 UTC
(rev 2342)
@@ -92,7 +92,7 @@
<resource-ident>textures/happyclouds</resource-ident>
<modifier>ROT0</modifier>
</resource></surface>
- <color>
+ <color>
<red>0.5</red>
<green>0</green>
<blue>0</blue>
Modified: trunk/src/actions/bridger.cxx
===================================================================
--- trunk/src/actions/bridger.cxx 2004-06-24 12:23:48 UTC (rev 2341)
+++ trunk/src/actions/bridger.cxx 2004-06-24 14:09:17 UTC (rev 2342)
@@ -32,12 +32,6 @@
namespace Pingus {
namespace Actions {
-// Initialise class static
-bool Bridger::static_surfaces_loaded = false;
-CL_PixelBuffer Bridger::brick_l;
-CL_PixelBuffer Bridger::brick_r;
-CL_Surface Bridger::static_surface;
-
Bridger::Bridger (Pingu* p)
: PinguAction(p),
mode(B_BUILDING),
@@ -51,13 +45,8 @@
build_sprite.load (Direction::LEFT,
Resource::load_sprite("pingus/bridger/left"));
build_sprite.load (Direction::RIGHT,
Resource::load_sprite("pingus/bridger/right"));
- if (!static_surfaces_loaded)
- {
- static_surface = Resource::load_surface ("pingus/bridger");
- brick_l = Resource::load_pixelbuffer("other/brick_left");
- brick_r = Resource::load_pixelbuffer("other/brick_right");
- static_surfaces_loaded = true;
- }
+ brick_l = Resource::load_pixelbuffer("other/brick_left");
+ brick_r = Resource::load_pixelbuffer("other/brick_right");
}
void
Modified: trunk/src/actions/bridger.hxx
===================================================================
--- trunk/src/actions/bridger.hxx 2004-06-24 12:23:48 UTC (rev 2341)
+++ trunk/src/actions/bridger.hxx 2004-06-24 14:09:17 UTC (rev 2342)
@@ -38,14 +38,11 @@
private:
StateSprite walk_sprite;
StateSprite build_sprite;
+ CL_PixelBuffer brick_l;
+ CL_PixelBuffer brick_r;
GameCounter counter;
- static bool static_surfaces_loaded;
- static CL_Surface static_surface;
- static CL_PixelBuffer brick_l;
- static CL_PixelBuffer brick_r;
-
int bricks;
//int step;
//int do_steps;
Modified: trunk/src/blitter.cxx
===================================================================
--- trunk/src/blitter.cxx 2004-06-24 12:23:48 UTC (rev 2341)
+++ trunk/src/blitter.cxx 2004-06-24 14:09:17 UTC (rev 2342)
@@ -300,7 +300,8 @@
void
Blitter::fill_rect(CL_PixelBuffer target, const CL_Rect& rect, const CL_Color&
color)
{
- if (target.get_format().get_depth() != 32)
+ if (target.get_format().get_depth() != 32
+ && target.get_format().get_depth() != 24)
{
std::cout << "Blitter::fill_rect: depth must be 32 but is " <<
target.get_format().get_depth() << std::endl;
return;
@@ -322,35 +323,71 @@
cl_uint8* target_buf = static_cast<cl_uint8*>(target.get_data());
- if (color.get_alpha() == 255)
+ if (target.get_format().get_depth() == 24)
{
- for (int y = start_y; y < end_y; ++y)
+ if (color.get_alpha() == 255)
{
- cl_uint8* tptr = target_buf + 4*((twidth*(y + rect.top)) + rect.left
+ start_x);
+ for (int y = start_y; y < end_y; ++y)
+ {
+ cl_uint8* tptr = target_buf + 3*((twidth*(y + rect.top)) +
rect.left + start_x);
- for (int x = start_x; x < end_x; ++x)
- {
- *tptr++ = 255;
- *tptr++ = color.get_blue();
- *tptr++ = color.get_green();
- *tptr++ = color.get_red();
+ for (int x = start_x; x < end_x; ++x)
+ {
+ *tptr++ = color.get_red();
+ *tptr++ = color.get_green();
+ *tptr++ = color.get_blue();
+ }
}
}
+ else
+ {
+ for (int y = start_y; y < end_y; ++y)
+ {
+ cl_uint8* tptr = target_buf + 3*((twidth*(y + rect.top)) +
rect.left + start_x);
+
+ for (int x = start_x; x < end_x; ++x)
+ {
+ float a = color.get_alpha()/255.0f;
+
+ *tptr++ = Math::mid(0, int((1.0f - a) * *tptr + a *
color.get_red()) , 255);
+ *tptr++ = Math::mid(0, int((1.0f - a) * *tptr + a *
color.get_green()), 255);
+ *tptr++ = Math::mid(0, int((1.0f - a) * *tptr + a *
color.get_blue()) , 255);
+ }
+ }
+ }
}
- else
+ else if (target.get_format().get_depth() == 32)
{
- for (int y = start_y; y < end_y; ++y)
+ if (color.get_alpha() == 255)
{
- cl_uint8* tptr = target_buf + 4*((twidth*(y + rect.top)) + rect.left
+ start_x);
+ for (int y = start_y; y < end_y; ++y)
+ {
+ cl_uint8* tptr = target_buf + 4*((twidth*(y + rect.top)) +
rect.left + start_x);
- for (int x = start_x; x < end_x; ++x)
- {
- float a = color.get_alpha()/255.0f;
+ for (int x = start_x; x < end_x; ++x)
+ {
+ *tptr++ = 255;
+ *tptr++ = color.get_blue();
+ *tptr++ = color.get_green();
+ *tptr++ = color.get_red();
+ }
+ }
+ }
+ else
+ {
+ for (int y = start_y; y < end_y; ++y)
+ {
+ cl_uint8* tptr = target_buf + 4*((twidth*(y + rect.top)) +
rect.left + start_x);
- *tptr++ = Math::mid(0, int(*tptr + a * color.get_alpha()), 255);
- *tptr++ = Math::mid(0, int((1.0f - a) * *tptr + a *
color.get_blue()) , 255);
- *tptr++ = Math::mid(0, int((1.0f - a) * *tptr + a *
color.get_green()), 255);
- *tptr++ = Math::mid(0, int((1.0f - a) * *tptr + a *
color.get_red()) , 255);
+ for (int x = start_x; x < end_x; ++x)
+ {
+ float a = color.get_alpha()/255.0f;
+
+ *tptr++ = Math::mid(0, int(*tptr + a * color.get_alpha()),
255);
+ *tptr++ = Math::mid(0, int((1.0f - a) * *tptr + a *
color.get_blue()) , 255);
+ *tptr++ = Math::mid(0, int((1.0f - a) * *tptr + a *
color.get_green()), 255);
+ *tptr++ = Math::mid(0, int((1.0f - a) * *tptr + a *
color.get_red()) , 255);
+ }
}
}
}
Modified: trunk/src/worldmap/pingus.cxx
===================================================================
--- trunk/src/worldmap/pingus.cxx 2004-06-24 12:23:48 UTC (rev 2341)
+++ trunk/src/worldmap/pingus.cxx 2004-06-24 14:09:17 UTC (rev 2342)
@@ -19,6 +19,7 @@
#include <iostream>
#include <math.h>
+#include "../vector.hxx"
#include "../gui/graphic_context.hxx"
#include "dot.hxx"
#include "../math.hxx"
@@ -71,6 +72,8 @@
gc.draw(sprite[Direction::RIGHT], pos);
else
gc.draw(sprite[Direction::LEFT], pos);
+
+ //std::cout << "Drawing at: " << pos.x << ", " << pos.y << " " <<
get_z_pos() << std::endl;
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] rev 2342 - in trunk: data/data data/levels/tutorial src src/actions src/worldmap,
Ingo Ruhnke <=