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) + { + } } } diff --git a/ShiftOS.WinForms/Properties/Resources.Designer.cs b/ShiftOS.WinForms/Properties/Resources.Designer.cs index 05c6c07..beef6ff 100644 --- a/ShiftOS.WinForms/Properties/Resources.Designer.cs +++ b/ShiftOS.WinForms/Properties/Resources.Designer.cs @@ -1026,6 +1026,126 @@ namespace ShiftOS.WinForms.Properties { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap SweeperTile0 { + get { + object obj = ResourceManager.GetObject("SweeperTile0", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap SweeperTile1 { + get { + object obj = ResourceManager.GetObject("SweeperTile1", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap SweeperTile2 { + get { + object obj = ResourceManager.GetObject("SweeperTile2", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap SweeperTile3 { + get { + object obj = ResourceManager.GetObject("SweeperTile3", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap SweeperTile4 { + get { + object obj = ResourceManager.GetObject("SweeperTile4", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap SweeperTile5 { + get { + object obj = ResourceManager.GetObject("SweeperTile5", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap SweeperTile6 { + get { + object obj = ResourceManager.GetObject("SweeperTile6", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap SweeperTile7 { + get { + object obj = ResourceManager.GetObject("SweeperTile7", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap SweeperTile8 { + get { + object obj = ResourceManager.GetObject("SweeperTile8", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap SweeperTileBlock { + get { + object obj = ResourceManager.GetObject("SweeperTileBlock", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap SweeperTileBomb { + get { + object obj = ResourceManager.GetObject("SweeperTileBomb", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap SweeperTileFlag { + get { + object obj = ResourceManager.GetObject("SweeperTileFlag", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// diff --git a/ShiftOS.WinForms/Properties/Resources.resx b/ShiftOS.WinForms/Properties/Resources.resx index aad84ee..8c4b52b 100644 --- a/ShiftOS.WinForms/Properties/Resources.resx +++ b/ShiftOS.WinForms/Properties/Resources.resx @@ -403,4 +403,40 @@ ..\SystemIcons\iconshutdown.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\SweeperTile0.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\SweeperTile1.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\SweeperTile2.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\SweeperTile3.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\SweeperTile4.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\SweeperTile5.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\SweeperTile6.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\SweeperTile7.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\SweeperTile8.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\SweeperTileBlock.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\SweeperTileBomb.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\SweeperTileFlag.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/ShiftOS.WinForms/Resources/SweeperTile0.png b/ShiftOS.WinForms/Resources/SweeperTile0.png new file mode 100644 index 0000000..c48c377 Binary files /dev/null and b/ShiftOS.WinForms/Resources/SweeperTile0.png differ diff --git a/ShiftOS.WinForms/Resources/SweeperTile1.png b/ShiftOS.WinForms/Resources/SweeperTile1.png new file mode 100644 index 0000000..06819d0 Binary files /dev/null and b/ShiftOS.WinForms/Resources/SweeperTile1.png differ diff --git a/ShiftOS.WinForms/Resources/SweeperTile2.png b/ShiftOS.WinForms/Resources/SweeperTile2.png new file mode 100644 index 0000000..eec00e9 Binary files /dev/null and b/ShiftOS.WinForms/Resources/SweeperTile2.png differ diff --git a/ShiftOS.WinForms/Resources/SweeperTile3.png b/ShiftOS.WinForms/Resources/SweeperTile3.png new file mode 100644 index 0000000..acc7530 Binary files /dev/null and b/ShiftOS.WinForms/Resources/SweeperTile3.png differ diff --git a/ShiftOS.WinForms/Resources/SweeperTile4.png b/ShiftOS.WinForms/Resources/SweeperTile4.png new file mode 100644 index 0000000..f8c3d2b Binary files /dev/null and b/ShiftOS.WinForms/Resources/SweeperTile4.png differ diff --git a/ShiftOS.WinForms/Resources/SweeperTile5.png b/ShiftOS.WinForms/Resources/SweeperTile5.png new file mode 100644 index 0000000..2b2e4fd Binary files /dev/null and b/ShiftOS.WinForms/Resources/SweeperTile5.png differ diff --git a/ShiftOS.WinForms/Resources/SweeperTile6.png b/ShiftOS.WinForms/Resources/SweeperTile6.png new file mode 100644 index 0000000..d8698d0 Binary files /dev/null and b/ShiftOS.WinForms/Resources/SweeperTile6.png differ diff --git a/ShiftOS.WinForms/Resources/SweeperTile7.png b/ShiftOS.WinForms/Resources/SweeperTile7.png new file mode 100644 index 0000000..ff02afd Binary files /dev/null and b/ShiftOS.WinForms/Resources/SweeperTile7.png differ diff --git a/ShiftOS.WinForms/Resources/SweeperTile8.png b/ShiftOS.WinForms/Resources/SweeperTile8.png new file mode 100644 index 0000000..9703491 Binary files /dev/null and b/ShiftOS.WinForms/Resources/SweeperTile8.png differ diff --git a/ShiftOS.WinForms/Resources/SweeperTileBlock.png b/ShiftOS.WinForms/Resources/SweeperTileBlock.png new file mode 100644 index 0000000..dc664a9 Binary files /dev/null and b/ShiftOS.WinForms/Resources/SweeperTileBlock.png differ diff --git a/ShiftOS.WinForms/Resources/SweeperTileBomb.png b/ShiftOS.WinForms/Resources/SweeperTileBomb.png new file mode 100644 index 0000000..c03a4a3 Binary files /dev/null and b/ShiftOS.WinForms/Resources/SweeperTileBomb.png differ diff --git a/ShiftOS.WinForms/Resources/SweeperTileFlag.png b/ShiftOS.WinForms/Resources/SweeperTileFlag.png new file mode 100644 index 0000000..11cedbe Binary files /dev/null and b/ShiftOS.WinForms/Resources/SweeperTileFlag.png differ