Merge pull request #100 from lempamo/master

shiftsweeper prettied up
This commit is contained in:
lempamo 2017-02-27 10:50:00 -05:00 committed by GitHub
commit 8ceef636cd
2 changed files with 50 additions and 51 deletions

View file

@ -104,7 +104,7 @@ namespace ShiftOS.WinForms.Applications
this.easyPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 11.11136F));
this.easyPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 11.11025F));
this.easyPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 11.11025F));
this.easyPanel.Size = new System.Drawing.Size(541, 308);
this.easyPanel.Size = new System.Drawing.Size(553, 308);
this.easyPanel.TabIndex = 1;
//
// buttonE
@ -129,7 +129,7 @@ namespace ShiftOS.WinForms.Applications
//
// buttonH
//
this.buttonH.Location = new System.Drawing.Point(470, 354);
this.buttonH.Location = new System.Drawing.Point(482, 354);
this.buttonH.Name = "buttonH";
this.buttonH.Size = new System.Drawing.Size(75, 23);
this.buttonH.TabIndex = 4;
@ -169,14 +169,14 @@ namespace ShiftOS.WinForms.Applications
this.lblinfo2.AutoSize = true;
this.lblinfo2.Location = new System.Drawing.Point(4, 22);
this.lblinfo2.Name = "lblinfo2";
this.lblinfo2.Size = new System.Drawing.Size(128, 13);
this.lblinfo2.Size = new System.Drawing.Size(233, 13);
this.lblinfo2.TabIndex = 8;
this.lblinfo2.Text = "Right Button: Toggle Flag";
this.lblinfo2.Text = "Click the button on the right to toggle flag mode.";
//
// flagButton
//
this.flagButton.Image = global::ShiftOS.WinForms.Properties.Resources.SweeperTileBlock;
this.flagButton.Location = new System.Drawing.Point(525, 14);
this.flagButton.Location = new System.Drawing.Point(537, 14);
this.flagButton.Name = "flagButton";
this.flagButton.Size = new System.Drawing.Size(20, 20);
this.flagButton.TabIndex = 9;
@ -222,43 +222,42 @@ namespace ShiftOS.WinForms.Applications
this.mediumPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 6.251231F));
this.mediumPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 6.251231F));
this.mediumPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 6.251231F));
this.mediumPanel.Size = new System.Drawing.Size(541, 307);
this.mediumPanel.Size = new System.Drawing.Size(553, 307);
this.mediumPanel.TabIndex = 2;
//
// hardPanel
//
this.hardPanel.ColumnCount = 27;
this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.hardPanel.ColumnCount = 30;
this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 3.448275F));
this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 3.448275F));
this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 3.448275F));
this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 3.448275F));
this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 3.448275F));
this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 3.448275F));
this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 3.448275F));
this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 3.448275F));
this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 3.448275F));
this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 3.448275F));
this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 3.448275F));
this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 3.448275F));
this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 3.448275F));
this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 3.448275F));
this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 3.448275F));
this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 3.448275F));
this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 3.448275F));
this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 3.448275F));
this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 3.448275F));
this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 3.448275F));
this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 3.448275F));
this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 3.448275F));
this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 3.448275F));
this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 3.448275F));
this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 3.448275F));
this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 3.448275F));
this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 3.448275F));
this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 3.448275F));
this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 3.448275F));
this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.hardPanel.GrowStyle = System.Windows.Forms.TableLayoutPanelGrowStyle.FixedSize;
this.hardPanel.Location = new System.Drawing.Point(4, 40);
this.hardPanel.Name = "hardPanel";
@ -279,7 +278,7 @@ namespace ShiftOS.WinForms.Applications
this.hardPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 6.251231F));
this.hardPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 6.251231F));
this.hardPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 6.251231F));
this.hardPanel.Size = new System.Drawing.Size(541, 308);
this.hardPanel.Size = new System.Drawing.Size(553, 308);
this.hardPanel.TabIndex = 3;
//
// ShiftSweeper
@ -299,7 +298,7 @@ namespace ShiftOS.WinForms.Applications
this.Controls.Add(this.easyPanel);
this.Controls.Add(this.pictureBox1);
this.Name = "ShiftSweeper";
this.Size = new System.Drawing.Size(563, 414);
this.Size = new System.Drawing.Size(596, 426);
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.flagButton)).EndInit();
this.ResumeLayout(false);

View file

@ -1,4 +1,4 @@
/*
/*
* MIT License
*
* Copyright (c) 2017 Michael VanOverbeek and ShiftOS devs
@ -192,14 +192,14 @@ namespace ShiftOS.WinForms.Applications
}
}
private Button makeButton(int col, int row)
private PictureBox makeButton(int col, int row)
{
Button bttn = new Button();
PictureBox bttn = new PictureBox();
bttn.Text = "";
bttn.Name = col.ToString() + " " + row.ToString();
Controls.AddRange(new System.Windows.Forms.Control[] { bttn, });
bttn.Size = new System.Drawing.Size(minefieldPanel.Width / minefieldPanel.ColumnCount, (minefieldPanel.Height / minefieldPanel.RowCount) + 10);
bttn.Size = new System.Drawing.Size(minefieldPanel.Width / minefieldPanel.ColumnCount, minefieldPanel.Height / minefieldPanel.RowCount);
bttn.Click += new System.EventHandler(bttnOnclick);
bttn.BackgroundImage = Properties.Resources.SweeperTileBlock;
bttn.BackgroundImageLayout = ImageLayout.Stretch;
@ -211,9 +211,9 @@ namespace ShiftOS.WinForms.Applications
{
if (!ticking.Enabled) return;
Button bttnClick = sender as Button;
PictureBox bttnClick = sender as PictureBox;
if (bttnClick == null) return; //not a button.
if (bttnClick == null) return;
string[] split = bttnClick.Name.Split(new Char[] { ' ' });
@ -299,10 +299,10 @@ namespace ShiftOS.WinForms.Applications
Int32 cp = 0;
origminecount = origminecount * 10;
if (minetimer < 31) cp = (origminecount * 3);
if (minetimer < 61) cp = (Int32)(origminecount * 2.5);
if (minetimer < 91) cp = (origminecount * 2);
if (minetimer < 121) cp = (Int32)(origminecount * 1.5);
if (minetimer > 120) cp = (origminecount * 1);
else if (minetimer < 61) cp = (Int32)(origminecount * 2.5);
else if (minetimer < 91) cp = (origminecount * 2);
else if (minetimer < 121) cp = (Int32)(origminecount * 1.5);
else if (minetimer > 120) cp = (origminecount * 1);
SaveSystem.TransferCodepointsFrom("shiftsweeper", cp);
pictureBox1.Image = Properties.Resources.SweeperWinFace;
}
@ -337,7 +337,7 @@ namespace ShiftOS.WinForms.Applications
private void trueform(int x, int y)
{
Button bttn = (Button)minefieldPanel.GetControlFromPosition(x, y);
PictureBox bttn = (PictureBox)minefieldPanel.GetControlFromPosition(x, y);
if (minemap[x,y] == 0) bttn.BackgroundImage = Properties.Resources.SweeperTile0;
else if (minemap[x, y] == 1) bttn.BackgroundImage = Properties.Resources.SweeperTile1;
else if (minemap[x, y] == 2) bttn.BackgroundImage = Properties.Resources.SweeperTile2;