Click here to Skip to main content
15,886,770 members
Articles / Mobile Apps

Bunnyaruga: GAPI, Hekkus, Basics of Deployment

Rate me:
Please Sign up or sign in to vote.
3.63/5 (15 votes)
25 Apr 2004CPOL14 min read 54.1K   247   20  
This article shows an example of a game that uses the GAPI and Hekkus libraries. It also shows a nice and free way of deploying your games/applications without requiring the .NET Framework installed on the end user machines.
#region Using Statements
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
#endregion
namespace Bunnyhug.Bunnyaruga
{
	/// <summary>
	/// The main form displayed for bunnyaruga
	/// </summary>
	public class OptionsForm : System.Windows.Forms.Form
	{
		#region Variables
		private GameOptions options;
		private System.Windows.Forms.Button saveButton;
		private System.Windows.Forms.Button cancelButton;
		private Microsoft.WindowsCE.Forms.InputPanel inputPanel;
		private System.Windows.Forms.TabControl tabControl;
		private System.Windows.Forms.TabPage generalTabPage;
		private System.Windows.Forms.TabPage fishTabPage;
		private System.Windows.Forms.TabPage sharkTabPage;
		private System.Windows.Forms.Label playerNameLabel;
		private System.Windows.Forms.TextBox playerTextBox;
		private System.Windows.Forms.ComboBox sharkSpawnComboBox;
		private System.Windows.Forms.Label sharkSpawnLabel;
		private System.Windows.Forms.Label numberOfFishLabel;
		private System.Windows.Forms.NumericUpDown fishColor2UpDown;
		private System.Windows.Forms.NumericUpDown fishColor1UpDown;
		private System.Windows.Forms.ComboBox fishSpawnComboBox;
		private System.Windows.Forms.Label fishSpawnLabel;
		private System.Windows.Forms.Label label2;
		private System.Windows.Forms.Label label4;
		private System.Windows.Forms.Label label5;
		private System.Windows.Forms.Label label6;
		private System.Windows.Forms.Label label7;
		private System.Windows.Forms.Label label8;
		private System.Windows.Forms.Label label9;
		private System.Windows.Forms.Label label10;
		private System.Windows.Forms.ComboBox soundsComboBox;
		private System.Windows.Forms.ComboBox musicComboBox;
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.Label label3;
		private System.Windows.Forms.ComboBox fishSpeedComboBox;
		private System.Windows.Forms.NumericUpDown fishMinimumSpeedUpDown;
		private System.Windows.Forms.NumericUpDown fishMaximumSpeedUpDown;
		private System.Windows.Forms.NumericUpDown fishWidthUpDown;
		private System.Windows.Forms.NumericUpDown fishHeightUpDown;
		private System.Windows.Forms.NumericUpDown sharkHeightUpDown;
		private System.Windows.Forms.NumericUpDown sharkWidthUpDown;
		private System.Windows.Forms.NumericUpDown sharkToughnessUpDown;
		private System.Windows.Forms.ComboBox screenEdgeComboBox;
		private System.Windows.Forms.Label screenEdgeLabel;
		/// <summary>
		/// The graphics object used to draw bitmaps on the screen
		/// </summary>
		private System.Drawing.Graphics graphics;

		#endregion

		#region Properties
		/// <summary>
		/// Property Options (GameOptions)
		/// </summary>
		public GameOptions Options
		{
			get
			{
				return this.options;
			}
			set
			{
				this.options = value;
			}
		}
		#endregion

		#region Constructor/Main/Dispose
		/// <summary>
		/// Constructor
		/// </summary>
		public OptionsForm()
		{
			InitializeComponent();
			this.tabControl.BackColor = Color.Black;
			this.generalTabPage.BackColor = Color.Black;
			this.fishTabPage.BackColor = Color.Black;
			this.sharkTabPage.BackColor = Color.Black;

			options = GameOptions.Deserialize();
			if (options.ScreenEdgeCausesDeath)
			{
				this.screenEdgeComboBox.SelectedIndex = 0;
			}
			else
			{
				this.screenEdgeComboBox.SelectedIndex = 1;
			}

			this.fishColor1UpDown.Value = options.NumberOfFishColor1;
			this.fishColor2UpDown.Value = options.NumberOfFishColor2;
			this.sharkSpawnComboBox.SelectedIndex = (int)options.SharkSpawnOption;
			this.fishSpawnComboBox.SelectedIndex = (int)options.FishSpawnOption;
			this.playerTextBox.Text = options.PlayerName;
			this.musicComboBox.SelectedIndex = options.MusicVolume;
			this.soundsComboBox.SelectedIndex = options.SoundsVolume;
			this.fishSpeedComboBox.SelectedIndex = (int)options.FishSpeed;
			this.fishMinimumSpeedUpDown.Value = options.MinimumSpeed;
			this.fishMaximumSpeedUpDown.Value = options.MaximumSpeed;
			this.sharkToughnessUpDown.Value = options.SharkToughness;
		}
		
		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			base.Dispose( disposing );
		}
		#endregion

		#region Windows Form 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()
		{
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(OptionsForm));
			this.saveButton = new System.Windows.Forms.Button();
			this.cancelButton = new System.Windows.Forms.Button();
			this.inputPanel = new Microsoft.WindowsCE.Forms.InputPanel();
			this.tabControl = new System.Windows.Forms.TabControl();
			this.generalTabPage = new System.Windows.Forms.TabPage();
			this.soundsComboBox = new System.Windows.Forms.ComboBox();
			this.musicComboBox = new System.Windows.Forms.ComboBox();
			this.label1 = new System.Windows.Forms.Label();
			this.label3 = new System.Windows.Forms.Label();
			this.playerNameLabel = new System.Windows.Forms.Label();
			this.playerTextBox = new System.Windows.Forms.TextBox();
			this.fishTabPage = new System.Windows.Forms.TabPage();
			this.label7 = new System.Windows.Forms.Label();
			this.fishHeightUpDown = new System.Windows.Forms.NumericUpDown();
			this.label6 = new System.Windows.Forms.Label();
			this.fishWidthUpDown = new System.Windows.Forms.NumericUpDown();
			this.label5 = new System.Windows.Forms.Label();
			this.fishMaximumSpeedUpDown = new System.Windows.Forms.NumericUpDown();
			this.label4 = new System.Windows.Forms.Label();
			this.fishMinimumSpeedUpDown = new System.Windows.Forms.NumericUpDown();
			this.fishSpeedComboBox = new System.Windows.Forms.ComboBox();
			this.label2 = new System.Windows.Forms.Label();
			this.numberOfFishLabel = new System.Windows.Forms.Label();
			this.fishColor2UpDown = new System.Windows.Forms.NumericUpDown();
			this.fishColor1UpDown = new System.Windows.Forms.NumericUpDown();
			this.fishSpawnComboBox = new System.Windows.Forms.ComboBox();
			this.fishSpawnLabel = new System.Windows.Forms.Label();
			this.sharkTabPage = new System.Windows.Forms.TabPage();
			this.label10 = new System.Windows.Forms.Label();
			this.sharkToughnessUpDown = new System.Windows.Forms.NumericUpDown();
			this.label8 = new System.Windows.Forms.Label();
			this.sharkHeightUpDown = new System.Windows.Forms.NumericUpDown();
			this.label9 = new System.Windows.Forms.Label();
			this.sharkWidthUpDown = new System.Windows.Forms.NumericUpDown();
			this.sharkSpawnComboBox = new System.Windows.Forms.ComboBox();
			this.sharkSpawnLabel = new System.Windows.Forms.Label();
			this.screenEdgeComboBox = new System.Windows.Forms.ComboBox();
			this.screenEdgeLabel = new System.Windows.Forms.Label();
			// 
			// saveButton
			// 
			this.saveButton.Location = new System.Drawing.Point(160, 256);
			this.saveButton.Text = "Save";
			this.saveButton.Click += new System.EventHandler(this.saveButton_Click);
			// 
			// cancelButton
			// 
			this.cancelButton.Location = new System.Drawing.Point(80, 256);
			this.cancelButton.Text = "Cancel";
			this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click);
			// 
			// tabControl
			// 
			this.tabControl.Controls.Add(this.generalTabPage);
//			this.tabControl.Controls.Add(this.fishTabPage);
//			this.tabControl.Controls.Add(this.sharkTabPage);
			this.tabControl.SelectedIndex = 0;
			this.tabControl.Size = new System.Drawing.Size(240, 256);
			// 
			// generalTabPage
			// 
			this.generalTabPage.Controls.Add(this.soundsComboBox);
			this.generalTabPage.Controls.Add(this.musicComboBox);
			this.generalTabPage.Controls.Add(this.label1);
			this.generalTabPage.Controls.Add(this.label3);
			this.generalTabPage.Controls.Add(this.playerNameLabel);
			this.generalTabPage.Controls.Add(this.playerTextBox);
			this.generalTabPage.Location = new System.Drawing.Point(4, 4);
			this.generalTabPage.Size = new System.Drawing.Size(232, 230);
			this.generalTabPage.Text = "General";
			// 
			// soundsComboBox
			// 
			this.soundsComboBox.Items.Add("Off");
			this.soundsComboBox.Items.Add("On");
			this.soundsComboBox.Location = new System.Drawing.Point(104, 56);
			this.soundsComboBox.Size = new System.Drawing.Size(120, 22);
			// 
			// musicComboBox
			// 
			this.musicComboBox.Items.Add("Off");
			this.musicComboBox.Items.Add("On");
			this.musicComboBox.Location = new System.Drawing.Point(104, 32);
			this.musicComboBox.Size = new System.Drawing.Size(120, 22);
			// 
			// label1
			// 
			this.label1.ForeColor = System.Drawing.Color.LightGray;
			this.label1.Location = new System.Drawing.Point(8, 32);
			this.label1.Size = new System.Drawing.Size(96, 20);
			this.label1.Text = "Music";
			// 
			// label3
			// 
			this.label3.ForeColor = System.Drawing.Color.LightGray;
			this.label3.Location = new System.Drawing.Point(8, 56);
			this.label3.Size = new System.Drawing.Size(96, 20);
			this.label3.Text = "Sound Effects";
			// 
			// playerNameLabel
			// 
			this.playerNameLabel.ForeColor = System.Drawing.Color.LightGray;
			this.playerNameLabel.Location = new System.Drawing.Point(8, 8);
			this.playerNameLabel.Size = new System.Drawing.Size(88, 20);
			this.playerNameLabel.Text = "Player Name";
			// 
			// playerTextBox
			// 
			this.playerTextBox.Location = new System.Drawing.Point(104, 8);
			this.playerTextBox.Size = new System.Drawing.Size(120, 22);
			this.playerTextBox.Text = "";
			this.playerTextBox.LostFocus += new System.EventHandler(this.playerTextBox_LostFocus);
			this.playerTextBox.GotFocus += new System.EventHandler(this.playerTextBox_GotFocus);
			// 
			// fishTabPage
			// 
			this.fishTabPage.Controls.Add(this.label7);
			this.fishTabPage.Controls.Add(this.fishHeightUpDown);
			this.fishTabPage.Controls.Add(this.label6);
			this.fishTabPage.Controls.Add(this.fishWidthUpDown);
			this.fishTabPage.Controls.Add(this.label5);
			this.fishTabPage.Controls.Add(this.fishMaximumSpeedUpDown);
			this.fishTabPage.Controls.Add(this.label4);
			this.fishTabPage.Controls.Add(this.fishMinimumSpeedUpDown);
			this.fishTabPage.Controls.Add(this.fishSpeedComboBox);
			this.fishTabPage.Controls.Add(this.label2);
			this.fishTabPage.Controls.Add(this.numberOfFishLabel);
			this.fishTabPage.Controls.Add(this.fishColor2UpDown);
			this.fishTabPage.Controls.Add(this.fishColor1UpDown);
			this.fishTabPage.Controls.Add(this.fishSpawnComboBox);
			this.fishTabPage.Controls.Add(this.fishSpawnLabel);
			this.fishTabPage.Location = new System.Drawing.Point(4, 4);
			this.fishTabPage.Size = new System.Drawing.Size(232, 230);
			this.fishTabPage.Text = "Fish";
			// 
			// label7
			// 
			this.label7.ForeColor = System.Drawing.Color.LightGray;
			this.label7.Location = new System.Drawing.Point(8, 152);
			this.label7.Text = "Fish Height";
			// 
			// fishHeightUpDown
			// 
			this.fishHeightUpDown.Increment = new System.Decimal(new int[] {
																			   5,
																			   0,
																			   0,
																			   0});
			this.fishHeightUpDown.Location = new System.Drawing.Point(112, 152);
			this.fishHeightUpDown.Size = new System.Drawing.Size(56, 20);
			this.fishHeightUpDown.Value = new System.Decimal(new int[] {
																		   10,
																		   0,
																		   0,
																		   0});
			// 
			// label6
			// 
			this.label6.ForeColor = System.Drawing.Color.LightGray;
			this.label6.Location = new System.Drawing.Point(8, 128);
			this.label6.Text = "Fish Width";
			// 
			// fishWidthUpDown
			// 
			this.fishWidthUpDown.Increment = new System.Decimal(new int[] {
																			  5,
																			  0,
																			  0,
																			  0});
			this.fishWidthUpDown.Location = new System.Drawing.Point(112, 128);
			this.fishWidthUpDown.Size = new System.Drawing.Size(56, 20);
			this.fishWidthUpDown.Value = new System.Decimal(new int[] {
																		  10,
																		  0,
																		  0,
																		  0});
			// 
			// label5
			// 
			this.label5.ForeColor = System.Drawing.Color.LightGray;
			this.label5.Location = new System.Drawing.Point(8, 104);
			this.label5.Text = "Maximum Speed";
			// 
			// fishMaximumSpeedUpDown
			// 
			this.fishMaximumSpeedUpDown.Increment = new System.Decimal(new int[] {
																					 5,
																					 0,
																					 0,
																					 0});
			this.fishMaximumSpeedUpDown.Location = new System.Drawing.Point(112, 104);
			this.fishMaximumSpeedUpDown.Size = new System.Drawing.Size(56, 20);
			this.fishMaximumSpeedUpDown.Value = new System.Decimal(new int[] {
																				 10,
																				 0,
																				 0,
																				 0});
			// 
			// label4
			// 
			this.label4.ForeColor = System.Drawing.Color.LightGray;
			this.label4.Location = new System.Drawing.Point(8, 80);
			this.label4.Text = "Minimum Speed";
			// 
			// fishMinimumSpeedUpDown
			// 
			this.fishMinimumSpeedUpDown.Increment = new System.Decimal(new int[] {
																					 5,
																					 0,
																					 0,
																					 0});
			this.fishMinimumSpeedUpDown.Location = new System.Drawing.Point(112, 80);
			this.fishMinimumSpeedUpDown.Size = new System.Drawing.Size(56, 20);
			this.fishMinimumSpeedUpDown.Value = new System.Decimal(new int[] {
																				 10,
																				 0,
																				 0,
																				 0});
			// 
			// fishSpeedComboBox
			// 
			this.fishSpeedComboBox.Items.Add("Constant");
			this.fishSpeedComboBox.Items.Add("Random");
			this.fishSpeedComboBox.Location = new System.Drawing.Point(112, 56);
			this.fishSpeedComboBox.Size = new System.Drawing.Size(120, 22);
			// 
			// label2
			// 
			this.label2.ForeColor = System.Drawing.Color.LightGray;
			this.label2.Location = new System.Drawing.Point(8, 56);
			this.label2.Text = "Fish Speed";
			// 
			// numberOfFishLabel
			// 
			this.numberOfFishLabel.ForeColor = System.Drawing.Color.LightGray;
			this.numberOfFishLabel.Location = new System.Drawing.Point(8, 32);
			this.numberOfFishLabel.Text = "Number Of Fish";
			// 
			// fishColor2UpDown
			// 
			this.fishColor2UpDown.Increment = new System.Decimal(new int[] {
																			   5,
																			   0,
																			   0,
																			   0});
			this.fishColor2UpDown.Location = new System.Drawing.Point(176, 32);
			this.fishColor2UpDown.Size = new System.Drawing.Size(56, 20);
			this.fishColor2UpDown.Value = new System.Decimal(new int[] {
																		   10,
																		   0,
																		   0,
																		   0});
			// 
			// fishColor1UpDown
			// 
			this.fishColor1UpDown.Increment = new System.Decimal(new int[] {
																			   5,
																			   0,
																			   0,
																			   0});
			this.fishColor1UpDown.Location = new System.Drawing.Point(112, 32);
			this.fishColor1UpDown.Size = new System.Drawing.Size(56, 20);
			this.fishColor1UpDown.Value = new System.Decimal(new int[] {
																		   10,
																		   0,
																		   0,
																		   0});
			// 
			// fishSpawnComboBox
			// 
			this.fishSpawnComboBox.Items.Add("All Corners");
			this.fishSpawnComboBox.Items.Add("Top Corners");
			this.fishSpawnComboBox.Items.Add("Bottom Corners");
			this.fishSpawnComboBox.Items.Add("Top Left");
			this.fishSpawnComboBox.Items.Add("Top Right");
			this.fishSpawnComboBox.Items.Add("Bottom Left");
			this.fishSpawnComboBox.Items.Add("Bottom Right");
			this.fishSpawnComboBox.Location = new System.Drawing.Point(112, 8);
			this.fishSpawnComboBox.Size = new System.Drawing.Size(120, 22);
			// 
			// fishSpawnLabel
			// 
			this.fishSpawnLabel.ForeColor = System.Drawing.Color.LightGray;
			this.fishSpawnLabel.Location = new System.Drawing.Point(8, 8);
			this.fishSpawnLabel.Text = "Fish Spawn";
			// 
			// sharkTabPage
			// 
			this.sharkTabPage.Controls.Add(this.screenEdgeComboBox);
			this.sharkTabPage.Controls.Add(this.screenEdgeLabel);
			this.sharkTabPage.Controls.Add(this.label10);
			this.sharkTabPage.Controls.Add(this.sharkToughnessUpDown);
			this.sharkTabPage.Controls.Add(this.label8);
			this.sharkTabPage.Controls.Add(this.sharkHeightUpDown);
			this.sharkTabPage.Controls.Add(this.label9);
			this.sharkTabPage.Controls.Add(this.sharkWidthUpDown);
			this.sharkTabPage.Controls.Add(this.sharkSpawnComboBox);
			this.sharkTabPage.Controls.Add(this.sharkSpawnLabel);
			this.sharkTabPage.Location = new System.Drawing.Point(4, 4);
			this.sharkTabPage.Size = new System.Drawing.Size(232, 230);
			this.sharkTabPage.Text = "Shark";
			// 
			// label10
			// 
			this.label10.ForeColor = System.Drawing.Color.LightGray;
			this.label10.Location = new System.Drawing.Point(8, 8);
			this.label10.Text = "Shark Toughness";
			// 
			// sharkToughnessUpDown
			// 
			this.sharkToughnessUpDown.Increment = new System.Decimal(new int[] {
																				   5,
																				   0,
																				   0,
																				   0});
			this.sharkToughnessUpDown.Location = new System.Drawing.Point(112, 8);
			this.sharkToughnessUpDown.Size = new System.Drawing.Size(56, 20);
			this.sharkToughnessUpDown.Value = new System.Decimal(new int[] {
																			   10,
																			   0,
																			   0,
																			   0});
			// 
			// label8
			// 
			this.label8.ForeColor = System.Drawing.Color.LightGray;
			this.label8.Location = new System.Drawing.Point(8, 80);
			this.label8.Text = "Shark Height";
			// 
			// sharkHeightUpDown
			// 
			this.sharkHeightUpDown.Increment = new System.Decimal(new int[] {
																				5,
																				0,
																				0,
																				0});
			this.sharkHeightUpDown.Location = new System.Drawing.Point(112, 80);
			this.sharkHeightUpDown.Size = new System.Drawing.Size(56, 20);
			this.sharkHeightUpDown.Value = new System.Decimal(new int[] {
																			10,
																			0,
																			0,
																			0});
			// 
			// label9
			// 
			this.label9.ForeColor = System.Drawing.Color.LightGray;
			this.label9.Location = new System.Drawing.Point(8, 56);
			this.label9.Text = "Shark Width";
			// 
			// sharkWidthUpDown
			// 
			this.sharkWidthUpDown.Increment = new System.Decimal(new int[] {
																			   5,
																			   0,
																			   0,
																			   0});
			this.sharkWidthUpDown.Location = new System.Drawing.Point(112, 56);
			this.sharkWidthUpDown.Size = new System.Drawing.Size(56, 20);
			this.sharkWidthUpDown.Value = new System.Decimal(new int[] {
																		   10,
																		   0,
																		   0,
																		   0});
			// 
			// sharkSpawnComboBox
			// 
			this.sharkSpawnComboBox.Items.Add("Center");
			this.sharkSpawnComboBox.Items.Add("Top Center");
			this.sharkSpawnComboBox.Items.Add("Bottom Center");
			this.sharkSpawnComboBox.Items.Add("Left Center");
			this.sharkSpawnComboBox.Items.Add("Right Center");
			this.sharkSpawnComboBox.Location = new System.Drawing.Point(112, 32);
			this.sharkSpawnComboBox.Size = new System.Drawing.Size(120, 22);
			// 
			// sharkSpawnLabel
			// 
			this.sharkSpawnLabel.ForeColor = System.Drawing.Color.LightGray;
			this.sharkSpawnLabel.Location = new System.Drawing.Point(8, 32);
			this.sharkSpawnLabel.Text = "Shark Spawn";
			// 
			// screenEdgeComboBox
			// 
			this.screenEdgeComboBox.Font = new System.Drawing.Font("Tahoma", 9F, System.Drawing.FontStyle.Regular);
			this.screenEdgeComboBox.Items.Add("Causes Death");
			this.screenEdgeComboBox.Items.Add("Safe");
			this.screenEdgeComboBox.Location = new System.Drawing.Point(112, 104);
			this.screenEdgeComboBox.Size = new System.Drawing.Size(120, 22);
			// 
			// screenEdgeLabel
			// 
			this.screenEdgeLabel.Font = new System.Drawing.Font("Tahoma", 9F, System.Drawing.FontStyle.Regular);
			this.screenEdgeLabel.ForeColor = System.Drawing.Color.LightGray;
			this.screenEdgeLabel.Location = new System.Drawing.Point(8, 104);
			this.screenEdgeLabel.Size = new System.Drawing.Size(96, 20);
			this.screenEdgeLabel.Text = "Screen Edge";
			this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
			// 
			// OptionsForm
			// 
			this.BackColor = System.Drawing.Color.Black;
			this.ClientSize = new System.Drawing.Size(240, 320);
			this.ControlBox = false;
			this.Controls.Add(this.tabControl);
			this.Controls.Add(this.cancelButton);
			this.Controls.Add(this.saveButton);
			this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
			this.MaximizeBox = false;
			this.MinimizeBox = false;
			this.Text = "Bunnyaruga";
			this.Load += new System.EventHandler(this.MainForm_Load);

		}
		#endregion

		#region Overrides and Form Event Handlers
		private void MainForm_Load(object sender, System.EventArgs e)
		{
			graphics = this.CreateGraphics();

			// First set the form so it does not interfere with the graphics
			this.ControlBox = false;
			this.Menu = null;
			this.WindowState = FormWindowState.Maximized;
			this.FormBorderStyle = FormBorderStyle.None;
		}

		/// <summary>
		/// Stubbed out since we do our own drawing
		/// </summary>
		protected override void OnPaint(PaintEventArgs e)
		{
		}

		/// <summary>
		/// Stubbed out so we can handle drawing
		/// </summary>
		/// <param name="e"></param>
		protected override void OnPaintBackground(PaintEventArgs e)
		{
			// draw the black background
			base.OnPaintBackground(e);
		}

		/// <summary>
		/// Mouse down event handler
		/// </summary>
		protected override void OnMouseDown(MouseEventArgs e)
		{
			base.OnMouseDown(e);
		}

		/// <summary>
		/// Mouse up event handler
		/// </summary>
		protected override void OnMouseUp(MouseEventArgs e)
		{
			base.OnMouseUp(e);
		}
		#endregion

		private void playerTextBox_GotFocus(object sender, System.EventArgs e)
		{
			this.Menu = new MainMenu();
			this.inputPanel.Enabled = true;
		}

		private void playerTextBox_LostFocus(object sender, System.EventArgs e)
		{
			this.inputPanel.Enabled = false;
			this.Menu = null;
		}

		private void saveButton_Click(object sender, System.EventArgs e)
		{
			if (this.screenEdgeComboBox.SelectedIndex == 0)
			{
				options.ScreenEdgeCausesDeath = true;
			}
			else
			{
				options.ScreenEdgeCausesDeath = false;
			}

			options.NumberOfFishColor1 = (int)this.fishColor1UpDown.Value;
			options.NumberOfFishColor2 = (int)this.fishColor2UpDown.Value;
			options.SharkSpawnOption = (Bunnyhug.Bunnyaruga.GameOptions.SharkSpawnOptions)this.sharkSpawnComboBox.SelectedIndex;
			options.FishSpawnOption = (Bunnyhug.Bunnyaruga.GameOptions.FishSpawnOptions)this.fishSpawnComboBox.SelectedIndex;
			options.PlayerName = this.playerTextBox.Text;
			options.MusicVolume = this.musicComboBox.SelectedIndex;
			options.SoundsVolume = this.soundsComboBox.SelectedIndex;
			options.FishSpeed = (Bunnyhug.Bunnyaruga.GameOptions.FishSpeeds)this.fishSpeedComboBox.SelectedIndex;
			options.MinimumSpeed = (int)this.fishMinimumSpeedUpDown.Value;
			options.MaximumSpeed = (int)this.fishMaximumSpeedUpDown.Value;
			options.SharkToughness = (int)this.sharkToughnessUpDown.Value;
			options.Serialize();
			this.Close();
		}

		private void cancelButton_Click(object sender, System.EventArgs e)
		{
			this.Close();
		}
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer
Canada Canada
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions