diff options
| author | lempamo <[email protected]> | 2017-08-07 14:04:08 -0400 |
|---|---|---|
| committer | lempamo <[email protected]> | 2017-08-07 14:04:08 -0400 |
| commit | e838d66d36751fdbf5c2f7fadab8fee42729b6ac (patch) | |
| tree | fc4d2e248b19f08f308dbf844d2a7225bb0e5cb4 /TimeHACK.Main | |
| parent | cb0ebed2918341ce02978bc32ab6e284ae5f000a (diff) | |
| download | histacom2-e838d66d36751fdbf5c2f7fadab8fee42729b6ac.tar.gz histacom2-e838d66d36751fdbf5c2f7fadab8fee42729b6ac.tar.bz2 histacom2-e838d66d36751fdbf5c2f7fadab8fee42729b6ac.zip | |
minesweeper gfx part 1
Diffstat (limited to 'TimeHACK.Main')
16 files changed, 162 insertions, 30 deletions
diff --git a/TimeHACK.Main/OS/Win95/Win95Apps/MineSweeper/Game.cs b/TimeHACK.Main/OS/Win95/Win95Apps/MineSweeper/Game.cs index b6e9293..b01596c 100644 --- a/TimeHACK.Main/OS/Win95/Win95Apps/MineSweeper/Game.cs +++ b/TimeHACK.Main/OS/Win95/Win95Apps/MineSweeper/Game.cs @@ -67,11 +67,9 @@ namespace TimeHACK.OS.Win95.Win95Apps.MineSweeper foreach (Square s in _squares) { s.RemoveEvents(); - if (s.Minded) + if (s.Minded && !s.Exploded) { - s.Button.Text = "*"; - s.Button.Font = new Font("Arial Black", 16F, FontStyle.Regular, GraphicsUnit.Point, ((System.Byte)(0))); - s.Button.ForeColor = Color.Black; + s.Button.BackgroundImage = Properties.Resources.minesweepSquareMine; } } } diff --git a/TimeHACK.Main/OS/Win95/Win95Apps/MineSweeper/Square.cs b/TimeHACK.Main/OS/Win95/Win95Apps/MineSweeper/Square.cs index 8dbb76c..ef20710 100644 --- a/TimeHACK.Main/OS/Win95/Win95Apps/MineSweeper/Square.cs +++ b/TimeHACK.Main/OS/Win95/Win95Apps/MineSweeper/Square.cs @@ -16,6 +16,7 @@ namespace TimeHACK.OS.Win95.Win95Apps.MineSweeper private Game _game; private bool _minded = false; private bool _opened = false; + private bool _exploded = false; private int _x; private int _y; @@ -30,17 +31,17 @@ namespace TimeHACK.OS.Win95.Win95Apps.MineSweeper int w = _game.Panel.Width / _game.Width; int h = _game.Panel.Height / _game.Height; - _button.Width = w + 1; - _button.Height = h + 1; + _button.Width = 16; + _button.Height = 16; _button.Left = w * X; _button.Top = h * Y; _button.Font = new Font(TitleScreen.pfc.Families[0], 16F, FontStyle.Bold, GraphicsUnit.Point, ((byte)(0))); _button.Click += new EventHandler(Click); - _button.Paint += (sender, args) => Paintbrush.PaintClassicBorders(sender,args,2); _button.MouseDown += new MouseEventHandler(DismantleClick); _button.MouseUp += new MouseEventHandler(MiddleClick); _button.FlatStyle = FlatStyle.Flat; - _button.FlatAppearance.BorderSize = 1; + _button.FlatAppearance.BorderSize = 0; + _button.BackgroundImage = Properties.Resources.minesweepSquare; _button.BackgroundImageLayout = ImageLayout.Stretch; _game.Panel.Controls.Add(Button); @@ -97,7 +98,8 @@ namespace TimeHACK.OS.Win95.Win95Apps.MineSweeper { if (Minded) { - Button.BackColor = Color.Red; + Button.BackgroundImage = Properties.Resources.minesweepSquareExploded; + _exploded = true; OnExplode(); } else @@ -128,7 +130,7 @@ namespace TimeHACK.OS.Win95.Win95Apps.MineSweeper else if(Button.Text == "?") { _dismantled = false; - Button.BackgroundImage = null; + Button.BackgroundImage = Properties.Resources.minesweepSquare; Button.Text = ""; return; } @@ -190,20 +192,19 @@ namespace TimeHACK.OS.Win95.Win95Apps.MineSweeper if (c > 0) { - Button.Text = c.ToString(); switch (c) { case 1: - Button.ForeColor = Color.Blue; + Button.BackgroundImage = Properties.Resources.minesweepSquare1; break; case 2: - Button.ForeColor = Color.Green; + Button.BackgroundImage = Properties.Resources.minesweepSquare2; break; case 3: - Button.ForeColor = Color.Red; + Button.BackgroundImage = Properties.Resources.minesweepSquare3; break; case 4: - Button.ForeColor = Color.DarkBlue; + Button.BackgroundImage = Properties.Resources.minesweepSquare4; break; case 5: Button.ForeColor = Color.DarkRed; @@ -221,8 +222,7 @@ namespace TimeHACK.OS.Win95.Win95Apps.MineSweeper } else { - Button.BackColor = SystemColors.ControlLight; - Button.FlatStyle = FlatStyle.Flat; + Button.BackgroundImage = Properties.Resources.minesweepSquare0; Button.Enabled = false; _game.OpenSpot(X - 1, Y - 1); @@ -254,10 +254,16 @@ namespace TimeHACK.OS.Win95.Win95Apps.MineSweeper get { return (this._y); } } + public bool Exploded + { + get { return (this._exploded); } + } + public void RemoveEvents() { _button.Click -= new EventHandler(Click); _button.MouseDown -= new MouseEventHandler(DismantleClick); + _button.MouseUp -= new MouseEventHandler(MiddleClick); } } } diff --git a/TimeHACK.Main/OS/Win95/Win95Apps/MineSweeper/WinClassicMinesweeper.Designer.cs b/TimeHACK.Main/OS/Win95/Win95Apps/MineSweeper/WinClassicMinesweeper.Designer.cs index 56d0133..91e6b98 100644 --- a/TimeHACK.Main/OS/Win95/Win95Apps/MineSweeper/WinClassicMinesweeper.Designer.cs +++ b/TimeHACK.Main/OS/Win95/Win95Apps/MineSweeper/WinClassicMinesweeper.Designer.cs @@ -53,7 +53,9 @@ this.aboutMinesweeperToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.button1 = new System.Windows.Forms.Button(); this.timer1 = new System.Windows.Forms.Timer(this.components); + this.panel2 = new System.Windows.Forms.Panel(); this.menuStrip1.SuspendLayout(); + this.panel2.SuspendLayout(); this.SuspendLayout(); // // labelBombs @@ -62,7 +64,7 @@ this.labelBombs.Font = new System.Drawing.Font("Lemon\'s LCD", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.labelBombs.ForeColor = System.Drawing.Color.Red; this.labelBombs.Image = global::TimeHACK.Properties.Resources.MinesweepNumBox; - this.labelBombs.Location = new System.Drawing.Point(20, 32); + this.labelBombs.Location = new System.Drawing.Point(17, 32); this.labelBombs.Name = "labelBombs"; this.labelBombs.Size = new System.Drawing.Size(56, 25); this.labelBombs.TabIndex = 7; @@ -75,7 +77,7 @@ this.labelTime.Font = new System.Drawing.Font("Lemon\'s LCD", 15F); this.labelTime.ForeColor = System.Drawing.Color.Red; this.labelTime.Image = global::TimeHACK.Properties.Resources.MinesweepNumBox; - this.labelTime.Location = new System.Drawing.Point(162, 32); + this.labelTime.Location = new System.Drawing.Point(90, 32); this.labelTime.Margin = new System.Windows.Forms.Padding(0); this.labelTime.Name = "labelTime"; this.labelTime.RightToLeft = System.Windows.Forms.RightToLeft.No; @@ -86,9 +88,9 @@ // // panel1 // - this.panel1.Location = new System.Drawing.Point(18, 63); + this.panel1.Location = new System.Drawing.Point(3, 3); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(200, 200); + this.panel1.Size = new System.Drawing.Size(128, 128); this.panel1.TabIndex = 4; // // menuStrip1 @@ -100,7 +102,7 @@ this.helpToolStripMenuItem}); this.menuStrip1.Location = new System.Drawing.Point(0, 0); this.menuStrip1.Name = "menuStrip1"; - this.menuStrip1.Size = new System.Drawing.Size(240, 24); + this.menuStrip1.Size = new System.Drawing.Size(164, 24); this.menuStrip1.TabIndex = 8; this.menuStrip1.Text = "menuStrip1"; // @@ -265,7 +267,7 @@ // this.button1.BackColor = System.Drawing.Color.Silver; this.button1.BackgroundImage = global::TimeHACK.Properties.Resources.WinClassicMinesweeperSmile; - this.button1.Location = new System.Drawing.Point(108, 32); + this.button1.Location = new System.Drawing.Point(70, 32); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(25, 25); this.button1.TabIndex = 9; @@ -277,21 +279,30 @@ this.timer1.Interval = 1; this.timer1.Tick += new System.EventHandler(this.timer1_Tick); // + // panel2 + // + this.panel2.Controls.Add(this.panel1); + this.panel2.Location = new System.Drawing.Point(16, 63); + this.panel2.Name = "panel2"; + this.panel2.Size = new System.Drawing.Size(134, 134); + this.panel2.TabIndex = 10; + // // WinClassicMinesweeper // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.Silver; + this.Controls.Add(this.panel2); this.Controls.Add(this.button1); this.Controls.Add(this.labelBombs); this.Controls.Add(this.labelTime); - this.Controls.Add(this.panel1); this.Controls.Add(this.menuStrip1); this.Name = "WinClassicMinesweeper"; - this.Size = new System.Drawing.Size(240, 275); + this.Size = new System.Drawing.Size(164, 210); this.Load += new System.EventHandler(this.WinClassicMinesweeper_Load); this.menuStrip1.ResumeLayout(false); this.menuStrip1.PerformLayout(); + this.panel2.ResumeLayout(false); this.ResumeLayout(false); this.PerformLayout(); @@ -323,5 +334,6 @@ private System.Windows.Forms.ToolStripMenuItem aboutMinesweeperToolStripMenuItem; private System.Windows.Forms.Button button1; private System.Windows.Forms.Timer timer1; + private System.Windows.Forms.Panel panel2; } } diff --git a/TimeHACK.Main/OS/Win95/Win95Apps/MineSweeper/WinClassicMinesweeper.cs b/TimeHACK.Main/OS/Win95/Win95Apps/MineSweeper/WinClassicMinesweeper.cs index 9bade7e..fb8f112 100644 --- a/TimeHACK.Main/OS/Win95/Win95Apps/MineSweeper/WinClassicMinesweeper.cs +++ b/TimeHACK.Main/OS/Win95/Win95Apps/MineSweeper/WinClassicMinesweeper.cs @@ -23,7 +23,7 @@ namespace TimeHACK.OS.Win95.Win95Apps InitializeComponent(); labelBombs.Font = new Font(TitleScreen.pfc.Families[2], 15, GraphicsUnit.Point); labelTime.Font = new Font(TitleScreen.pfc.Families[2], 15, GraphicsUnit.Point); - panel1.Paint += (sender, args) => Paintbrush.PaintClassicBordersIndented(sender, args, 3); + panel2.Paint += (sender, args) => Paintbrush.PaintClassicBordersIndented(sender, args, 3); } private void GameTick(object sender, EventArgs e) { @@ -36,15 +36,19 @@ namespace TimeHACK.OS.Win95.Win95Apps } public void calculateFormSize(int x, int y) { - panel1.Size = new Size(x * 25, y * 25); - this.ParentForm.Size = new Size(x * 25 + 45, y * 25 + 100); - labelTime.Location = new Point(x * 25 - 38, button1.Location.Y); + panel1.Size = new Size(x * 16, y * 16); + panel2.Size = new Size(x * 16 + 6, y * 16 + 6); + this.ParentForm.Size = new Size(x * 16 + 51, y * 16 + 106); + labelTime.Location = new Point(x * 16 - 32, button1.Location.Y); + panel2.Paint -= (sender, args) => Paintbrush.PaintClassicBordersIndented(sender, args, 3); + panel2.Refresh(); + panel2.Paint += (sender, args) => Paintbrush.PaintClassicBordersIndented(sender, args, 3); button1.PerformClick(); } private void begginnerToolStripMenuItem_Click(object sender, EventArgs e) { level = "easy"; - button1.Location = new Point(108, 32); + button1.Location = new Point(70, 32); calculateFormSize(8, 8); } private void intermediateToolStripMenuItem_Click(object sender, EventArgs e) diff --git a/TimeHACK.Main/Properties/Resources.Designer.cs b/TimeHACK.Main/Properties/Resources.Designer.cs index d4f62fa..cf09010 100644 --- a/TimeHACK.Main/Properties/Resources.Designer.cs +++ b/TimeHACK.Main/Properties/Resources.Designer.cs @@ -416,6 +416,86 @@ namespace TimeHACK.Properties { } /// <summary> + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// </summary> + internal static System.Drawing.Bitmap minesweepSquare { + get { + object obj = ResourceManager.GetObject("minesweepSquare", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// <summary> + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// </summary> + internal static System.Drawing.Bitmap minesweepSquare0 { + get { + object obj = ResourceManager.GetObject("minesweepSquare0", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// <summary> + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// </summary> + internal static System.Drawing.Bitmap minesweepSquare1 { + get { + object obj = ResourceManager.GetObject("minesweepSquare1", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// <summary> + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// </summary> + internal static System.Drawing.Bitmap minesweepSquare2 { + get { + object obj = ResourceManager.GetObject("minesweepSquare2", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// <summary> + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// </summary> + internal static System.Drawing.Bitmap minesweepSquare3 { + get { + object obj = ResourceManager.GetObject("minesweepSquare3", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// <summary> + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// </summary> + internal static System.Drawing.Bitmap minesweepSquare4 { + get { + object obj = ResourceManager.GetObject("minesweepSquare4", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// <summary> + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// </summary> + internal static System.Drawing.Bitmap minesweepSquareExploded { + get { + object obj = ResourceManager.GetObject("minesweepSquareExploded", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// <summary> + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// </summary> + internal static System.Drawing.Bitmap minesweepSquareMine { + get { + object obj = ResourceManager.GetObject("minesweepSquareMine", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// <summary> /// Looks up a localized resource of type System.IO.UnmanagedMemoryStream similar to System.IO.MemoryStream. /// </summary> internal static System.IO.UnmanagedMemoryStream modem_dial { diff --git a/TimeHACK.Main/Properties/Resources.resx b/TimeHACK.Main/Properties/Resources.resx index b893582..0ccafe4 100644 --- a/TimeHACK.Main/Properties/Resources.resx +++ b/TimeHACK.Main/Properties/Resources.resx @@ -720,4 +720,28 @@ <data name="Lemon_s_LCD" type="System.Resources.ResXFileRef, System.Windows.Forms"> <value>..\resources\lemon's lcd.ttf;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </data> + <data name="minesweepSquare" type="System.Resources.ResXFileRef, System.Windows.Forms"> + <value>..\Resources\minesweepSquare.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> + </data> + <data name="minesweepSquare0" type="System.Resources.ResXFileRef, System.Windows.Forms"> + <value>..\Resources\minesweepSquare0.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> + </data> + <data name="minesweepSquare1" type="System.Resources.ResXFileRef, System.Windows.Forms"> + <value>..\Resources\minesweepSquare1.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> + </data> + <data name="minesweepSquare2" type="System.Resources.ResXFileRef, System.Windows.Forms"> + <value>..\Resources\minesweepSquare2.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> + </data> + <data name="minesweepSquare3" type="System.Resources.ResXFileRef, System.Windows.Forms"> + <value>..\Resources\minesweepSquare3.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> + </data> + <data name="minesweepSquare4" type="System.Resources.ResXFileRef, System.Windows.Forms"> + <value>..\Resources\minesweepSquare4.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> + </data> + <data name="minesweepSquareExploded" type="System.Resources.ResXFileRef, System.Windows.Forms"> + <value>..\Resources\minesweepSquareExploded.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> + </data> + <data name="minesweepSquareMine" type="System.Resources.ResXFileRef, System.Windows.Forms"> + <value>..\Resources\minesweepSquareMine.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> + </data> </root>
\ No newline at end of file diff --git a/TimeHACK.Main/Resources/minesweepSquare.png b/TimeHACK.Main/Resources/minesweepSquare.png Binary files differnew file mode 100644 index 0000000..8ce60a7 --- /dev/null +++ b/TimeHACK.Main/Resources/minesweepSquare.png diff --git a/TimeHACK.Main/Resources/minesweepSquare0.png b/TimeHACK.Main/Resources/minesweepSquare0.png Binary files differnew file mode 100644 index 0000000..758ce7c --- /dev/null +++ b/TimeHACK.Main/Resources/minesweepSquare0.png diff --git a/TimeHACK.Main/Resources/minesweepSquare1.png b/TimeHACK.Main/Resources/minesweepSquare1.png Binary files differnew file mode 100644 index 0000000..4b72565 --- /dev/null +++ b/TimeHACK.Main/Resources/minesweepSquare1.png diff --git a/TimeHACK.Main/Resources/minesweepSquare2.png b/TimeHACK.Main/Resources/minesweepSquare2.png Binary files differnew file mode 100644 index 0000000..b57b254 --- /dev/null +++ b/TimeHACK.Main/Resources/minesweepSquare2.png diff --git a/TimeHACK.Main/Resources/minesweepSquare3.png b/TimeHACK.Main/Resources/minesweepSquare3.png Binary files differnew file mode 100644 index 0000000..43c83c1 --- /dev/null +++ b/TimeHACK.Main/Resources/minesweepSquare3.png diff --git a/TimeHACK.Main/Resources/minesweepSquare4.png b/TimeHACK.Main/Resources/minesweepSquare4.png Binary files differnew file mode 100644 index 0000000..39868f8 --- /dev/null +++ b/TimeHACK.Main/Resources/minesweepSquare4.png diff --git a/TimeHACK.Main/Resources/minesweepSquareExploded.png b/TimeHACK.Main/Resources/minesweepSquareExploded.png Binary files differnew file mode 100644 index 0000000..199b292 --- /dev/null +++ b/TimeHACK.Main/Resources/minesweepSquareExploded.png diff --git a/TimeHACK.Main/Resources/minesweepSquareMine.png b/TimeHACK.Main/Resources/minesweepSquareMine.png Binary files differnew file mode 100644 index 0000000..a523ec0 --- /dev/null +++ b/TimeHACK.Main/Resources/minesweepSquareMine.png diff --git a/TimeHACK.Main/Resources/minsweeper flag.PNG b/TimeHACK.Main/Resources/minsweeper flag.PNG Binary files differindex bb79134..81fd65f 100644 --- a/TimeHACK.Main/Resources/minsweeper flag.PNG +++ b/TimeHACK.Main/Resources/minsweeper flag.PNG diff --git a/TimeHACK.Main/TimeHACK.Main.csproj b/TimeHACK.Main/TimeHACK.Main.csproj index 658cc68..a85279f 100644 --- a/TimeHACK.Main/TimeHACK.Main.csproj +++ b/TimeHACK.Main/TimeHACK.Main.csproj @@ -540,6 +540,14 @@ <None Include="Resources\minsweeper smile.PNG" /> <None Include="Resources\minesweepeprlogo.PNG" /> <None Include="Resources\MinesweepNumBox.png" /> + <None Include="Resources\minesweepSquare.png" /> + <None Include="Resources\minesweepSquare0.png" /> + <None Include="Resources\minesweepSquare1.png" /> + <None Include="Resources\minesweepSquare2.png" /> + <None Include="Resources\minesweepSquare3.png" /> + <None Include="Resources\minesweepSquare4.png" /> + <None Include="Resources\minesweepSquareExploded.png" /> + <None Include="Resources\minesweepSquareMine.png" /> <Content Include="Resources\modem_dial.wav" /> <None Include="Resources\MS-DOS-logo-1.png" /> <None Include="Resources\msdosprompt.png" /> |
