Revert nes nametable viewer hijacking

This commit is contained in:
adelikat 2014-08-05 02:26:30 +00:00
parent d5d2c87d68
commit 7efc567519
2 changed files with 7 additions and 51 deletions

View File

@ -37,7 +37,7 @@ namespace BizHawk.Client.EmuHawk
_nes = Global.Emulator as NES;
RefreshRate.Value = Global.Config.NESNameTableRefreshRate;
//Generate(true);
Generate(true);
}
#region Public API
@ -50,7 +50,7 @@ namespace BizHawk.Client.EmuHawk
if (Global.Emulator is NES)
{
_nes = Global.Emulator as NES;
//Generate(true);
Generate(true);
}
else
{
@ -62,8 +62,7 @@ namespace BizHawk.Client.EmuHawk
{
if (Global.Emulator is NES)
{
//(Global.Emulator as NES).ppu.NTViewCallback = _callback;
NameTableView.Invalidate();
(Global.Emulator as NES).ppu.NTViewCallback = _callback;
}
else
{

View File

@ -5,9 +5,6 @@ using System.Drawing.Imaging;
using BizHawk.Client.Common;
using BizHawk.Client.EmuHawk.WinFormExtensions;
using System.Text;
using System;
using BizHawk.Client.EmuHawk.CustomControls;
namespace BizHawk.Client.EmuHawk
{
@ -23,12 +20,12 @@ namespace BizHawk.Client.EmuHawk
Nametables = new Bitmap(pSize.Width, pSize.Height);
SetStyle(ControlStyles.AllPaintingInWmPaint, true);
SetStyle(ControlStyles.UserPaint, true);
SetStyle(ControlStyles.DoubleBuffer, false);
// SetStyle(ControlStyles.SupportsTransparentBackColor, false);
SetStyle(ControlStyles.DoubleBuffer, true);
SetStyle(ControlStyles.SupportsTransparentBackColor, true);
SetStyle(ControlStyles.Opaque, true);
Size = new Size(256, 224);
//BackColor = Color.Transparent;
//Paint += NameTableViewer_Paint;
BackColor = Color.Transparent;
Paint += NameTableViewer_Paint;
}
public enum WhichNametable
@ -38,46 +35,6 @@ namespace BizHawk.Client.EmuHawk
public WhichNametable Which = WhichNametable.NT_ALL;
protected override void OnPaintBackground(PaintEventArgs pevent)
{
}
protected override void OnPaint(PaintEventArgs e)
{
var font = this.Font;
StringBuilder sb = new StringBuilder(128);
Random r = new Random((int)DateTime.Now.Ticks);
for (int i = 0; i < 64; i++)
{
sb.Append((char)r.Next('a', 'z'));
}
string junk = sb.ToString();
using (var ntr = new NativeTextRenderer(this))
{
ntr.PrepDrawString(junk, font, Color.Black, new Point(0, 0));
ntr.DrawRectangle(0, 0, ClientRectangle.Right, ClientRectangle.Bottom);
for (int y = 0; y < 16; y++)
{
ntr.DrawString(junk, font, Color.Black, new Point(15, y * 30));
//e.Graphics.DrawString(sb.ToString(), this.Font, Brushes.Black, new Point(15, y * 30));
}
}
//e.Graphics.FillRectangle(Brushes.White, ClientRectangle);
//for (int y = 0; y < 16; y++)
//{
// e.Graphics.DrawString(junk, font, Brushes.Black, new Point(15, y * 30));
//}
//base.OnPaint(e);
}
private void NameTableViewer_Paint(object sender, PaintEventArgs e)
{
e.Graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor;