Virtual Pads - basic analog button control and wire up to NES arkanoid paddle
This commit is contained in:
parent
73ed79e270
commit
3208440225
|
@ -883,6 +883,12 @@
|
|||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="tools\VirtualPads\controls\IVirtualPadControl.cs" />
|
||||
<Compile Include="tools\VirtualPads\controls\VirtualPadAnalogButton.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="tools\VirtualPads\controls\VirtualPadAnalogButton.Designer.cs">
|
||||
<DependentUpon>VirtualPadAnalogButton.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="tools\VirtualPads\controls\VirtualPadAnalogStick.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
|
@ -1242,6 +1248,9 @@
|
|||
<EmbeddedResource Include="tools\TI83\TI83KeyPad.resx">
|
||||
<DependentUpon>TI83KeyPad.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="tools\VirtualPads\controls\VirtualPadAnalogButton.resx">
|
||||
<DependentUpon>VirtualPadAnalogButton.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="tools\VirtualPads\controls\VirtualPadAnalogStick.resx">
|
||||
<DependentUpon>VirtualPadAnalogStick.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
|
|
@ -58,7 +58,18 @@ namespace BizHawk.Client.EmuHawk
|
|||
Location = button.Location,
|
||||
XName = button.Name,
|
||||
YName = button.SecondaryNames[0],
|
||||
FireButton = button.SecondaryNames[1]
|
||||
FireButton = button.SecondaryNames[1],
|
||||
Size = button.TargetSize
|
||||
});
|
||||
break;
|
||||
case PadSchema.PadInputType.FloatSingle:
|
||||
Controls.Add(new VirtualPadAnalogButton
|
||||
{
|
||||
Name = button.Name,
|
||||
DisplayName = button.DisplayName,
|
||||
Location = button.Location,
|
||||
Size = button.TargetSize,
|
||||
MaxValue = button.MaxValue
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
|
88
BizHawk.Client.EmuHawk/tools/VirtualPads/controls/VirtualPadAnalogButton.Designer.cs
generated
Normal file
88
BizHawk.Client.EmuHawk/tools/VirtualPads/controls/VirtualPadAnalogButton.Designer.cs
generated
Normal file
|
@ -0,0 +1,88 @@
|
|||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
partial class VirtualPadAnalogButton
|
||||
{
|
||||
/// <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 Component 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.AnalogTrackBar = new System.Windows.Forms.TrackBar();
|
||||
this.DisplayNameLabel = new System.Windows.Forms.Label();
|
||||
this.ValueLabel = new System.Windows.Forms.Label();
|
||||
((System.ComponentModel.ISupportInitialize)(this.AnalogTrackBar)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// AnalogTrackBar
|
||||
//
|
||||
this.AnalogTrackBar.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.AnalogTrackBar.Location = new System.Drawing.Point(3, 3);
|
||||
this.AnalogTrackBar.Name = "AnalogTrackBar";
|
||||
this.AnalogTrackBar.Size = new System.Drawing.Size(299, 45);
|
||||
this.AnalogTrackBar.TabIndex = 0;
|
||||
this.AnalogTrackBar.ValueChanged += new System.EventHandler(this.AnalogTrackBar_ValueChanged);
|
||||
//
|
||||
// DisplayNameLabel
|
||||
//
|
||||
this.DisplayNameLabel.AutoSize = true;
|
||||
this.DisplayNameLabel.Location = new System.Drawing.Point(13, 51);
|
||||
this.DisplayNameLabel.Name = "DisplayNameLabel";
|
||||
this.DisplayNameLabel.Size = new System.Drawing.Size(33, 13);
|
||||
this.DisplayNameLabel.TabIndex = 1;
|
||||
this.DisplayNameLabel.Text = "Slider";
|
||||
//
|
||||
// ValueLabel
|
||||
//
|
||||
this.ValueLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.ValueLabel.AutoSize = true;
|
||||
this.ValueLabel.Location = new System.Drawing.Point(297, 7);
|
||||
this.ValueLabel.Name = "ValueLabel";
|
||||
this.ValueLabel.Size = new System.Drawing.Size(37, 13);
|
||||
this.ValueLabel.TabIndex = 2;
|
||||
this.ValueLabel.Text = "99999";
|
||||
//
|
||||
// VirtualPadAnalogButton
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.ValueLabel);
|
||||
this.Controls.Add(this.DisplayNameLabel);
|
||||
this.Controls.Add(this.AnalogTrackBar);
|
||||
this.Name = "VirtualPadAnalogButton";
|
||||
this.Size = new System.Drawing.Size(338, 74);
|
||||
this.Load += new System.EventHandler(this.VirtualPadAnalogButton_Load);
|
||||
((System.ComponentModel.ISupportInitialize)(this.AnalogTrackBar)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TrackBar AnalogTrackBar;
|
||||
private System.Windows.Forms.Label DisplayNameLabel;
|
||||
private System.Windows.Forms.Label ValueLabel;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,75 @@
|
|||
using System;
|
||||
using System.Windows.Forms;
|
||||
using System.Drawing;
|
||||
|
||||
using BizHawk.Client.Common;
|
||||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
public partial class VirtualPadAnalogButton : UserControl, IVirtualPadControl
|
||||
{
|
||||
private string _displayName = string.Empty;
|
||||
private int _maxValue = 0;
|
||||
|
||||
public VirtualPadAnalogButton()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void VirtualPadAnalogButton_Load(object sender, EventArgs e)
|
||||
{
|
||||
DisplayNameLabel.Text = DisplayName;
|
||||
ValueLabel.Text = AnalogTrackBar.Value.ToString();
|
||||
|
||||
}
|
||||
|
||||
public string DisplayName
|
||||
{
|
||||
get
|
||||
{
|
||||
return _displayName;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_displayName = value ?? string.Empty;
|
||||
if (DisplayNameLabel != null)
|
||||
{
|
||||
DisplayNameLabel.Text = _displayName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int MaxValue
|
||||
{
|
||||
get
|
||||
{
|
||||
return _maxValue;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_maxValue = value;
|
||||
if (AnalogTrackBar != null)
|
||||
{
|
||||
AnalogTrackBar.Maximum = _maxValue;
|
||||
AnalogTrackBar.TickFrequency = _maxValue / 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO
|
||||
public void Clear()
|
||||
{
|
||||
}
|
||||
|
||||
private void AnalogTrackBar_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
ValueLabel.Text = AnalogTrackBar.Value.ToString();
|
||||
Refresh();
|
||||
Global.StickyXORAdapter.SetFloat(Name, AnalogTrackBar.Value);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,120 @@
|
|||
<?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>
|
|
@ -28,6 +28,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
case "Zapper":
|
||||
schemaL = Zapper(1);
|
||||
break;
|
||||
case "ArkanoidNES":
|
||||
schemaL = ArkanoidPaddle(1);
|
||||
break;
|
||||
}
|
||||
|
||||
if (schemaL != null)
|
||||
|
@ -50,6 +53,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
case "Zapper":
|
||||
schemaR = Zapper(2);
|
||||
break;
|
||||
case "ArkanoidNES":
|
||||
schemaR = ArkanoidPaddle(2);
|
||||
break;
|
||||
}
|
||||
|
||||
if (schemaR != null)
|
||||
|
@ -179,13 +185,36 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
|
||||
// TODO
|
||||
private static PadSchema ArkanoidPaddle()
|
||||
private static PadSchema ArkanoidPaddle(int controller)
|
||||
{
|
||||
return new PadSchema();
|
||||
return new PadSchema
|
||||
{
|
||||
IsConsole = false,
|
||||
DefaultSize = new Size(380, 110),
|
||||
Buttons = new[]
|
||||
{
|
||||
new PadSchema.ButtonScema
|
||||
{
|
||||
Name = "P" + controller + " Paddle",
|
||||
DisplayName = "Arkanoid Paddle",
|
||||
Location = new Point(14, 2),
|
||||
Type = PadSchema.PadInputType.FloatSingle,
|
||||
TargetSize = new Size(375, 75),
|
||||
MaxValue = 160
|
||||
},
|
||||
new PadSchema.ButtonScema
|
||||
{
|
||||
Name = "P" + controller + " Fire",
|
||||
DisplayName = "Fire",
|
||||
Location = new Point(14, 80),
|
||||
Type = PadSchema.PadInputType.Boolean
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// TODO
|
||||
private static PadSchema PowerPad()
|
||||
private static PadSchema PowerPad(int controller)
|
||||
{
|
||||
return new PadSchema();
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
public Bitmap Icon { get; set; }
|
||||
public Size TargetSize { get; set; } // Specifically for TargetedPair, specifies the screen size
|
||||
public string[] SecondaryNames { get; set; } // Any other buttons necessary to operate (such as the Y axis, fire buttons, etc
|
||||
public int MaxValue { get; set; } // For non-boolean values, specifies the maximum value the button allows
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue