UltimateZoneBuilder/Source/BuilderModes/Editing/BaseVisualMode.cs

113 lines
2.5 KiB
C#

#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;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Reflection;
using CodeImp.DoomBuilder.Interface;
using CodeImp.DoomBuilder.IO;
using CodeImp.DoomBuilder.Map;
using CodeImp.DoomBuilder.Rendering;
using CodeImp.DoomBuilder.Geometry;
using CodeImp.DoomBuilder.Editing;
#endregion
namespace CodeImp.DoomBuilder.BuilderModes.Editing
{
[EditMode(SwitchAction = "visualmode", // Action name used to switch to this mode
ButtonDesc = "Visual Mode", // Description on the button in toolbar/menu
ButtonImage = "VisualMode.png", // Image resource name for the button
ButtonOrder = 0)] // Position of the button (lower is more to the left)
public class BaseVisualMode : VisualMode
{
#region ================== Constants
#endregion
#region ================== Variables
#endregion
#region ================== Properties
#endregion
#region ================== Constructor / Disposer
// Constructor
public BaseVisualMode()
{
// Initialize
// We have no destructor
GC.SuppressFinalize(this);
}
// Diposer
public override void Dispose()
{
// Not already disposed?
if(!isdisposed)
{
// Clean up
// Done
base.Dispose();
}
}
#endregion
#region ================== Methods
// This draws a frame
public override void RedrawDisplay()
{
VisualSector vs = new VisualSector(General.GetByIndex<Sector>(General.Map.Map.Sectors, 0));
VisualObject vo = new VisualObject();
vo.Texture = General.Map.Data.GetTextureImage("TEKGREN1");
vo.Visible = true;
vs.AddGeometry(vo);
// Start drawing
if(renderer.Start())
{
// Begin with geometry
renderer.StartGeometry();
renderer.RenderGeometry(vs);
renderer.FinishGeometry();
renderer.Finish();
}
// Call base
base.RedrawDisplay();
}
#endregion
}
}