mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-11-25 13:21:28 +00:00
added stuff
This commit is contained in:
parent
36f18b8c13
commit
616d535c88
20 changed files with 472 additions and 15 deletions
|
@ -2,9 +2,9 @@
|
|||
mainwindow
|
||||
{
|
||||
positionx = 27;
|
||||
windowstate = 2;
|
||||
positiony = 15;
|
||||
sizeheight = 572;
|
||||
positiony = 15;
|
||||
windowstate = 2;
|
||||
sizewidth = 739;
|
||||
}
|
||||
|
||||
|
|
|
@ -53,6 +53,12 @@
|
|||
<Compile Include="Geometry\Line2D.cs" />
|
||||
<Compile Include="Geometry\Vector2D.cs" />
|
||||
<Compile Include="Geometry\Vector3D.cs" />
|
||||
<Compile Include="Interface\AboutForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Interface\AboutForm.Designer.cs">
|
||||
<DependentUpon>AboutForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Interface\MapOptionsForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
|
@ -105,6 +111,10 @@
|
|||
<Reference Include="System.Windows.Forms" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Interface\AboutForm.resx">
|
||||
<SubType>Designer</SubType>
|
||||
<DependentUpon>AboutForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Interface\MainForm.resx">
|
||||
<SubType>Designer</SubType>
|
||||
<DependentUpon>MainForm.cs</DependentUpon>
|
||||
|
@ -125,6 +135,7 @@
|
|||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Resources\Builder.ico" />
|
||||
<None Include="Resources\Splash2small.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources\Splash2.png" />
|
||||
|
|
|
@ -27,6 +27,7 @@ using System.Reflection;
|
|||
using CodeImp.DoomBuilder.Interface;
|
||||
using CodeImp.DoomBuilder.IO;
|
||||
using CodeImp.DoomBuilder.Map;
|
||||
using CodeImp.DoomBuilder.Rendering;
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -39,7 +40,10 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
#endregion
|
||||
|
||||
#region ================== Variables
|
||||
|
||||
|
||||
// Graphics
|
||||
protected Graphics graphics;
|
||||
|
||||
// Disposing
|
||||
protected bool isdisposed = false;
|
||||
|
||||
|
@ -58,6 +62,7 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
public EditMode()
|
||||
{
|
||||
// Initialize
|
||||
this.graphics = General.Map.Graphics;
|
||||
|
||||
// We have no destructor
|
||||
GC.SuppressFinalize(this);
|
||||
|
@ -89,6 +94,7 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
public virtual void MouseMove(MouseEventArgs e) { }
|
||||
public virtual void MouseUp(MouseEventArgs e) { }
|
||||
public virtual void Cancel() { }
|
||||
public virtual void RedrawDisplay() { }
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ using System.Reflection;
|
|||
using CodeImp.DoomBuilder.Interface;
|
||||
using CodeImp.DoomBuilder.IO;
|
||||
using CodeImp.DoomBuilder.Map;
|
||||
using CodeImp.DoomBuilder.Rendering;
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -72,6 +73,17 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
|
||||
#region ================== Methods
|
||||
|
||||
// This redraws the display
|
||||
public override void RedrawDisplay()
|
||||
{
|
||||
if(renderer.StartRendering())
|
||||
{
|
||||
renderer.RenderLinedefs(General.Map.Data.Linedefs);
|
||||
|
||||
renderer.FinishRendering();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ using System.Reflection;
|
|||
using CodeImp.DoomBuilder.Interface;
|
||||
using CodeImp.DoomBuilder.IO;
|
||||
using CodeImp.DoomBuilder.Map;
|
||||
using CodeImp.DoomBuilder.Rendering;
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -40,6 +41,9 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
|
||||
#region ================== Variables
|
||||
|
||||
// Graphics
|
||||
protected Renderer2D renderer;
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Properties
|
||||
|
@ -52,7 +56,7 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
public ViewClassicMode()
|
||||
{
|
||||
// Initialize
|
||||
|
||||
this.renderer = graphics.Renderer2D;
|
||||
}
|
||||
|
||||
// Diposer
|
||||
|
@ -62,7 +66,7 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
if(!isdisposed)
|
||||
{
|
||||
// Clean up
|
||||
|
||||
|
||||
// Dispose base
|
||||
base.Dispose();
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ using System.Reflection;
|
|||
using CodeImp.DoomBuilder.Interface;
|
||||
using CodeImp.DoomBuilder.IO;
|
||||
using CodeImp.DoomBuilder.Map;
|
||||
using CodeImp.DoomBuilder.Geometry;
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -215,7 +216,7 @@ namespace CodeImp.DoomBuilder
|
|||
{
|
||||
MapOptions newoptions;
|
||||
MapOptionsForm optionswindow;
|
||||
|
||||
|
||||
// Empty options
|
||||
newoptions = new MapOptions();
|
||||
|
||||
|
@ -252,6 +253,16 @@ namespace CodeImp.DoomBuilder
|
|||
return false;
|
||||
}
|
||||
|
||||
// TEST:
|
||||
Vertex v1 = map.Data.CreateVertex(new Vector2D(20f, 20f));
|
||||
Vertex v2 = map.Data.CreateVertex(new Vector2D(-20f, 20f));
|
||||
Vertex v3 = map.Data.CreateVertex(new Vector2D(-20f, -20f));
|
||||
Vertex v4 = map.Data.CreateVertex(new Vector2D(20f, -20f));
|
||||
map.Data.CreateLinedef(v1, v2);
|
||||
map.Data.CreateLinedef(v2, v3);
|
||||
map.Data.CreateLinedef(v3, v4);
|
||||
map.Data.CreateLinedef(v4, v1);
|
||||
|
||||
// Done
|
||||
mainwindow.UpdateMenus();
|
||||
mainwindow.DisplayReady();
|
||||
|
|
|
@ -65,10 +65,12 @@ namespace CodeImp.DoomBuilder
|
|||
public string FilePathName { get { return filepathname; } }
|
||||
public string FileTitle { get { return filetitle; } }
|
||||
public MapOptions Options { get { return options; } }
|
||||
public MapSet Data { get { return data; } }
|
||||
public EditMode Mode { get { return mode; } }
|
||||
public bool IsChanged { get { return changed; } set { changed = value; } }
|
||||
public bool IsDisposed { get { return isdisposed; } }
|
||||
|
||||
public Graphics Graphics { get { return graphics; } }
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Constructor / Disposer
|
||||
|
|
70
Source/Interface/AboutForm.Designer.cs
generated
Normal file
70
Source/Interface/AboutForm.Designer.cs
generated
Normal file
|
@ -0,0 +1,70 @@
|
|||
namespace CodeImp.DoomBuilder.Interface
|
||||
{
|
||||
partial class AboutForm
|
||||
{
|
||||
/// <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 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.Windows.Forms.PictureBox pictureBox1;
|
||||
pictureBox1 = new System.Windows.Forms.PictureBox();
|
||||
((System.ComponentModel.ISupportInitialize)(pictureBox1)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// pictureBox1
|
||||
//
|
||||
pictureBox1.Image = global::CodeImp.DoomBuilder.Properties.Resources.Splash2small;
|
||||
pictureBox1.Location = new System.Drawing.Point(12, 12);
|
||||
pictureBox1.Name = "pictureBox1";
|
||||
pictureBox1.Size = new System.Drawing.Size(137, 82);
|
||||
pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
|
||||
pictureBox1.TabIndex = 0;
|
||||
pictureBox1.TabStop = false;
|
||||
//
|
||||
// AboutForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 14F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(428, 263);
|
||||
this.Controls.Add(pictureBox1);
|
||||
this.DoubleBuffered = true;
|
||||
this.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "AboutForm";
|
||||
this.ShowIcon = false;
|
||||
this.ShowInTaskbar = false;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "About Doom Builder";
|
||||
((System.ComponentModel.ISupportInitialize)(pictureBox1)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
39
Source/Interface/AboutForm.cs
Normal file
39
Source/Interface/AboutForm.cs
Normal file
|
@ -0,0 +1,39 @@
|
|||
|
||||
#region ================== Copyright (c) 2007 Pascal vd Heiden
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Pascal vd Heiden, www.codeimp.com
|
||||
* This program is released under GNU General Public License
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*/
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Namespaces
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CodeImp.DoomBuilder.Interface
|
||||
{
|
||||
public partial class AboutForm : Form
|
||||
{
|
||||
// Constructor
|
||||
public AboutForm()
|
||||
{
|
||||
// Initialize
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
123
Source/Interface/AboutForm.resx
Normal file
123
Source/Interface/AboutForm.resx
Normal file
|
@ -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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="pictureBox1.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
</root>
|
31
Source/Interface/MainForm.Designer.cs
generated
31
Source/Interface/MainForm.Designer.cs
generated
|
@ -28,6 +28,7 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
|
||||
this.menumain = new System.Windows.Forms.MenuStrip();
|
||||
this.menufile = new System.Windows.Forms.ToolStripMenuItem();
|
||||
|
@ -45,6 +46,9 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
this.statuslabel = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
this.panelinfo = new System.Windows.Forms.Panel();
|
||||
this.display = new System.Windows.Forms.PictureBox();
|
||||
this.redrawtimer = new System.Windows.Forms.Timer(this.components);
|
||||
this.menuhelp = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.itemhelpabout = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.menumain.SuspendLayout();
|
||||
this.statusbar.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.display)).BeginInit();
|
||||
|
@ -53,7 +57,8 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
// menumain
|
||||
//
|
||||
this.menumain.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.menufile});
|
||||
this.menufile,
|
||||
this.menuhelp});
|
||||
this.menumain.Location = new System.Drawing.Point(0, 0);
|
||||
this.menumain.Name = "menumain";
|
||||
this.menumain.Size = new System.Drawing.Size(731, 24);
|
||||
|
@ -184,11 +189,32 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
this.display.MouseLeave += new System.EventHandler(this.display_MouseLeave);
|
||||
this.display.MouseDown += new System.Windows.Forms.MouseEventHandler(this.display_MouseDown);
|
||||
this.display.MouseMove += new System.Windows.Forms.MouseEventHandler(this.display_MouseMove);
|
||||
this.display.Paint += new System.Windows.Forms.PaintEventHandler(this.display_Paint);
|
||||
this.display.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.display_MouseDoubleClick);
|
||||
this.display.MouseClick += new System.Windows.Forms.MouseEventHandler(this.display_MouseClick);
|
||||
this.display.MouseUp += new System.Windows.Forms.MouseEventHandler(this.display_MouseUp);
|
||||
this.display.MouseEnter += new System.EventHandler(this.display_MouseEnter);
|
||||
//
|
||||
// redrawtimer
|
||||
//
|
||||
this.redrawtimer.Interval = 1;
|
||||
this.redrawtimer.Tick += new System.EventHandler(this.redrawtimer_Tick);
|
||||
//
|
||||
// menuhelp
|
||||
//
|
||||
this.menuhelp.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.itemhelpabout});
|
||||
this.menuhelp.Name = "menuhelp";
|
||||
this.menuhelp.Size = new System.Drawing.Size(40, 20);
|
||||
this.menuhelp.Text = "Help";
|
||||
//
|
||||
// itemhelpabout
|
||||
//
|
||||
this.itemhelpabout.Name = "itemhelpabout";
|
||||
this.itemhelpabout.Size = new System.Drawing.Size(191, 22);
|
||||
this.itemhelpabout.Text = "About Doom Builder...";
|
||||
this.itemhelpabout.Click += new System.EventHandler(this.itemhelpabout_Click);
|
||||
//
|
||||
// MainForm
|
||||
//
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
|
@ -238,5 +264,8 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
private System.Windows.Forms.ToolStripMenuItem itemexit;
|
||||
private System.Windows.Forms.ToolStripStatusLabel statuslabel;
|
||||
private System.Windows.Forms.ToolStripMenuItem itemclosemap;
|
||||
private System.Windows.Forms.Timer redrawtimer;
|
||||
private System.Windows.Forms.ToolStripMenuItem menuhelp;
|
||||
private System.Windows.Forms.ToolStripMenuItem itemhelpabout;
|
||||
}
|
||||
}
|
|
@ -177,6 +177,23 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
this.Update();
|
||||
}
|
||||
|
||||
// Display needs repainting
|
||||
private void display_Paint(object sender, PaintEventArgs e)
|
||||
{
|
||||
// Repaint on demand
|
||||
if(General.Map != null) redrawtimer.Enabled = true;
|
||||
}
|
||||
|
||||
// Redraw requested
|
||||
private void redrawtimer_Tick(object sender, EventArgs e)
|
||||
{
|
||||
// Disable timer (only redraw once)
|
||||
redrawtimer.Enabled = false;
|
||||
|
||||
// Redraw now
|
||||
if(General.Map != null) General.Map.Mode.RedrawDisplay();
|
||||
}
|
||||
|
||||
// Mouse click
|
||||
private void display_MouseClick(object sender, MouseEventArgs e) { if(General.Map != null) General.Map.Mode.MouseClick(e); }
|
||||
|
||||
|
@ -233,5 +250,19 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Help Menu
|
||||
|
||||
// About clicked
|
||||
private void itemhelpabout_Click(object sender, EventArgs e)
|
||||
{
|
||||
AboutForm aboutform;
|
||||
|
||||
// Show about dialog
|
||||
aboutform = new AboutForm();
|
||||
aboutform.ShowDialog(this);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -141,6 +141,9 @@
|
|||
<metadata name="display.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="redrawtimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>304, 17</value>
|
||||
</metadata>
|
||||
<metadata name="$this.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
|
|
|
@ -116,8 +116,8 @@ namespace CodeImp.DoomBuilder.Map
|
|||
end.DetachLinedef(endvertexlistitem);
|
||||
|
||||
// Dispose sidedefs
|
||||
front.Dispose();
|
||||
back.Dispose();
|
||||
if(front != null) front.Dispose();
|
||||
if(back != null) back.Dispose();
|
||||
|
||||
// Clean up
|
||||
mainlistitem = null;
|
||||
|
|
7
Source/Properties/Resources.Designer.cs
generated
7
Source/Properties/Resources.Designer.cs
generated
|
@ -66,5 +66,12 @@ namespace CodeImp.DoomBuilder.Properties {
|
|||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
internal static System.Drawing.Bitmap Splash2small {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("Splash2small", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -121,4 +121,7 @@
|
|||
<data name="Splash2" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Splash2.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="Splash2small" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Splash2small.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
|
@ -50,6 +50,8 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
private Control rendertarget;
|
||||
private Caps devicecaps;
|
||||
private Device d3dd;
|
||||
private Renderer2D renderer2d;
|
||||
private Renderer3D renderer3d;
|
||||
|
||||
// Disposing
|
||||
private bool isdisposed = false;
|
||||
|
@ -58,9 +60,11 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
|
||||
#region ================== Properties
|
||||
|
||||
// Disposing
|
||||
public Device Device { get { return d3dd; } }
|
||||
public bool IsDisposed { get { return isdisposed; } }
|
||||
|
||||
public Renderer2D Renderer2D { get { return renderer2d; } }
|
||||
public Renderer3D Renderer3D { get { return renderer3d; } }
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Constructor / Disposer
|
||||
|
@ -82,6 +86,8 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
if(!isdisposed)
|
||||
{
|
||||
// Clean up
|
||||
renderer2d.Dispose();
|
||||
renderer3d.Dispose();
|
||||
d3dd.Dispose();
|
||||
rendertarget = null;
|
||||
|
||||
|
@ -210,6 +216,10 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
// Initialize settings
|
||||
SetupSettings();
|
||||
|
||||
// Create renderers
|
||||
renderer2d = new Renderer2D(this);
|
||||
renderer3d = new Renderer3D(this);
|
||||
|
||||
// Done
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -27,6 +27,8 @@ using System.Reflection;
|
|||
using System.Drawing;
|
||||
using Microsoft.DirectX.Direct3D;
|
||||
using System.ComponentModel;
|
||||
using CodeImp.DoomBuilder.Map;
|
||||
using Microsoft.DirectX;
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -40,6 +42,12 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
|
||||
#region ================== Variables
|
||||
|
||||
// Owner
|
||||
private Graphics graphics;
|
||||
|
||||
// Main objects
|
||||
private Line line;
|
||||
|
||||
// Disposing
|
||||
private bool isdisposed = false;
|
||||
|
||||
|
@ -55,10 +63,16 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
#region ================== Constructor / Disposer
|
||||
|
||||
// Constructor
|
||||
public Renderer2D()
|
||||
public Renderer2D(Graphics graphics)
|
||||
{
|
||||
// Initialize
|
||||
this.graphics = graphics;
|
||||
|
||||
// Create line object
|
||||
line = new Line(graphics.Device);
|
||||
line.Width = 2f;
|
||||
line.Antialias = true;
|
||||
|
||||
// We have no destructor
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
@ -70,7 +84,8 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
if(!isdisposed)
|
||||
{
|
||||
// Clean up
|
||||
|
||||
line.Dispose();
|
||||
|
||||
// Done
|
||||
isdisposed = true;
|
||||
}
|
||||
|
@ -80,6 +95,83 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
|
||||
#region ================== Methods
|
||||
|
||||
// This begins a drawing session
|
||||
public bool StartRendering()
|
||||
{
|
||||
int coopresult;
|
||||
|
||||
// When minimized, do not render anything
|
||||
if(General.MainWindow.WindowState != FormWindowState.Minimized)
|
||||
{
|
||||
// Test the cooperative level
|
||||
graphics.Device.CheckCooperativeLevel(out coopresult);
|
||||
|
||||
// Check if device must be reset
|
||||
if(coopresult == (int)ResultCode.DeviceNotReset)
|
||||
{
|
||||
// TODO: Device is lost and must be reset now
|
||||
//return Reset();
|
||||
return false;
|
||||
}
|
||||
// Check if device is lost
|
||||
else if(coopresult == (int)ResultCode.DeviceLost)
|
||||
{
|
||||
// Device is lost and cannot be reset now
|
||||
return false;
|
||||
}
|
||||
|
||||
// Clear the screen
|
||||
graphics.Device.Clear(ClearFlags.Target | ClearFlags.ZBuffer, 0, 1f, 0);
|
||||
|
||||
// Ready to render
|
||||
graphics.Device.BeginScene();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Minimized, you cannot see anything
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// This ends a drawing session
|
||||
public void FinishRendering()
|
||||
{
|
||||
try
|
||||
{
|
||||
// Done
|
||||
graphics.Device.EndScene();
|
||||
|
||||
// Display the scene
|
||||
graphics.Device.Present();
|
||||
}
|
||||
// Errors are not a problem here
|
||||
catch(Exception) { }
|
||||
}
|
||||
|
||||
// This renders a set of Linedefs
|
||||
public void RenderLinedefs(IEnumerable<Linedef> linedefs)
|
||||
{
|
||||
Vector2[] vertices = new Vector2[2];
|
||||
|
||||
line.Begin();
|
||||
|
||||
// Go for all linedefs
|
||||
foreach(Linedef l in linedefs)
|
||||
{
|
||||
// Make vertices
|
||||
vertices[0].X = l.Start.Position.x;
|
||||
vertices[0].Y = l.Start.Position.y;
|
||||
vertices[1].X = l.End.Position.x;
|
||||
vertices[1].Y = l.End.Position.y;
|
||||
|
||||
// Draw line
|
||||
line.Draw(vertices, -1);
|
||||
}
|
||||
|
||||
line.End();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,6 +40,9 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
|
||||
#region ================== Variables
|
||||
|
||||
// Owner
|
||||
private Graphics graphics;
|
||||
|
||||
// Disposing
|
||||
private bool isdisposed = false;
|
||||
|
||||
|
@ -55,9 +58,10 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
#region ================== Constructor / Disposer
|
||||
|
||||
// Constructor
|
||||
public Renderer3D()
|
||||
public Renderer3D(Graphics graphics)
|
||||
{
|
||||
// Initialize
|
||||
this.graphics = graphics;
|
||||
|
||||
// We have no destructor
|
||||
GC.SuppressFinalize(this);
|
||||
|
|
BIN
Source/Resources/Splash2small.png
Normal file
BIN
Source/Resources/Splash2small.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
Loading…
Reference in a new issue