示例#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);
        }
示例#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);
        }
示例#3
0
 public ActorTool(ActorTemplate actor)
 {
     this.Actor = actor;
 }
示例#4
0
		public void SetWaypoint(WaypointTemplate waypoint) { Brush = null; Actor = null; Resource = null; Waypoint = waypoint; }
示例#5
0
		public void SetResource(ResourceTemplate resource) { Brush = null; Actor = null; Resource = resource; Waypoint = null; }
示例#6
0
		public void SetActor(ActorTemplate actor) { Brush = null; Actor = actor; Resource = null; Waypoint = null; }
示例#7
0
		public void SetBrush(BrushTemplate brush) { Actor = null; Brush = brush; Resource = null; Waypoint = null; }
示例#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);
		}
示例#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();
		}
示例#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);
		}
示例#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);
		}
示例#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);
		}
示例#13
0
文件: Surface.cs 项目: pdovy/OpenRA
		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);
		}
示例#14
0
文件: Surface.cs 项目: pdovy/OpenRA
		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);
		}
示例#15
0
文件: Surface.cs 项目: pdovy/OpenRA
		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();
		}
示例#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()));
		}
示例#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);
        }
示例#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 );
		}
示例#19
0
		public ActorTool(ActorTemplate actor) { this.actorTemplate = actor; }
示例#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;
		}