aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS.WinForms/Applications/ShiftSweeper.cs
diff options
context:
space:
mode:
authorlempamo <[email protected]>2017-02-26 15:02:40 -0500
committerlempamo <[email protected]>2017-02-26 15:02:40 -0500
commitc49c7ac9c68a1815910a80afc45b43e05009137f (patch)
tree1ff76b335e60ca8c9780a45e9da9d18a75bd8ca4 /ShiftOS.WinForms/Applications/ShiftSweeper.cs
parent7ba86e65c43960bc9069e5abc9540aa14ec57774 (diff)
downloadshiftos_thereturn-c49c7ac9c68a1815910a80afc45b43e05009137f.tar.gz
shiftos_thereturn-c49c7ac9c68a1815910a80afc45b43e05009137f.tar.bz2
shiftos_thereturn-c49c7ac9c68a1815910a80afc45b43e05009137f.zip
more shiftsweeper stuffs
Diffstat (limited to 'ShiftOS.WinForms/Applications/ShiftSweeper.cs')
-rw-r--r--ShiftOS.WinForms/Applications/ShiftSweeper.cs53
1 files changed, 53 insertions, 0 deletions
diff --git a/ShiftOS.WinForms/Applications/ShiftSweeper.cs b/ShiftOS.WinForms/Applications/ShiftSweeper.cs
index d7c22b4..70c69d7 100644
--- a/ShiftOS.WinForms/Applications/ShiftSweeper.cs
+++ b/ShiftOS.WinForms/Applications/ShiftSweeper.cs
@@ -19,6 +19,7 @@ namespace ShiftOS.WinForms.Applications
{
private bool gameplayed = false;
private int mineCount = 0;
+ private int[,] minemap;
public ShiftSweeper()
{
@@ -59,6 +60,58 @@ namespace ShiftOS.WinForms.Applications
default:
throw new NullReferenceException();
}
+ makegrid();
+ }
+
+ private void makegrid()
+ {
+ Random rnd1 = new Random();
+ minemap = new int[minefieldPanel.ColumnCount, minefieldPanel.RowCount];
+
+ for (int x = 0; x < minefieldPanel.ColumnCount; x++)
+ {
+ for (int y = 0; y < minefieldPanel.RowCount; y++)
+ {
+ minemap[x, y] = 0;
+ minefieldPanel.Controls.Add(makeButton(x, y), x, y);
+ }
+ }
+ }
+
+ private Button makeButton(int col, int row)
+ {
+ Button bttn = new Button();
+
+ bttn.Text = "";
+ bttn.Name = col.ToString() + " " + row.ToString();
+ Controls.AddRange(new System.Windows.Forms.Control[] { bttn, });
+ bttn.Click += new System.EventHandler(bttnOnclick);
+ bttn.MouseDown += new MouseEventHandler(mouseDwn);
+ bttn.MouseUp += new MouseEventHandler(mauseUp);
+ bttn.MouseHover += new EventHandler(mauseHov);
+ bttn.BackgroundImage = Properties.Resources.SweeperTileBlock;
+
+ return bttn;
+ }
+
+ private void mauseHov(object sender, EventArgs e)
+ {
+ pictureBox1.BackgroundImage = Properties.Resources.SweeperNormalFace;
+ }
+
+ private void mauseUp(object sender, MouseEventArgs e)
+ {
+ pictureBox1.BackgroundImage = Properties.Resources.SweeperNormalFace;
+ }
+
+ private void mouseDwn(object sender, EventArgs e)
+ {
+ pictureBox1.BackgroundImage = Properties.Resources.SweeperClickFace;
+ }
+
+ private void bttnOnclick(object sender, EventArgs e)
+ {
+
}
}
}