void DrawActorBorder(SGraphics g, CPos p, ActorTemplate t) { var centered = t.Appearance == null || !t.Appearance.RelativeToTopLeft; var drawPos = GetDrawPosition(p, t.Bitmap, centered); g.DrawRectangle(CordonPen, drawPos.X, drawPos.Y, t.Bitmap.Width * Zoom, t.Bitmap.Height * Zoom); }
public void DrawActor(SGraphics g, CPos p, ActorTemplate t, ColorPalette cp) { var centered = t.Appearance == null || !t.Appearance.RelativeToTopLeft; var actorPalette = cp; if (t.Appearance != null && t.Appearance.UseTerrainPalette) { actorPalette = Palette.AsSystemPalette(); } DrawImage(g, t.Bitmap, p, centered, actorPalette); }
public ActorTool(ActorTemplate actor) { this.Actor = actor; }
public void SetWaypoint(WaypointTemplate waypoint) { Brush = null; Actor = null; Resource = null; Waypoint = waypoint; }
public void SetResource(ResourceTemplate resource) { Brush = null; Actor = null; Resource = resource; Waypoint = null; }
public void SetActor(ActorTemplate actor) { Brush = null; Actor = actor; Resource = null; Waypoint = null; }
public void SetBrush(BrushTemplate brush) { Actor = null; Brush = brush; Resource = null; Waypoint = null; }
void DrawActorBorder(System.Drawing.Graphics g, int2 p, ActorTemplate t) { var centered = t.Appearance == null || !t.Appearance.RelativeToTopLeft; float OffsetX = centered ? t.Bitmap.Width / 2 - TileSet.TileSize / 2 : 0; float DrawX = TileSet.TileSize * p.X * Zoom + Offset.X - OffsetX; float OffsetY = centered ? t.Bitmap.Height / 2 - TileSet.TileSize / 2 : 0; float DrawY = TileSet.TileSize * p.Y * Zoom + Offset.Y - OffsetY; g.DrawRectangle(CordonPen, DrawX, DrawY, t.Bitmap.Width * Zoom, t.Bitmap.Height * Zoom); }
void Erase() { Actor = null; Brush = null; Resource = null; Waypoint = null; var key = Map.Actors.FirstOrDefault(a => a.Value.Location() == GetBrushLocation()); if (key.Key != null) Map.Actors.Remove(key.Key); if (Map.MapResources[GetBrushLocation().X, GetBrushLocation().Y].type != 0) { Map.MapResources[GetBrushLocation().X, GetBrushLocation().Y] = new TileReference<byte, byte>(); var ch = new int2((GetBrushLocation().X) / ChunkSize, (GetBrushLocation().Y) / ChunkSize); if (Chunks.ContainsKey(ch)) { Chunks[ch].Dispose(); Chunks.Remove(ch); } } var k = Map.Waypoints.FirstOrDefault(a => a.Value == GetBrushLocation()); if (k.Key != null) Map.Waypoints.Remove(k.Key); AfterChange(); }
void DrawActorBorder(SGraphics g, CPos p, ActorTemplate t) { var centered = t.Appearance == null || !t.Appearance.RelativeToTopLeft; var drawPos = GetDrawPosition(p, t.Bitmap, centered); g.DrawRectangle(CordonPen, drawPos.X, drawPos.Y, t.Bitmap.Width * Zoom, t.Bitmap.Height * Zoom); }
public void DrawActor(SGraphics g, CPos p, ActorTemplate t, ColorPalette cp) { var centered = t.Appearance == null || !t.Appearance.RelativeToTopLeft; var actorPalette = cp; if (t.Appearance != null && t.Appearance.UseTerrainPalette) actorPalette = Palette.AsSystemPalette(); DrawImage(g, t.Bitmap, p, centered, actorPalette); }
public void DrawActor(SGraphics g, int2 p, ActorTemplate t, ColorPalette cp) { var centered = t.Appearance == null || !t.Appearance.RelativeToTopLeft; DrawImage(g, t.Bitmap, p, centered, cp); }
void DrawActorBorder(System.Drawing.Graphics g, int2 p, ActorTemplate t) { float OffsetX = t.Centered ? t.Bitmap.Width / 2 - TileSet.TileSize / 2 : 0; float DrawX = TileSet.TileSize * p.X * Zoom + Offset.X - OffsetX; float OffsetY = t.Centered ? t.Bitmap.Height / 2 - TileSet.TileSize / 2 : 0; float DrawY = TileSet.TileSize * p.Y * Zoom + Offset.Y - OffsetY; g.DrawRectangle(CordonPen, DrawX, DrawY, t.Bitmap.Width * Zoom, t.Bitmap.Height * Zoom); }
void DrawActor(System.Drawing.Graphics g, int2 p, ActorTemplate t) { float OffsetX = t.Centered ? t.Bitmap.Width / 2 - TileSet.TileSize/2 : 0; float DrawX = TileSet.TileSize * p.X * Zoom + Offset.X - OffsetX; float OffsetY = t.Centered ? t.Bitmap.Height / 2 - TileSet.TileSize/2 : 0; float DrawY = TileSet.TileSize * p.Y * Zoom + Offset.Y - OffsetY; float width = t.Bitmap.Width * Zoom; float height = t.Bitmap.Height * Zoom; RectangleF sourceRect = new RectangleF(0, 0, t.Bitmap.Width, t.Bitmap.Height); RectangleF destRect = new RectangleF(DrawX, DrawY, width, height); g.DrawImage(t.Bitmap, destRect, sourceRect, GraphicsUnit.Pixel); }
void Erase() { // Crash preventing var BrushLocation = GetBrushLocation(); if (Map == null || BrushLocation.X >= Map.MapSize.X || BrushLocation.Y >= Map.MapSize.Y || BrushLocation.X < 0 || BrushLocation.Y < 0) return; Actor = null; Brush = null; Resource = null; Waypoint = null; var key = Map.Actors.FirstOrDefault(a => a.Value.Location() == BrushLocation); if (key.Key != null) Map.Actors.Remove(key.Key); if (Map.MapResources[BrushLocation.X, BrushLocation.Y].type != 0) { Map.MapResources[BrushLocation.X, BrushLocation.Y] = new TileReference<byte, byte>(); var ch = new int2((BrushLocation.X) / ChunkSize, (BrushLocation.Y) / ChunkSize); if (Chunks.ContainsKey(ch)) { Chunks[ch].Dispose(); Chunks.Remove(ch); } } var k = Map.Waypoints.FirstOrDefault(a => a.Value == BrushLocation); if (k.Key != null) Map.Waypoints.Remove(k.Key); AfterChange(); }
void DrawActor(System.Drawing.Graphics g, int2 p, ActorTemplate t) { g.DrawImage(t.Bitmap, ((24 * p + Offset - (t.Centered ? new int2(t.Bitmap.Width / 2 - 12, t.Bitmap.Height / 2 - 12) : int2.Zero)).ToPoint())); }
public void DrawActor(SGraphics g, CPos p, ActorTemplate t, ColorPalette cp) { var centered = t.Appearance == null || !t.Appearance.RelativeToTopLeft; DrawImage(g, t.Bitmap, p, centered, cp); }
void DrawActorBorder(System.Drawing.Graphics g, int2 p, ActorTemplate t) { var origin = (24 * p + Offset - (t.Centered ? new int2(t.Bitmap.Width / 2 - 12, t.Bitmap.Height / 2 - 12) : int2.Zero)).ToPoint(); g.DrawRectangle(CordonPen, origin.X, origin.Y, t.Bitmap.Width, t.Bitmap.Height ); }
public ActorTool(ActorTemplate actor) { this.actorTemplate = actor; }
void DrawActor(System.Drawing.Graphics g, int2 p, ActorTemplate t, ColorPalette cp) { var centered = t.Appearance == null || !t.Appearance.RelativeToTopLeft; float OffsetX = centered ? t.Bitmap.Width / 2 - TileSet.TileSize / 2 : 0; float DrawX = TileSet.TileSize * p.X * Zoom + Offset.X - OffsetX; float OffsetY = centered ? t.Bitmap.Height / 2 - TileSet.TileSize / 2 : 0; float DrawY = TileSet.TileSize * p.Y * Zoom + Offset.Y - OffsetY; float width = t.Bitmap.Width * Zoom; float height = t.Bitmap.Height * Zoom; RectangleF sourceRect = new RectangleF(0, 0, t.Bitmap.Width, t.Bitmap.Height); RectangleF destRect = new RectangleF(DrawX, DrawY, width, height); var restorePalette = t.Bitmap.Palette; if (cp != null) t.Bitmap.Palette = cp; g.DrawImage(t.Bitmap, destRect, sourceRect, GraphicsUnit.Pixel); if (cp != null) t.Bitmap.Palette = restorePalette; }