diff options
Diffstat (limited to 'ShiftOS.WinForms/Applications')
| -rw-r--r-- | ShiftOS.WinForms/Applications/ShiftSweeper.cs | 53 |
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) + { + } } } |
