diff options
Diffstat (limited to 'TimeHACK.Main/OS/Win95/Win95Apps')
5 files changed, 875 insertions, 0 deletions
diff --git a/TimeHACK.Main/OS/Win95/Win95Apps/MineSweeper/Game.cs b/TimeHACK.Main/OS/Win95/Win95Apps/MineSweeper/Game.cs new file mode 100644 index 0000000..e6f31dd --- /dev/null +++ b/TimeHACK.Main/OS/Win95/Win95Apps/MineSweeper/Game.cs @@ -0,0 +1,201 @@ +using System; +using System.Drawing; +using System.Windows.Forms; + + +namespace TimeHACK.OS.Win95.Win95Apps.MineSweeper +{ + public class Game + { + public event EventHandler DismantledMinesChanged; + public event EventHandler Tick; + + private int _dismantledMines; + private int _height; + private int _incorrectdismantledMines; + private int _mines; + private Panel _panel; + private Square[,] _squares; + private Timer _timer; + private int _width; + + public int Time; + + public Game(Panel panel, int width, int height, int mines) + { + _panel = panel; + _width = width; + _height = height; + _mines = mines; + } + + private void Dismantle(object sender, EventArgs e) + { + Square s = (Square)sender; + if (s.Dismantled) + { + if (s.Minded) + { + _dismantledMines++; + } + else + { + _incorrectdismantledMines++; + } + } + else + { + if (s.Minded) + { + _dismantledMines--; + } + else + { + _incorrectdismantledMines--; + } + } + + OnDismantledMinesChanged(); + + if (_dismantledMines == Mines) + { + _timer.Enabled = false; + Panel.Enabled = false; + } + } + + public int DismantledMines + { + get { return _dismantledMines + _incorrectdismantledMines; } + } + + private void Explode(object sender, EventArgs e) + { + _timer.Enabled = false; + + foreach (Square s in _squares) + { + s.RemoveEvents(); + if (s.Minded) + { + s.Button.Text = "*"; + s.Button.Font = new System.Drawing.Font("Arial Black", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); + s.Button.ForeColor = Color.Black; + } + } + } + + public int Height + { + get { return (this._height); } + } + + public bool IsBomb(int x, int y) + { + if (x >= 0 && x < Width) + { + if (y >= 0 && y < Height) + { + return _squares[x, y].Minded; + } + } + return false; + } + + public int Mines + { + get { return (this._mines); } + } + + protected void OnDismantledMinesChanged() + { + if (DismantledMinesChanged != null) + { + DismantledMinesChanged(this, new EventArgs()); + } + } + + protected void OnTick() + { + if (Tick != null) + { + Tick(this, new EventArgs()); + } + } + + public void OpenSpot(int x, int y) + { + if (x >= 0 && x < Width) + { + if (y >= 0 && y < Height) + { + _squares[x, y].Open(); + } + } + } + + public Panel Panel + { + get { return (this._panel); } + } + + public void Start() + { + + //Panel.SuspendLayout(); + Time = 0; + _dismantledMines = 0; + _incorrectdismantledMines = 0; + OnTick(); + Panel.Enabled = true; + Panel.Controls.Clear(); + + // Create Spots + _squares = new Square[Width, Height]; + for (int x = 0; x < Width; x++) + { + for (int y = 0; y < Height; y++) + { + Square s = new Square(this, x, y); + s.Explode += new EventHandler(Explode); + s.Dismantle += new EventHandler(Dismantle); + _squares[x, y] = s; + } + } + + // Place Mines + int b = 0; + Random r = new Random(); + while (b < Mines) + { + int x = r.Next(Width); + int y = r.Next(Height); + + Square s = _squares[x, y]; + if (!s.Minded) + { + s.Minded = true; + b++; + } + } + + OnDismantledMinesChanged(); + + _timer = new Timer(); + _timer.Interval = 1000; + _timer.Tick += new EventHandler(TimerTick); + _timer.Enabled = true; + } + + private void TimerTick(object sender, EventArgs e) + { + Time++; + OnTick(); + } + + public int Width + { + get { return (this._width); } + } + } +} diff --git a/TimeHACK.Main/OS/Win95/Win95Apps/MineSweeper/Square.cs b/TimeHACK.Main/OS/Win95/Win95Apps/MineSweeper/Square.cs new file mode 100644 index 0000000..f7a9e99 --- /dev/null +++ b/TimeHACK.Main/OS/Win95/Win95Apps/MineSweeper/Square.cs @@ -0,0 +1,199 @@ +using System; +using System.Drawing; +using System.Windows.Forms; +using TimeHACK.Engine; + +namespace TimeHACK.OS.Win95.Win95Apps.MineSweeper +{ + class Square + { + public event EventHandler Dismantle; + public event EventHandler Explode; + + private Button _button; + private bool _dismantled = false; + private Game _game; + private bool _minded = false; + private bool _opened = false; + private int _x; + private int _y; + + public Square(Game game, int x, int y) + { + _game = game; + _x = x; + _y = y; + _button = new Button(); + Button.Text = ""; + + int w = _game.Panel.Width / _game.Width; + int h = _game.Panel.Height / _game.Height; + + _button.Width = w + 1; + _button.Height = h + 1; + _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); + + _game.Panel.Controls.Add(Button); + } + + public Button Button + { + get { return (this._button); } + } + + private void Click(object sender, System.EventArgs e) + { + if (!Dismantled) + { + if (Minded) + { + Button.BackColor = Color.Red; + OnExplode(); + } + else + { + this.Open(); + } + } + } + + private void DismantleClick(object sender, MouseEventArgs e) + { + if (!Opened && e.Button == MouseButtons.Right) + { + if (Dismantled) + { + _dismantled = false; + Button.BackColor = SystemColors.Control; + Button.Text = "?"; + } + else + { + _dismantled = true; + Button.BackgroundImage = Properties.Resources.minsweeper_flag; + } + OnDismantle(); + } + } + + public bool Dismantled + { + get { return (this._dismantled); } + } + + public bool Minded + { + get { return (this._minded); } + set { this._minded = value; } + } + + protected void OnDismantle() + { + if (Dismantle != null) + { + Dismantle(this, new EventArgs()); + } + } + + protected void OnExplode() + { + if (Explode != null) + { + Explode(this, new EventArgs()); + } + } + + public void Open() + { + if (!Opened && !Dismantled) + { + _opened = true; + // Count Bombs + int c = 0; + if (_game.IsBomb(X - 1, Y - 1)) c++; + if (_game.IsBomb(X - 0, Y - 1)) c++; + if (_game.IsBomb(X + 1, Y - 1)) c++; + if (_game.IsBomb(X - 1, Y - 0)) c++; + if (_game.IsBomb(X - 0, Y - 0)) c++; + if (_game.IsBomb(X + 1, Y - 0)) c++; + if (_game.IsBomb(X - 1, Y + 1)) c++; + if (_game.IsBomb(X - 0, Y + 1)) c++; + if (_game.IsBomb(X + 1, Y + 1)) c++; + + if (c > 0) + { + Button.Text = c.ToString(); + switch (c) + { + case 1: + Button.ForeColor = Color.Blue; + break; + case 2: + Button.ForeColor = Color.Green; + break; + case 3: + Button.ForeColor = Color.Red; + break; + case 4: + Button.ForeColor = Color.DarkBlue; + break; + case 5: + Button.ForeColor = Color.DarkRed; + break; + case 6: + Button.ForeColor = Color.LightBlue; + break; + case 7: + Button.ForeColor = Color.Orange; // Guesed, never seen one! + break; + case 8: + Button.ForeColor = Color.Ivory; // Guesed, never seen one! + break; + } + } + else + { + Button.BackColor = SystemColors.ControlLight; + Button.FlatStyle = FlatStyle.Flat; + Button.Enabled = false; + + _game.OpenSpot(X - 1, Y - 1); + _game.OpenSpot(X - 0, Y - 1); + _game.OpenSpot(X + 1, Y - 1); + _game.OpenSpot(X - 1, Y - 0); + _game.OpenSpot(X - 0, Y - 0); + _game.OpenSpot(X + 1, Y - 0); + _game.OpenSpot(X - 1, Y + 1); + _game.OpenSpot(X - 0, Y + 1); + _game.OpenSpot(X + 1, Y + 1); + } + } + } + + public bool Opened + { + get { return (this._opened); } + } + + public int X + { + get { return (this._x); } + } + + public int Y + { + get { return (this._y); } + } + + public void RemoveEvents() + { + _button.Click -= new EventHandler(Click); + _button.MouseDown -= new MouseEventHandler(DismantleClick); + } + } +} diff --git a/TimeHACK.Main/OS/Win95/Win95Apps/MineSweeper/WinClassicMinesweeper.Designer.cs b/TimeHACK.Main/OS/Win95/Win95Apps/MineSweeper/WinClassicMinesweeper.Designer.cs new file mode 100644 index 0000000..59c11db --- /dev/null +++ b/TimeHACK.Main/OS/Win95/Win95Apps/MineSweeper/WinClassicMinesweeper.Designer.cs @@ -0,0 +1,311 @@ +namespace TimeHACK.OS.Win95.Win95Apps +{ + partial class WinClassicMinesweeper + { + /// <summary> + /// Required designer variable. + /// </summary> + private System.ComponentModel.IContainer components = null; + + /// <summary> + /// Clean up any resources being used. + /// </summary> + /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// <summary> + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// </summary> + private void InitializeComponent() + { + this.labelBombs = new System.Windows.Forms.Label(); + this.labelTime = new System.Windows.Forms.Label(); + this.panel1 = new System.Windows.Forms.Panel(); + this.menuStrip1 = new System.Windows.Forms.MenuStrip(); + this.gameToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.newToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); + this.begginnerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.intermediateToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.expertToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.customToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); + this.marksToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.colorToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator(); + this.bestTimesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator(); + this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.helpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.helpTopicsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator(); + this.aboutMinesweeperToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.pictureBox1 = new System.Windows.Forms.PictureBox(); + this.menuStrip1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); + this.SuspendLayout(); + // + // labelBombs + // + this.labelBombs.BackColor = System.Drawing.Color.Black; + this.labelBombs.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; + this.labelBombs.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.labelBombs.ForeColor = System.Drawing.Color.Red; + this.labelBombs.Location = new System.Drawing.Point(18, 34); + this.labelBombs.Name = "labelBombs"; + this.labelBombs.Size = new System.Drawing.Size(56, 23); + this.labelBombs.TabIndex = 7; + this.labelBombs.Text = "0"; + this.labelBombs.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // labelTime + // + this.labelTime.BackColor = System.Drawing.Color.Black; + this.labelTime.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; + this.labelTime.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.labelTime.ForeColor = System.Drawing.Color.Red; + this.labelTime.Location = new System.Drawing.Point(116, 34); + this.labelTime.Name = "labelTime"; + this.labelTime.Size = new System.Drawing.Size(56, 23); + this.labelTime.TabIndex = 6; + this.labelTime.Text = "0"; + this.labelTime.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // panel1 + // + this.panel1.Location = new System.Drawing.Point(18, 66); + this.panel1.Name = "panel1"; + this.panel1.Size = new System.Drawing.Size(256, 224); + this.panel1.TabIndex = 4; + // + // menuStrip1 + // + this.menuStrip1.ImageScalingSize = new System.Drawing.Size(0, 0); + this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.gameToolStripMenuItem, + this.helpToolStripMenuItem}); + this.menuStrip1.Location = new System.Drawing.Point(0, 0); + this.menuStrip1.Name = "menuStrip1"; + this.menuStrip1.Size = new System.Drawing.Size(302, 24); + this.menuStrip1.TabIndex = 8; + this.menuStrip1.Text = "menuStrip1"; + // + // gameToolStripMenuItem + // + this.gameToolStripMenuItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + this.gameToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.newToolStripMenuItem, + this.toolStripSeparator1, + this.begginnerToolStripMenuItem, + this.intermediateToolStripMenuItem, + this.expertToolStripMenuItem, + this.customToolStripMenuItem, + this.toolStripSeparator2, + this.marksToolStripMenuItem, + this.colorToolStripMenuItem, + this.toolStripSeparator3, + this.bestTimesToolStripMenuItem, + this.toolStripSeparator4, + this.exitToolStripMenuItem}); + this.gameToolStripMenuItem.Name = "gameToolStripMenuItem"; + this.gameToolStripMenuItem.Size = new System.Drawing.Size(50, 20); + this.gameToolStripMenuItem.Text = "Game"; + // + // newToolStripMenuItem + // + this.newToolStripMenuItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + this.newToolStripMenuItem.Name = "newToolStripMenuItem"; + this.newToolStripMenuItem.Size = new System.Drawing.Size(141, 22); + this.newToolStripMenuItem.Text = "New"; + this.newToolStripMenuItem.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.newToolStripMenuItem.TextImageRelation = System.Windows.Forms.TextImageRelation.TextBeforeImage; + // + // toolStripSeparator1 + // + this.toolStripSeparator1.Name = "toolStripSeparator1"; + this.toolStripSeparator1.Size = new System.Drawing.Size(138, 6); + // + // begginnerToolStripMenuItem + // + this.begginnerToolStripMenuItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + this.begginnerToolStripMenuItem.Name = "begginnerToolStripMenuItem"; + this.begginnerToolStripMenuItem.Size = new System.Drawing.Size(141, 22); + this.begginnerToolStripMenuItem.Text = "Begginner"; + this.begginnerToolStripMenuItem.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.begginnerToolStripMenuItem.TextImageRelation = System.Windows.Forms.TextImageRelation.TextBeforeImage; + // + // intermediateToolStripMenuItem + // + this.intermediateToolStripMenuItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + this.intermediateToolStripMenuItem.Name = "intermediateToolStripMenuItem"; + this.intermediateToolStripMenuItem.Size = new System.Drawing.Size(141, 22); + this.intermediateToolStripMenuItem.Text = "Intermediate"; + this.intermediateToolStripMenuItem.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.intermediateToolStripMenuItem.TextImageRelation = System.Windows.Forms.TextImageRelation.TextBeforeImage; + // + // expertToolStripMenuItem + // + this.expertToolStripMenuItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + this.expertToolStripMenuItem.Name = "expertToolStripMenuItem"; + this.expertToolStripMenuItem.Size = new System.Drawing.Size(141, 22); + this.expertToolStripMenuItem.Text = "Expert"; + this.expertToolStripMenuItem.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.expertToolStripMenuItem.TextImageRelation = System.Windows.Forms.TextImageRelation.TextBeforeImage; + // + // customToolStripMenuItem + // + this.customToolStripMenuItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + this.customToolStripMenuItem.Name = "customToolStripMenuItem"; + this.customToolStripMenuItem.Size = new System.Drawing.Size(141, 22); + this.customToolStripMenuItem.Text = "Custom"; + this.customToolStripMenuItem.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.customToolStripMenuItem.TextImageRelation = System.Windows.Forms.TextImageRelation.TextBeforeImage; + // + // toolStripSeparator2 + // + this.toolStripSeparator2.Name = "toolStripSeparator2"; + this.toolStripSeparator2.Size = new System.Drawing.Size(138, 6); + // + // marksToolStripMenuItem + // + this.marksToolStripMenuItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + this.marksToolStripMenuItem.Name = "marksToolStripMenuItem"; + this.marksToolStripMenuItem.Size = new System.Drawing.Size(141, 22); + this.marksToolStripMenuItem.Text = "Marks {?}"; + this.marksToolStripMenuItem.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.marksToolStripMenuItem.TextImageRelation = System.Windows.Forms.TextImageRelation.TextBeforeImage; + // + // colorToolStripMenuItem + // + this.colorToolStripMenuItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + this.colorToolStripMenuItem.Name = "colorToolStripMenuItem"; + this.colorToolStripMenuItem.Size = new System.Drawing.Size(141, 22); + this.colorToolStripMenuItem.Text = "Color"; + this.colorToolStripMenuItem.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.colorToolStripMenuItem.TextImageRelation = System.Windows.Forms.TextImageRelation.TextBeforeImage; + // + // toolStripSeparator3 + // + this.toolStripSeparator3.Name = "toolStripSeparator3"; + this.toolStripSeparator3.Size = new System.Drawing.Size(138, 6); + // + // bestTimesToolStripMenuItem + // + this.bestTimesToolStripMenuItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + this.bestTimesToolStripMenuItem.Name = "bestTimesToolStripMenuItem"; + this.bestTimesToolStripMenuItem.Size = new System.Drawing.Size(141, 22); + this.bestTimesToolStripMenuItem.Text = "Best Times"; + this.bestTimesToolStripMenuItem.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.bestTimesToolStripMenuItem.TextImageRelation = System.Windows.Forms.TextImageRelation.TextBeforeImage; + // + // toolStripSeparator4 + // + this.toolStripSeparator4.Name = "toolStripSeparator4"; + this.toolStripSeparator4.Size = new System.Drawing.Size(138, 6); + // + // exitToolStripMenuItem + // + this.exitToolStripMenuItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + this.exitToolStripMenuItem.Name = "exitToolStripMenuItem"; + this.exitToolStripMenuItem.Size = new System.Drawing.Size(141, 22); + this.exitToolStripMenuItem.Text = "Exit"; + this.exitToolStripMenuItem.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.exitToolStripMenuItem.TextImageRelation = System.Windows.Forms.TextImageRelation.TextBeforeImage; + // + // helpToolStripMenuItem + // + this.helpToolStripMenuItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + this.helpToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.helpTopicsToolStripMenuItem, + this.toolStripSeparator5, + this.aboutMinesweeperToolStripMenuItem}); + this.helpToolStripMenuItem.Name = "helpToolStripMenuItem"; + this.helpToolStripMenuItem.Size = new System.Drawing.Size(44, 20); + this.helpToolStripMenuItem.Text = "Help"; + // + // helpTopicsToolStripMenuItem + // + this.helpTopicsToolStripMenuItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + this.helpTopicsToolStripMenuItem.Name = "helpTopicsToolStripMenuItem"; + this.helpTopicsToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.helpTopicsToolStripMenuItem.Text = "Help Topics"; + // + // toolStripSeparator5 + // + this.toolStripSeparator5.Name = "toolStripSeparator5"; + this.toolStripSeparator5.Size = new System.Drawing.Size(177, 6); + // + // aboutMinesweeperToolStripMenuItem + // + this.aboutMinesweeperToolStripMenuItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + this.aboutMinesweeperToolStripMenuItem.Name = "aboutMinesweeperToolStripMenuItem"; + this.aboutMinesweeperToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.aboutMinesweeperToolStripMenuItem.Text = "About Minesweeper"; + // + // pictureBox1 + // + this.pictureBox1.Image = global::TimeHACK.Properties.Resources.minsweeper_smile; + this.pictureBox1.Location = new System.Drawing.Point(80, 34); + this.pictureBox1.Name = "pictureBox1"; + this.pictureBox1.Size = new System.Drawing.Size(30, 26); + this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox1.TabIndex = 9; + this.pictureBox1.TabStop = false; + this.pictureBox1.Click += new System.EventHandler(this.pictureBox1_Click); + // + // WinClassicMinesweeper + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.pictureBox1); + 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(302, 306); + this.menuStrip1.ResumeLayout(false); + this.menuStrip1.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label labelBombs; + private System.Windows.Forms.Label labelTime; + private System.Windows.Forms.Panel panel1; + private System.Windows.Forms.MenuStrip menuStrip1; + private System.Windows.Forms.ToolStripMenuItem gameToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem newToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; + private System.Windows.Forms.ToolStripMenuItem begginnerToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem intermediateToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem expertToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem customToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator2; + private System.Windows.Forms.ToolStripMenuItem marksToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem colorToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator3; + private System.Windows.Forms.ToolStripMenuItem bestTimesToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator4; + private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem helpToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem helpTopicsToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator5; + private System.Windows.Forms.ToolStripMenuItem aboutMinesweeperToolStripMenuItem; + private System.Windows.Forms.PictureBox pictureBox1; + } +} diff --git a/TimeHACK.Main/OS/Win95/Win95Apps/MineSweeper/WinClassicMinesweeper.cs b/TimeHACK.Main/OS/Win95/Win95Apps/MineSweeper/WinClassicMinesweeper.cs new file mode 100644 index 0000000..a7e043f --- /dev/null +++ b/TimeHACK.Main/OS/Win95/Win95Apps/MineSweeper/WinClassicMinesweeper.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using TimeHACK.OS.Win95.Win95Apps.MineSweeper; + +namespace TimeHACK.OS.Win95.Win95Apps +{ + public partial class WinClassicMinesweeper : UserControl + { + private Game _game; + public int currentface = 1; + public WinClassicMinesweeper() + { + InitializeComponent(); + } + private void GameTick(object sender, EventArgs e) + { + labelTime.Text = _game.Time.ToString(); + } + + private void GameDismantledMinesChanged(object sender, EventArgs e) + { + labelBombs.Text = (_game.Mines - _game.DismantledMines).ToString(); + } + + private void pictureBox1_Click(object sender, EventArgs e) + { + Cursor.Current = Cursors.WaitCursor; + _game = new Game(this.panel1, 8, 8, 10); + _game.Tick += new EventHandler(GameTick); + _game.DismantledMinesChanged += new EventHandler(GameDismantledMinesChanged); + _game.Start(); + } + } +} diff --git a/TimeHACK.Main/OS/Win95/Win95Apps/MineSweeper/WinClassicMinesweeper.resx b/TimeHACK.Main/OS/Win95/Win95Apps/MineSweeper/WinClassicMinesweeper.resx new file mode 100644 index 0000000..d5494e3 --- /dev/null +++ b/TimeHACK.Main/OS/Win95/Win95Apps/MineSweeper/WinClassicMinesweeper.resx @@ -0,0 +1,123 @@ +<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" use="required" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>17, 17</value> + </metadata> +</root>
\ No newline at end of file |
