|
From: <je...@us...> - 2007-05-18 20:45:40
|
Revision: 1380
http://cs-sdl.svn.sourceforge.net/cs-sdl/?rev=1380&view=rev
Author: jendave
Date: 2007-05-18 13:45:34 -0700 (Fri, 18 May 2007)
Log Message:
-----------
Fixed transparency issue. Transparency changed from SdlDotNet 5.0.0 to 6.0.0
Modified Paths:
--------------
trunk/scsharp/ChangeLog
trunk/scsharp/src/SCSharpLib/UI/ButtonElement.cs
trunk/scsharp/src/SCSharpLib/UI/ComboBoxElement.cs
trunk/scsharp/src/SCSharpLib/UI/DialogBoxElement.cs
trunk/scsharp/src/SCSharpLib/UI/GameScreen.cs
trunk/scsharp/src/SCSharpLib/UI/GuiUtil.cs
trunk/scsharp/src/SCSharpLib/UI/LabelElement.cs
trunk/scsharp/src/SCSharpLib/UI/ListBoxElement.cs
trunk/scsharp/src/SCSharpLib/UI/Pcx.cs
Modified: trunk/scsharp/ChangeLog
===================================================================
--- trunk/scsharp/ChangeLog 2007-05-18 19:59:26 UTC (rev 1379)
+++ trunk/scsharp/ChangeLog 2007-05-18 20:45:34 UTC (rev 1380)
@@ -342,6 +342,8 @@
* configure.ac: add a check for mono >= 1.1.14
+ * 0.0000007 released
+
2006-05-01 Chris Toshok <to...@hu...>
* SCSharp/SCSharp.Mpq/Mpq.cs: Make GetStreamForResource public so
Modified: trunk/scsharp/src/SCSharpLib/UI/ButtonElement.cs
===================================================================
--- trunk/scsharp/src/SCSharpLib/UI/ButtonElement.cs 2007-05-18 19:59:26 UTC (rev 1379)
+++ trunk/scsharp/src/SCSharpLib/UI/ButtonElement.cs 2007-05-18 20:45:34 UTC (rev 1380)
@@ -64,12 +64,13 @@
Surface surf = new Surface(Width, Height);
surf.TransparentColor = Color.Black; /* XXX */
+ surf.Transparent = true;
- Surface text_surf = GuiUtil.ComposeText(Text, Font, Palette, -1, -1,
+ Surface textSurf = GuiUtil.ComposeText(Text, Font, Palette, -1, -1,
Sensitive ? 4 : 24);
- surf.Blit(text_surf, new Point((surf.Width - text_surf.Width) / 2,
- (surf.Height - text_surf.Height) / 2));
+ surf.Blit(textSurf, new Point((surf.Width - textSurf.Width) / 2,
+ (surf.Height - textSurf.Height) / 2));
return surf;
}
Modified: trunk/scsharp/src/SCSharpLib/UI/ComboBoxElement.cs
===================================================================
--- trunk/scsharp/src/SCSharpLib/UI/ComboBoxElement.cs 2007-05-18 19:59:26 UTC (rev 1379)
+++ trunk/scsharp/src/SCSharpLib/UI/ComboBoxElement.cs 2007-05-18 20:45:34 UTC (rev 1380)
@@ -226,10 +226,11 @@
if (cursor != -1)
{
- Surface item_surface = GuiUtil.ComposeText(items[cursor], Font, Palette, 4);
+ Surface itemSurface = GuiUtil.ComposeText(items[cursor], Font, Palette, 4);
- item_surface.TransparentColor = Color.Black;
- surf.Blit(item_surface, new Point(0, 0));
+ itemSurface.TransparentColor = Color.Black;
+ itemSurface.Transparent = true;
+ surf.Blit(itemSurface, new Point(0, 0));
}
return surf;
@@ -242,13 +243,14 @@
int y = 0;
for (int i = 0; i < items.Count; i++)
{
- Surface item_surface = GuiUtil.ComposeText(items[i], Font, Palette,
+ Surface itemSurface = GuiUtil.ComposeText(items[i], Font, Palette,
i == selectedItem ? 4 : 24);
- item_surface.TransparentColor = Color.Black;
+ itemSurface.TransparentColor = Color.Black;
+ itemSurface.Transparent = true;
- dropdownSurface.Blit(item_surface, new Point(0, y));
- y += item_surface.Height;
+ dropdownSurface.Blit(itemSurface, new Point(0, y));
+ y += itemSurface.Height;
}
}
Modified: trunk/scsharp/src/SCSharpLib/UI/DialogBoxElement.cs
===================================================================
--- trunk/scsharp/src/SCSharpLib/UI/DialogBoxElement.cs 2007-05-18 19:59:26 UTC (rev 1379)
+++ trunk/scsharp/src/SCSharpLib/UI/DialogBoxElement.cs 2007-05-18 20:45:34 UTC (rev 1380)
@@ -107,6 +107,7 @@
surf.Fill(new Rectangle(new Point(0, 0), new Size(Width, Height)),
Color.FromArgb(0, 0, 0, 0));
surf.TransparentColor = Color.Black; /* XXX */
+ surf.Transparent = true;
Pcx pal = new Pcx();
pal.ReadFromStream((Stream)Mpq.GetResource("unit\\cmdbtns\\ticon.pcx"),
Modified: trunk/scsharp/src/SCSharpLib/UI/GameScreen.cs
===================================================================
--- trunk/scsharp/src/SCSharpLib/UI/GameScreen.cs 2007-05-18 19:59:26 UTC (rev 1379)
+++ trunk/scsharp/src/SCSharpLib/UI/GameScreen.cs 2007-05-18 20:45:34 UTC (rev 1380)
@@ -139,20 +139,20 @@
ScrollCursors = new CursorAnimator[8];
}
- Surface[] starfield_layers;
+ Surface[] starfieldLayers;
void PaintStarfield(Surface surf, DateTime dt)
{
float scroll_factor = 1.0f;
- float[] factors = new float[starfield_layers.Length];
+ float[] factors = new float[starfieldLayers.Length];
- for (int i = 0; i < starfield_layers.Length; i++)
+ for (int i = 0; i < starfieldLayers.Length; i++)
{
factors[i] = scroll_factor;
scroll_factor *= 0.75f;
}
- for (int i = starfield_layers.Length - 1; i >= 0; i--)
+ for (int i = starfieldLayers.Length - 1; i >= 0; i--)
{
int scroll_x = (int)(topleft_x * factors[i]);
int scroll_y = (int)(topleft_y * factors[i]);
@@ -166,7 +166,7 @@
scroll_y %= Painter.ScreenResY;
}
- surf.Blit(starfield_layers[i],
+ surf.Blit(starfieldLayers[i],
new Rectangle(new Point(0, 0),
new Size(Painter.ScreenResX - scroll_x,
Painter.ScreenResY - scroll_y)),
@@ -176,7 +176,7 @@
if (scroll_x != 0)
{
- surf.Blit(starfield_layers[i],
+ surf.Blit(starfieldLayers[i],
new Rectangle(new Point(Painter.ScreenResX - scroll_x, 0),
new Size(scroll_x, Painter.ScreenResY - scroll_y)),
new Rectangle(new Point(0, scroll_y),
@@ -185,7 +185,7 @@
if (scroll_y != 0)
{
- surf.Blit(starfield_layers[i],
+ surf.Blit(starfieldLayers[i],
new Rectangle(new Point(0, Painter.ScreenResY - scroll_y),
new Size(Painter.ScreenResX - scroll_x, scroll_y)),
new Rectangle(new Point(scroll_x, 0),
@@ -194,7 +194,7 @@
if (scroll_x != 0 || scroll_y != 0)
{
- surf.Blit(starfield_layers[i],
+ surf.Blit(starfieldLayers[i],
new Rectangle(new Point(Painter.ScreenResX - scroll_x, Painter.ScreenResY - scroll_y),
new Size(scroll_x, scroll_y)),
new Rectangle(new Point(0, 0),
@@ -296,18 +296,19 @@
{
Spk starfield = (Spk)this.Mpq.GetResource("parallax\\star.spk");
- starfield_layers = new Surface[starfield.Layers.Length];
- for (int i = 0; i < starfield_layers.Length; i++)
+ starfieldLayers = new Surface[starfield.Layers.Length];
+ for (int i = 0; i < starfieldLayers.Length; i++)
{
- starfield_layers[i] = new Surface(Painter.ScreenResX, Painter.ScreenResY);
+ starfieldLayers[i] = new Surface(Painter.ScreenResX, Painter.ScreenResY);
- starfield_layers[i].TransparentColor = Color.Black;
+ starfieldLayers[i].TransparentColor = Color.Black;
+ starfieldLayers[i].Transparent = true;
for (int o = 0; o < starfield.Layers[i].Objects.Length; o++)
{
ParallaxObject obj = starfield.Layers[i].Objects[o];
- starfield_layers[i].Fill(new Rectangle(new Point(obj.X, obj.Y), new Size(2, 2)),
+ starfieldLayers[i].Fill(new Rectangle(new Point(obj.X, obj.Y), new Size(2, 2)),
Color.White);
}
}
Modified: trunk/scsharp/src/SCSharpLib/UI/GuiUtil.cs
===================================================================
--- trunk/scsharp/src/SCSharpLib/UI/GuiUtil.cs 2007-05-18 19:59:26 UTC (rev 1379)
+++ trunk/scsharp/src/SCSharpLib/UI/GuiUtil.cs 2007-05-18 20:45:34 UTC (rev 1380)
@@ -239,6 +239,7 @@
Surface surf = new Surface(text_width, text_height);
surf.TransparentColor = Color.Black;
+ surf.Transparent = true;
/* the draw it */
x = y = 0;
Modified: trunk/scsharp/src/SCSharpLib/UI/LabelElement.cs
===================================================================
--- trunk/scsharp/src/SCSharpLib/UI/LabelElement.cs 2007-05-18 19:59:26 UTC (rev 1379)
+++ trunk/scsharp/src/SCSharpLib/UI/LabelElement.cs 2007-05-18 20:45:34 UTC (rev 1380)
@@ -78,6 +78,7 @@
surf.Blit(textSurf, new Point(x, 0));
surf.TransparentColor = Color.Black /* XXX */;
+ surf.Transparent = true;
return surf;
}
}
Modified: trunk/scsharp/src/SCSharpLib/UI/ListBoxElement.cs
===================================================================
--- trunk/scsharp/src/SCSharpLib/UI/ListBoxElement.cs 2007-05-18 19:59:26 UTC (rev 1379)
+++ trunk/scsharp/src/SCSharpLib/UI/ListBoxElement.cs 2007-05-18 20:45:34 UTC (rev 1380)
@@ -318,6 +318,7 @@
}
surf.TransparentColor = Color.Black; /* XXX */
+ surf.Transparent = true;
return surf;
}
Modified: trunk/scsharp/src/SCSharpLib/UI/Pcx.cs
===================================================================
--- trunk/scsharp/src/SCSharpLib/UI/Pcx.cs 2007-05-18 19:59:26 UTC (rev 1379)
+++ trunk/scsharp/src/SCSharpLib/UI/Pcx.cs 2007-05-18 20:45:34 UTC (rev 1380)
@@ -50,7 +50,7 @@
ushort ymin;
ushort ymax;
- bool with_alpha;
+ bool withAlpha;
/// <summary>
///
@@ -60,11 +60,13 @@
/// <param name="transparentIndex"></param>
public void ReadFromStream(Stream stream, int translucentIndex, int transparentIndex)
{
- with_alpha = translucentIndex != -1 || transparentIndex != -1;
+ withAlpha = translucentIndex != -1 || transparentIndex != -1;
byte magic = Utilities.ReadByte(stream);
if (magic != 0x0A)
+ {
throw new Exception("stream is not a valid .pcx file");
+ }
/*version =*/
Utilities.ReadByte(stream);
@@ -138,14 +140,20 @@
data[idx + 3] = palette[value * 3 + 0];
data[idx + 2] = palette[value * 3 + 1];
data[idx + 1] = palette[value * 3 + 2];
- if (with_alpha)
+ if (withAlpha)
{
if (value == translucentIndex)
+ {
data[idx + 0] = 0xd0;
+ }
else if (value == transparentIndex)
+ {
data[idx + 0] = 0x00;
+ }
else
+ {
data[idx + 0] = 0xff;
+ }
}
idx += 4;
@@ -221,7 +229,7 @@
[CLSCompliant(false)]
public ushort Depth
{
- get { return (ushort)(with_alpha ? 32 : 24); }
+ get { return (ushort)(withAlpha ? 32 : 24); }
}
/// <summary>
@@ -230,7 +238,7 @@
[CLSCompliant(false)]
public ushort Stride
{
- get { return (ushort)(width * (3 + (with_alpha ? 1 : 0))); }
+ get { return (ushort)(width * (3 + (withAlpha ? 1 : 0))); }
}
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|