ControllerConfig object - automatically make columns if controller buttons don't fit in a single column, fix formatting of TI-83

This commit is contained in:
adelikat 2012-11-08 04:09:24 +00:00
parent b59d248cda
commit 027b56e861
3 changed files with 40 additions and 10 deletions

View File

@ -250,9 +250,7 @@
//
// ControllerImage
//
this.ControllerImage.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.ControllerImage.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.ControllerImage.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.ControllerImage.Image = global::BizHawk.MultiClient.Properties.Resources.NES_Controller;
this.ControllerImage.Location = new System.Drawing.Point(485, 37);
@ -1040,8 +1038,7 @@
//
// pictureBox7
//
this.pictureBox7.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
this.pictureBox7.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Right)));
this.pictureBox7.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.pictureBox7.Image = global::BizHawk.MultiClient.Properties.Resources.TI83_Controller;
@ -1385,9 +1382,12 @@
//
// TI83ControllerPanel
//
this.TI83ControllerPanel.Location = new System.Drawing.Point(12, 18);
this.TI83ControllerPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.TI83ControllerPanel.Location = new System.Drawing.Point(11, 8);
this.TI83ControllerPanel.Name = "TI83ControllerPanel";
this.TI83ControllerPanel.Size = new System.Drawing.Size(567, 404);
this.TI83ControllerPanel.Size = new System.Drawing.Size(567, 414);
this.TI83ControllerPanel.TabIndex = 1;
//
// ControllerConfig

View File

@ -32,6 +32,14 @@ namespace BizHawk.MultiClient
NESAutofire3Panel.LoadSettings(Global.Config.NESAutoController[2]);
NESAutofire4Panel.LoadSettings(Global.Config.NESAutoController[3]);
SNESController1Panel.Spacing = 25;
SNESController2Panel.Spacing = 25;
SNESController3Panel.Spacing = 25;
SNESController4Panel.Spacing = 25;
SNESAutofire1Panel.Spacing = 25;
SNESAutofire2Panel.Spacing = 25;
SNESAutofire3Panel.Spacing = 25;
SNESAutofire4Panel.Spacing = 25;
SNESController1Panel.LoadSettings(Global.Config.SNESController[0]);
SNESController2Panel.LoadSettings(Global.Config.SNESController[1]);
SNESController3Panel.LoadSettings(Global.Config.SNESController[2]);
@ -70,6 +78,10 @@ namespace BizHawk.MultiClient
Atari2600Autofire1Panel.LoadSettings(Global.Config.Atari2600AutoController[0]);
Atari2600Autofire2Panel.LoadSettings(Global.Config.Atari2600AutoController[1]);
TI83ControllerPanel.Spacing = 24;
TI83ControllerPanel.InputSize = 110;
TI83ControllerPanel.LabelPadding = 5;
TI83ControllerPanel.ColumnWidth = 170;
TI83ControllerPanel.LoadSettings(Global.Config.TI83Controller[0]);
SetAutoTab(true);

View File

@ -22,6 +22,7 @@ namespace BizHawk.MultiClient
public int MarginTop = 0;
public int Spacing = 30;
public int InputSize = 200;
public int ColumnWidth = 220;
protected List<InputWidget> Inputs = new List<InputWidget>();
protected List<Label> Labels = new List<Label>();
@ -82,18 +83,35 @@ namespace BizHawk.MultiClient
private void Startup()
{
if (buttons.Count > 30)
{
int xx = 0;
xx++;
int yy = xx;
yy++;
}
int x = InputMarginLeft;
int y = MarginTop - Spacing; ;
for (int i = 0; i < buttons.Count; i++)
{
y += Spacing;
if (y > (this.Size.Height - 23))
{
y = MarginTop;
x += ColumnWidth;
}
InputWidget iw = new InputWidget();
iw.Location = new Point(InputMarginLeft, MarginTop + (i * Spacing));
iw.Location = new Point(x, y);
iw.Size = new Size(InputSize, 23);
iw.TabIndex = i;
iw.BringToFront();
Controls.Add(iw);
Inputs.Add(iw);
Label l = new Label();
l.Location = new Point(InputMarginLeft + InputSize + LabelPadding, MarginTop + (i * Spacing) + 3);
l.Text = buttons[i];
l.Location = new Point(x + InputSize + LabelPadding, y + 3);
l.Text = buttons[i].Trim();
l.Width = 50;
Controls.Add(l);
Labels.Add(l);
}