Migrated WpfEditor, fixed disposing of State objects and added Debug names to the state objects.

The WpfEditor doesn't create a new device anymore every time it receives
focus.
StateObjects get recreated if the used device changes and they get
disposed if the parent GraphicsDevice gets disposed.
This commit is contained in:
Konstantin Koch 2015-10-18 14:31:08 +02:00
parent c61b7a077e
commit 6f1b068bf5
8 changed files with 277 additions and 73 deletions

View File

@ -17,14 +17,16 @@ namespace ANX.RenderSystem.Windows.DX11
protected const int IntMaxOver16 = int.MaxValue / 16;
protected const float ColorByteToFloatFactor = 1f / 255f;
#region Private
protected bool isDirty;
protected T nativeState;
#endregion
#region Public
public bool IsBound { get; protected set; }
#endregion
protected GraphicsDevice GraphicsDevice
{
get;
private set;
}
#region Constructor
protected BaseStateObject()
@ -75,13 +77,31 @@ namespace ANX.RenderSystem.Windows.DX11
#region UpdateNativeBlendState
private void UpdateNativeBlendState(GraphicsDevice graphics)
{
if (graphics != this.GraphicsDevice)
{
if (this.GraphicsDevice != null)
this.GraphicsDevice.ResourceDestroyed -= GraphicsDevice_ResourceDestroyed;
if (graphics != null)
graphics.ResourceDestroyed += GraphicsDevice_ResourceDestroyed;
this.GraphicsDevice = graphics;
this.Dispose();
}
if (isDirty || nativeState == null)
{
Dispose();
this.GraphicsDevice = graphics;
nativeState = CreateNativeState(graphics);
isDirty = false;
}
}
void GraphicsDevice_ResourceDestroyed(object sender, ResourceDestroyedEventArgs e)
{
this.Dispose();
}
#endregion
protected virtual void Init() { }

View File

@ -21,6 +21,10 @@ namespace ANX.RenderSystem.Windows.DX10
private SharpDX.Color4 blendFactor;
private int multiSampleMask;
#if DEBUG
private static int blendStateCount = 0;
#endif
#region Public
public Color BlendFactor
{
@ -141,7 +145,11 @@ namespace ANX.RenderSystem.Windows.DX10
protected override Dx10.BlendState CreateNativeState(GraphicsDevice graphics)
{
Dx10.Device device = (graphics.NativeDevice as GraphicsDeviceDX).NativeDevice;
return new Dx10.BlendState(device, ref description);
var blendState = new Dx10.BlendState(device, ref description);
#if DEBUG
blendState.DebugName = "BlendState_" + blendStateCount++;
#endif
return blendState;
}
protected override void ApplyNativeState(GraphicsDevice graphics)

View File

@ -19,6 +19,10 @@ namespace ANX.RenderSystem.Windows.DX10
private Dx10.DepthStencilStateDescription description;
private int referenceStencil;
#if DEBUG
private static int depthStencilStateCount = 0;
#endif
#region Public (TODO)
public StencilOperation CounterClockwiseStencilDepthBufferFail
{
@ -172,7 +176,11 @@ namespace ANX.RenderSystem.Windows.DX10
protected override Dx10.DepthStencilState CreateNativeState(GraphicsDevice graphics)
{
Dx10.Device device = (graphics.NativeDevice as GraphicsDeviceDX).NativeDevice;
return new Dx10.DepthStencilState(device, ref description);
var state = new Dx10.DepthStencilState(device, ref description);
#if DEBUG
state.DebugName = "DepthStencilState_" + depthStencilStateCount++;
#endif
return state;
}
protected override void ApplyNativeState(GraphicsDevice graphics)

View File

@ -18,6 +18,10 @@ namespace ANX.RenderSystem.Windows.DX10
{
private Dx10.RasterizerStateDescription description;
#if DEBUG
private static int rasterizerStateCount = 0;
#endif
#region Public
public CullMode CullMode
{
@ -90,7 +94,11 @@ namespace ANX.RenderSystem.Windows.DX10
protected override Dx10.RasterizerState CreateNativeState(GraphicsDevice graphics)
{
Dx10.Device device = (graphics.NativeDevice as GraphicsDeviceDX).NativeDevice;
return new Dx10.RasterizerState(device, ref description);
var state = new Dx10.RasterizerState(device, ref description);
#if DEBUG
state.DebugName = "RasterizerState_" + rasterizerStateCount++;
#endif
return state;
}
protected override void ApplyNativeState(GraphicsDevice graphics)

View File

@ -18,6 +18,10 @@ namespace ANX.RenderSystem.Windows.DX10
{
#region Private
private Dx10.SamplerStateDescription description;
#if DEBUG
private static int samplerStateCount = 0;
#endif
#endregion
#region Public
@ -105,6 +109,9 @@ namespace ANX.RenderSystem.Windows.DX10
Dispose();
nativeState = new Dx10.SamplerState(device, ref description);
isDirty = false;
#if DEBUG
nativeState.DebugName = "SamplerState_" + samplerStateCount++;
#endif
}
}
#endregion

View File

@ -1,62 +1,211 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleContent", "SampleContent\SampleContent.contentproj", "{FA6E229D-4504-47B1-8A23-2D3FCC13F778}"
EndProject
# Visual Studio 2013
VisualStudioVersion = 12.0.40629.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WpfEditor", "WpfEditor\WpfEditor.csproj", "{EFC485F7-3E0A-40AB-B79D-E07FE86FC386}"
ProjectSection(ProjectDependencies) = postProject
{75EFAE60-726E-430F-8661-4CF9ABD1306C} = {75EFAE60-726E-430F-8661-4CF9ABD1306C}
EndProjectSection
EndProject
Project("{75EFAE60-726E-430F-8661-4CF9ABD1306C}") = "SampleContent", "SampleContent\SampleContent.cproj", "{75EFAE60-726E-430F-8661-4CF9ABD1306C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Android = Debug|Android
Debug|Any CPU = Debug|Any CPU
Debug|iOS = Debug|iOS
Debug|Linux = Debug|Linux
Debug|Mac OS = Debug|Mac OS
Debug|Mixed Platforms = Debug|Mixed Platforms
Debug|PS Vita = Debug|PS Vita
Debug|Windows = Debug|Windows
Debug|Windows Metro = Debug|Windows Metro
Debug|Windows Phone = Debug|Windows Phone
Debug|x86 = Debug|x86
Debug|XBox 360 = Debug|XBox 360
DebugWin8|Android = DebugWin8|Android
DebugWin8|Any CPU = DebugWin8|Any CPU
DebugWin8|iOS = DebugWin8|iOS
DebugWin8|Linux = DebugWin8|Linux
DebugWin8|Mac OS = DebugWin8|Mac OS
DebugWin8|Mixed Platforms = DebugWin8|Mixed Platforms
DebugWin8|PS Vita = DebugWin8|PS Vita
DebugWin8|Windows = DebugWin8|Windows
DebugWin8|Windows Metro = DebugWin8|Windows Metro
DebugWin8|Windows Phone = DebugWin8|Windows Phone
DebugWin8|x86 = DebugWin8|x86
DebugWin8|XBox 360 = DebugWin8|XBox 360
Release|Android = Release|Android
Release|Any CPU = Release|Any CPU
Release|iOS = Release|iOS
Release|Linux = Release|Linux
Release|Mac OS = Release|Mac OS
Release|Mixed Platforms = Release|Mixed Platforms
Release|PS Vita = Release|PS Vita
Release|Windows = Release|Windows
Release|Windows Metro = Release|Windows Metro
Release|Windows Phone = Release|Windows Phone
Release|x86 = Release|x86
Release|XBox 360 = Release|XBox 360
ReleaseWin8|Android = ReleaseWin8|Android
ReleaseWin8|Any CPU = ReleaseWin8|Any CPU
ReleaseWin8|iOS = ReleaseWin8|iOS
ReleaseWin8|Linux = ReleaseWin8|Linux
ReleaseWin8|Mac OS = ReleaseWin8|Mac OS
ReleaseWin8|Mixed Platforms = ReleaseWin8|Mixed Platforms
ReleaseWin8|PS Vita = ReleaseWin8|PS Vita
ReleaseWin8|Windows = ReleaseWin8|Windows
ReleaseWin8|Windows Metro = ReleaseWin8|Windows Metro
ReleaseWin8|Windows Phone = ReleaseWin8|Windows Phone
ReleaseWin8|x86 = ReleaseWin8|x86
ReleaseWin8|XBox 360 = ReleaseWin8|XBox 360
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{FA6E229D-4504-47B1-8A23-2D3FCC13F778}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FA6E229D-4504-47B1-8A23-2D3FCC13F778}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{FA6E229D-4504-47B1-8A23-2D3FCC13F778}.Debug|x86.ActiveCfg = Debug|Any CPU
{FA6E229D-4504-47B1-8A23-2D3FCC13F778}.DebugWin8|Any CPU.ActiveCfg = Debug|Any CPU
{FA6E229D-4504-47B1-8A23-2D3FCC13F778}.DebugWin8|Mixed Platforms.ActiveCfg = Debug|Any CPU
{FA6E229D-4504-47B1-8A23-2D3FCC13F778}.DebugWin8|x86.ActiveCfg = Debug|Any CPU
{FA6E229D-4504-47B1-8A23-2D3FCC13F778}.Release|Any CPU.ActiveCfg = Debug|Any CPU
{FA6E229D-4504-47B1-8A23-2D3FCC13F778}.Release|Mixed Platforms.ActiveCfg = Debug|Any CPU
{FA6E229D-4504-47B1-8A23-2D3FCC13F778}.Release|x86.ActiveCfg = Debug|Any CPU
{FA6E229D-4504-47B1-8A23-2D3FCC13F778}.ReleaseWin8|Any CPU.ActiveCfg = Debug|Any CPU
{FA6E229D-4504-47B1-8A23-2D3FCC13F778}.ReleaseWin8|Mixed Platforms.ActiveCfg = Debug|Any CPU
{FA6E229D-4504-47B1-8A23-2D3FCC13F778}.ReleaseWin8|x86.ActiveCfg = Debug|Any CPU
{EFC485F7-3E0A-40AB-B79D-E07FE86FC386}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EFC485F7-3E0A-40AB-B79D-E07FE86FC386}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EFC485F7-3E0A-40AB-B79D-E07FE86FC386}.Debug|Android.ActiveCfg = Debug|x86
{EFC485F7-3E0A-40AB-B79D-E07FE86FC386}.Debug|Any CPU.ActiveCfg = Debug|x86
{EFC485F7-3E0A-40AB-B79D-E07FE86FC386}.Debug|iOS.ActiveCfg = Debug|x86
{EFC485F7-3E0A-40AB-B79D-E07FE86FC386}.Debug|Linux.ActiveCfg = Debug|x86
{EFC485F7-3E0A-40AB-B79D-E07FE86FC386}.Debug|Mac OS.ActiveCfg = Debug|x86
{EFC485F7-3E0A-40AB-B79D-E07FE86FC386}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
{EFC485F7-3E0A-40AB-B79D-E07FE86FC386}.Debug|Mixed Platforms.Build.0 = Debug|x86
{EFC485F7-3E0A-40AB-B79D-E07FE86FC386}.Debug|PS Vita.ActiveCfg = Debug|x86
{EFC485F7-3E0A-40AB-B79D-E07FE86FC386}.Debug|Windows.ActiveCfg = Debug|x86
{EFC485F7-3E0A-40AB-B79D-E07FE86FC386}.Debug|Windows Metro.ActiveCfg = Debug|x86
{EFC485F7-3E0A-40AB-B79D-E07FE86FC386}.Debug|Windows Phone.ActiveCfg = Debug|x86
{EFC485F7-3E0A-40AB-B79D-E07FE86FC386}.Debug|x86.ActiveCfg = Debug|x86
{EFC485F7-3E0A-40AB-B79D-E07FE86FC386}.Debug|x86.Build.0 = Debug|x86
{EFC485F7-3E0A-40AB-B79D-E07FE86FC386}.DebugWin8|Any CPU.ActiveCfg = Debug|Any CPU
{EFC485F7-3E0A-40AB-B79D-E07FE86FC386}.DebugWin8|Any CPU.Build.0 = Debug|Any CPU
{EFC485F7-3E0A-40AB-B79D-E07FE86FC386}.Debug|XBox 360.ActiveCfg = Debug|x86
{EFC485F7-3E0A-40AB-B79D-E07FE86FC386}.DebugWin8|Android.ActiveCfg = Debug|x86
{EFC485F7-3E0A-40AB-B79D-E07FE86FC386}.DebugWin8|Any CPU.ActiveCfg = Debug|x86
{EFC485F7-3E0A-40AB-B79D-E07FE86FC386}.DebugWin8|iOS.ActiveCfg = Debug|x86
{EFC485F7-3E0A-40AB-B79D-E07FE86FC386}.DebugWin8|Linux.ActiveCfg = Debug|x86
{EFC485F7-3E0A-40AB-B79D-E07FE86FC386}.DebugWin8|Mac OS.ActiveCfg = Debug|x86
{EFC485F7-3E0A-40AB-B79D-E07FE86FC386}.DebugWin8|Mixed Platforms.ActiveCfg = Debug|x86
{EFC485F7-3E0A-40AB-B79D-E07FE86FC386}.DebugWin8|Mixed Platforms.Build.0 = Debug|x86
{EFC485F7-3E0A-40AB-B79D-E07FE86FC386}.DebugWin8|PS Vita.ActiveCfg = Debug|x86
{EFC485F7-3E0A-40AB-B79D-E07FE86FC386}.DebugWin8|Windows.ActiveCfg = Debug|x86
{EFC485F7-3E0A-40AB-B79D-E07FE86FC386}.DebugWin8|Windows Metro.ActiveCfg = Debug|x86
{EFC485F7-3E0A-40AB-B79D-E07FE86FC386}.DebugWin8|Windows Phone.ActiveCfg = Debug|x86
{EFC485F7-3E0A-40AB-B79D-E07FE86FC386}.DebugWin8|x86.ActiveCfg = Debug|x86
{EFC485F7-3E0A-40AB-B79D-E07FE86FC386}.DebugWin8|x86.Build.0 = Debug|x86
{EFC485F7-3E0A-40AB-B79D-E07FE86FC386}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EFC485F7-3E0A-40AB-B79D-E07FE86FC386}.Release|Any CPU.Build.0 = Release|Any CPU
{EFC485F7-3E0A-40AB-B79D-E07FE86FC386}.DebugWin8|XBox 360.ActiveCfg = Debug|x86
{EFC485F7-3E0A-40AB-B79D-E07FE86FC386}.Release|Android.ActiveCfg = Release|x86
{EFC485F7-3E0A-40AB-B79D-E07FE86FC386}.Release|Any CPU.ActiveCfg = Release|x86
{EFC485F7-3E0A-40AB-B79D-E07FE86FC386}.Release|iOS.ActiveCfg = Release|x86
{EFC485F7-3E0A-40AB-B79D-E07FE86FC386}.Release|Linux.ActiveCfg = Release|x86
{EFC485F7-3E0A-40AB-B79D-E07FE86FC386}.Release|Mac OS.ActiveCfg = Release|x86
{EFC485F7-3E0A-40AB-B79D-E07FE86FC386}.Release|Mixed Platforms.ActiveCfg = Release|x86
{EFC485F7-3E0A-40AB-B79D-E07FE86FC386}.Release|Mixed Platforms.Build.0 = Release|x86
{EFC485F7-3E0A-40AB-B79D-E07FE86FC386}.Release|PS Vita.ActiveCfg = Release|x86
{EFC485F7-3E0A-40AB-B79D-E07FE86FC386}.Release|Windows.ActiveCfg = Release|x86
{EFC485F7-3E0A-40AB-B79D-E07FE86FC386}.Release|Windows Metro.ActiveCfg = Release|x86
{EFC485F7-3E0A-40AB-B79D-E07FE86FC386}.Release|Windows Phone.ActiveCfg = Release|x86
{EFC485F7-3E0A-40AB-B79D-E07FE86FC386}.Release|x86.ActiveCfg = Release|x86
{EFC485F7-3E0A-40AB-B79D-E07FE86FC386}.Release|x86.Build.0 = Release|x86
{EFC485F7-3E0A-40AB-B79D-E07FE86FC386}.ReleaseWin8|Any CPU.ActiveCfg = Release|Any CPU
{EFC485F7-3E0A-40AB-B79D-E07FE86FC386}.ReleaseWin8|Any CPU.Build.0 = Release|Any CPU
{EFC485F7-3E0A-40AB-B79D-E07FE86FC386}.Release|XBox 360.ActiveCfg = Release|x86
{EFC485F7-3E0A-40AB-B79D-E07FE86FC386}.ReleaseWin8|Android.ActiveCfg = Release|x86
{EFC485F7-3E0A-40AB-B79D-E07FE86FC386}.ReleaseWin8|Any CPU.ActiveCfg = Release|x86
{EFC485F7-3E0A-40AB-B79D-E07FE86FC386}.ReleaseWin8|iOS.ActiveCfg = Release|x86
{EFC485F7-3E0A-40AB-B79D-E07FE86FC386}.ReleaseWin8|Linux.ActiveCfg = Release|x86
{EFC485F7-3E0A-40AB-B79D-E07FE86FC386}.ReleaseWin8|Mac OS.ActiveCfg = Release|x86
{EFC485F7-3E0A-40AB-B79D-E07FE86FC386}.ReleaseWin8|Mixed Platforms.ActiveCfg = Release|x86
{EFC485F7-3E0A-40AB-B79D-E07FE86FC386}.ReleaseWin8|Mixed Platforms.Build.0 = Release|x86
{EFC485F7-3E0A-40AB-B79D-E07FE86FC386}.ReleaseWin8|PS Vita.ActiveCfg = Release|x86
{EFC485F7-3E0A-40AB-B79D-E07FE86FC386}.ReleaseWin8|Windows.ActiveCfg = Release|x86
{EFC485F7-3E0A-40AB-B79D-E07FE86FC386}.ReleaseWin8|Windows Metro.ActiveCfg = Release|x86
{EFC485F7-3E0A-40AB-B79D-E07FE86FC386}.ReleaseWin8|Windows Phone.ActiveCfg = Release|x86
{EFC485F7-3E0A-40AB-B79D-E07FE86FC386}.ReleaseWin8|x86.ActiveCfg = Release|x86
{EFC485F7-3E0A-40AB-B79D-E07FE86FC386}.ReleaseWin8|x86.Build.0 = Release|x86
{EFC485F7-3E0A-40AB-B79D-E07FE86FC386}.ReleaseWin8|XBox 360.ActiveCfg = Release|x86
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Debug|Android.ActiveCfg = Debug|Android
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Debug|Android.Build.0 = Debug|Android
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Debug|Any CPU.ActiveCfg = Debug|Android
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Debug|iOS.ActiveCfg = Debug|iOS
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Debug|iOS.Build.0 = Debug|iOS
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Debug|Linux.ActiveCfg = Debug|Linux
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Debug|Linux.Build.0 = Debug|Linux
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Debug|Mac OS.ActiveCfg = Debug|Mac OS
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Debug|Mac OS.Build.0 = Debug|Mac OS
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Debug|Mixed Platforms.ActiveCfg = Debug|XBox 360
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Debug|Mixed Platforms.Build.0 = Debug|XBox 360
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Debug|PS Vita.ActiveCfg = Debug|PS Vita
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Debug|PS Vita.Build.0 = Debug|PS Vita
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Debug|Windows.ActiveCfg = Debug|Windows
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Debug|Windows.Build.0 = Debug|Windows
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Debug|Windows Metro.ActiveCfg = Debug|Windows Metro
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Debug|Windows Metro.Build.0 = Debug|Windows Metro
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Debug|Windows Phone.ActiveCfg = Debug|Windows Phone
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Debug|Windows Phone.Build.0 = Debug|Windows Phone
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Debug|x86.ActiveCfg = Debug|XBox 360
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Debug|XBox 360.ActiveCfg = Debug|XBox 360
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Debug|XBox 360.Build.0 = Debug|XBox 360
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.DebugWin8|Android.ActiveCfg = Debug|Android
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.DebugWin8|Android.Build.0 = Debug|Android
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.DebugWin8|Any CPU.ActiveCfg = Debug|Android
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.DebugWin8|iOS.ActiveCfg = Debug|iOS
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.DebugWin8|iOS.Build.0 = Debug|iOS
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.DebugWin8|Linux.ActiveCfg = Debug|Linux
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.DebugWin8|Linux.Build.0 = Debug|Linux
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.DebugWin8|Mac OS.ActiveCfg = Debug|Mac OS
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.DebugWin8|Mac OS.Build.0 = Debug|Mac OS
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.DebugWin8|Mixed Platforms.ActiveCfg = Debug|XBox 360
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.DebugWin8|Mixed Platforms.Build.0 = Debug|XBox 360
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.DebugWin8|PS Vita.ActiveCfg = Debug|PS Vita
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.DebugWin8|PS Vita.Build.0 = Debug|PS Vita
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.DebugWin8|Windows.ActiveCfg = Debug|Windows
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.DebugWin8|Windows.Build.0 = Debug|Windows
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.DebugWin8|Windows Metro.ActiveCfg = Debug|Windows Metro
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.DebugWin8|Windows Metro.Build.0 = Debug|Windows Metro
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.DebugWin8|Windows Phone.ActiveCfg = Debug|Windows Phone
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.DebugWin8|Windows Phone.Build.0 = Debug|Windows Phone
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.DebugWin8|x86.ActiveCfg = Debug|XBox 360
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.DebugWin8|XBox 360.ActiveCfg = Debug|XBox 360
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.DebugWin8|XBox 360.Build.0 = Debug|XBox 360
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Release|Android.ActiveCfg = Release|Android
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Release|Android.Build.0 = Release|Android
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Release|Any CPU.ActiveCfg = Release|Android
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Release|iOS.ActiveCfg = Release|iOS
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Release|iOS.Build.0 = Release|iOS
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Release|Linux.ActiveCfg = Release|Linux
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Release|Linux.Build.0 = Release|Linux
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Release|Mac OS.ActiveCfg = Release|Mac OS
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Release|Mac OS.Build.0 = Release|Mac OS
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Release|Mixed Platforms.ActiveCfg = Release|XBox 360
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Release|Mixed Platforms.Build.0 = Release|XBox 360
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Release|PS Vita.ActiveCfg = Release|PS Vita
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Release|PS Vita.Build.0 = Release|PS Vita
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Release|Windows.ActiveCfg = Release|Windows
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Release|Windows.Build.0 = Release|Windows
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Release|Windows Metro.ActiveCfg = Release|Windows Metro
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Release|Windows Metro.Build.0 = Release|Windows Metro
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Release|Windows Phone.ActiveCfg = Release|Windows Phone
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Release|Windows Phone.Build.0 = Release|Windows Phone
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Release|x86.ActiveCfg = Release|XBox 360
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Release|XBox 360.ActiveCfg = Release|XBox 360
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Release|XBox 360.Build.0 = Release|XBox 360
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.ReleaseWin8|Android.ActiveCfg = Release|Android
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.ReleaseWin8|Android.Build.0 = Release|Android
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.ReleaseWin8|Any CPU.ActiveCfg = Release|Android
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.ReleaseWin8|iOS.ActiveCfg = Release|iOS
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.ReleaseWin8|iOS.Build.0 = Release|iOS
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.ReleaseWin8|Linux.ActiveCfg = Release|Linux
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.ReleaseWin8|Linux.Build.0 = Release|Linux
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.ReleaseWin8|Mac OS.ActiveCfg = Release|Mac OS
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.ReleaseWin8|Mac OS.Build.0 = Release|Mac OS
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.ReleaseWin8|Mixed Platforms.ActiveCfg = Release|XBox 360
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.ReleaseWin8|Mixed Platforms.Build.0 = Release|XBox 360
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.ReleaseWin8|PS Vita.ActiveCfg = Release|PS Vita
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.ReleaseWin8|PS Vita.Build.0 = Release|PS Vita
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.ReleaseWin8|Windows.ActiveCfg = Release|Windows
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.ReleaseWin8|Windows.Build.0 = Release|Windows
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.ReleaseWin8|Windows Metro.ActiveCfg = Release|Windows Metro
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.ReleaseWin8|Windows Metro.Build.0 = Release|Windows Metro
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.ReleaseWin8|Windows Phone.ActiveCfg = Release|Windows Phone
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.ReleaseWin8|Windows Phone.Build.0 = Release|Windows Phone
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.ReleaseWin8|x86.ActiveCfg = Release|XBox 360
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.ReleaseWin8|XBox 360.ActiveCfg = Release|XBox 360
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.ReleaseWin8|XBox 360.Build.0 = Release|XBox 360
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -19,20 +19,33 @@ namespace WpfEditor
public MainWindow()
{
InitializeComponent();
emptyThreadStart = delegate { };
//AddInSystemFactory.Instance.SetPreferredSystem(AddInType.RenderSystem, "OpenGL3");
AddInSystemFactory.Instance.SetPreferredSystem(AddInType.RenderSystem, "DirectX10");
InitializeComponent();
emptyThreadStart = delegate { };
}
protected override void OnInitialized(EventArgs e)
{
base.OnInitialized(e);
device = new GraphicsDevice(GraphicsAdapter.DefaultAdapter, GraphicsProfile.HiDef,
new PresentationParameters
{
BackBufferWidth = GamePanel.Width,
BackBufferHeight = GamePanel.Height,
BackBufferFormat = SurfaceFormat.Color,
DeviceWindowHandle = new WindowHandle(GamePanel.Handle),
PresentationInterval = PresentInterval.Default,
});
}
protected override void OnActivated(EventArgs e)
{
base.OnActivated(e);
Initialize();
while (IsVisible)
while (IsVisible && IsActive)
{
if (Application.Current != null)
Application.Current.Dispatcher.Invoke(DispatcherPriority.Background, emptyThreadStart);
@ -41,19 +54,6 @@ namespace WpfEditor
}
}
public void Initialize()
{
device = new GraphicsDevice(GraphicsAdapter.DefaultAdapter, GraphicsProfile.HiDef,
new PresentationParameters
{
BackBufferWidth = GamePanel.Width,
BackBufferHeight = GamePanel.Height,
BackBufferFormat = SurfaceFormat.Color,
DeviceWindowHandle = new WindowHandle(GamePanel.Handle),
PresentationInterval = PresentInterval.Default,
});
}
public void Tick()
{
device.Clear(ClearOptions.Target, Color.CornflowerBlue, 0f, 0);

View File

@ -25,6 +25,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<UseVSHostingProcess>true</UseVSHostingProcess>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<PlatformTarget>x86</PlatformTarget>
@ -38,6 +39,9 @@
<PropertyGroup>
<ApplicationIcon>anx.ico</ApplicationIcon>
</PropertyGroup>
<PropertyGroup>
<RunPostBuildEvent>Always</RunPostBuildEvent>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
@ -98,35 +102,35 @@
<AppDesigner Include="Properties\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\ANX.Framework\ANX.Framework.csproj">
<Project>{6899F0C9-70B9-4EB0-9DD3-E598D4BE3E35}</Project>
<Name>ANX.Framework</Name>
</ProjectReference>
<ProjectReference Include="..\..\InputSystems\ANX.InputDevices.Windows.XInput\ANX.InputDevices.Windows.XInput.csproj">
<Project>{60D08399-244F-46A3-91F1-4CFD26D961A3}</Project>
<Name>ANX.InputDevices.Windows.XInput</Name>
</ProjectReference>
<ProjectReference Include="..\..\InputSystems\ANX.InputSystem.Standard\ANX.InputSystem.Standard.csproj">
<Project>{49066074-3B7B-4A55-B122-6BD33AB73558}</Project>
<Name>ANX.InputSystem.Standard</Name>
</ProjectReference>
<ProjectReference Include="..\..\RenderSystems\ANX.Framework.GL3\ANX.RenderSystem.GL3.csproj">
<Project>{EB8258E0-6741-4DB9-B756-1EBDF67B1ED6}</Project>
<Name>ANX.RenderSystem.GL3</Name>
</ProjectReference>
<ProjectReference Include="..\..\RenderSystems\ANX.RenderSystem.Windows.DX10\ANX.RenderSystem.Windows.DX10.csproj">
<Project>{5BE49183-2F6F-4527-AC90-D816911FCF90}</Project>
<Name>ANX.RenderSystem.Windows.DX10</Name>
</ProjectReference>
<ProjectReference Include="..\..\SoundSystems\ANX.SoundSystem.OpenAL\ANX.SoundSystem.OpenAL.csproj">
<Project>{14EF49AB-6D3F-458D-9D5C-D120B86EDD7A}</Project>
<Name>ANX.SoundSystem.OpenAL</Name>
</ProjectReference>
<Reference Include="ANX.Framework">
<HintPath>..\..\bin\Debug\ANX.Framework.dll</HintPath>
</Reference>
<Reference Include="ANX.InputDevices.Windows.XInput">
<HintPath>..\..\bin\Debug\ANX.InputDevices.Windows.XInput.dll</HintPath>
</Reference>
<Reference Include="ANX.InputSystem.Standard">
<HintPath>..\..\bin\Debug\ANX.InputSystem.Standard.dll</HintPath>
</Reference>
<Reference Include="ANX.PlatformSystem.Windows">
<HintPath>..\..\bin\Debug\ANX.PlatformSystem.Windows.dll</HintPath>
</Reference>
<Reference Include="ANX.RenderSystem.Windows.DX10">
<HintPath>..\..\bin\Debug\ANX.RenderSystem.Windows.DX10.dll</HintPath>
</Reference>
<Reference Include="ANX.RenderSystem.GL3">
<HintPath>..\..\bin\Debug\ANX.RenderSystem.GL3.dll</HintPath>
</Reference>
<Reference Include="ANX.SoundSystem.OpenAL">
<HintPath>..\..\bin\Debug\ANX.SoundSystem.OpenAL.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Resource Include="anx.ico" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>xcopy $(ProjectDir)..\SampleContent\bin\$(ConfigurationName) $(TargetDir)SampleContent\ /D /E /Y</PostBuildEvent>
</PropertyGroup>
<!-- 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">