Commits

Anonymous committed 7c96d50

no message

Comments (0)

Files changed (14)

DarkMotion/DHView.Designer.cs

+namespace DarkMotion
+{
+	partial class DHView
+	{
+		/// <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 Component 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();
+			// 
+			// DHView
+			// 
+			this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+			this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+			this.Name = "DHView";
+			this.Size = new System.Drawing.Size(378, 234);
+			this.ResumeLayout(false);
+
+		}
+
+		#endregion
+	}
+}

DarkMotion/DHView.cs

+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Windows.Forms;
+using System.Runtime.InteropServices;
+
+namespace DarkMotion
+{
+	public partial class DHView : UserControl
+	{
+		public DHView()
+		{
+			InitializeComponent();
+		}
+
+		protected override void OnLoad(EventArgs e)
+		{
+			base.OnLoad(e);
+		}
+
+		protected override void OnPaint(PaintEventArgs e) { }
+
+		protected override void OnPaintBackground(PaintEventArgs e)	{ }
+
+		static bool AppStillIdle
+		{
+			get
+			{
+				Message msg;
+				return !PeekMessage(out msg, IntPtr.Zero, 0, 0, 0);
+			}
+		}
+
+		[System.Security.SuppressUnmanagedCodeSecurity]
+		[DllImport("user32.dll", CharSet = CharSet.Auto)]
+		[return: MarshalAs(UnmanagedType.Bool)]
+		private static extern bool PeekMessage(out Message msg, IntPtr hWnd,
+			uint messageFilterMin, uint messageFilterMax, uint flags);
+
+		[StructLayout(LayoutKind.Sequential)]
+		struct Message
+		{
+			public IntPtr hWnd;
+			public uint msg;
+			public IntPtr wParam;
+			public IntPtr lParam;
+			public uint time;
+			public System.Drawing.Point p;
+		}
+	}
+}

DarkMotion/DHView.resx

+<?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=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+</root>

DarkMotion/DarkMotion.csproj

       <SubType>UserControl</SubType>
     </Compile>
     <Compile Include="Condition.cs" />
+    <Compile Include="DHView.cs">
+      <SubType>UserControl</SubType>
+    </Compile>
+    <Compile Include="DHView.Designer.cs">
+      <DependentUpon>DHView.cs</DependentUpon>
+    </Compile>
     <Compile Include="IMotionFormat.cs" />
     <Compile Include="MainForm.cs">
       <SubType>Form</SubType>
     <EmbeddedResource Include="Canvas.resx">
       <DependentUpon>Canvas.cs</DependentUpon>
     </EmbeddedResource>
+    <EmbeddedResource Include="DHView.resx">
+      <DependentUpon>DHView.cs</DependentUpon>
+    </EmbeddedResource>
     <EmbeddedResource Include="MainForm.resx">
       <DependentUpon>MainForm.cs</DependentUpon>
     </EmbeddedResource>

DarkMotion/MainForm.cs

 using System.IO;
 using System.Windows.Forms;
 
+using SharpHammer;
+
 namespace DarkMotion
 {
 	public partial class MainForm : Form
 	{
 		private Motion editMotion;
-		private Timer timer;
+		private Engine eng = null;
+		private Scene scn = null;
 
 		public MainForm()
 		{
 			pnlStateMachine.Invalidate();
 		}
 
+		protected override void OnClosed(EventArgs e)
+		{
+			releasePreview();
+		}
+
 		#region Preview Panel
 
 		void initPreview()
 		{
-			SharpHammer.sh_wrap.sh_init(pnlPreview.Handle);
-			pnlPreview.Resize += pnlPreview_Resize;
-			SharpHammer.sh_wrap.handle_activate(true);
-			this.KeyDown += MainForm_KeyDown;
-			SharpHammer.sh_wrap.handle_resize((UInt32)pnlPreview.Width, (UInt32)pnlPreview.Height, true);
-			timer = new Timer();
-			timer.Interval = 16;
-			timer.Tick += timer_Tick;
-			timer.Enabled = true;
+			//Core.Init();
+			//Log.ConsoleOutput = true;
+
+			//Config cfg;
+			//try {
+			//	cfg = Config.FromFile("setting.json");
+			//} catch {
+			//	cfg = Config.Default;
+			//}
+
+			//eng = new Engine("DarkMotion", cfg, pnlPreview.Handle);
+
+			//scn = new Scene("testscene1");
+			//eng.ActiveScene = scn;
+			//Camera cam = new Camera();
+			//eng.ActiveCamera = cam;
+			//pnlPreview_Resize(null, null);
+			//Application.Idle += Application_Idle;
+			//eng.Run();
 		}
 
-		void timer_Tick(object sender, EventArgs e)
+		//void Application_Idle(object sender, EventArgs e)
+		//{
+		//	while (eng.IsAppStillIdle) {
+		//		eng.Update();
+		//	}
+		//}
+
+		void releasePreview()
 		{
-			SharpHammer.sh_wrap.handle_update();
+			//scn.Dispose();
+			//eng.Dispose();
+			Core.Release();
 		}
 
-
-		void MainForm_KeyDown(object sender, KeyEventArgs e)
-		{
-			SharpHammer.sh_wrap.handle_keypress(0, (UInt32)e.KeyCode);
-		}
-		
 		void pnlPreview_Resize(object sender, EventArgs e)
 		{
-			SharpHammer.sh_wrap.handle_resize((UInt32)pnlPreview.Width, (UInt32)pnlPreview.Height, true);
+			//if (eng != null)
+			//	eng.SetViewSize(pnlPreview.ClientSize.Width, pnlPreview.ClientSize.Height);
 		}
 
 		#endregion

Examples/App.config

-<?xml version="1.0"?>
+<?xml version="1.0" encoding="utf-8" ?>
 <configuration>
-  <startup>
-
-    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
-  </startup>
+    <startup> 
+        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
+    </startup>
 </configuration>

Examples/Examples.csproj

+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{373F6897-94BF-4A51-A1BE-184A3652ABAE}</ProjectGuid>
+    <OutputType>Exe</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>Examples</RootNamespace>
+    <AssemblyName>Examples</AssemblyName>
+    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <PublishUrl>publish\</PublishUrl>
+    <Install>true</Install>
+    <InstallFrom>Disk</InstallFrom>
+    <UpdateEnabled>false</UpdateEnabled>
+    <UpdateMode>Foreground</UpdateMode>
+    <UpdateInterval>7</UpdateInterval>
+    <UpdateIntervalUnits>Days</UpdateIntervalUnits>
+    <UpdatePeriodically>false</UpdatePeriodically>
+    <UpdateRequired>false</UpdateRequired>
+    <MapFileExtensions>true</MapFileExtensions>
+    <ApplicationRevision>0</ApplicationRevision>
+    <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
+    <IsWebBootstrapper>false</IsWebBootstrapper>
+    <UseApplicationTrust>false</UseApplicationTrust>
+    <BootstrapperEnabled>true</BootstrapperEnabled>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>..\bin\Examples\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>..\bin\Examples\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
+    <PlatformTarget>x86</PlatformTarget>
+    <OutputPath>..\bin\Examples\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
+    <PlatformTarget>x86</PlatformTarget>
+    <OutputPath>..\bin\Examples\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <Optimize>true</Optimize>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Program.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="App.config" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\SharpHammer\SharpHammer.csproj">
+      <Project>{42ae9267-6a8a-49ac-8efe-a9da2bff6546}</Project>
+      <Name>SharpHammer</Name>
+    </ProjectReference>
+  </ItemGroup>
+  <ItemGroup>
+    <BootstrapperPackage Include=".NETFramework,Version=v4.5">
+      <Visible>False</Visible>
+      <ProductName>Microsoft .NET Framework 4.5 %28x86 and x64%29</ProductName>
+      <Install>true</Install>
+    </BootstrapperPackage>
+    <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
+      <Visible>False</Visible>
+      <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
+      <Install>false</Install>
+    </BootstrapperPackage>
+    <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
+      <Visible>False</Visible>
+      <ProductName>.NET Framework 3.5 SP1</ProductName>
+      <Install>false</Install>
+    </BootstrapperPackage>
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\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.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>

Examples/Program.cs

 using System;
-using System.IO;
 using SharpHammer;
 
-namespace UnitTest
+namespace Examples
 {
 	class Program
 	{
-
 		private static void Main(string[] args)
 		{
 			Core.Init();
 			Log.ConsoleOutput = true;
-			Log.SetFileOutput("log.txt");
+			//Log.SetFileOutput("log.txt");
 			Config cfg;
 			try {
 				cfg = Config.FromFile("setting.json");
 			Scene scn = new Scene("test");
 			eng.ActiveScene = scn;
 			Camera cam = new Camera(new Vec4(0f, 1f, -5f, 1f), new Vec4(0f, 1f, 1f, 1f));
-			
+
 			eng.ActiveCamera = cam;
 
 			eng.Run();
 			cfg.Dispose();
 			Core.Release();
 		}
-	
+
 		static void eng_OnUpdate()
 		{
-			
+
 		}
-
 	}
-}
+}

Examples/Properties/AssemblyInfo.cs

 using System.Reflection;
+using System.Runtime.CompilerServices;
 using System.Runtime.InteropServices;
 
-// General Information about an assembly is controlled through the following
+// General Information about an assembly is controlled through the following 
 // set of attributes. Change these attribute values to modify the information
 // associated with an assembly.
-[assembly: AssemblyTitle("UnitTest")]
-[assembly: AssemblyDescription("UnitTest For SharpHammer Wrapper")]
+[assembly: AssemblyTitle("Examples")]
+[assembly: AssemblyDescription("")]
 [assembly: AssemblyConfiguration("")]
 [assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("UnitTest")]
-[assembly: AssemblyCopyright("Copyright © Mohamad Amin Valinejad 2013")]
+[assembly: AssemblyProduct("Examples")]
+[assembly: AssemblyCopyright("Copyright ©  2013")]
 [assembly: AssemblyTrademark("")]
 [assembly: AssemblyCulture("")]
 
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components.  If you need to access a type in this assembly from
+// Setting ComVisible to false makes the types in this assembly not visible 
+// to COM components.  If you need to access a type in this assembly from 
 // COM, set the ComVisible attribute to true on that type.
 [assembly: ComVisible(false)]
 
 // The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("0baea5c4-b80d-41ff-a9b9-df8c31b5936a")]
+[assembly: Guid("a014e6cd-ef82-45ad-8214-bfa8d4840522")]
 
 // Version information for an assembly consists of the following four values:
 //
 //      Major Version
-//      Minor Version
+//      Minor Version 
 //      Build Number
 //      Revision
 //
-// You can specify all the values or you can default the Build and Revision Numbers
+// You can specify all the values or you can default the Build and Revision Numbers 
 // by using the '*' as shown below:
 // [assembly: AssemblyVersion("1.0.*")]
 [assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
 EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{6DFF9C77-51F5-4D11-A044-CEED07BDD345}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Examples", "UnitTest\Examples.csproj", "{936F2A1E-54B3-45F2-8627-9447543049D2}"
-EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DarkMotion", "DarkMotion\DarkMotion.csproj", "{5480F275-D449-4DBA-9246-1A77F4875E23}"
 	ProjectSection(ProjectDependencies) = postProject
 		{42AE9267-6A8A-49AC-8EFE-A9DA2BFF6546} = {42AE9267-6A8A-49AC-8EFE-A9DA2BFF6546}
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UIcomp", "UIcomp\UIcomp.csproj", "{750A85EA-D5EE-48E8-9DA2-048A56C0984D}"
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Examples", "Examples\Examples.csproj", "{373F6897-94BF-4A51-A1BE-184A3652ABAE}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
+		Debug|x86 = Debug|x86
 		Release|Any CPU = Release|Any CPU
+		Release|x86 = Release|x86
 	EndGlobalSection
 	GlobalSection(ProjectConfigurationPlatforms) = postSolution
 		{42AE9267-6A8A-49AC-8EFE-A9DA2BFF6546}.Debug|Any CPU.ActiveCfg = Debug|x86
 		{42AE9267-6A8A-49AC-8EFE-A9DA2BFF6546}.Debug|Any CPU.Build.0 = Debug|x86
+		{42AE9267-6A8A-49AC-8EFE-A9DA2BFF6546}.Debug|x86.ActiveCfg = Debug|x86
+		{42AE9267-6A8A-49AC-8EFE-A9DA2BFF6546}.Debug|x86.Build.0 = Debug|x86
 		{42AE9267-6A8A-49AC-8EFE-A9DA2BFF6546}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{42AE9267-6A8A-49AC-8EFE-A9DA2BFF6546}.Release|Any CPU.Build.0 = Release|Any CPU
-		{936F2A1E-54B3-45F2-8627-9447543049D2}.Debug|Any CPU.ActiveCfg = Debug|x86
-		{936F2A1E-54B3-45F2-8627-9447543049D2}.Debug|Any CPU.Build.0 = Debug|x86
-		{936F2A1E-54B3-45F2-8627-9447543049D2}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{936F2A1E-54B3-45F2-8627-9447543049D2}.Release|Any CPU.Build.0 = Release|Any CPU
+		{42AE9267-6A8A-49AC-8EFE-A9DA2BFF6546}.Release|x86.ActiveCfg = Release|x86
+		{42AE9267-6A8A-49AC-8EFE-A9DA2BFF6546}.Release|x86.Build.0 = Release|x86
 		{5480F275-D449-4DBA-9246-1A77F4875E23}.Debug|Any CPU.ActiveCfg = Debug|x86
 		{5480F275-D449-4DBA-9246-1A77F4875E23}.Debug|Any CPU.Build.0 = Debug|x86
+		{5480F275-D449-4DBA-9246-1A77F4875E23}.Debug|x86.ActiveCfg = Debug|x86
+		{5480F275-D449-4DBA-9246-1A77F4875E23}.Debug|x86.Build.0 = Debug|x86
 		{5480F275-D449-4DBA-9246-1A77F4875E23}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{5480F275-D449-4DBA-9246-1A77F4875E23}.Release|Any CPU.Build.0 = Release|Any CPU
+		{5480F275-D449-4DBA-9246-1A77F4875E23}.Release|x86.ActiveCfg = Release|x86
+		{5480F275-D449-4DBA-9246-1A77F4875E23}.Release|x86.Build.0 = Release|x86
 		{750A85EA-D5EE-48E8-9DA2-048A56C0984D}.Debug|Any CPU.ActiveCfg = Debug|x86
 		{750A85EA-D5EE-48E8-9DA2-048A56C0984D}.Debug|Any CPU.Build.0 = Debug|x86
+		{750A85EA-D5EE-48E8-9DA2-048A56C0984D}.Debug|x86.ActiveCfg = Debug|x86
+		{750A85EA-D5EE-48E8-9DA2-048A56C0984D}.Debug|x86.Build.0 = Debug|x86
 		{750A85EA-D5EE-48E8-9DA2-048A56C0984D}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{750A85EA-D5EE-48E8-9DA2-048A56C0984D}.Release|Any CPU.Build.0 = Release|Any CPU
+		{750A85EA-D5EE-48E8-9DA2-048A56C0984D}.Release|x86.ActiveCfg = Release|x86
+		{750A85EA-D5EE-48E8-9DA2-048A56C0984D}.Release|x86.Build.0 = Release|x86
+		{373F6897-94BF-4A51-A1BE-184A3652ABAE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{373F6897-94BF-4A51-A1BE-184A3652ABAE}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{373F6897-94BF-4A51-A1BE-184A3652ABAE}.Debug|x86.ActiveCfg = Debug|x86
+		{373F6897-94BF-4A51-A1BE-184A3652ABAE}.Debug|x86.Build.0 = Debug|x86
+		{373F6897-94BF-4A51-A1BE-184A3652ABAE}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{373F6897-94BF-4A51-A1BE-184A3652ABAE}.Release|Any CPU.Build.0 = Release|Any CPU
+		{373F6897-94BF-4A51-A1BE-184A3652ABAE}.Release|x86.ActiveCfg = Release|x86
+		{373F6897-94BF-4A51-A1BE-184A3652ABAE}.Release|x86.Build.0 = Release|x86
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE

SharpHammer/Scene.cs

 		{
 			_name = name;
 			_sceneID = NativeCalls.scn_create_scene(name);
+			if (_sceneID == 0)
+				throw new Exception("Failed to create scene.");
 		}
 
 		protected override void OnDisposeUnmanaged()

SharpHammer/SharpHammer.csproj

     <Compile Include="NativeCalls.cs" />
     <Compile Include="Engine.cs" />
     <Compile Include="Scene.cs" />
-    <Compile Include="sh_wrap.cs" />
     <Compile Include="DisposableBase.cs" />
     <Compile Include="MathUtil.cs" />
     <Compile Include="Matrix4.cs" />

SharpHammer/engine.cs

 
 		public void Run()
 		{
+			NativeCalls.gfx_set_gridcallback();
 			if (_frm != null) {
-				NativeCalls.gfx_set_gridcallback();
-				_frm.MainLoop = onUpdate;
 				_frm.Resize = onResize;
+				_frm.Update = onUpdate;
 				System.Windows.Forms.Application.Run(_frm);
+			} else {
+				//Application.Idle += Application_Idle;
 			}
 		}
 
+		//void Application_Idle(object sender, EventArgs e)
+		//{
+		//	while (AppStillIdle) {
+		//		onUpdate();
+		//	}
+		//}
+
+		public bool IsAppStillIdle
+		{
+			get { return Engine.AppStillIdle; }
+		}
+
+		public void Update()
+		{
+			onUpdate();
+		}
+
 		public void SetViewSize(int w, int h)
 		{
 			NativeCalls.cam_set_viewsize(ref ActiveCamera._cam, (float)w, (float)h);
 		}
 		#endregion
 
+		#region FastLoop
+		static bool AppStillIdle
+		{
+			get
+			{
+				Message msg;
+				return !PeekMessage(out msg, IntPtr.Zero, 0, 0, 0);
+			}
+		}
+
+		[System.Security.SuppressUnmanagedCodeSecurity]
+		[DllImport("user32.dll", CharSet = CharSet.Auto)]
+		[return: MarshalAs(UnmanagedType.Bool)]
+		private static extern bool PeekMessage(out Message msg, IntPtr hWnd,
+			uint messageFilterMin, uint messageFilterMax, uint flags);
+
+		[StructLayout(LayoutKind.Sequential)]
+		struct Message
+		{
+			public IntPtr hWnd;
+			public uint msg;
+			public IntPtr wParam;
+			public IntPtr lParam;
+			public uint time;
+			public System.Drawing.Point p;
+		}
+		#endregion
+
 		#region RenderForm
 		private class RenderForm : Form
 		{
-			public Action MainLoop = null;
+			public Action Update = null;
 			public Action Resize = null;
 
 			public RenderForm()
 			void Application_Idle(object sender, EventArgs e)
 			{
 				while (AppStillIdle) {
-					if (MainLoop != null)
-						MainLoop();
-				}
+					if (Update != null)
+						Update();
+				}	
 			}
 
 			protected override void OnResize(EventArgs e)
 
 			protected override void OnPaintBackground(PaintEventArgs e)
 			{ }
-
-			static bool AppStillIdle
-			{
-				get
-				{
-					Message msg;
-					return !PeekMessage(out msg, IntPtr.Zero, 0, 0, 0);
-				}
-			}
-
-			[System.Security.SuppressUnmanagedCodeSecurity]
-			[DllImport("user32.dll", CharSet = CharSet.Auto)]
-			[return: MarshalAs(UnmanagedType.Bool)]
-			private static extern bool PeekMessage(out Message msg, IntPtr hWnd,
-				uint messageFilterMin, uint messageFilterMax, uint flags);
-
-			[StructLayout(LayoutKind.Sequential)]
-			struct Message
-			{
-				public IntPtr hWnd;
-				public uint msg;
-				public IntPtr wParam;
-				public IntPtr lParam;
-				public uint time;
-				public System.Drawing.Point p;
-			}
 		}
 		#endregion
 

SharpHammer/sh_wrap.cs

-using System;
-using System.Runtime.InteropServices;
-
-namespace SharpHammer
-{
-	public class sh_wrap
-	{
-		public const string NativeDll = "sh_wrap.dll";
-
-		[DllImport(sh_wrap.NativeDll, CallingConvention = CallingConvention.Cdecl)]
-		public static extern void sh_init(IntPtr hwnd);
-
-		[DllImport(sh_wrap.NativeDll, CallingConvention = CallingConvention.Cdecl)]
-		public static extern void sh_exit();
-
-		[DllImport(sh_wrap.NativeDll, CallingConvention = CallingConvention.Cdecl)]
-		public static extern void handle_update();
-
-		[DllImport(sh_wrap.NativeDll, CallingConvention = CallingConvention.Cdecl)]
-		public static extern void handle_activate([MarshalAs(UnmanagedType.Bool)] bool active);
-
-		[DllImport(sh_wrap.NativeDll, CallingConvention = CallingConvention.Cdecl)]
-		public static extern void handle_resize(UInt32 width, UInt32 height, [MarshalAs(UnmanagedType.Bool)] bool wnd_override);
-
-		[DllImport(sh_wrap.NativeDll, CallingConvention = CallingConvention.Cdecl)]
-		public static extern void handle_keypress(byte c, UInt32 vkey);
-	}
-}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.