public void Draw(DevicePanel d) { Rectangle screen = d.GetScreen(); RSDKv5Color rcolor1 = Editor.Instance.Scene.EditorMetadata.BackgroundColor1; RSDKv5Color rcolor2 = Editor.Instance.Scene.EditorMetadata.BackgroundColor2; Color color1 = Color.FromArgb(rcolor1.A, rcolor1.R, rcolor1.G, rcolor1.B); Color color2 = Color.FromArgb(rcolor2.A, rcolor2.R, rcolor2.G, rcolor2.B); int start_x = screen.X / (BOX_SIZE * EditorLayer.TILE_SIZE); int end_x = Math.Min(DivideRoundUp(screen.X + screen.Width, BOX_SIZE * EditorLayer.TILE_SIZE), Editor.Instance.SceneWidth); int start_y = screen.Y / (BOX_SIZE * EditorLayer.TILE_SIZE); int end_y = Math.Min(DivideRoundUp(screen.Y + screen.Height, BOX_SIZE * EditorLayer.TILE_SIZE), Editor.Instance.Height); // Draw with first color everything d.DrawRectangle(screen.X, screen.Y, screen.X + screen.Width, screen.Y + screen.Height, Color.FromArgb(0, 0, 0)); /* * if (color2.A != 0) { * for (int y = start_y; y < end_y; ++y) * { * for (int x = start_x; x < end_x; ++x) * { * //if ((x + y) % 2 == 1) d.DrawRectangle(x * BOX_SIZE * EditorLayer.TILE_SIZE, y * BOX_SIZE * EditorLayer.TILE_SIZE, (x + 1) * BOX_SIZE * EditorLayer.TILE_SIZE, (y + 1) * BOX_SIZE * EditorLayer.TILE_SIZE, color2); * } * } * } * //*/ }
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); } }