456 lines
16 KiB
C#
456 lines
16 KiB
C#
using System;
|
|
using System.Drawing;
|
|
using System.Collections;
|
|
using System.ComponentModel;
|
|
using System.Windows.Forms;
|
|
|
|
namespace Icarus.Logic.GameEngine
|
|
{
|
|
/// <summary>
|
|
/// Form for creating and editng levels.
|
|
/// Provides for saving and loading levels.
|
|
/// </summary>
|
|
public class LevelBuilder : System.Windows.Forms.Form
|
|
{
|
|
|
|
#region GUI Components
|
|
private System.Windows.Forms.TextBox levelNameTextBox;
|
|
private System.Windows.Forms.Label levelNameLabel;
|
|
private System.Windows.Forms.Label physicsScaleLabel;
|
|
private System.Windows.Forms.TextBox physicsScaleTextBox;
|
|
private System.Windows.Forms.Label bgImageLabel;
|
|
private System.Windows.Forms.TextBox bgImageTextBox;
|
|
private System.Windows.Forms.Button bgImageButton;
|
|
private System.Windows.Forms.Button itemButton;
|
|
private System.Windows.Forms.Button actorButton;
|
|
private System.Windows.Forms.Button terrainButton;
|
|
private System.Windows.Forms.Button particleButton;
|
|
private System.Windows.Forms.ListBox itemList;
|
|
private System.Windows.Forms.ListBox actorList;
|
|
private System.Windows.Forms.ListBox terrainList;
|
|
private System.Windows.Forms.ListBox particleList;
|
|
private System.Windows.Forms.Button loadButton;
|
|
private System.Windows.Forms.Button saveButton;
|
|
private System.Windows.Forms.Button itemEditButton;
|
|
private System.Windows.Forms.Button itemRemoveButton;
|
|
private System.Windows.Forms.Button actorRemoveButton;
|
|
private System.Windows.Forms.Button actorEditButton;
|
|
private System.Windows.Forms.Button terrainRemoveButton;
|
|
private System.Windows.Forms.Button terrainEditButton;
|
|
private System.Windows.Forms.Button particleRemoveButton;
|
|
private System.Windows.Forms.Button particleEditButton;
|
|
private System.ComponentModel.Container components = null;
|
|
#endregion
|
|
|
|
#region Execution And Initialization
|
|
|
|
/// <summary>
|
|
/// Executes the Level Builder
|
|
/// </summary>
|
|
public static void Main()
|
|
{
|
|
new LevelBuilder().Show();
|
|
Console.WriteLine("You are now running the level builder program for the Icarus Game Engine.");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Initialize the LevelBuilder object
|
|
/// </summary>
|
|
public LevelBuilder()
|
|
{
|
|
// Required for Windows Form Designer support
|
|
InitializeComponent();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Clean up any resources being used.
|
|
/// </summary>
|
|
protected override void Dispose(bool disposing)
|
|
{
|
|
if( disposing )
|
|
{
|
|
if (components != null)
|
|
{
|
|
components.Dispose();
|
|
}
|
|
}
|
|
base.Dispose( disposing );
|
|
Console.WriteLine("You have exited the level builder program for the Icarus Game Engine.");
|
|
Console.WriteLine("Have A Nice Day!");
|
|
}
|
|
#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()
|
|
{
|
|
this.levelNameTextBox = new System.Windows.Forms.TextBox();
|
|
this.levelNameLabel = new System.Windows.Forms.Label();
|
|
this.physicsScaleLabel = new System.Windows.Forms.Label();
|
|
this.physicsScaleTextBox = new System.Windows.Forms.TextBox();
|
|
this.bgImageLabel = new System.Windows.Forms.Label();
|
|
this.bgImageTextBox = new System.Windows.Forms.TextBox();
|
|
this.bgImageButton = new System.Windows.Forms.Button();
|
|
this.itemButton = new System.Windows.Forms.Button();
|
|
this.actorButton = new System.Windows.Forms.Button();
|
|
this.terrainButton = new System.Windows.Forms.Button();
|
|
this.particleButton = new System.Windows.Forms.Button();
|
|
this.itemList = new System.Windows.Forms.ListBox();
|
|
this.actorList = new System.Windows.Forms.ListBox();
|
|
this.terrainList = new System.Windows.Forms.ListBox();
|
|
this.particleList = new System.Windows.Forms.ListBox();
|
|
this.loadButton = new System.Windows.Forms.Button();
|
|
this.saveButton = new System.Windows.Forms.Button();
|
|
this.itemEditButton = new System.Windows.Forms.Button();
|
|
this.itemRemoveButton = new System.Windows.Forms.Button();
|
|
this.actorRemoveButton = new System.Windows.Forms.Button();
|
|
this.actorEditButton = new System.Windows.Forms.Button();
|
|
this.terrainRemoveButton = new System.Windows.Forms.Button();
|
|
this.terrainEditButton = new System.Windows.Forms.Button();
|
|
this.particleRemoveButton = new System.Windows.Forms.Button();
|
|
this.particleEditButton = new System.Windows.Forms.Button();
|
|
this.SuspendLayout();
|
|
//
|
|
// levelNameTextBox
|
|
//
|
|
this.levelNameTextBox.Location = new System.Drawing.Point(112, 48);
|
|
this.levelNameTextBox.Name = "levelNameTextBox";
|
|
this.levelNameTextBox.Size = new System.Drawing.Size(416, 20);
|
|
this.levelNameTextBox.TabIndex = 0;
|
|
this.levelNameTextBox.Text = "Level";
|
|
//
|
|
// levelNameLabel
|
|
//
|
|
this.levelNameLabel.Location = new System.Drawing.Point(40, 48);
|
|
this.levelNameLabel.Name = "levelNameLabel";
|
|
this.levelNameLabel.Size = new System.Drawing.Size(72, 23);
|
|
this.levelNameLabel.TabIndex = 1;
|
|
this.levelNameLabel.Text = "Level Name:";
|
|
this.levelNameLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
|
//
|
|
// physicsScaleLabel
|
|
//
|
|
this.physicsScaleLabel.Location = new System.Drawing.Point(32, 112);
|
|
this.physicsScaleLabel.Name = "physicsScaleLabel";
|
|
this.physicsScaleLabel.Size = new System.Drawing.Size(80, 23);
|
|
this.physicsScaleLabel.TabIndex = 2;
|
|
this.physicsScaleLabel.Text = "Physics Scale:";
|
|
this.physicsScaleLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
|
//
|
|
// physicsScaleTextBox
|
|
//
|
|
this.physicsScaleTextBox.Location = new System.Drawing.Point(112, 112);
|
|
this.physicsScaleTextBox.Name = "physicsScaleTextBox";
|
|
this.physicsScaleTextBox.Size = new System.Drawing.Size(48, 20);
|
|
this.physicsScaleTextBox.TabIndex = 3;
|
|
this.physicsScaleTextBox.Text = "1";
|
|
//
|
|
// bgImageLabel
|
|
//
|
|
this.bgImageLabel.Location = new System.Drawing.Point(8, 80);
|
|
this.bgImageLabel.Name = "bgImageLabel";
|
|
this.bgImageLabel.Size = new System.Drawing.Size(104, 23);
|
|
this.bgImageLabel.TabIndex = 4;
|
|
this.bgImageLabel.Text = "Background Image:";
|
|
this.bgImageLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
|
//
|
|
// bgImageTextBox
|
|
//
|
|
this.bgImageTextBox.Location = new System.Drawing.Point(112, 80);
|
|
this.bgImageTextBox.Name = "bgImageTextBox";
|
|
this.bgImageTextBox.ReadOnly = true;
|
|
this.bgImageTextBox.Size = new System.Drawing.Size(416, 20);
|
|
this.bgImageTextBox.TabIndex = 5;
|
|
this.bgImageTextBox.Text = "[None]";
|
|
//
|
|
// bgImageButton
|
|
//
|
|
this.bgImageButton.Location = new System.Drawing.Point(536, 80);
|
|
this.bgImageButton.Name = "bgImageButton";
|
|
this.bgImageButton.TabIndex = 6;
|
|
this.bgImageButton.Text = "Browse...";
|
|
this.bgImageButton.Click += new System.EventHandler(this.bgImageButton_Click);
|
|
//
|
|
// itemButton
|
|
//
|
|
this.itemButton.Location = new System.Drawing.Point(32, 152);
|
|
this.itemButton.Name = "itemButton";
|
|
this.itemButton.Size = new System.Drawing.Size(104, 23);
|
|
this.itemButton.TabIndex = 7;
|
|
this.itemButton.Text = "Add New Item";
|
|
this.itemButton.Click += new System.EventHandler(this.itemButton_Click);
|
|
//
|
|
// actorButton
|
|
//
|
|
this.actorButton.Location = new System.Drawing.Point(184, 152);
|
|
this.actorButton.Name = "actorButton";
|
|
this.actorButton.Size = new System.Drawing.Size(104, 23);
|
|
this.actorButton.TabIndex = 8;
|
|
this.actorButton.Text = "Add New Actor";
|
|
this.actorButton.Click += new System.EventHandler(this.actorButton_Click);
|
|
//
|
|
// terrainButton
|
|
//
|
|
this.terrainButton.Location = new System.Drawing.Point(336, 152);
|
|
this.terrainButton.Name = "terrainButton";
|
|
this.terrainButton.Size = new System.Drawing.Size(104, 23);
|
|
this.terrainButton.TabIndex = 9;
|
|
this.terrainButton.Text = "Add New Terrain";
|
|
this.terrainButton.Click += new System.EventHandler(this.terrainButton_Click);
|
|
//
|
|
// particleButton
|
|
//
|
|
this.particleButton.Location = new System.Drawing.Point(488, 152);
|
|
this.particleButton.Name = "particleButton";
|
|
this.particleButton.Size = new System.Drawing.Size(104, 23);
|
|
this.particleButton.TabIndex = 10;
|
|
this.particleButton.Text = "Add New Particle";
|
|
this.particleButton.Click += new System.EventHandler(this.particleButton_Click);
|
|
//
|
|
// itemList
|
|
//
|
|
this.itemList.Location = new System.Drawing.Point(16, 184);
|
|
this.itemList.Name = "itemList";
|
|
this.itemList.ScrollAlwaysVisible = true;
|
|
this.itemList.Size = new System.Drawing.Size(136, 238);
|
|
this.itemList.TabIndex = 11;
|
|
//
|
|
// actorList
|
|
//
|
|
this.actorList.Location = new System.Drawing.Point(168, 184);
|
|
this.actorList.Name = "actorList";
|
|
this.actorList.ScrollAlwaysVisible = true;
|
|
this.actorList.Size = new System.Drawing.Size(136, 238);
|
|
this.actorList.TabIndex = 12;
|
|
//
|
|
// terrainList
|
|
//
|
|
this.terrainList.Location = new System.Drawing.Point(320, 184);
|
|
this.terrainList.Name = "terrainList";
|
|
this.terrainList.ScrollAlwaysVisible = true;
|
|
this.terrainList.Size = new System.Drawing.Size(136, 238);
|
|
this.terrainList.TabIndex = 13;
|
|
//
|
|
// particleList
|
|
//
|
|
this.particleList.Location = new System.Drawing.Point(472, 184);
|
|
this.particleList.Name = "particleList";
|
|
this.particleList.ScrollAlwaysVisible = true;
|
|
this.particleList.Size = new System.Drawing.Size(136, 238);
|
|
this.particleList.TabIndex = 14;
|
|
//
|
|
// loadButton
|
|
//
|
|
this.loadButton.Location = new System.Drawing.Point(8, 8);
|
|
this.loadButton.Name = "loadButton";
|
|
this.loadButton.Size = new System.Drawing.Size(120, 23);
|
|
this.loadButton.TabIndex = 15;
|
|
this.loadButton.Text = "Load Level From File";
|
|
this.loadButton.Click += new System.EventHandler(this.loadButton_Click);
|
|
//
|
|
// saveButton
|
|
//
|
|
this.saveButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
|
|
this.saveButton.Location = new System.Drawing.Point(216, 472);
|
|
this.saveButton.Name = "saveButton";
|
|
this.saveButton.Size = new System.Drawing.Size(200, 32);
|
|
this.saveButton.TabIndex = 16;
|
|
this.saveButton.Text = "Save Level";
|
|
this.saveButton.Click += new System.EventHandler(this.saveButton_Click);
|
|
//
|
|
// itemEditButton
|
|
//
|
|
this.itemEditButton.Location = new System.Drawing.Point(24, 432);
|
|
this.itemEditButton.Name = "itemEditButton";
|
|
this.itemEditButton.Size = new System.Drawing.Size(56, 23);
|
|
this.itemEditButton.TabIndex = 17;
|
|
this.itemEditButton.Text = "Edit";
|
|
this.itemEditButton.Click += new System.EventHandler(this.itemEditButton_Click);
|
|
//
|
|
// itemRemoveButton
|
|
//
|
|
this.itemRemoveButton.Location = new System.Drawing.Point(88, 432);
|
|
this.itemRemoveButton.Name = "itemRemoveButton";
|
|
this.itemRemoveButton.Size = new System.Drawing.Size(56, 23);
|
|
this.itemRemoveButton.TabIndex = 18;
|
|
this.itemRemoveButton.Text = "Remove";
|
|
this.itemRemoveButton.Click += new System.EventHandler(this.itemRemoveButton_Click);
|
|
//
|
|
// actorRemoveButton
|
|
//
|
|
this.actorRemoveButton.Location = new System.Drawing.Point(240, 432);
|
|
this.actorRemoveButton.Name = "actorRemoveButton";
|
|
this.actorRemoveButton.Size = new System.Drawing.Size(56, 23);
|
|
this.actorRemoveButton.TabIndex = 20;
|
|
this.actorRemoveButton.Text = "Remove";
|
|
this.actorRemoveButton.Click += new System.EventHandler(this.actorRemoveButton_Click);
|
|
//
|
|
// actorEditButton
|
|
//
|
|
this.actorEditButton.Location = new System.Drawing.Point(176, 432);
|
|
this.actorEditButton.Name = "actorEditButton";
|
|
this.actorEditButton.Size = new System.Drawing.Size(56, 23);
|
|
this.actorEditButton.TabIndex = 19;
|
|
this.actorEditButton.Text = "Edit";
|
|
this.actorEditButton.Click += new System.EventHandler(this.actorEditButton_Click);
|
|
//
|
|
// terrainRemoveButton
|
|
//
|
|
this.terrainRemoveButton.Location = new System.Drawing.Point(392, 432);
|
|
this.terrainRemoveButton.Name = "terrainRemoveButton";
|
|
this.terrainRemoveButton.Size = new System.Drawing.Size(56, 23);
|
|
this.terrainRemoveButton.TabIndex = 22;
|
|
this.terrainRemoveButton.Text = "Remove";
|
|
this.terrainRemoveButton.Click += new System.EventHandler(this.terrainRemoveButton_Click);
|
|
//
|
|
// terrainEditButton
|
|
//
|
|
this.terrainEditButton.Location = new System.Drawing.Point(328, 432);
|
|
this.terrainEditButton.Name = "terrainEditButton";
|
|
this.terrainEditButton.Size = new System.Drawing.Size(56, 23);
|
|
this.terrainEditButton.TabIndex = 21;
|
|
this.terrainEditButton.Text = "Edit";
|
|
this.terrainEditButton.Click += new System.EventHandler(this.terrainEditButton_Click);
|
|
//
|
|
// particleRemoveButton
|
|
//
|
|
this.particleRemoveButton.Location = new System.Drawing.Point(544, 432);
|
|
this.particleRemoveButton.Name = "particleRemoveButton";
|
|
this.particleRemoveButton.Size = new System.Drawing.Size(56, 23);
|
|
this.particleRemoveButton.TabIndex = 24;
|
|
this.particleRemoveButton.Text = "Remove";
|
|
this.particleRemoveButton.Click += new System.EventHandler(this.particleRemoveButton_Click);
|
|
//
|
|
// particleEditButton
|
|
//
|
|
this.particleEditButton.Location = new System.Drawing.Point(480, 432);
|
|
this.particleEditButton.Name = "particleEditButton";
|
|
this.particleEditButton.Size = new System.Drawing.Size(56, 23);
|
|
this.particleEditButton.TabIndex = 23;
|
|
this.particleEditButton.Text = "Edit";
|
|
this.particleEditButton.Click += new System.EventHandler(this.particleEditButton_Click);
|
|
//
|
|
// LevelBuilder
|
|
//
|
|
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
|
|
this.ClientSize = new System.Drawing.Size(624, 518);
|
|
this.Controls.Add(this.particleRemoveButton);
|
|
this.Controls.Add(this.particleEditButton);
|
|
this.Controls.Add(this.terrainRemoveButton);
|
|
this.Controls.Add(this.terrainEditButton);
|
|
this.Controls.Add(this.actorRemoveButton);
|
|
this.Controls.Add(this.actorEditButton);
|
|
this.Controls.Add(this.itemRemoveButton);
|
|
this.Controls.Add(this.itemEditButton);
|
|
this.Controls.Add(this.saveButton);
|
|
this.Controls.Add(this.loadButton);
|
|
this.Controls.Add(this.particleList);
|
|
this.Controls.Add(this.terrainList);
|
|
this.Controls.Add(this.actorList);
|
|
this.Controls.Add(this.itemList);
|
|
this.Controls.Add(this.particleButton);
|
|
this.Controls.Add(this.terrainButton);
|
|
this.Controls.Add(this.actorButton);
|
|
this.Controls.Add(this.itemButton);
|
|
this.Controls.Add(this.bgImageButton);
|
|
this.Controls.Add(this.bgImageTextBox);
|
|
this.Controls.Add(this.bgImageLabel);
|
|
this.Controls.Add(this.physicsScaleTextBox);
|
|
this.Controls.Add(this.physicsScaleLabel);
|
|
this.Controls.Add(this.levelNameLabel);
|
|
this.Controls.Add(this.levelNameTextBox);
|
|
this.Name = "LevelBuilder";
|
|
this.Text = "LevelBuilder";
|
|
this.ResumeLayout(false);
|
|
|
|
}
|
|
#endregion
|
|
|
|
#region File System Buttons
|
|
private void loadButton_Click(object sender, System.EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void saveButton_Click(object sender, System.EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void bgImageButton_Click(object sender, System.EventArgs e)
|
|
{
|
|
|
|
}
|
|
#endregion
|
|
|
|
#region WorldObject Creation
|
|
private void itemButton_Click(object sender, System.EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void actorButton_Click(object sender, System.EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void terrainButton_Click(object sender, System.EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void particleButton_Click(object sender, System.EventArgs e)
|
|
{
|
|
|
|
}
|
|
#endregion
|
|
|
|
#region WorldObject Editing
|
|
private void itemEditButton_Click(object sender, System.EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void actorEditButton_Click(object sender, System.EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void terrainEditButton_Click(object sender, System.EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void particleEditButton_Click(object sender, System.EventArgs e)
|
|
{
|
|
|
|
}
|
|
#endregion
|
|
|
|
#region WorldObject Removal
|
|
private void itemRemoveButton_Click(object sender, System.EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void actorRemoveButton_Click(object sender, System.EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void terrainRemoveButton_Click(object sender, System.EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void particleRemoveButton_Click(object sender, System.EventArgs e)
|
|
{
|
|
|
|
}
|
|
#endregion
|
|
}
|
|
}
|