N64 virtual pad - graphics for the analog control, not hooked up to anything yet, and not tweaked
This commit is contained in:
parent
9c80ea5ec7
commit
29226acd54
|
@ -37,6 +37,10 @@
|
|||
this.PalettePath = new System.Windows.Forms.TextBox();
|
||||
this.BrowsePalette = new System.Windows.Forms.Button();
|
||||
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
||||
this.label6 = new System.Windows.Forms.Label();
|
||||
this.PAL_LastLineNumeric = new System.Windows.Forms.NumericUpDown();
|
||||
this.PAL_FirstLineNumeric = new System.Windows.Forms.NumericUpDown();
|
||||
this.label5 = new System.Windows.Forms.Label();
|
||||
this.btnAreaFull = new System.Windows.Forms.Button();
|
||||
this.btnAreaStandard = new System.Windows.Forms.Button();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
|
@ -55,18 +59,14 @@
|
|||
this.DispSprites = new System.Windows.Forms.CheckBox();
|
||||
this.BGColorDialog = new System.Windows.Forms.ColorDialog();
|
||||
this.RestoreDefaultsButton = new System.Windows.Forms.Button();
|
||||
this.label5 = new System.Windows.Forms.Label();
|
||||
this.label6 = new System.Windows.Forms.Label();
|
||||
this.PAL_LastLineNumeric = new System.Windows.Forms.NumericUpDown();
|
||||
this.PAL_FirstLineNumeric = new System.Windows.Forms.NumericUpDown();
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.groupBox2.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.PAL_LastLineNumeric)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.PAL_FirstLineNumeric)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.NTSC_LastLineNumeric)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.NTSC_FirstLineNumeric)).BeginInit();
|
||||
this.groupBox3.SuspendLayout();
|
||||
this.groupBox4.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.PAL_LastLineNumeric)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.PAL_FirstLineNumeric)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// OK
|
||||
|
@ -180,6 +180,58 @@
|
|||
this.groupBox2.TabStop = false;
|
||||
this.groupBox2.Text = "Drawing Area";
|
||||
//
|
||||
// label6
|
||||
//
|
||||
this.label6.AutoSize = true;
|
||||
this.label6.Location = new System.Drawing.Point(131, 22);
|
||||
this.label6.Name = "label6";
|
||||
this.label6.Size = new System.Drawing.Size(27, 13);
|
||||
this.label6.TabIndex = 44;
|
||||
this.label6.Text = "PAL";
|
||||
//
|
||||
// PAL_LastLineNumeric
|
||||
//
|
||||
this.PAL_LastLineNumeric.Location = new System.Drawing.Point(124, 67);
|
||||
this.PAL_LastLineNumeric.Maximum = new decimal(new int[] {
|
||||
239,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.PAL_LastLineNumeric.Minimum = new decimal(new int[] {
|
||||
128,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.PAL_LastLineNumeric.Name = "PAL_LastLineNumeric";
|
||||
this.PAL_LastLineNumeric.Size = new System.Drawing.Size(47, 20);
|
||||
this.PAL_LastLineNumeric.TabIndex = 43;
|
||||
this.PAL_LastLineNumeric.Value = new decimal(new int[] {
|
||||
128,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
//
|
||||
// PAL_FirstLineNumeric
|
||||
//
|
||||
this.PAL_FirstLineNumeric.Location = new System.Drawing.Point(124, 41);
|
||||
this.PAL_FirstLineNumeric.Maximum = new decimal(new int[] {
|
||||
127,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.PAL_FirstLineNumeric.Name = "PAL_FirstLineNumeric";
|
||||
this.PAL_FirstLineNumeric.Size = new System.Drawing.Size(47, 20);
|
||||
this.PAL_FirstLineNumeric.TabIndex = 42;
|
||||
//
|
||||
// label5
|
||||
//
|
||||
this.label5.AutoSize = true;
|
||||
this.label5.Location = new System.Drawing.Point(62, 22);
|
||||
this.label5.Name = "label5";
|
||||
this.label5.Size = new System.Drawing.Size(36, 13);
|
||||
this.label5.TabIndex = 41;
|
||||
this.label5.Text = "NTSC";
|
||||
//
|
||||
// btnAreaFull
|
||||
//
|
||||
this.btnAreaFull.Location = new System.Drawing.Point(7, 115);
|
||||
|
@ -331,6 +383,7 @@
|
|||
//
|
||||
// BackgroundColorPanel
|
||||
//
|
||||
this.BackgroundColorPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.BackgroundColorPanel.Location = new System.Drawing.Point(4, 8);
|
||||
this.BackgroundColorPanel.Name = "BackgroundColorPanel";
|
||||
this.BackgroundColorPanel.Size = new System.Drawing.Size(20, 16);
|
||||
|
@ -372,58 +425,6 @@
|
|||
this.RestoreDefaultsButton.UseVisualStyleBackColor = true;
|
||||
this.RestoreDefaultsButton.Click += new System.EventHandler(this.RestoreDefaultsButton_Click);
|
||||
//
|
||||
// label5
|
||||
//
|
||||
this.label5.AutoSize = true;
|
||||
this.label5.Location = new System.Drawing.Point(62, 22);
|
||||
this.label5.Name = "label5";
|
||||
this.label5.Size = new System.Drawing.Size(36, 13);
|
||||
this.label5.TabIndex = 41;
|
||||
this.label5.Text = "NTSC";
|
||||
//
|
||||
// label6
|
||||
//
|
||||
this.label6.AutoSize = true;
|
||||
this.label6.Location = new System.Drawing.Point(131, 22);
|
||||
this.label6.Name = "label6";
|
||||
this.label6.Size = new System.Drawing.Size(27, 13);
|
||||
this.label6.TabIndex = 44;
|
||||
this.label6.Text = "PAL";
|
||||
//
|
||||
// PAL_LastLineNumeric
|
||||
//
|
||||
this.PAL_LastLineNumeric.Location = new System.Drawing.Point(124, 67);
|
||||
this.PAL_LastLineNumeric.Maximum = new decimal(new int[] {
|
||||
239,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.PAL_LastLineNumeric.Minimum = new decimal(new int[] {
|
||||
128,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.PAL_LastLineNumeric.Name = "PAL_LastLineNumeric";
|
||||
this.PAL_LastLineNumeric.Size = new System.Drawing.Size(47, 20);
|
||||
this.PAL_LastLineNumeric.TabIndex = 43;
|
||||
this.PAL_LastLineNumeric.Value = new decimal(new int[] {
|
||||
128,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
//
|
||||
// PAL_FirstLineNumeric
|
||||
//
|
||||
this.PAL_FirstLineNumeric.Location = new System.Drawing.Point(124, 41);
|
||||
this.PAL_FirstLineNumeric.Maximum = new decimal(new int[] {
|
||||
127,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.PAL_FirstLineNumeric.Name = "PAL_FirstLineNumeric";
|
||||
this.PAL_FirstLineNumeric.Size = new System.Drawing.Size(47, 20);
|
||||
this.PAL_FirstLineNumeric.TabIndex = 42;
|
||||
//
|
||||
// NESGraphicsConfig
|
||||
//
|
||||
this.AcceptButton = this.OK;
|
||||
|
@ -450,13 +451,13 @@
|
|||
this.groupBox1.PerformLayout();
|
||||
this.groupBox2.ResumeLayout(false);
|
||||
this.groupBox2.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.PAL_LastLineNumeric)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.PAL_FirstLineNumeric)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.NTSC_LastLineNumeric)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.NTSC_FirstLineNumeric)).EndInit();
|
||||
this.groupBox3.ResumeLayout(false);
|
||||
this.groupBox3.PerformLayout();
|
||||
this.groupBox4.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.PAL_LastLineNumeric)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.PAL_FirstLineNumeric)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
|
|
@ -3,25 +3,91 @@ using System.Windows.Forms;
|
|||
|
||||
namespace BizHawk.MultiClient
|
||||
{
|
||||
public sealed class AnalogControlPanel : Control
|
||||
public sealed class AnalogControlPanel : Panel
|
||||
{
|
||||
public double X;
|
||||
public double Y;
|
||||
public int X = 1;
|
||||
public int Y = 1;
|
||||
|
||||
private readonly Brush WhiteBrush = Brushes.White;
|
||||
private readonly Brush BlackBrush = Brushes.Black;
|
||||
private readonly Brush GrayBrush = Brushes.LightGray;
|
||||
private readonly Brush RedBrush = Brushes.Red;
|
||||
private readonly Brush BlueBrush = Brushes.DarkBlue;
|
||||
private readonly Pen _white_pen;
|
||||
private readonly Pen BlackPen;
|
||||
private readonly Pen GrayPen;
|
||||
private readonly Pen RedPen;
|
||||
private readonly Pen BluePen;
|
||||
|
||||
private const int DOTW = 8;
|
||||
|
||||
public AnalogControlPanel()
|
||||
{
|
||||
Size = new Size(129, 129);
|
||||
SetStyle(ControlStyles.AllPaintingInWmPaint, true);
|
||||
SetStyle(ControlStyles.UserPaint, true);
|
||||
SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
|
||||
SetStyle(ControlStyles.SupportsTransparentBackColor, true);
|
||||
SetStyle(ControlStyles.Opaque, true);
|
||||
BackColor = Color.Transparent;
|
||||
BackColor = Color.Gray;
|
||||
Paint += AnalogControlPanel_Paint;
|
||||
MouseClick += Event_MouseClick;
|
||||
MouseMove += Event_MouseMove;
|
||||
_white_pen = new Pen(WhiteBrush);
|
||||
BlackPen = new Pen(BlackBrush);
|
||||
GrayPen = new Pen(GrayBrush);
|
||||
RedPen = new Pen(RedBrush);
|
||||
BluePen = new Pen(BlueBrush);
|
||||
BorderStyle = BorderStyle.Fixed3D;
|
||||
}
|
||||
|
||||
private int RealToGFX(int val)
|
||||
{
|
||||
return (val + 128)/2;
|
||||
}
|
||||
|
||||
private int GFXToReal(int val)
|
||||
{
|
||||
return (val * 2) - 128;
|
||||
}
|
||||
|
||||
private void AnalogControlPanel_Paint(object sender, PaintEventArgs e)
|
||||
{
|
||||
|
||||
unchecked
|
||||
{
|
||||
//Background
|
||||
e.Graphics.FillRectangle(GrayBrush, 0, 0, 128, 128);
|
||||
e.Graphics.FillEllipse(WhiteBrush, 0, 0, 127, 127);
|
||||
e.Graphics.DrawEllipse(BlackPen, 0, 0, 127, 127);
|
||||
e.Graphics.DrawLine(BlackPen, 65, 0, 65, 127);
|
||||
e.Graphics.DrawLine(BlackPen, 0, 65, 127, 65);
|
||||
|
||||
//Line
|
||||
e.Graphics.DrawLine(BluePen, 64, 64, RealToGFX(X), RealToGFX(Y));
|
||||
e.Graphics.FillEllipse(RedBrush, RealToGFX(X) - (DOTW / 2), RealToGFX(Y) - (DOTW / 2), DOTW, DOTW);
|
||||
}
|
||||
}
|
||||
|
||||
private void Event_MouseClick(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (e.Button == MouseButtons.Left)
|
||||
{
|
||||
X = GFXToReal(e.X);
|
||||
Y = GFXToReal(e.Y);
|
||||
}
|
||||
|
||||
Refresh();
|
||||
}
|
||||
|
||||
private void Event_MouseMove(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (e.Button == MouseButtons.Left)
|
||||
{
|
||||
X = GFXToReal(e.X);
|
||||
Y = GFXToReal(e.Y);
|
||||
}
|
||||
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
this.PL.Appearance = System.Windows.Forms.Appearance.Button;
|
||||
this.PL.AutoSize = true;
|
||||
this.PL.Image = global::BizHawk.MultiClient.Properties.Resources.Back;
|
||||
this.PL.Location = new System.Drawing.Point(20, 229);
|
||||
this.PL.Location = new System.Drawing.Point(3, 207);
|
||||
this.PL.Name = "PL";
|
||||
this.PL.Size = new System.Drawing.Size(22, 22);
|
||||
this.PL.TabIndex = 7;
|
||||
|
@ -62,7 +62,7 @@
|
|||
this.PD.Appearance = System.Windows.Forms.Appearance.Button;
|
||||
this.PD.AutoSize = true;
|
||||
this.PD.Image = global::BizHawk.MultiClient.Properties.Resources.BlueDown;
|
||||
this.PD.Location = new System.Drawing.Point(41, 238);
|
||||
this.PD.Location = new System.Drawing.Point(24, 216);
|
||||
this.PD.Name = "PD";
|
||||
this.PD.Size = new System.Drawing.Size(22, 22);
|
||||
this.PD.TabIndex = 6;
|
||||
|
@ -74,7 +74,7 @@
|
|||
this.PR.Appearance = System.Windows.Forms.Appearance.Button;
|
||||
this.PR.AutoSize = true;
|
||||
this.PR.Image = global::BizHawk.MultiClient.Properties.Resources.Forward;
|
||||
this.PR.Location = new System.Drawing.Point(62, 229);
|
||||
this.PR.Location = new System.Drawing.Point(45, 207);
|
||||
this.PR.Name = "PR";
|
||||
this.PR.Size = new System.Drawing.Size(22, 22);
|
||||
this.PR.TabIndex = 5;
|
||||
|
@ -86,7 +86,7 @@
|
|||
this.PU.Appearance = System.Windows.Forms.Appearance.Button;
|
||||
this.PU.AutoSize = true;
|
||||
this.PU.Image = global::BizHawk.MultiClient.Properties.Resources.BlueUp;
|
||||
this.PU.Location = new System.Drawing.Point(41, 217);
|
||||
this.PU.Location = new System.Drawing.Point(24, 195);
|
||||
this.PU.Name = "PU";
|
||||
this.PU.Size = new System.Drawing.Size(22, 22);
|
||||
this.PU.TabIndex = 4;
|
||||
|
@ -97,7 +97,7 @@
|
|||
//
|
||||
this.BL.Appearance = System.Windows.Forms.Appearance.Button;
|
||||
this.BL.AutoSize = true;
|
||||
this.BL.Location = new System.Drawing.Point(14, 180);
|
||||
this.BL.Location = new System.Drawing.Point(3, 148);
|
||||
this.BL.Name = "BL";
|
||||
this.BL.Size = new System.Drawing.Size(23, 23);
|
||||
this.BL.TabIndex = 8;
|
||||
|
@ -109,7 +109,7 @@
|
|||
//
|
||||
this.BR.Appearance = System.Windows.Forms.Appearance.Button;
|
||||
this.BR.AutoSize = true;
|
||||
this.BR.Location = new System.Drawing.Point(177, 180);
|
||||
this.BR.Location = new System.Drawing.Point(138, 148);
|
||||
this.BR.Name = "BR";
|
||||
this.BR.Size = new System.Drawing.Size(25, 23);
|
||||
this.BR.TabIndex = 9;
|
||||
|
@ -121,7 +121,7 @@
|
|||
//
|
||||
this.BS.Appearance = System.Windows.Forms.Appearance.Button;
|
||||
this.BS.AutoSize = true;
|
||||
this.BS.Location = new System.Drawing.Point(98, 191);
|
||||
this.BS.Location = new System.Drawing.Point(74, 157);
|
||||
this.BS.Name = "BS";
|
||||
this.BS.Size = new System.Drawing.Size(24, 23);
|
||||
this.BS.TabIndex = 10;
|
||||
|
@ -133,7 +133,7 @@
|
|||
//
|
||||
this.BZ.Appearance = System.Windows.Forms.Appearance.Button;
|
||||
this.BZ.AutoSize = true;
|
||||
this.BZ.Location = new System.Drawing.Point(98, 270);
|
||||
this.BZ.Location = new System.Drawing.Point(74, 245);
|
||||
this.BZ.Name = "BZ";
|
||||
this.BZ.Size = new System.Drawing.Size(24, 23);
|
||||
this.BZ.TabIndex = 11;
|
||||
|
@ -144,7 +144,7 @@
|
|||
//
|
||||
this.BB.Appearance = System.Windows.Forms.Appearance.Button;
|
||||
this.BB.AutoSize = true;
|
||||
this.BB.Location = new System.Drawing.Point(98, 220);
|
||||
this.BB.Location = new System.Drawing.Point(98, 195);
|
||||
this.BB.Name = "BB";
|
||||
this.BB.Size = new System.Drawing.Size(24, 23);
|
||||
this.BB.TabIndex = 12;
|
||||
|
@ -156,7 +156,7 @@
|
|||
//
|
||||
this.BA.Appearance = System.Windows.Forms.Appearance.Button;
|
||||
this.BA.AutoSize = true;
|
||||
this.BA.Location = new System.Drawing.Point(128, 229);
|
||||
this.BA.Location = new System.Drawing.Point(128, 206);
|
||||
this.BA.Name = "BA";
|
||||
this.BA.Size = new System.Drawing.Size(24, 23);
|
||||
this.BA.TabIndex = 13;
|
||||
|
@ -168,7 +168,7 @@
|
|||
//
|
||||
this.CU.Appearance = System.Windows.Forms.Appearance.Button;
|
||||
this.CU.AutoSize = true;
|
||||
this.CU.Location = new System.Drawing.Point(212, 216);
|
||||
this.CU.Location = new System.Drawing.Point(138, 235);
|
||||
this.CU.Name = "CU";
|
||||
this.CU.Size = new System.Drawing.Size(31, 23);
|
||||
this.CU.TabIndex = 14;
|
||||
|
@ -180,7 +180,7 @@
|
|||
//
|
||||
this.CL.Appearance = System.Windows.Forms.Appearance.Button;
|
||||
this.CL.AutoSize = true;
|
||||
this.CL.Location = new System.Drawing.Point(190, 245);
|
||||
this.CL.Location = new System.Drawing.Point(116, 258);
|
||||
this.CL.Name = "CL";
|
||||
this.CL.Size = new System.Drawing.Size(29, 23);
|
||||
this.CL.TabIndex = 15;
|
||||
|
@ -192,7 +192,7 @@
|
|||
//
|
||||
this.CR.Appearance = System.Windows.Forms.Appearance.Button;
|
||||
this.CR.AutoSize = true;
|
||||
this.CR.Location = new System.Drawing.Point(225, 245);
|
||||
this.CR.Location = new System.Drawing.Point(151, 259);
|
||||
this.CR.Name = "CR";
|
||||
this.CR.Size = new System.Drawing.Size(31, 23);
|
||||
this.CR.TabIndex = 16;
|
||||
|
@ -204,7 +204,7 @@
|
|||
//
|
||||
this.CD.Appearance = System.Windows.Forms.Appearance.Button;
|
||||
this.CD.AutoSize = true;
|
||||
this.CD.Location = new System.Drawing.Point(212, 274);
|
||||
this.CD.Location = new System.Drawing.Point(138, 284);
|
||||
this.CD.Name = "CD";
|
||||
this.CD.Size = new System.Drawing.Size(31, 23);
|
||||
this.CD.TabIndex = 17;
|
||||
|
@ -215,9 +215,9 @@
|
|||
// AnalogControl1
|
||||
//
|
||||
this.AnalogControl1.BackColor = System.Drawing.Color.Transparent;
|
||||
this.AnalogControl1.Location = new System.Drawing.Point(14, 27);
|
||||
this.AnalogControl1.Location = new System.Drawing.Point(24, 14);
|
||||
this.AnalogControl1.Name = "AnalogControl1";
|
||||
this.AnalogControl1.Size = new System.Drawing.Size(205, 147);
|
||||
this.AnalogControl1.Size = new System.Drawing.Size(128, 128);
|
||||
this.AnalogControl1.TabIndex = 0;
|
||||
//
|
||||
// VirtualPadN64
|
||||
|
@ -240,7 +240,7 @@
|
|||
this.Controls.Add(this.PU);
|
||||
this.Controls.Add(this.AnalogControl1);
|
||||
this.Name = "VirtualPadN64";
|
||||
this.Size = new System.Drawing.Size(463, 332);
|
||||
this.Size = new System.Drawing.Size(201, 332);
|
||||
this.Load += new System.EventHandler(this.UserControl1_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
|
Loading…
Reference in New Issue