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 DrawGrid(DevicePanel d) { Rectangle screen = d.GetScreen(); RSDKv5Color rcolor1 = Editor.Instance.EditorScene.EditorMetadata.BackgroundColor1; RSDKv5Color rcolor2 = Editor.Instance.EditorScene.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 / (TILE_BOX_SIZE * EditorLayer.TILE_SIZE); int end_x = Math.Min(DivideRoundUp(screen.X + screen.Width, TILE_BOX_SIZE * EditorLayer.TILE_SIZE), Editor.Instance.SceneWidth); int start_y = screen.Y / (TILE_BOX_SIZE * EditorLayer.TILE_SIZE); int end_y = Math.Min(DivideRoundUp(screen.Y + screen.Height, TILE_BOX_SIZE * EditorLayer.TILE_SIZE), Editor.Instance.Height); if (color2.A != 0) { for (int y = start_y; y < end_y; ++y) { for (int x = start_x; x < end_x; ++x) { d.DrawLine(x * EditorLayer.TILE_SIZE, y * EditorLayer.TILE_SIZE, x * EditorLayer.TILE_SIZE + EditorLayer.TILE_SIZE, y * EditorLayer.TILE_SIZE, System.Drawing.Color.Black); d.DrawLine(x * EditorLayer.TILE_SIZE, y * EditorLayer.TILE_SIZE, x * EditorLayer.TILE_SIZE, y * EditorLayer.TILE_SIZE + EditorLayer.TILE_SIZE, System.Drawing.Color.Black); //d.DrawLine(x * EditorLayer.TILE_SIZE + EditorLayer.TILE_SIZE, y * EditorLayer.TILE_SIZE + EditorLayer.TILE_SIZE, x * EditorLayer.TILE_SIZE + EditorLayer.TILE_SIZE, y * EditorLayer.TILE_SIZE, System.Drawing.Color.Black); //d.DrawLine(x * EditorLayer.TILE_SIZE + EditorLayer.TILE_SIZE, y * EditorLayer.TILE_SIZE + EditorLayer.TILE_SIZE, x * EditorLayer.TILE_SIZE, y * EditorLayer.TILE_SIZE + EditorLayer.TILE_SIZE, System.Drawing.Color.Black); } } } }
public SceneBGColorPickerTool(RSDKv5.Color A, RSDKv5.Color B) : this() { BackgroundColor1 = A; BackgroundColor2 = B; ColorPickerA.SelectedColor = ToMediaColor(A); ColorPickerB.SelectedColor = ToMediaColor(B); }
private System.Windows.Media.Color ToMediaColor(RSDKv5.Color value) { return(new System.Windows.Media.Color { R = value.R, A = value.A, B = value.B, G = value.G }); }
public void Draw(GLViewControl gl) { 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); // Draw with first color everything if (vb1 == null) { using (var c = new VBCreator()) { c.AddRectangle(new Rectangle(0, 0, width, height)); vb1 = c.GetVertices(); } } vb1.Draw(PrimitiveType.Quads, color1); if (color2.A != 0) { if (vb2 == null) { using (var c = new VBCreator()) { for (int y = 0; y < DivideRoundUp(height, BOX_SIZE * EditorLayer.TILE_SIZE); ++y) { for (int x = 0; x < DivideRoundUp(width, BOX_SIZE * EditorLayer.TILE_SIZE); ++x) { if ((x + y) % 2 == 1) { c.AddRectangle(new Rectangle(x * BOX_SIZE * EditorLayer.TILE_SIZE, y * BOX_SIZE * EditorLayer.TILE_SIZE, BOX_SIZE * EditorLayer.TILE_SIZE, BOX_SIZE * EditorLayer.TILE_SIZE)); } } } vb2 = c.GetVertices(); } } GL.PushMatrix(); GL.Translate(0, 0, Editor.LAYER_DEPTH / 2); vb2.Draw(PrimitiveType.Quads, color2); GL.PopMatrix(); } }