Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
 public ActorTool(ActorTemplate actor)
 {
     this.Actor = actor;
 }
Ejemplo n.º 4
0
		public void SetWaypoint(WaypointTemplate waypoint) { Brush = null; Actor = null; Resource = null; Waypoint = waypoint; }
Ejemplo n.º 5
0
		public void SetResource(ResourceTemplate resource) { Brush = null; Actor = null; Resource = resource; Waypoint = null; }
Ejemplo n.º 6
0
		public void SetActor(ActorTemplate actor) { Brush = null; Actor = actor; Resource = null; Waypoint = null; }
Ejemplo n.º 7
0
		public void SetBrush(BrushTemplate brush) { Actor = null; Brush = brush; Resource = null; Waypoint = null; }
Ejemplo n.º 8
0
		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);
		}
Ejemplo n.º 9
0
		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();
		}
Ejemplo n.º 10
0
		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);
		}
Ejemplo n.º 11
0
		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);
		}
Ejemplo n.º 12
0
		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);
		}
Ejemplo n.º 13
0
		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);
		}
Ejemplo n.º 14
0
		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);
		}
Ejemplo n.º 15
0
		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();
		}
Ejemplo n.º 16
0
		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()));
		}
Ejemplo n.º 17
0
        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);
        }
Ejemplo n.º 18
0
		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 );
		}
Ejemplo n.º 19
0
		public ActorTool(ActorTemplate actor) { this.actorTemplate = actor; }
Ejemplo n.º 20
0
		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;
		}