my sincere excuses for previous commit, my compiler lied to me and said it all compiled fine.

This commit is contained in:
codeimp 2007-10-31 21:33:06 +00:00
parent efc1a88112
commit b1c6c20714
10 changed files with 108 additions and 22 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 618 B

After

Width:  |  Height:  |  Size: 906 B

View file

@ -111,6 +111,7 @@
<Compile Include="Interface\ImageBrowser.Designer.cs"> <Compile Include="Interface\ImageBrowser.Designer.cs">
<DependentUpon>ImageBrowser.cs</DependentUpon> <DependentUpon>ImageBrowser.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="Interface\ImageBrowserItem.cs" />
<Compile Include="Interface\LinedefInfoPanel.cs"> <Compile Include="Interface\LinedefInfoPanel.cs">
<SubType>UserControl</SubType> <SubType>UserControl</SubType>
</Compile> </Compile>
@ -263,11 +264,11 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="Resources\Builder.ico" /> <Content Include="Resources\Builder.ico" />
<None Include="Resources\ThingsMode.png" />
<None Include="Resources\Status1.png" /> <None Include="Resources\Status1.png" />
<None Include="Resources\Status2.png" /> <None Include="Resources\Status2.png" />
<None Include="Resources\Status0.png" /> <None Include="Resources\Status0.png" />
<None Include="Resources\UnknownImage.png" /> <None Include="Resources\UnknownImage.png" />
<None Include="Resources\ThingsMode.png" />
<None Include="Resources\VerticesMode.png" /> <None Include="Resources\VerticesMode.png" />
<None Include="Resources\SectorsMode.png" /> <None Include="Resources\SectorsMode.png" />
<None Include="Resources\LinesMode.png" /> <None Include="Resources\LinesMode.png" />

View file

@ -60,7 +60,7 @@ namespace CodeImp.DoomBuilder.Interface
this.rendertarget.Location = new System.Drawing.Point(0, 0); this.rendertarget.Location = new System.Drawing.Point(0, 0);
this.rendertarget.Name = "rendertarget"; this.rendertarget.Name = "rendertarget";
this.rendertarget.Size = new System.Drawing.Size(518, 310); this.rendertarget.Size = new System.Drawing.Size(518, 310);
this.rendertarget.TabIndex = 0; this.rendertarget.TabIndex = 3;
this.rendertarget.TabStop = false; this.rendertarget.TabStop = false;
// //
// ImageBrowser // ImageBrowser

View file

@ -27,6 +27,7 @@ using System.Diagnostics;
using CodeImp.DoomBuilder.Controls; using CodeImp.DoomBuilder.Controls;
using CodeImp.DoomBuilder.Data; using CodeImp.DoomBuilder.Data;
using CodeImp.DoomBuilder.Config; using CodeImp.DoomBuilder.Config;
using CodeImp.DoomBuilder.Rendering;
#endregion #endregion
@ -43,13 +44,18 @@ namespace CodeImp.DoomBuilder.Interface
#region ================== Variables #region ================== Variables
// Number of items horizontally // Graphics device for rendering
private int numitemswidth; private D3DDevice graphics;
// Items list
private List<ImageBrowserItem> items;
#endregion #endregion
#region ================== Properties #region ================== Properties
public int Count { get { return items.Count; } }
#endregion #endregion
#region ================== Constructor / Disposer #region ================== Constructor / Disposer
@ -57,7 +63,12 @@ namespace CodeImp.DoomBuilder.Interface
// Constructor // Constructor
public ImageBrowser() public ImageBrowser()
{ {
// Make graphics device
graphics = new D3DDevice(rendertarget);
graphics.Initialize();
// Make items list // Make items list
items = new List<ImageBrowserItem>();
// Initialize // Initialize
InitializeComponent(); InitializeComponent();
@ -70,6 +81,8 @@ namespace CodeImp.DoomBuilder.Interface
// When resized // When resized
protected override void OnResize(EventArgs e) protected override void OnResize(EventArgs e)
{ {
// Redraw
Redraw();
// Call base // Call base
base.OnResize(e); base.OnResize(e);
@ -77,19 +90,31 @@ namespace CodeImp.DoomBuilder.Interface
#endregion #endregion
#region ================== Controls #region ================== Rendering
// This redraws the list
public void Redraw()
{
int numitemswide;
// Calculate number of items wide
numitemswide = (int)Math.Floor((float)ClientSize.Width / (float)ITEM_WIDTH);
}
#endregion #endregion
#region ================== Methods #region ================== Methods
// This adds an item // This adds an item
public void Add(string name, ImageData image, object tag) public void Add(string text, ImageData image, object tag)
{ {
ImageBrowserItem i;
// Make new item // Make new item
i = new ImageBrowserItem(text, image, tag);
// Add item to list // Add item to list
items.Add(i);
} }
#endregion #endregion

View file

@ -0,0 +1,52 @@
#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;
using Microsoft.Win32;
using System.Diagnostics;
using CodeImp.DoomBuilder.Controls;
using CodeImp.DoomBuilder.Data;
using CodeImp.DoomBuilder.Config;
using CodeImp.DoomBuilder.Rendering;
#endregion
namespace CodeImp.DoomBuilder.Interface
{
internal struct ImageBrowserItem
{
// Variables
public string text;
public ImageData image;
public object tag;
// Constructors
public ImageBrowserItem(string text, ImageData image, object tag)
{
// Initialize
this.text = text;
this.image = image;
this.tag = tag;
}
}
}

View file

@ -91,6 +91,7 @@ namespace CodeImp.DoomBuilder.Interface
this.linedefinfo = new CodeImp.DoomBuilder.Interface.LinedefInfoPanel(); this.linedefinfo = new CodeImp.DoomBuilder.Interface.LinedefInfoPanel();
this.redrawtimer = new System.Windows.Forms.Timer(this.components); this.redrawtimer = new System.Windows.Forms.Timer(this.components);
this.display = new CodeImp.DoomBuilder.Interface.RenderTargetControl(); this.display = new CodeImp.DoomBuilder.Interface.RenderTargetControl();
this.toolStripSeparator7 = new System.Windows.Forms.ToolStripSeparator();
toolStripMenuItem1 = new System.Windows.Forms.ToolStripSeparator(); toolStripMenuItem1 = new System.Windows.Forms.ToolStripSeparator();
toolStripMenuItem2 = new System.Windows.Forms.ToolStripSeparator(); toolStripMenuItem2 = new System.Windows.Forms.ToolStripSeparator();
toolStripMenuItem3 = new System.Windows.Forms.ToolStripSeparator(); toolStripMenuItem3 = new System.Windows.Forms.ToolStripSeparator();
@ -101,7 +102,6 @@ namespace CodeImp.DoomBuilder.Interface
this.toolbar.SuspendLayout(); this.toolbar.SuspendLayout();
this.statusbar.SuspendLayout(); this.statusbar.SuspendLayout();
this.panelinfo.SuspendLayout(); this.panelinfo.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.display)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
// //
// toolStripMenuItem1 // toolStripMenuItem1
@ -357,7 +357,8 @@ namespace CodeImp.DoomBuilder.Interface
this.buttonverticesmode, this.buttonverticesmode,
this.buttonlinedefsmode, this.buttonlinedefsmode,
this.buttonsectorsmode, this.buttonsectorsmode,
this.buttonthingsmode}); this.buttonthingsmode,
this.toolStripSeparator7});
this.toolbar.Location = new System.Drawing.Point(0, 24); this.toolbar.Location = new System.Drawing.Point(0, 24);
this.toolbar.Name = "toolbar"; this.toolbar.Name = "toolbar";
this.toolbar.Size = new System.Drawing.Size(839, 25); this.toolbar.Size = new System.Drawing.Size(839, 25);
@ -398,7 +399,7 @@ namespace CodeImp.DoomBuilder.Interface
// //
// toolStripSeparator3 // toolStripSeparator3
// //
this.toolStripSeparator3.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.toolStripSeparator3.Margin = new System.Windows.Forms.Padding(3, 0, 3, 0);
this.toolStripSeparator3.Name = "toolStripSeparator3"; this.toolStripSeparator3.Name = "toolStripSeparator3";
this.toolStripSeparator3.Size = new System.Drawing.Size(6, 25); this.toolStripSeparator3.Size = new System.Drawing.Size(6, 25);
// //
@ -415,7 +416,7 @@ namespace CodeImp.DoomBuilder.Interface
// //
// toolStripSeparator5 // toolStripSeparator5
// //
this.toolStripSeparator5.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.toolStripSeparator5.Margin = new System.Windows.Forms.Padding(3, 0, 3, 0);
this.toolStripSeparator5.Name = "toolStripSeparator5"; this.toolStripSeparator5.Name = "toolStripSeparator5";
this.toolStripSeparator5.Size = new System.Drawing.Size(6, 25); this.toolStripSeparator5.Size = new System.Drawing.Size(6, 25);
// //
@ -678,6 +679,12 @@ namespace CodeImp.DoomBuilder.Interface
this.display.MouseUp += new System.Windows.Forms.MouseEventHandler(this.display_MouseUp); this.display.MouseUp += new System.Windows.Forms.MouseEventHandler(this.display_MouseUp);
this.display.MouseEnter += new System.EventHandler(this.display_MouseEnter); this.display.MouseEnter += new System.EventHandler(this.display_MouseEnter);
// //
// toolStripSeparator7
//
this.toolStripSeparator7.Margin = new System.Windows.Forms.Padding(3, 0, 3, 0);
this.toolStripSeparator7.Name = "toolStripSeparator7";
this.toolStripSeparator7.Size = new System.Drawing.Size(6, 25);
//
// MainForm // MainForm
// //
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
@ -708,7 +715,6 @@ namespace CodeImp.DoomBuilder.Interface
this.statusbar.ResumeLayout(false); this.statusbar.ResumeLayout(false);
this.statusbar.PerformLayout(); this.statusbar.PerformLayout();
this.panelinfo.ResumeLayout(false); this.panelinfo.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.display)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();
@ -771,5 +777,6 @@ namespace CodeImp.DoomBuilder.Interface
private VertexInfoPanel vertexinfo; private VertexInfoPanel vertexinfo;
private SectorInfoPanel sectorinfo; private SectorInfoPanel sectorinfo;
private ThingInfoPanel thinginfo; private ThingInfoPanel thinginfo;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator7;
} }
} }

View file

@ -32,7 +32,7 @@ using CodeImp.DoomBuilder.Editing;
namespace CodeImp.DoomBuilder.Interface namespace CodeImp.DoomBuilder.Interface
{ {
public class RenderTargetControl : PictureBox public class RenderTargetControl : Panel
{ {
#region ================== Constants #region ================== Constants
@ -99,7 +99,7 @@ namespace CodeImp.DoomBuilder.Interface
{ {
// Set new source image // Set new source image
img = srcimg; img = srcimg;
this.Image = img; //this.Image = img;
} }
// This sets up the control to display the splash logo // This sets up the control to display the splash logo
@ -110,7 +110,7 @@ namespace CodeImp.DoomBuilder.Interface
// Change display to show splash logo // Change display to show splash logo
this.SetStyle(ControlStyles.SupportsTransparentBackColor, false); this.SetStyle(ControlStyles.SupportsTransparentBackColor, false);
this.SetStyle(ControlStyles.ContainerControl, false); this.SetStyle(ControlStyles.ContainerControl, true);
this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true); this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
this.SetStyle(ControlStyles.UserPaint, true); this.SetStyle(ControlStyles.UserPaint, true);
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true); this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
@ -119,7 +119,7 @@ namespace CodeImp.DoomBuilder.Interface
this.BackColor = System.Drawing.SystemColors.AppWorkspace; this.BackColor = System.Drawing.SystemColors.AppWorkspace;
this.BackgroundImage = global::CodeImp.DoomBuilder.Properties.Resources.Splash2; this.BackgroundImage = global::CodeImp.DoomBuilder.Properties.Resources.Splash2;
this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
this.Image = null; //this.Image = null;
} }
// This sets up the control for manual rendering // This sets up the control for manual rendering
@ -128,14 +128,14 @@ namespace CodeImp.DoomBuilder.Interface
// Change display for rendering // Change display for rendering
/* /*
this.SetStyle(ControlStyles.SupportsTransparentBackColor, false); this.SetStyle(ControlStyles.SupportsTransparentBackColor, false);
this.SetStyle(ControlStyles.ContainerControl, false); this.SetStyle(ControlStyles.ContainerControl, true);
this.SetStyle(ControlStyles.OptimizedDoubleBuffer, false); this.SetStyle(ControlStyles.OptimizedDoubleBuffer, false);
this.SetStyle(ControlStyles.UserPaint, true); this.SetStyle(ControlStyles.UserPaint, true);
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true); this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
this.SetStyle(ControlStyles.Opaque, true); this.SetStyle(ControlStyles.Opaque, true);
*/ */
this.SetStyle(ControlStyles.SupportsTransparentBackColor, false); this.SetStyle(ControlStyles.SupportsTransparentBackColor, false);
this.SetStyle(ControlStyles.ContainerControl, false); this.SetStyle(ControlStyles.ContainerControl, true);
this.SetStyle(ControlStyles.OptimizedDoubleBuffer, false); this.SetStyle(ControlStyles.OptimizedDoubleBuffer, false);
this.SetStyle(ControlStyles.UserPaint, true); this.SetStyle(ControlStyles.UserPaint, true);
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true); this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
@ -146,7 +146,7 @@ namespace CodeImp.DoomBuilder.Interface
this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
//this.BackgroundImage = global::CodeImp.DoomBuilder.Properties.Resources.floor0_3; //this.BackgroundImage = global::CodeImp.DoomBuilder.Properties.Resources.floor0_3;
//this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Tile; //this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Tile;
this.Image = img; //this.Image = img;
} }
#endregion #endregion

View file

@ -239,7 +239,7 @@ namespace CodeImp.DoomBuilder.Rendering
//device.DeviceResizing += new CancelEventHandler(CancelResize); //device.DeviceResizing += new CancelEventHandler(CancelResize);
// Create shader manager // Create shader manager
shaders = new ShaderManager(); shaders = new ShaderManager(this);
// Initialize settings // Initialize settings
SetupSettings(); SetupSettings();

View file

@ -175,7 +175,8 @@ namespace CodeImp.DoomBuilder.Rendering
if(thingsfront) PresentThings(1f); if(thingsfront) PresentThings(1f);
// Done // Done
graphics.FinishRendering(true); graphics.FinishRendering();
graphics.Present();
} }
} }
@ -637,7 +638,7 @@ namespace CodeImp.DoomBuilder.Rendering
public void FinishRendering() public void FinishRendering()
{ {
// Stop rendering // Stop rendering
graphics.FinishRendering(false); graphics.FinishRendering();
// Release rendertarget // Release rendertarget
try try

Binary file not shown.

Before

Width:  |  Height:  |  Size: 618 B

After

Width:  |  Height:  |  Size: 906 B