Apply current code style to Bizware.Test
including enabling NRTs and minifying TestForm w/o Designer
This commit is contained in:
parent
d1205fa807
commit
778098e8b7
|
@ -5,7 +5,6 @@
|
||||||
<Import Project="../MainSlnExecutable.props" />
|
<Import Project="../MainSlnExecutable.props" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<DefineConstants>$(DefineConstants);EXE_PROJECT</DefineConstants>
|
<DefineConstants>$(DefineConstants);EXE_PROJECT</DefineConstants>
|
||||||
<Nullable>disable</Nullable>
|
|
||||||
<OutputPath>$(ProjectDir)bin<!--/$(Configuration)/$(TargetFramework)--></OutputPath>
|
<OutputPath>$(ProjectDir)bin<!--/$(Configuration)/$(TargetFramework)--></OutputPath>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using System.Threading;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
using BizHawk.Bizware.BizwareGL;
|
using BizHawk.Bizware.BizwareGL;
|
||||||
|
@ -11,7 +12,7 @@ using BizHawk.Client.EmuHawk;
|
||||||
|
|
||||||
namespace BizHawk.Bizware.Test
|
namespace BizHawk.Bizware.Test
|
||||||
{
|
{
|
||||||
class Program
|
public static class Program
|
||||||
{
|
{
|
||||||
static Program()
|
static Program()
|
||||||
{
|
{
|
||||||
|
@ -21,7 +22,7 @@ namespace BizHawk.Bizware.Test
|
||||||
{
|
{
|
||||||
var firstAsm = Array.Find(AppDomain.CurrentDomain.GetAssemblies(), asm => asm.FullName == args.Name);
|
var firstAsm = Array.Find(AppDomain.CurrentDomain.GetAssemblies(), asm => asm.FullName == args.Name);
|
||||||
if (firstAsm is not null) return firstAsm;
|
if (firstAsm is not null) return firstAsm;
|
||||||
var guessFilename = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "dll", $"{new AssemblyName(args.Name).Name}.dll");
|
var guessFilename = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!, "dll", $"{new AssemblyName(args.Name).Name}.dll");
|
||||||
return File.Exists(guessFilename) ? Assembly.LoadFile(guessFilename) : null;
|
return File.Exists(guessFilename) ? Assembly.LoadFile(guessFilename) : null;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -29,29 +30,41 @@ namespace BizHawk.Bizware.Test
|
||||||
|
|
||||||
public static void Main() => RunTest();
|
public static void Main() => RunTest();
|
||||||
|
|
||||||
|
private sealed class TestForm : Form
|
||||||
|
{
|
||||||
|
public TestForm()
|
||||||
|
{
|
||||||
|
SuspendLayout();
|
||||||
|
AutoScaleDimensions = new(6F, 13F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new(292, 273);
|
||||||
|
Name = "TestForm";
|
||||||
|
Text = "TestForm";
|
||||||
|
ResumeLayout();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static void RunTest()
|
private static void RunTest()
|
||||||
{
|
{
|
||||||
IGL igl = new IGL_TK(2, 0, false);
|
IGL igl = new IGL_TK(2, 0, false);
|
||||||
|
ArtManager am = new(igl);
|
||||||
List<Art> testArts = new List<Art>();
|
var testArts = typeof(Program).Assembly.GetManifestResourceNames().Where(s => s.Contains("flame"))
|
||||||
ArtManager am = new ArtManager(igl);
|
.Select(s => am.LoadArt(ReflectionCache.EmbeddedResourceStream(s.Substring(21)))) // ReflectionCache adds back the prefix
|
||||||
foreach (var name in typeof(Program).Assembly.GetManifestResourceNames())
|
.ToList();
|
||||||
if (name.Contains("flame"))
|
var smile = am.LoadArt(ReflectionCache.EmbeddedResourceStream("TestImages.smile.png"));
|
||||||
testArts.Add(am.LoadArt(typeof(Program).Assembly.GetManifestResourceStream(name)));
|
am.Close();
|
||||||
var smile = am.LoadArt(typeof(Program).Assembly.GetManifestResourceStream("BizHawk.Bizware.Test.TestImages.smile.png"));
|
|
||||||
am.Close(true);
|
|
||||||
StringRenderer sr;
|
StringRenderer sr;
|
||||||
using (var xml = typeof(Program).Assembly.GetManifestResourceStream("BizHawk.Bizware.Test.TestImages.courier16px.fnt"))
|
using (var xml = ReflectionCache.EmbeddedResourceStream("TestImages.courier16px.fnt"))
|
||||||
using (var tex = typeof(Program).Assembly.GetManifestResourceStream("BizHawk.Bizware.Test.TestImages.courier16px_0.png"))
|
using (var tex = ReflectionCache.EmbeddedResourceStream("TestImages.courier16px_0.png"))
|
||||||
|
{
|
||||||
sr = new StringRenderer(igl, xml, tex);
|
sr = new StringRenderer(igl, xml, tex);
|
||||||
|
}
|
||||||
|
|
||||||
GuiRenderer gr = new GuiRenderer(igl);
|
GuiRenderer gr = new(igl);
|
||||||
|
|
||||||
TestForm tf = new TestForm();
|
RetainedGraphicsControl? c = new(igl) { Dock = DockStyle.Fill };
|
||||||
RetainedGraphicsControl c = new RetainedGraphicsControl(igl);
|
TestForm tf = new() { Controls = { c } };
|
||||||
tf.Controls.Add(c);
|
tf.FormClosing += (_, _) =>
|
||||||
c.Dock = System.Windows.Forms.DockStyle.Fill;
|
|
||||||
tf.FormClosing += (object sender, System.Windows.Forms.FormClosingEventArgs e) =>
|
|
||||||
{
|
{
|
||||||
tf.Controls.Remove(c);
|
tf.Controls.Remove(c);
|
||||||
c.Dispose();
|
c.Dispose();
|
||||||
|
@ -59,12 +72,14 @@ namespace BizHawk.Bizware.Test
|
||||||
};
|
};
|
||||||
tf.Show();
|
tf.Show();
|
||||||
|
|
||||||
//tf.Paint += (object sender, PaintEventArgs e) => c.Refresh();
|
#if false
|
||||||
|
tf.Paint += (_, _) => c.Refresh();
|
||||||
|
#endif
|
||||||
|
|
||||||
c.SetVsync(false);
|
c.SetVsync(false);
|
||||||
|
|
||||||
// create a render target
|
// create a render target
|
||||||
RenderTarget rt = igl.CreateRenderTarget(60, 60);
|
var rt = igl.CreateRenderTarget(60, 60);
|
||||||
rt.Bind();
|
rt.Bind();
|
||||||
igl.SetClearColor(Color.Blue);
|
igl.SetClearColor(Color.Blue);
|
||||||
igl.Clear(ClearBufferMask.ColorBufferBit);
|
igl.Clear(ClearBufferMask.ColorBufferBit);
|
||||||
|
@ -73,35 +88,32 @@ namespace BizHawk.Bizware.Test
|
||||||
gr.End();
|
gr.End();
|
||||||
rt.Unbind();
|
rt.Unbind();
|
||||||
|
|
||||||
Texture2d rttex2d = igl.LoadTexture(rt.Texture2d.Resolve());
|
var rttex2d = igl.LoadTexture(rt.Texture2d.Resolve());
|
||||||
|
|
||||||
// test retroarch shader
|
// test retroarch shader
|
||||||
RenderTarget rt2 = igl.CreateRenderTarget(240, 240);
|
var rt2 = igl.CreateRenderTarget(240, 240);
|
||||||
rt2.Bind();
|
rt2.Bind();
|
||||||
igl.SetClearColor(Color.CornflowerBlue);
|
igl.SetClearColor(Color.CornflowerBlue);
|
||||||
igl.Clear(ClearBufferMask.ColorBufferBit);
|
igl.Clear(ClearBufferMask.ColorBufferBit);
|
||||||
RetroShader shader;
|
RetroShader shader;
|
||||||
using (var stream = typeof(Program).Assembly.GetManifestResourceStream("BizHawk.Bizware.Test.TestImages.4xSoft.glsl"))
|
using (var stream = ReflectionCache.EmbeddedResourceStream("TestImages.4xSoft.glsl"))
|
||||||
shader = new RetroShader(igl, new System.IO.StreamReader(stream).ReadToEnd());
|
{
|
||||||
|
shader = new(igl, new StreamReader(stream).ReadToEnd());
|
||||||
|
}
|
||||||
igl.SetBlendState(igl.BlendNoneCopy);
|
igl.SetBlendState(igl.BlendNoneCopy);
|
||||||
shader.Run(rttex2d, new Size(60, 60), new Size(240, 240), true);
|
shader.Run(rttex2d, new Size(60, 60), new Size(240, 240), true);
|
||||||
|
|
||||||
|
var running = true;
|
||||||
bool running = true;
|
c.MouseClick += (_, args) =>
|
||||||
c.MouseClick += (object sender, MouseEventArgs e) =>
|
|
||||||
{
|
{
|
||||||
if(e.Button == MouseButtons.Left)
|
if (args.Button == MouseButtons.Left) running ^= true;
|
||||||
running ^= true;
|
else if (args.Button == MouseButtons.Right) c.Retain ^= true;
|
||||||
if (e.Button == MouseButtons.Right)
|
|
||||||
c.Retain ^= true;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
DateTime start = DateTime.Now;
|
var start = DateTime.Now;
|
||||||
int wobble = 0;
|
var wobble = 0;
|
||||||
for (; ; )
|
while (c is not null)
|
||||||
{
|
{
|
||||||
if (c == null) break;
|
|
||||||
|
|
||||||
if (running)
|
if (running)
|
||||||
{
|
{
|
||||||
c.Begin();
|
c.Begin();
|
||||||
|
@ -109,7 +121,7 @@ namespace BizHawk.Bizware.Test
|
||||||
igl.SetClearColor(Color.Red);
|
igl.SetClearColor(Color.Red);
|
||||||
igl.Clear(ClearBufferMask.ColorBufferBit);
|
igl.Clear(ClearBufferMask.ColorBufferBit);
|
||||||
|
|
||||||
int frame = (int)((DateTime.Now - start).TotalSeconds) % testArts.Count;
|
var frame = (int) (DateTime.Now - start).TotalSeconds % testArts.Count;
|
||||||
|
|
||||||
gr.Begin(c.ClientSize.Width, c.ClientSize.Height);
|
gr.Begin(c.ClientSize.Width, c.ClientSize.Height);
|
||||||
gr.SetBlendState(igl.BlendNormal);
|
gr.SetBlendState(igl.BlendNormal);
|
||||||
|
@ -142,13 +154,12 @@ namespace BizHawk.Bizware.Test
|
||||||
|
|
||||||
gr.End();
|
gr.End();
|
||||||
|
|
||||||
|
|
||||||
c.SwapBuffers();
|
c.SwapBuffers();
|
||||||
c.End();
|
c.End();
|
||||||
}
|
}
|
||||||
|
|
||||||
System.Windows.Forms.Application.DoEvents();
|
Application.DoEvents();
|
||||||
System.Threading.Thread.Sleep(0);
|
Thread.Sleep(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,48 +0,0 @@
|
||||||
namespace BizHawk.Bizware.Test
|
|
||||||
{
|
|
||||||
partial class TestForm
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Required designer variable.
|
|
||||||
/// </summary>
|
|
||||||
private System.ComponentModel.IContainer components = null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Clean up any resources being used.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing && (components != null))
|
|
||||||
{
|
|
||||||
components.Dispose();
|
|
||||||
}
|
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Windows Form Designer generated code
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Required method for Designer support - do not modify
|
|
||||||
/// the contents of this method with the code editor.
|
|
||||||
/// </summary>
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
this.SuspendLayout();
|
|
||||||
//
|
|
||||||
// TestForm
|
|
||||||
//
|
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
||||||
this.ClientSize = new System.Drawing.Size(292, 273);
|
|
||||||
this.Name = "TestForm";
|
|
||||||
this.Text = "TestForm";
|
|
||||||
this.ResumeLayout(false);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,19 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Data;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
|
|
||||||
namespace BizHawk.Bizware.Test
|
|
||||||
{
|
|
||||||
public partial class TestForm : Form
|
|
||||||
{
|
|
||||||
public TestForm()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,120 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<root>
|
|
||||||
<!--
|
|
||||||
Microsoft ResX Schema
|
|
||||||
|
|
||||||
Version 2.0
|
|
||||||
|
|
||||||
The primary goals of this format is to allow a simple XML format
|
|
||||||
that is mostly human readable. The generation and parsing of the
|
|
||||||
various data types are done through the TypeConverter classes
|
|
||||||
associated with the data types.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
... ado.net/XML headers & schema ...
|
|
||||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
|
||||||
<resheader name="version">2.0</resheader>
|
|
||||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
|
||||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
|
||||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
|
||||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
|
||||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
|
||||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
|
||||||
</data>
|
|
||||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
|
||||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
|
||||||
<comment>This is a comment</comment>
|
|
||||||
</data>
|
|
||||||
|
|
||||||
There are any number of "resheader" rows that contain simple
|
|
||||||
name/value pairs.
|
|
||||||
|
|
||||||
Each data row contains a name, and value. The row also contains a
|
|
||||||
type or mimetype. Type corresponds to a .NET class that support
|
|
||||||
text/value conversion through the TypeConverter architecture.
|
|
||||||
Classes that don't support this are serialized and stored with the
|
|
||||||
mimetype set.
|
|
||||||
|
|
||||||
The mimetype is used for serialized objects, and tells the
|
|
||||||
ResXResourceReader how to depersist the object. This is currently not
|
|
||||||
extensible. For a given mimetype the value must be set accordingly:
|
|
||||||
|
|
||||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
|
||||||
that the ResXResourceWriter will generate, however the reader can
|
|
||||||
read any of the formats listed below.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.binary.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.soap.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
|
||||||
value : The object must be serialized into a byte array
|
|
||||||
: using a System.ComponentModel.TypeConverter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
-->
|
|
||||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
|
||||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:choice maxOccurs="unbounded">
|
|
||||||
<xsd:element name="metadata">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="assembly">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:attribute name="alias" type="xsd:string" />
|
|
||||||
<xsd:attribute name="name" type="xsd:string" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="data">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="resheader">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:choice>
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:schema>
|
|
||||||
<resheader name="resmimetype">
|
|
||||||
<value>text/microsoft-resx</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="version">
|
|
||||||
<value>2.0</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="reader">
|
|
||||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="writer">
|
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
</root>
|
|
Loading…
Reference in New Issue