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/OS | |
| parent | cb0ebed2918341ce02978bc32ab6e284ae5f000a (diff) | |
| download | histacom2-e838d66d36751fdbf5c2f7fadab8fee42729b6ac.tar.gz histacom2-e838d66d36751fdbf5c2f7fadab8fee42729b6ac.tar.bz2 histacom2-e838d66d36751fdbf5c2f7fadab8fee42729b6ac.zip | |
minesweeper gfx part 1
Diffstat (limited to 'TimeHACK.Main/OS')
4 files changed, 50 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) |
