[Rpgworldmodel-commits] SF.net SVN: rpgworldmodel: [8] src/test_applications/ItemsViewer
Status: Inactive
Brought to you by:
deadwood_pl
From: <pos...@us...> - 2006-06-26 15:10:57
|
Revision: 8 Author: poserdev Date: 2006-06-26 08:10:32 -0700 (Mon, 26 Jun 2006) ViewCVS: http://svn.sourceforge.net/rpgworldmodel/?rev=8&view=rev Log Message: ----------- Some more simple ItemsViewer implementation. It now work with the app config file. Models folder should by stored in the app startup path, like: ....\bin\Debug\Models. Some basic model rotation, but I really need to get some tutorials on DirectX transformations :D Modified Paths: -------------- src/test_applications/ItemsViewer/ItemsViewer.csproj src/test_applications/ItemsViewer/Program.cs src/test_applications/ItemsViewer/Surface.cs Added Paths: ----------- src/test_applications/ItemsViewer/App.config src/test_applications/ItemsViewer/IModel.cs src/test_applications/ItemsViewer/Model.cs src/test_applications/ItemsViewer/OpenModelDialog.Designer.cs src/test_applications/ItemsViewer/OpenModelDialog.cs src/test_applications/ItemsViewer/ViewController.cs src/test_applications/ItemsViewer/ViewState.cs Removed Paths: ------------- src/test_applications/ItemsViewer/Surface.Designer.cs src/test_applications/ItemsViewer/Surface.resx Added: src/test_applications/ItemsViewer/App.config =================================================================== --- src/test_applications/ItemsViewer/App.config (rev 0) +++ src/test_applications/ItemsViewer/App.config 2006-06-26 15:10:32 UTC (rev 8) @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="utf-8" ?> + +<configuration> + <configSections> + <section name="models" type="System.Configuration.NameValueSectionHandler" /> + </configSections> + + <models> + <add key="Long Iron Sword" value="Models\sword.x" /> + </models> +</configuration> \ No newline at end of file Added: src/test_applications/ItemsViewer/IModel.cs =================================================================== --- src/test_applications/ItemsViewer/IModel.cs (rev 0) +++ src/test_applications/ItemsViewer/IModel.cs 2006-06-26 15:10:32 UTC (rev 8) @@ -0,0 +1,24 @@ +using System; + +using Microsoft.DirectX.Direct3D; + +namespace RPGWorldModel.ItemsViewer +{ + public interface IModel + { + Mesh Object + { + get; + } + + Material[] Materials + { + get; + } + + Texture[] Textures + { + get; + } + } +} Modified: src/test_applications/ItemsViewer/ItemsViewer.csproj =================================================================== --- src/test_applications/ItemsViewer/ItemsViewer.csproj 2006-06-25 10:49:06 UTC (rev 7) +++ src/test_applications/ItemsViewer/ItemsViewer.csproj 2006-06-26 15:10:32 UTC (rev 8) @@ -7,7 +7,7 @@ <ProjectGuid>{57684296-F942-4797-8C0F-ADB151A02477}</ProjectGuid> <OutputType>WinExe</OutputType> <AppDesignerFolder>Properties</AppDesignerFolder> - <RootNamespace>ModelViewer</RootNamespace> + <RootNamespace>RPGWorldModel.ItemsViewer</RootNamespace> <AssemblyName>ModelViewer</AssemblyName> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> @@ -37,24 +37,35 @@ <Reference Include="Microsoft.DirectX.Direct3DX, Version=1.0.2902.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"> <Private>False</Private> </Reference> + <Reference Include="RPGWorldModel.Abstracts, Version=0.1.0.0, Culture=neutral, processorArchitecture=MSIL"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\..\RPGWorldModel.Abstracts\bin\Debug\RPGWorldModel.Abstracts.dll</HintPath> + </Reference> <Reference Include="System" /> + <Reference Include="System.configuration" /> <Reference Include="System.Drawing" /> <Reference Include="System.Windows.Forms" /> </ItemGroup> <ItemGroup> + <Compile Include="IModel.cs" /> + <Compile Include="Model.cs" /> + <Compile Include="OpenModelDialog.cs"> + <SubType>Form</SubType> + </Compile> + <Compile Include="OpenModelDialog.Designer.cs"> + <DependentUpon>OpenModelDialog.cs</DependentUpon> + </Compile> <Compile Include="Surface.cs"> <SubType>Form</SubType> </Compile> - <Compile Include="Surface.Designer.cs"> - <DependentUpon>Surface.cs</DependentUpon> - </Compile> <Compile Include="Program.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> - <EmbeddedResource Include="Surface.resx"> - <SubType>Designer</SubType> - <DependentUpon>Surface.cs</DependentUpon> - </EmbeddedResource> + <Compile Include="ViewController.cs" /> + <Compile Include="ViewState.cs" /> </ItemGroup> + <ItemGroup> + <None Include="App.config" /> + </ItemGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. Added: src/test_applications/ItemsViewer/Model.cs =================================================================== --- src/test_applications/ItemsViewer/Model.cs (rev 0) +++ src/test_applications/ItemsViewer/Model.cs 2006-06-26 15:10:32 UTC (rev 8) @@ -0,0 +1,69 @@ +using System; +using System.IO; +using System.Windows.Forms; + +using Microsoft.DirectX; +using Microsoft.DirectX.Direct3D; + +namespace RPGWorldModel.ItemsViewer +{ + public class Model : IModel + { + private Mesh m_Object; + private Material[] m_Materials; + private Texture[] m_Textures; + + public Model(string source, Device device) + { + + + if (File.Exists(source)) + { + Directory.SetCurrentDirectory(Application.StartupPath + + Path.DirectorySeparatorChar + Path.GetDirectoryName(source)); + + // Load the model + ExtendedMaterial[] materials; + this.m_Object = Mesh.FromFile(System.IO.Path.GetFileName(source), MeshFlags.SystemMemory, device, out materials); + + this.m_Textures = new Texture[materials.Length]; + this.m_Materials = new Material[materials.Length]; + + for (int i = 0; i < materials.Length; i++) + { + this.m_Materials[i] = materials[i].Material3D; + this.m_Materials[i].Ambient = this.m_Materials[i].Diffuse; + this.m_Textures[i] = TextureLoader.FromFile(device, materials[i].TextureFilename); + } + } + } + + #region IModel Members + + public Mesh Object + { + get + { + return this.m_Object; + } + } + + public Material[] Materials + { + get + { + return this.m_Materials; + } + } + + public Texture[] Textures + { + get + { + return this.m_Textures; + } + } + + #endregion + } +} Added: src/test_applications/ItemsViewer/OpenModelDialog.Designer.cs =================================================================== --- src/test_applications/ItemsViewer/OpenModelDialog.Designer.cs (rev 0) +++ src/test_applications/ItemsViewer/OpenModelDialog.Designer.cs 2006-06-26 15:10:32 UTC (rev 8) @@ -0,0 +1,84 @@ +namespace RPGWorldModel.ItemsViewer +{ + partial class OpenModelDialog + { + /// <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() + { + this.m_List = new System.Windows.Forms.ListBox(); + this.m_Picture = new System.Windows.Forms.PictureBox(); + ((System.ComponentModel.ISupportInitialize)(this.m_Picture)).BeginInit(); + this.SuspendLayout(); + // + // m_List + // + this.m_List.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.m_List.Dock = System.Windows.Forms.DockStyle.Left; + this.m_List.Font = new System.Drawing.Font("Microsoft Sans Serif", 12.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.m_List.IntegralHeight = false; + this.m_List.ItemHeight = 20; + this.m_List.Location = new System.Drawing.Point(0, 0); + this.m_List.Margin = new System.Windows.Forms.Padding(0); + this.m_List.Name = "m_List"; + this.m_List.ScrollAlwaysVisible = true; + this.m_List.Size = new System.Drawing.Size(400, 168); + this.m_List.TabIndex = 0; + this.m_List.DoubleClick += new System.EventHandler(this.m_List_DoubleClick); + this.m_List.SelectedIndexChanged += new System.EventHandler(this.m_List_SelectedIndexChanged); + // + // m_Picture + // + this.m_Picture.Dock = System.Windows.Forms.DockStyle.Fill; + this.m_Picture.Location = new System.Drawing.Point(400, 0); + this.m_Picture.Name = "m_Picture"; + this.m_Picture.Size = new System.Drawing.Size(194, 168); + this.m_Picture.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.m_Picture.TabIndex = 1; + this.m_Picture.TabStop = false; + // + // OpenModelDialog + // + this.AutoSize = true; + this.ClientSize = new System.Drawing.Size(594, 168); + this.Controls.Add(this.m_Picture); + this.Controls.Add(this.m_List); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "OpenModelDialog"; + this.ShowIcon = false; + this.Text = "Model"; + ((System.ComponentModel.ISupportInitialize)(this.m_Picture)).EndInit(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.ListBox m_List; + private System.Windows.Forms.PictureBox m_Picture; + } +} \ No newline at end of file Added: src/test_applications/ItemsViewer/OpenModelDialog.cs =================================================================== --- src/test_applications/ItemsViewer/OpenModelDialog.cs (rev 0) +++ src/test_applications/ItemsViewer/OpenModelDialog.cs 2006-06-26 15:10:32 UTC (rev 8) @@ -0,0 +1,54 @@ +using System; +using System.IO; +using System.Collections.Specialized; +using System.ComponentModel; +using System.Drawing; +using System.Windows.Forms; + +namespace RPGWorldModel.ItemsViewer +{ + public partial class OpenModelDialog : Form + { + private string m_SelectedModel; + private NameValueCollection m_Models; + + public OpenModelDialog(NameValueCollection models) + { + InitializeComponent(); + + this.m_Models = models; + + foreach (string key in this.m_Models.AllKeys) + this.m_List.Items.Add(key); + + this.m_List.SelectedIndex = -1; + } + + private void m_List_SelectedIndexChanged(object sender, EventArgs e) + { + string file = this.m_Models[this.m_List.SelectedItem.ToString()]; + // Load the model image + this.m_Picture.Load(Path.GetDirectoryName(file) + Path.DirectorySeparatorChar + + Path.GetFileNameWithoutExtension(file) + @".bmp"); + } + + private void m_List_DoubleClick(object sender, EventArgs e) + { + if (this.m_List.SelectedItem != null) + { + this.m_SelectedModel = this.m_List.SelectedItem.ToString(); + + this.DialogResult = DialogResult.OK; + this.Close(); + } + } + + public string SelectedModel + { + get + { + return this.m_SelectedModel; + } + } + } +} \ No newline at end of file Modified: src/test_applications/ItemsViewer/Program.cs =================================================================== --- src/test_applications/ItemsViewer/Program.cs 2006-06-25 10:49:06 UTC (rev 7) +++ src/test_applications/ItemsViewer/Program.cs 2006-06-26 15:10:32 UTC (rev 8) @@ -1,19 +1,13 @@ using System; -using System.Collections.Generic; -using System.Windows.Forms; -namespace ModelViewer +namespace RPGWorldModel.ItemsViewer { static class Program { - /// <summary> - /// The main entry point for the application. - /// </summary> [STAThread] static void Main() { - Surface surface = new Surface(); - surface.ShowDialog(); + ViewController view = new ViewController(); } } } \ No newline at end of file Deleted: src/test_applications/ItemsViewer/Surface.Designer.cs =================================================================== --- src/test_applications/ItemsViewer/Surface.Designer.cs 2006-06-25 10:49:06 UTC (rev 7) +++ src/test_applications/ItemsViewer/Surface.Designer.cs 2006-06-26 15:10:32 UTC (rev 8) @@ -1,51 +0,0 @@ -namespace ModelViewer -{ - partial class Surface - { - /// <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() - { - this.SuspendLayout(); - // - // Surface - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(794, 568); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; - this.Name = "Surface"; - this.ShowIcon = false; - this.WindowState = System.Windows.Forms.FormWindowState.Maximized; - this.Load += new System.EventHandler(this.Surface_Load); - this.ResumeLayout(false); - - } - - #endregion - - } -} - Modified: src/test_applications/ItemsViewer/Surface.cs =================================================================== --- src/test_applications/ItemsViewer/Surface.cs 2006-06-25 10:49:06 UTC (rev 7) +++ src/test_applications/ItemsViewer/Surface.cs 2006-06-26 15:10:32 UTC (rev 8) @@ -7,37 +7,78 @@ using Microsoft.DirectX; using Microsoft.DirectX.Direct3D; -namespace ModelViewer +namespace RPGWorldModel.ItemsViewer { - public partial class Surface : Form + public sealed partial class Surface : Form { - private Device m_RenderingDevice = null; - private PresentParameters m_DeviceParameters = null; - private Mesh m_SceenObjct = null; - private Material[] m_ObjectMaterials; - private Texture[] m_ObjectTextures; + private Device m_RenderingDevice; + private IModel m_Model; public Surface() { - InitializeComponent(); + this.SuspendLayout(); + + this.ClientSize = new System.Drawing.Size(800, 600); + this.ShowIcon = false; + this.KeyDown += new KeyEventHandler(Surface_KeyDown); + this.Paint += new PaintEventHandler(Surface_Paint); + + this.ResumeLayout(false); + + this.InitializeDevice(); } - private void SetMetrices() + void Surface_Paint(object sender, PaintEventArgs e) { - this.m_RenderingDevice.Transform.View = Matrix.LookAtLH(new Vector3(0.0f, 0.0f, -100.0f), - new Vector3(0.0f, 0.0f, 0.0f), - new Vector3(1.0f, 1.0f, 0.0f)); + this.RenderSceen(); + } - this.m_RenderingDevice.Transform.World = Matrix.Scaling(0.1f, 0.1f, 0.1f); - + float yAngle = 0.0f; + float xAngle = 0.0f; + + void Surface_KeyDown(object sender, KeyEventArgs e) + { + switch (e.KeyCode) + { + case(Keys.Left): + { + this.m_RenderingDevice.Transform.World = Matrix.RotationY((yAngle += 0.1f)); + this.RenderSceen(); + break; + } + case (Keys.Right): + { + this.m_RenderingDevice.Transform.World = Matrix.RotationY((yAngle -= 0.1f)); + this.RenderSceen(); + break; + } + case (Keys.Up): + { + this.m_RenderingDevice.Transform.World = Matrix.RotationX((xAngle += 0.1f)); + this.RenderSceen(); + break; + } + case (Keys.Down): + { + this.m_RenderingDevice.Transform.World = Matrix.RotationX((xAngle -= 0.1f)); + this.RenderSceen(); + break; + } + } + } + + private void InitializeDevice() + { + PresentParameters parameters = new PresentParameters(); + parameters.Windowed = true; + parameters.SwapEffect = SwapEffect.Discard; + + this.m_RenderingDevice = new Device(0, DeviceType.Hardware, + this, CreateFlags.SoftwareVertexProcessing, parameters); + + // Set metrices + this.m_RenderingDevice.Transform.View = Matrix.LookAtLH(new Vector3(0.0f, 0.0f, -100.0f), new Vector3(0.0f, 0.0f, 50.0f), new Vector3(0.0f, 1.0f, 0.0f)); this.m_RenderingDevice.Transform.Projection = Matrix.PerspectiveFovLH((float)(Math.PI / 2), 1.0f, 1.0f, 100.0f); - - this.m_RenderingDevice.Lights[0].Type = LightType.Directional; - this.m_RenderingDevice.Lights[0].Diffuse = System.Drawing.Color.Red; - this.m_RenderingDevice.Lights[0].Direction = new Vector3((float)Math.Cos(Environment.TickCount / 250.0f), 1.0f, (float)Math.Sin(Environment.TickCount / 250.0f)); - this.m_RenderingDevice.Lights[0].Direction = new Vector3(-1, 0, 0); - this.m_RenderingDevice.Lights[0].Enabled = true; - } public void RenderSceen() @@ -47,59 +88,39 @@ this.m_RenderingDevice.RenderState.Ambient = System.Drawing.Color.FromArgb(0x676766); - for (int i = 0; i < this.m_ObjectMaterials.Length; i++) + for (int i = 0; i < this.m_Model.Materials.Length; i++) { - this.m_RenderingDevice.Material = this.m_ObjectMaterials[i]; - this.m_RenderingDevice.SetTexture(0, this.m_ObjectTextures[i]); - this.m_SceenObjct.DrawSubset(i); + this.m_RenderingDevice.Material = this.m_Model.Materials[i]; + this.m_RenderingDevice.SetTexture(0, this.m_Model.Textures[i]); + this.m_Model.Object.DrawSubset(i); } this.m_RenderingDevice.EndScene(); this.m_RenderingDevice.Present(); } - private void Surface_Load(object sender, EventArgs e) + #region Public properties + + public Device RenderingDevice { - using (OpenFileDialog modelSource = new OpenFileDialog()) + get { - modelSource.Multiselect = false; - modelSource.Filter = "DirectX X Models (*.x)|*.x"; + return this.m_RenderingDevice; + } + } - if (modelSource.ShowDialog() == DialogResult.OK) - { - System.IO.Directory.SetCurrentDirectory(System.IO.Path.GetDirectoryName(modelSource.FileName)); - - this.m_DeviceParameters = new PresentParameters(); - this.m_DeviceParameters.Windowed = true; - this.m_DeviceParameters.SwapEffect = SwapEffect.Discard; - - this.m_RenderingDevice = new Device(0, DeviceType.Hardware, - this, CreateFlags.SoftwareVertexProcessing, this.m_DeviceParameters); - - ExtendedMaterial[] materials; - - this.m_SceenObjct = Mesh.FromFile(System.IO.Path.GetFileName(modelSource.FileName), MeshFlags.SystemMemory, this.m_RenderingDevice, out materials); - - this.m_ObjectTextures = new Texture[materials.Length]; - this.m_ObjectMaterials = new Material[materials.Length]; - - for (int i = 0; i < materials.Length; i++) - { - this.m_ObjectMaterials[i] = materials[i].Material3D; - this.m_ObjectMaterials[i].Ambient = this.m_ObjectMaterials[i].Diffuse; - this.m_ObjectTextures[i] = TextureLoader.FromFile(this.m_RenderingDevice, materials[i].TextureFilename); - } - - this.SetMetrices(); - - this.RenderSceen(); - } - else - { - MessageBox.Show("No model selected"); - this.Close(); - } + public IModel Model + { + get + { + return this.m_Model; } + set + { + this.m_Model = value; + } } + + #endregion } } \ No newline at end of file Deleted: src/test_applications/ItemsViewer/Surface.resx =================================================================== --- src/test_applications/ItemsViewer/Surface.resx 2006-06-25 10:49:06 UTC (rev 7) +++ src/test_applications/ItemsViewer/Surface.resx 2006-06-26 15:10:32 UTC (rev 8) @@ -1,120 +0,0 @@ -<?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> -</root> \ No newline at end of file Added: src/test_applications/ItemsViewer/ViewController.cs =================================================================== --- src/test_applications/ItemsViewer/ViewController.cs (rev 0) +++ src/test_applications/ItemsViewer/ViewController.cs 2006-06-26 15:10:32 UTC (rev 8) @@ -0,0 +1,54 @@ +using System; +using System.IO; +using System.Configuration; +using System.Collections.Specialized; +using System.Windows.Forms; + +namespace RPGWorldModel.ItemsViewer +{ + public sealed class ViewController + { + private Surface m_View; + private Model m_Model; + + public ViewController() + { + this.m_View = new Surface(); + + if (this.LoadModel()) + { + this.m_View.Model = this.m_Model; + this.m_View.ShowDialog(); + } + } + + private bool LoadModel() + { + NameValueCollection models = (NameValueCollection)ConfigurationManager.GetSection("models"); + + if (models != null) + { + using (OpenModelDialog openModel = new OpenModelDialog(models)) + { + Directory.SetCurrentDirectory(Application.StartupPath); + + if (openModel.ShowDialog() == DialogResult.OK) + { + try + { + this.m_Model = new Model(models[openModel.SelectedModel], this.m_View.RenderingDevice); + } + catch + { + return false; + } + + return true; + } + } + } + + return false; + } + } +} Added: src/test_applications/ItemsViewer/ViewState.cs =================================================================== --- src/test_applications/ItemsViewer/ViewState.cs (rev 0) +++ src/test_applications/ItemsViewer/ViewState.cs 2006-06-26 15:10:32 UTC (rev 8) @@ -0,0 +1,10 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace RPGWorldModel.ItemsViewer +{ + public struct ViewState + { + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |