public GraphicsWindow(GraphicsService graphicsService, TileService tileService, PalettesService palettesService) { InitializeComponent(); _graphicsService = graphicsService; _tileService = tileService; _paletteService = palettesService; _graphicsAccessor = new GraphicsAccessor(_graphicsService.GetTilesAtAddress(0)); _graphicsRenderer = new GraphicsSetRender(_graphicsAccessor); _blockRenderer = new BlockRenderer(); Dpi dpi = this.GetDpi(); _graphicsBitmap = new WriteableBitmap(128, 128, dpi.X, dpi.Y, PixelFormats.Bgra32, null); _editorBitmap = new WriteableBitmap(16, 16, dpi.X, dpi.Y, PixelFormats.Bgra32, null); PatternTable.Source = _graphicsBitmap; EditorImage.Source = _editorBitmap; LoadPalettes(); GraphicsType.SelectedIndex = LayoutOrder.SelectedIndex = 0; _paletteService.PalettesChanged += _paletteService_PalettesChanged; }
private void UpdateGraphics(int address) { if (address < 0) { GraphicsAddress.Text = "0"; address = 0; } if (showOverlays && address > 0x2000) { GraphicsAddress.Text = "2000"; address = 0x2000; } if (address > 0x3F000) { GraphicsAddress.Text = "3F000"; address = 0x3F000; } if (showOverlays) { _graphicsAccessor.SetFullTable(_graphicsService.GetExtraTilesAtAddress(address)); } else { _graphicsAccessor.SetFullTable(_graphicsService.GetTilesAtAddress(address)); } _graphicsRenderer.Update(); CopyTilesToEditor(); UpdateGraphics(); UpdateEditor(); }