public void DrawTile(DevicePanel d, ushort tile, int x, int y, bool selected, int Transperncy) { bool flipX = ((tile >> 10) & 1) == 1; bool flipY = ((tile >> 11) & 1) == 1; int tsx = 0; int tsy = (tile & 0x3ff); if (Editor.Instance.StageTiles.Image.W > 16) { tsx = (tile & 0x3ff) & 0x1F; tsy = (tile & 0x3ff) >> 5; } d.DrawBitmap(Editor.Instance.StageTiles.Image.GetTexture(d._device, new Rectangle(tsx * TILE_SIZE, tsy * TILE_SIZE, TILE_SIZE, TILE_SIZE), flipX, flipY), x * TILE_SIZE, y * TILE_SIZE, TILE_SIZE, TILE_SIZE, selected, Transperncy); if (selected) { d.DrawLine(x * TILE_SIZE, y * TILE_SIZE, x * TILE_SIZE + TILE_SIZE, y * TILE_SIZE, System.Drawing.Color.Brown); d.DrawLine(x * TILE_SIZE, y * TILE_SIZE, x * TILE_SIZE, y * TILE_SIZE + TILE_SIZE, System.Drawing.Color.Brown); d.DrawLine(x * TILE_SIZE + TILE_SIZE, y * TILE_SIZE + TILE_SIZE, x * TILE_SIZE + TILE_SIZE, y * TILE_SIZE, System.Drawing.Color.Brown); d.DrawLine(x * TILE_SIZE + TILE_SIZE, y * TILE_SIZE + TILE_SIZE, x * TILE_SIZE, y * TILE_SIZE + TILE_SIZE, System.Drawing.Color.Brown); } }
public void Draw(DevicePanel d) { if (!d.IsObjectOnScreen(entity.X, entity.Y, NAME_BOX_WIDTH, NAME_BOX_HEIGHT)) { return; } Color color = Selected ? Color.MediumPurple : Color.MediumTurquoise; Color color2 = Color.DarkBlue; int Transparency = (Editor.Instance.EditLayer == null) ? 0xff : 0x32; int x = entity.X; int y = entity.Y; d.DrawRectangle(x, y, x + NAME_BOX_WIDTH, y + NAME_BOX_HEIGHT, Color.FromArgb(Transparency, color)); d.DrawLine(x, y, x + NAME_BOX_WIDTH, y, Color.FromArgb(Transparency, color2)); d.DrawLine(x, y, x, y + NAME_BOX_HEIGHT, Color.FromArgb(Transparency, color2)); d.DrawLine(x, y + NAME_BOX_HEIGHT, x + NAME_BOX_WIDTH, y + NAME_BOX_HEIGHT, Color.FromArgb(Transparency, color2)); d.DrawLine(x + NAME_BOX_WIDTH, y, x + NAME_BOX_WIDTH, y + NAME_BOX_HEIGHT, Color.FromArgb(Transparency, color2)); if (Editor.Instance.GetZoom() >= 1) { d.DrawTextSmall(String.Format("{0} (ID: {1})", entity.Definition?.ObjectName, 0), x + 2, y + 2, NAME_BOX_WIDTH - 4, Color.FromArgb(Transparency, Color.Black), true); } }