/// <summary> /// Draws the combos in the editor. /// </summary> public void Draw() { if (patterns == null || tiles == null) return; b.Begin(patterns.PatternImage, tiles); for(int row = 0; row < 16; row++) { for(int combo = 0; combo < 16; combo++ ) { int comboIndex = combo + (row + _ScrollPos)* 16; b.BlitTile(_Combos[comboIndex].GetByte(0), combo * 2, row * 2, (byte)_PaletteTable); b.BlitTile(_Combos[comboIndex].GetByte(1), combo * 2 + 1, row * 2, (byte)_PaletteTable); b.BlitTile(_Combos[comboIndex].GetByte(2), combo * 2, row * 2 + 1, (byte)_PaletteTable); b.BlitTile(_Combos[comboIndex].GetByte(3), combo * 2 + 1, row * 2 + 1, (byte)_PaletteTable); } } b.End(); this.BackgroundImage = tiles; Invalidate(); }
/////// <summary> /////// Queues an async render. Renders the screen in memory, additionally rendering any doors and enemies specified. /////// </summary> /////// <param name="b_UTF32">The Blitter object used for rendering.</param> /////// <param name="dest">The brush to render to.</param> /////// <param name="enemies">An array of enemies to be rendered, or null if there are no enemies.</param> /////// <param name="doors">An array of doors to render, or null if there are no doors.</param> /////// <param name="showPhysics">If true then the screen will be drawn such that the phyics of the tiles are appearent. Sprites, doors, currentLevelItems, and the selection will be omitted.</param> ////public Editroid.Graphic.ScreenRenderer.RenderTask BeginRender(Blitter b, Bitmap dest, EnemyInstance[] sprites, DoorInstance[] doors, bool showPhysics, bool invalidate) { //// Editroid.Graphic.ScreenRenderer.RenderTask task = new Editroid.Graphic.ScreenRenderer.RenderTask(this, b, dest, sprites, doors, showPhysics, invalidate); //// RenderThread.QueueTask(task, true); //// return task; ////} /// <summary> /// Renders the screen in memory, additionally rendering any doors and enemies specified. /// </summary> /// <param name="b">The Blitter object used for rendering.</param> /// <param name="dest">The brush to render to.</param> /// <param name="enemies">An array of enemies to be rendered, or null if there are no enemies.</param> /// <param name="doors">An array of doors to render, or null if there are no doors.</param> /// <param name="showPhysics">If true then the screen will be drawn such that the phyics of the tiles are appearent. Sprites, doors, currentLevelItems, and the selection will be omitted.</param> public void Render(Blitter b, Bitmap dest, IList <EnemyInstance> sprites, IList <DoorInstance> doors, bool showPhysics) { using (b.Begin(Level.Patterns.PatternImage, dest)) { ////if (showPhysics) { //// RenderPhysics(b); //// RenderEnemies(b, sprites); ////} else { //// RenderStandard(b); //// RenderEnemies(b, sprites); //// RenderDoors(b, doors, selectedDoor); ////} RenderStandard(b); if (showPhysics) { RenderPhysics(b); } RenderEnemies(b, sprites); RenderDoors(b, doors, selectedDoor); RenderMiscSprites(b); } }
public override void DoWork() { ColorPalette bitmapPalette = dest.Palette; NesPalette bgPalette = display._Level.BgPalette; NesPalette spritePalette = display._Level.SpritePalette; // Todo: alt pal support //if (display..UseAltPalette && (display._Level.LevelIdentifier == LevelIndex.Brinstar || LevelData.LevelIdentifier == LevelIndex.Norfair)) // bgPalette = display._Level.BgAltPalette; // Load palettes twice bgPalette.ApplyTable(bitmapPalette.Entries); bgPalette.ApplyTable(bitmapPalette.Entries, 16); spritePalette.ApplyTable(bitmapPalette.Entries, 32); spritePalette.ApplyTable(bitmapPalette.Entries, 48); // Invert second paletteIndex for selections ApplyHighlightFilter(bitmapPalette); dest.Palette = bitmapPalette; bitmapPalette.Entries[NesPalette.HighlightEntry] = SystemColors.Highlight; b.Begin(display.Level.Patterns.PatternImage, dest); if (showPhysics) { display.RenderPhysics(b); display.RederEnemies(b, sprites); } else { for (int x = 0; x < 32; x++) { for (int y = 0; y < 30; y++) { int tile = display.tiles[x, y]; b.BlitTile(tile, x, y, display.colors[x, y]); } } display.RederEnemies(b, sprites); if (doors != null) { foreach (DoorInstance d in doors) { byte pal = 9; if (d.Type == DoorType.Missile) { pal = 8; } else if (d.Type == DoorType.TenMissile) { pal = 10; } if (d.Side == DoorSide.Left) { Graphic.SpriteDefinition.LeftDoor.Draw(b, 2, 0xA, pal); } else { Graphic.SpriteDefinition.RightDoor.Draw(b, 0x1D, 0xA, pal); } } } } if (!showPhysics) { ////if (display.gameItem != null) //// display.gameItem.Draw(b); for (int i = 0; i < display._sprites.Count; i++) { SpriteListItem item = display._sprites[i]; item.SpriteDefinition.Draw(b, item.Location.X, item.Location.Y, (byte)(item.PaletteIndex)); } } b.End(); }