public void renderChars(int dataPtr) { m_wb = new WriteableBitmap(8 * 40, 8 * 25, 96, 96, PixelFormats.Bgra32, BitmapPalettes.WebPalette); int charCol = 1; // spriteCol.SelectedIndex; for (int y = 0; y < 25; ++y) { for (int x = 0; x < 40; ++x) { VICIIRenderer.renderChar(dataPtr, x, y, false, charCol, m_backgroundColour, m_mulCol0, m_mulCol1, m_wb); dataPtr += 8; } //x } // y canvas.Source = m_wb; }
private void renderScreen() { C64RAM ram = C64RAM.getInstace(); byte[] RAM = ram.getRAM(); m_wb = new WriteableBitmap(320, 200, 96, 96, PixelFormats.Bgra32, BitmapPalettes.WebPalette); for (int y = 0; y < 25; ++y) { int rowPtr = m_screenAddress + (y * 40); for (int x = 0; x < 40; ++x) { byte c = RAM[rowPtr + x]; int charAddress = m_charAddress + ((int)c * 8); VICIIRenderer.renderChar(charAddress, x, y, m_hiresOrMulti[x, y], m_charColour, m_backgroundColour, m_mulCol0, m_mulCol1, m_wb); } //x } //y canvas.Source = m_wb; }
private void canvas_MouseDown(object sender, MouseButtonEventArgs e) { if (e.LeftButton == MouseButtonState.Pressed && e.ClickCount == 2) { Point clickPoint = e.GetPosition(canvas); double x = clickPoint.X / 8.0; double y = clickPoint.Y / 8.0; int CharX = (int)Math.Floor(x); int CharY = (int)Math.Floor(y); m_hiresOrMulti[CharX, CharY] = !m_hiresOrMulti[CharX, CharY]; int CharPtr = m_screenAddress + (CharY * 40) + CharX; C64RAM ram = C64RAM.getInstace(); byte[] RAM = ram.getRAM(); int dataPtr = m_charAddress + (8 * RAM[CharPtr]); VICIIRenderer.renderChar(dataPtr, CharX, CharY, m_hiresOrMulti[CharX, CharY], m_charColour, m_backgroundColour, m_mulCol0, m_mulCol1, m_wb); } }
private void canvas_MouseDown(object sender, MouseButtonEventArgs e) { if (e.LeftButton == MouseButtonState.Pressed && e.ClickCount == 2) { Point clickPoint = e.GetPosition(canvas); double x = clickPoint.X / 8.0; double y = clickPoint.Y / 8.0; int CharX = (int)Math.Floor(x); int CharY = (int)Math.Floor(y); m_hiresOrMulti[CharX, CharY] = !m_hiresOrMulti[CharX, CharY]; int dataPtr = m_startAddress; dataPtr += CharY * (16 * 8); dataPtr += CharX * 8; int sprCol = spriteCol.SelectedIndex; VICIIRenderer.renderChar(dataPtr, CharX, CharY, m_hiresOrMulti[CharX, CharY], sprCol, m_backgroundColour, m_mulCol0, m_mulCol1, m_wb); } }