Controller Config - make a GamepadConfigPanel base class to build the NESGamePad from
This commit is contained in:
parent
2a2ce9891c
commit
f5700351c9
|
@ -166,6 +166,9 @@
|
||||||
<Compile Include="config\ControllerConfig.Designer.cs">
|
<Compile Include="config\ControllerConfig.Designer.cs">
|
||||||
<DependentUpon>ControllerConfig.cs</DependentUpon>
|
<DependentUpon>ControllerConfig.cs</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="config\ControllerConfig\GamepadConfigPanel.cs">
|
||||||
|
<SubType>Component</SubType>
|
||||||
|
</Compile>
|
||||||
<Compile Include="config\ControllerConfig\NESGamePad.cs">
|
<Compile Include="config\ControllerConfig\NESGamePad.cs">
|
||||||
<SubType>Component</SubType>
|
<SubType>Component</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
|
|
@ -0,0 +1,56 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using System.Drawing;
|
||||||
|
|
||||||
|
namespace BizHawk.MultiClient
|
||||||
|
{
|
||||||
|
class GamepadConfigPanel : Panel
|
||||||
|
{
|
||||||
|
public static List<string> buttons = new List<string>();
|
||||||
|
public int ControllerNumber = 1;
|
||||||
|
public bool Autofire = false;
|
||||||
|
|
||||||
|
public int InputMarginLeft = 0;
|
||||||
|
public int LabelPadding = 20;
|
||||||
|
|
||||||
|
public int MarginTop = 0;
|
||||||
|
public int Spacing = 30;
|
||||||
|
public int InputSize = 200;
|
||||||
|
|
||||||
|
public GamepadConfigPanel()
|
||||||
|
{
|
||||||
|
Size = new Size(174, 74);
|
||||||
|
this.BorderStyle = BorderStyle.None;
|
||||||
|
Startup();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Startup()
|
||||||
|
{
|
||||||
|
for (int i = 0; i < buttons.Count; i++)
|
||||||
|
{
|
||||||
|
int pos = i + 1;
|
||||||
|
|
||||||
|
InputWidget iw = new InputWidget();
|
||||||
|
iw.Location = new Point(InputMarginLeft, MarginTop + (pos * Spacing));
|
||||||
|
iw.Size = new Size(InputSize, 23);
|
||||||
|
Controls.Add(iw);
|
||||||
|
|
||||||
|
Label l = new Label();
|
||||||
|
l.Location = new Point(InputMarginLeft + InputSize + LabelPadding, MarginTop + (pos * Spacing) + 3);
|
||||||
|
l.Text = buttons[i];
|
||||||
|
Controls.Add(l);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual void Save()
|
||||||
|
{
|
||||||
|
for (int button = 0; button < 8; button++)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -7,104 +7,19 @@ using System.Drawing;
|
||||||
|
|
||||||
namespace BizHawk.MultiClient
|
namespace BizHawk.MultiClient
|
||||||
{
|
{
|
||||||
class NESGamePad : Panel
|
class NESGamePad : GamepadConfigPanel
|
||||||
{
|
{
|
||||||
public InputWidget UpBox = new InputWidget();
|
|
||||||
public InputWidget DownBox = new InputWidget();
|
|
||||||
public InputWidget LeftBox = new InputWidget();
|
|
||||||
public InputWidget RightBox = new InputWidget();
|
|
||||||
public InputWidget ABox = new InputWidget();
|
|
||||||
public InputWidget BBox = new InputWidget();
|
|
||||||
public InputWidget SelectBox = new InputWidget();
|
|
||||||
public InputWidget StartBox = new InputWidget();
|
|
||||||
|
|
||||||
public Label UpLabel = new Label();
|
|
||||||
public Label DownLabel = new Label();
|
|
||||||
public Label LeftLabel = new Label();
|
|
||||||
public Label RightLabel = new Label();
|
|
||||||
public Label ALabel = new Label();
|
|
||||||
public Label BLabel = new Label();
|
|
||||||
public Label SelectLabel = new Label();
|
|
||||||
public Label StartLabel = new Label();
|
|
||||||
|
|
||||||
public int ControllerNumber = 1;
|
|
||||||
public bool Autofire = false;
|
|
||||||
|
|
||||||
public NESGamePad()
|
public NESGamePad()
|
||||||
{
|
{
|
||||||
this.BorderStyle = BorderStyle.Fixed3D;
|
buttons = new List<string> { "Up", "Down", "Left", "Right", "A", "B", "Select", "Start" };
|
||||||
this.Size = new Size(174, 74);
|
|
||||||
ControllerNumber = 1;
|
|
||||||
|
|
||||||
UpBox.Location = new Point(15, 15);
|
|
||||||
UpBox.Size = new Size(200, 23);
|
|
||||||
|
|
||||||
DownBox.Location = new Point(15, 45);
|
|
||||||
DownBox.Size = new Size(200, 23);
|
|
||||||
|
|
||||||
LeftBox.Location = new Point(15, 75);
|
|
||||||
LeftBox.Size = new Size(200, 23);
|
|
||||||
|
|
||||||
RightBox.Location = new Point(15, 105);
|
|
||||||
RightBox.Size = new Size(200, 23);
|
|
||||||
|
|
||||||
ABox.Location = new Point(15, 135);
|
|
||||||
ABox.Size = new Size(200, 23);
|
|
||||||
|
|
||||||
BBox.Location = new Point(15, 165);
|
|
||||||
BBox.Size = new Size(200, 23);
|
|
||||||
|
|
||||||
SelectBox.Location = new Point(15, 195);
|
|
||||||
SelectBox.Size = new Size(200, 23);
|
|
||||||
|
|
||||||
StartBox.Location = new Point(15, 225);
|
|
||||||
StartBox.Size = new Size(200, 23);
|
|
||||||
|
|
||||||
UpLabel.Text = "Up";
|
|
||||||
UpLabel.Location = new Point(220, 18);
|
|
||||||
|
|
||||||
DownLabel.Text = "Down";
|
|
||||||
DownLabel.Location = new Point(220, 48);
|
|
||||||
|
|
||||||
LeftLabel.Text = "Left";
|
|
||||||
LeftLabel.Location = new Point(220, 78);
|
|
||||||
|
|
||||||
RightLabel.Text = "Right";
|
|
||||||
RightLabel.Location = new Point(220, 108);
|
|
||||||
|
|
||||||
ALabel.Text = "A";
|
|
||||||
ALabel.Location = new Point(220, 138);
|
|
||||||
|
|
||||||
BLabel.Text = "B";
|
|
||||||
BLabel.Location = new Point(220, 168);
|
|
||||||
|
|
||||||
SelectLabel.Text = "Select";
|
|
||||||
SelectLabel.Location = new Point(220, 198);
|
|
||||||
|
|
||||||
StartLabel.Text = "Start";
|
|
||||||
StartLabel.Location = new Point(220, 228);
|
|
||||||
|
|
||||||
this.Controls.Add(this.UpBox);
|
|
||||||
this.Controls.Add(this.DownBox);
|
|
||||||
this.Controls.Add(this.LeftBox);
|
|
||||||
this.Controls.Add(this.RightBox);
|
|
||||||
this.Controls.Add(this.ABox);
|
|
||||||
this.Controls.Add(this.BBox);
|
|
||||||
this.Controls.Add(this.SelectBox);
|
|
||||||
this.Controls.Add(this.StartBox);
|
|
||||||
|
|
||||||
this.Controls.Add(this.UpLabel);
|
|
||||||
this.Controls.Add(this.DownLabel);
|
|
||||||
this.Controls.Add(this.LeftLabel);
|
|
||||||
this.Controls.Add(this.RightLabel);
|
|
||||||
this.Controls.Add(this.ALabel);
|
|
||||||
this.Controls.Add(this.BLabel);
|
|
||||||
this.Controls.Add(this.SelectLabel);
|
|
||||||
this.Controls.Add(this.StartLabel);
|
|
||||||
|
|
||||||
this.BorderStyle = BorderStyle.None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void Save()
|
||||||
|
{
|
||||||
|
for (int button = 0; button < 8; button++)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue