Skip to content

Commit

Permalink
Avoid Graphics.DrawImage outside Windows for now
Browse files Browse the repository at this point in the history
  • Loading branch information
tkzv committed Dec 26, 2018
1 parent 4367544 commit de7a5d9
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion MapView/CuboidSprite.cs
Expand Up @@ -59,17 +59,23 @@ internal CuboidSprite(SpriteCollection spriteset)
bool front,
bool red)
{
#if __MonoCS__
Pen p = new Pen( front ?
(red ? Color.Red : Color.Green):
(red ? Color.Purple : Color.Blue ), 2);
graphics.DrawRectangle (p, x, y, halfWidth * 2, halfHeight * 5);
#else
int id = 0;
if (front)
id = (red ? 3 : 5);
else
id = (red ? 0 : 2);

graphics.DrawImage(
_spriteset[id].Image,
x, y,
halfWidth * 2, // NOTE: the values for width and height
halfHeight * 5); // are based on a sprite that's 32x40.
#endif
}

internal void DrawTargeter(
Expand All @@ -78,11 +84,16 @@ internal CuboidSprite(SpriteCollection spriteset)
int halfWidth,
int halfHeight)
{
#if __MonoCS__
Pen p = new Pen( Color.Yellow, 5 );
graphics.DrawRectangle (p, x, y, halfWidth * 2, halfHeight * 5);
#else
graphics.DrawImage(
_spriteset[7].Image, // yellow targeter sprite
x, y,
halfWidth * 2, // NOTE: the values for width and height
halfHeight * 5); // are based on a sprite that's 32x40.
#endif
}
#endregion
}
Expand Down

0 comments on commit de7a5d9

Please sign in to comment.