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 (!Visible) { return; } bool LoopX = true; bool DrawLined = Editor.Instance.EditLayer != this && Layer.ScrollIndexes.Length > 1; int Transperncy = (Editor.Instance.EditLayer != null && Editor.Instance.EditLayer != this) ? 0x32 : 0xFF; Rectangle screen = d.GetScreen(); int alteredX = screen.X * Layer.ScrollingInfo[0].RelativeX / 0x100; int alteredY = screen.Y * Layer.RelativeY / 0x100; int start_x = alteredX / (TILES_CHUNK_SIZE * TILE_SIZE); int end_x = Math.Min(DivideRoundUp(alteredX + screen.Width, TILES_CHUNK_SIZE * TILE_SIZE), TileChunksTextures[0].Length); if (LoopX) { end_x = DivideRoundUp(alteredX + screen.Width, TILES_CHUNK_SIZE * TILE_SIZE); } int start_y = alteredY / (TILES_CHUNK_SIZE * TILE_SIZE); int end_y = Math.Min(DivideRoundUp(alteredY + screen.Height, TILES_CHUNK_SIZE * TILE_SIZE), TileChunksTextures.Length); for (int y = start_y; y < end_y; y++) { for (int oldx = start_x; oldx < end_x; oldx++) { int x = oldx % TileChunksTextures[0].Length; Rectangle rect = GetTilesChunkArea(x, y); rect.X += oldx / TileChunksTextures[0].Length * TileChunksTextures[0].Length * TILES_CHUNK_SIZE; if (SelectedTiles.IsChunkUsed(x, y) || TempSelectionTiles.IsChunkUsed(x, y)) { // draw one by one DrawTilesChunk(d, x, y, Transperncy); } else { d.DrawBitmap(GetTilesChunkTexture(d, x, y), rect.X * TILE_SIZE - screen.X * Layer.ScrollingInfo[0].RelativeX / 0x100 + screen.X, rect.Y * TILE_SIZE - screen.Y * Layer.RelativeY / 0x100 + screen.Y, rect.Width * TILE_SIZE, rect.Height * TILE_SIZE, false, Transperncy); } DrawSelectedTiles(d, x, y, Transperncy); } } }