diff --git a/ANX.Framework.TestCenter/Strukturen/Input/GamePadTest.cs b/ANX.Framework.TestCenter/Strukturen/Input/GamePadTest.cs
index 051838a2..19f282e8 100644
--- a/ANX.Framework.TestCenter/Strukturen/Input/GamePadTest.cs
+++ b/ANX.Framework.TestCenter/Strukturen/Input/GamePadTest.cs
@@ -90,7 +90,7 @@ namespace ANX.Framework.TestCenter.Strukturen.Input
{
AddInSystemFactory.Instance.Initialize();
- AddInSystemFactory.Instance.SetDefaultCreator("XInput");
+ AddInSystemFactory.Instance.PreferredInputSystem = "XInput";
XNAGamePadState xnastate = XNAGamePad.GetState(xnaplayer);
ANXGamePadState anxstate = ANXGamePad.GetState(anxplayer);
diff --git a/ANX.Framework/ANX.Framework.csproj b/ANX.Framework/ANX.Framework.csproj
index df8e9c9c..343dcf54 100644
--- a/ANX.Framework/ANX.Framework.csproj
+++ b/ANX.Framework/ANX.Framework.csproj
@@ -418,7 +418,9 @@
+
+
diff --git a/ANX.Framework/Game.cs b/ANX.Framework/Game.cs
index 80aafd63..cd46cb63 100644
--- a/ANX.Framework/Game.cs
+++ b/ANX.Framework/Game.cs
@@ -90,21 +90,9 @@ namespace ANX.Framework
public event EventHandler Disposed;
public event EventHandler Exiting;
- //TODO: The constructor should be overloaded unlike the original XNA. There will be one argument which is used to
- // try to load a specified environment (DX9, DX10, DX11, OpenGL). The default constructor will decide which
- // is the best (or only) environment to load. The default environment should behave mostly like XNA.
-
public Game()
- : this("DirectX10", "XInput", "XAudio")
- {
- }
-
- public Game(String renderSystemName = "DirectX10", String inputSystemName = "XInput", String soundSystemName = "XAudio")
{
logger.Info("created a new Game-Class");
- logger.Info("- asked for RenderSystem '{0}'", renderSystemName);
- logger.Info("- asked for InputSystem '{0}'", inputSystemName);
- logger.Info("- asked for SoundSystem '{0}'", soundSystemName);
this.gameServices = new GameServiceContainer();
this.gameTime = new GameTime();
@@ -120,46 +108,18 @@ namespace ANX.Framework
throw new AddInLoadingException("Error while initializing AddInSystem.", ex);
}
- try
- {
- AddInSystemFactory.Instance.SetDefaultCreator(inputSystemName);
- }
- catch (Exception ex)
- {
- logger.ErrorException(String.Format("Error during loading InputSystem {0}", inputSystemName), ex);
- throw new AddInLoadingException(String.Format("Error during loading InputSystem {0}", inputSystemName), ex);
- }
IInputSystemCreator inputSystemCreator = AddInSystemFactory.Instance.GetDefaultCreator();
if (inputSystemCreator != null)
{
this.gameServices.AddService(typeof(IInputSystemCreator), inputSystemCreator);
}
- try
- {
- AddInSystemFactory.Instance.SetDefaultCreator(soundSystemName);
- }
- catch (Exception ex)
- {
- logger.ErrorException(String.Format("Error during loading SoundSystem {0}", soundSystemName), ex);
- throw new AddInLoadingException(String.Format("Error during loading SoundSystem {0}", soundSystemName), ex);
- }
-
ISoundSystemCreator soundSystemCreator = AddInSystemFactory.Instance.GetDefaultCreator();
if (soundSystemCreator != null)
{
this.gameServices.AddService(typeof(ISoundSystemCreator), soundSystemCreator);
}
- try
- {
- AddInSystemFactory.Instance.SetDefaultCreator(renderSystemName);
- }
- catch (Exception ex)
- {
- logger.ErrorException(String.Format("Error during loading RenderSystem {0}", renderSystemName), ex);
- throw new AddInLoadingException(String.Format("Error during loading RenderSystem {0}", renderSystemName), ex);
- }
IRenderSystemCreator renderSystemCreator = AddInSystemFactory.Instance.GetDefaultCreator();
if (renderSystemCreator != null)
{
@@ -168,10 +128,9 @@ namespace ANX.Framework
logger.Info("creating GameHost");
- IRenderSystemCreator creator = AddInSystemFactory.Instance.GetDefaultCreator();
- if (creator != null)
+ if (renderSystemCreator != null)
{
- this.host = creator.CreateGameHost(this);
+ this.host = renderSystemCreator.CreateGameHost(this);
this.host.Activated += new EventHandler(this.HostActivated);
this.host.Deactivated += new EventHandler(this.HostDeactivated);
diff --git a/ANX.Framework/NonXNA/AddIn.cs b/ANX.Framework/NonXNA/AddIn.cs
new file mode 100644
index 00000000..30f01d34
--- /dev/null
+++ b/ANX.Framework/NonXNA/AddIn.cs
@@ -0,0 +1,307 @@
+#region Using Statements
+using System;
+using System.Runtime.Serialization;
+using System.IO;
+using System.Reflection;
+using System.Collections.Generic;
+using System.Resources;
+using System.Collections;
+using System.Linq;
+
+#endregion
+
+#region License
+
+//
+// This file is part of the ANX.Framework created by the "ANX.Framework developer group".
+//
+// This file is released under the Ms-PL license.
+//
+//
+//
+// Microsoft Public License (Ms-PL)
+//
+// This license governs use of the accompanying software. If you use the software, you accept this license.
+// If you do not accept the license, do not use the software.
+//
+// 1.Definitions
+// The terms "reproduce," "reproduction," "derivative works," and "distribution" have the same meaning
+// here as under U.S. copyright law.
+// A "contribution" is the original software, or any additions or changes to the software.
+// A "contributor" is any person that distributes its contribution under this license.
+// "Licensed patents" are a contributor's patent claims that read directly on its contribution.
+//
+// 2.Grant of Rights
+// (A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations
+// in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to
+// reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution
+// or any derivative works that you create.
+// (B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in
+// section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed
+// patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution
+// in the software or derivative works of the contribution in the software.
+//
+// 3.Conditions and Limitations
+// (A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks.
+// (B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your
+// patent license from such contributor to the software ends automatically.
+// (C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution
+// notices that are present in the software.
+// (D) If you distribute any portion of the software in source code form, you may do so only under this license by including
+// a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or
+// object code form, you may only do so under a license that complies with this license.
+// (E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees,
+// or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the
+// extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a
+// particular purpose and non-infringement.
+
+#endregion // License
+
+namespace ANX.Framework.NonXNA
+{
+ public class AddIn : IComparable
+ {
+ #region Private Members
+ private string fileName;
+ private List platforms = new List();
+ private Assembly assembly;
+ private Type creatorType;
+ private ICreator instance;
+ private AddInType addInType;
+
+ #endregion // Private Members
+
+ #region Constructor
+
+ public AddIn(string fileName)
+ {
+ if (string.IsNullOrEmpty(fileName))
+ {
+ throw new ArgumentNullException("fileName");
+ }
+
+ if (!File.Exists(fileName))
+ {
+ throw new InvalidOperationException(String.Format("The AddIn '{0}' does not exist.", fileName));
+ }
+
+ this.fileName = fileName;
+
+ try
+ {
+ this.assembly = Assembly.LoadFrom(fileName);
+ }
+ catch { }
+
+ if (this.assembly != null)
+ {
+ foreach (Type t in this.assembly.GetTypes().Where(p => typeof(IInputSystemCreator).IsAssignableFrom(p) ||
+ typeof(IRenderSystemCreator).IsAssignableFrom(p) ||
+ typeof(ISoundSystemCreator).IsAssignableFrom(p)
+ ))
+ {
+ this.creatorType = t;
+
+ if (typeof(IInputSystemCreator).IsAssignableFrom(t))
+ {
+ this.addInType = AddInType.InputSystem;
+ }
+ else if (typeof(IRenderSystemCreator).IsAssignableFrom(t))
+ {
+ this.addInType = AddInType.RenderSystem;
+ }
+ else if (typeof(ISoundSystemCreator).IsAssignableFrom(t))
+ {
+ this.addInType = AddInType.SoundSystem;
+ }
+ else
+ {
+ this.addInType = AddInType.Unknown;
+ }
+
+ break;
+ }
+
+ if (this.creatorType != null)
+ {
+ try
+ {
+ this.platforms.AddRange(FetchSupportedPlattforms(this.assembly));
+ }
+ catch { }
+ }
+ }
+ }
+
+ #endregion // Constructor
+
+ #region Puplic Methods
+
+
+ #endregion // Public Methods
+
+ #region Properties
+
+ ///
+ /// Returns whether this is a valid AddIn of the ANX.Framework.
+ ///
+ public bool IsValid
+ {
+ get
+ {
+ return this.assembly != null && this.creatorType != null;
+ }
+ }
+
+ ///
+ /// The filename of the current AddIn assembly
+ ///
+ public string FileName
+ {
+ get
+ {
+ return this.fileName;
+ }
+ }
+
+ ///
+ /// Returns true if this AddIn is supported by the current Platform
+ ///
+ public bool IsSupported
+ {
+ get
+ {
+ if (this.assembly != null && this.platforms != null && this.platforms.Count > 0)
+ {
+ foreach (string platform in this.platforms)
+ {
+ if (string.Equals(Environment.OSVersion.Platform.ToString(), platform, StringComparison.InvariantCultureIgnoreCase))
+ {
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+ }
+
+ ///
+ /// Returns the version of the AddIn
+ ///
+ public Version Version
+ {
+ get
+ {
+ if (this.assembly != null)
+ {
+ return this.assembly.GetName().Version;
+ }
+
+ return null;
+ }
+ }
+
+ public string Name
+ {
+ get
+ {
+ if (this.assembly != null)
+ {
+ return this.Instance.Name;
+ }
+
+ return String.Empty;
+ }
+ }
+
+ public int Priority
+ {
+ get
+ {
+ if (this.assembly != null)
+ {
+ return this.Instance.Priority;
+ }
+
+ return int.MaxValue;
+ }
+ }
+
+ public AddInType Type
+ {
+ get
+ {
+ return this.addInType;
+ }
+ }
+
+ ///
+ /// Returns the concrete instance of the creator of this AddIn. The instance is cached and
+ /// only created on first access.
+ ///
+ ///
+ /// If this AddIn is not supported on this platform the instance will be null.
+ ///
+ public ICreator Instance
+ {
+ get
+ {
+ if (instance == null && IsSupported)
+ {
+ this.instance = this.assembly.CreateInstance(this.creatorType.FullName) as ICreator;
+ if (this.instance != null)
+ {
+ this.instance.RegisterCreator(AddInSystemFactory.Instance);
+ }
+ }
+
+ return this.instance;
+ }
+ }
+
+ #endregion // Properties
+
+ #region Private Helpers
+ private string[] FetchSupportedPlattforms(Assembly assembly)
+ {
+ string[] platforms = null;
+ string[] res = assembly.GetManifestResourceNames();
+
+ if (res != null)
+ {
+ foreach (string ressource in res)
+ {
+ Stream manifestResourceStream = assembly.GetManifestResourceStream(ressource);
+
+ if (manifestResourceStream != null)
+ {
+ using (ResourceReader resourceReader = new ResourceReader(manifestResourceStream))
+ {
+ IDictionaryEnumerator dict = resourceReader.GetEnumerator();
+ while (dict.MoveNext())
+ {
+ if (string.Equals(dict.Key.ToString(), "SupportedPlatforms", StringComparison.InvariantCultureIgnoreCase) &&
+ dict.Value.GetType() == typeof(string))
+ {
+ platforms = dict.Value.ToString().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
+ return platforms;
+ }
+ }
+ resourceReader.Close();
+ }
+ }
+ }
+ }
+
+ return platforms;
+ }
+
+ #endregion // Private Helpers
+
+ public int CompareTo(AddIn other)
+ {
+ return this.Priority.CompareTo(other.Priority);
+ }
+ }
+}
diff --git a/ANX.Framework/NonXNA/AddInSystemFactory.cs b/ANX.Framework/NonXNA/AddInSystemFactory.cs
index df92ca0a..dbec292c 100644
--- a/ANX.Framework/NonXNA/AddInSystemFactory.cs
+++ b/ANX.Framework/NonXNA/AddInSystemFactory.cs
@@ -62,6 +62,7 @@ namespace ANX.Framework.NonXNA
{
public class AddInSystemFactory
{
+ #region Private Members
private Dictionary creators;
private static AddInSystemFactory instance;
private bool initialized;
@@ -69,8 +70,21 @@ namespace ANX.Framework.NonXNA
private OperatingSystem operatingSystem;
private Version operatingSystemVersion;
+ private string preferredRenderSystem;
+ private bool preferredRenderSystemLocked;
+ private string preferredInputSystem;
+ private bool preferredInputSystemLocked;
+ private string preferredSoundSystem;
+ private bool preferredSoundSystemLocked;
+
+ private List renderSystems;
+ private List inputSystems;
+ private List soundSystems;
+
private static Logger logger = LogManager.GetCurrentClassLogger();
+ #endregion // Private Members
+
public static AddInSystemFactory Instance
{
get
@@ -87,6 +101,10 @@ namespace ANX.Framework.NonXNA
private AddInSystemFactory()
{
+ this.renderSystems = new List();
+ this.inputSystems = new List();
+ this.soundSystems = new List();
+
this.creators = new Dictionary();
this.operatingSystem = Environment.OSVersion;
@@ -110,56 +128,33 @@ namespace ANX.Framework.NonXNA
{
logger.Info("[ANX] trying to load '{0}'...", file);
- Assembly part = null;
-
- try
+ AddIn addin = new AddIn(file);
+ if (addin.IsValid && addin.IsSupported)
{
- part = Assembly.LoadFile(file);
- }
- catch (Exception ex)
- {
- logger.Debug("error calling Assembly.LoadFile({0}) Exception: {1}", file, ex.Message);
- }
-
- if (part != null)
- {
- logger.Info("[ANX] scanning for ANX interfaces...");
-
- foreach (Type t in part.GetTypes().Where(p => typeof(IInputSystemCreator).IsAssignableFrom(p) ||
- typeof(IRenderSystemCreator).IsAssignableFrom(p) ||
- typeof(ISoundSystemCreator).IsAssignableFrom(p)
- ))
+ switch (addin.Type)
{
- logger.Info("[ANX] testing if assembly is supported on current platform");
- string[] platforms = FetchSupportedPlattforms(part);
- bool supportedPlatform = false;
-
- foreach (string platform in platforms)
- {
- if (string.Equals(OperatingSystem.Platform.ToString(), platform, StringComparison.InvariantCultureIgnoreCase))
- {
- supportedPlatform = true;
- break;
- }
- }
-
- if (supportedPlatform)
- {
- logger.Info("[ANX] registering instance of '{0}'...", t.FullName);
-
- var instance = part.CreateInstance(t.FullName);
- ((ICreator)instance).RegisterCreator(this);
- }
- else
- {
- logger.Info("[ANX] current platform '{0}' is not supported by '{1}'", OperatingSystem.Platform.ToString(), t.FullName);
- }
+ case AddInType.InputSystem:
+ this.inputSystems.Add(addin);
+ break;
+ case AddInType.RenderSystem:
+ this.renderSystems.Add(addin);
+ break;
+ case AddInType.SoundSystem:
+ this.soundSystems.Add(addin);
+ break;
}
+ logger.Info("[ANX] successfully loaded addin...");
+ }
+ else
+ {
+ logger.Info("[ANX] skipped loading file because it is not supported or not a valid AddIn");
}
}
}
- SetDefaultCreators();
+ this.inputSystems.Sort();
+ this.renderSystems.Sort();
+ this.soundSystems.Sort();
}
}
@@ -220,54 +215,82 @@ namespace ANX.Framework.NonXNA
}
Type type = typeof(T);
+ AddInType addInType = GetAddInType(type);
- if (defaultCreators.ContainsKey(type))
+ switch (addInType)
{
- return defaultCreators[type] as T;
- }
+ case AddInType.InputSystem:
+ if (string.IsNullOrEmpty(preferredInputSystem))
+ {
+ if (inputSystems.Count > 0)
+ {
+ return inputSystems[0].Instance as T;
+ }
+
+ throw new AddInLoadingException("couldn't get default input system because there are no registered input systems available");
+ }
+ else
+ {
+ foreach (AddIn addin in this.inputSystems)
+ {
+ if (addin.Name.Equals(preferredInputSystem, StringComparison.InvariantCultureIgnoreCase))
+ {
+ return addin.Instance as T;
+ }
+ }
+
+ throw new AddInLoadingException(String.Format("couldn't get default input system '{0}' because it was not found in the list of registered creators", preferredInputSystem));
+ }
+ case AddInType.RenderSystem:
+ if (string.IsNullOrEmpty(preferredRenderSystem))
+ {
+ if (renderSystems.Count > 0)
+ {
+ return renderSystems[0].Instance as T;
+ }
+
+ throw new AddInLoadingException("couldn't get default render system because there are no registered render systems available");
+ }
+ else
+ {
+ foreach (AddIn addin in this.renderSystems)
+ {
+ if (addin.Name.Equals(preferredRenderSystem, StringComparison.InvariantCultureIgnoreCase))
+ {
+ return addin.Instance as T;
+ }
+ }
+
+ throw new AddInLoadingException(String.Format("couldn't get default render system '{0}' because it was not found in the list of registered creators", preferredRenderSystem));
+ }
+ case AddInType.SoundSystem:
+ if (string.IsNullOrEmpty(preferredSoundSystem))
+ {
+ if (soundSystems.Count > 0)
+ {
+ return soundSystems[0].Instance as T;
+ }
+
+ throw new AddInLoadingException("couldn't get default sound system because there are no registered sound systems available");
+ }
+ else
+ {
+ foreach (AddIn addin in this.soundSystems)
+ {
+ if (addin.Name.Equals(preferredSoundSystem, StringComparison.InvariantCultureIgnoreCase))
+ {
+ return addin.Instance as T;
+ }
+ }
+
+ throw new AddInLoadingException(String.Format("couldn't get default sound system '{0}' because it was not found in the list of registered creators", preferredSoundSystem));
+ }
- logger.Error(String.Format("couldn't find a DefaultCreator of type '{0}'. Listing all registered creators: ", type.FullName));
- foreach (KeyValuePair kvp in defaultCreators)
- {
- logger.Error(kvp.Key);
}
throw new AddInLoadingException(String.Format("couldn't find a DefaultCreator of type '{0}'", type.FullName));
}
- public void SetDefaultCreator(T creator) where T : class, ICreator
- {
- Type t = typeof(T);
- logger.Debug("setting DefaultCreator by type: {0}", t.FullName);
- defaultCreators[t] = creator;
- }
-
- public void SetDefaultCreator(string creatorName)
- {
- if (!initialized)
- {
- Initialize();
- }
-
- ICreator creator = null;
- creators.TryGetValue(creatorName.ToLowerInvariant(), out creator);
- if (creator != null)
- {
- Type t = creator.GetType().GetInterfaces()[0];
- if (t == typeof(ICreator))
- {
- //TODO: exception handling
- t = creator.GetType().GetInterfaces()[1];
- }
- logger.Debug("setting DefaultCreator by name: '{0}'. Resolved type: '{1}'. ", creatorName, t.FullName);
- defaultCreators[t] = creator;
- }
- else
- {
- throw new AddInLoadingException(String.Format("couldn't set DefaultCreator by name: '{0}'. ", creatorName));
- }
- }
-
public OperatingSystem OperatingSystem
{
get
@@ -284,94 +307,90 @@ namespace ANX.Framework.NonXNA
}
}
- private void SetDefaultCreators()
+ public string PreferredRenderSystem
{
- foreach (ICreator creator in this.creators.Values)
+ get
{
- string type = creator.GetType().GetInterfaces()[0].ToString();
-
- switch (type)
+ return this.preferredRenderSystem;
+ }
+ set
+ {
+ if (this.preferredRenderSystemLocked && !this.preferredRenderSystem.Equals(value, StringComparison.InvariantCultureIgnoreCase))
{
- case "ANX.Framework.NonXNA.IRenderSystemCreator":
- IRenderSystemCreator renderSystemCreator = creator as IRenderSystemCreator;
- IRenderSystemCreator defaultRenderSystemCreator = null;
- if (defaultCreators.ContainsKey(typeof(IRenderSystemCreator)))
- {
- renderSystemCreator = defaultCreators[typeof(IRenderSystemCreator)] as IRenderSystemCreator;
- }
-
- if (renderSystemCreator != null && (defaultRenderSystemCreator == null || defaultRenderSystemCreator.Priority > renderSystemCreator.Priority))
- {
- SetDefaultCreator(renderSystemCreator);
- }
- break;
- case "ANX.Framework.NonXNA.ISoundSystemCreator":
- ISoundSystemCreator soundSystemCreator = creator as ISoundSystemCreator;
- ISoundSystemCreator defaultSoundSystemCreator = null;
- if (defaultCreators.ContainsKey(typeof(ISoundSystemCreator)))
- {
- defaultSoundSystemCreator = defaultCreators[typeof(ISoundSystemCreator)] as ISoundSystemCreator;
- }
-
- if (soundSystemCreator != null && (defaultSoundSystemCreator == null || defaultSoundSystemCreator.Priority > soundSystemCreator.Priority))
- {
- SetDefaultCreator(soundSystemCreator);
- }
- break;
- case "ANX.Framework.NonXNA.IInputSystemCreator":
- IInputSystemCreator inputSystemCreator = creator as IInputSystemCreator;
- IInputSystemCreator defaultInputSystemCreator = null;
- if (defaultCreators.ContainsKey(typeof(IInputSystemCreator)))
- {
- defaultInputSystemCreator = defaultCreators[typeof(IInputSystemCreator)] as IInputSystemCreator;
- }
-
- if (inputSystemCreator != null && (defaultInputSystemCreator == null || defaultInputSystemCreator.Priority > inputSystemCreator.Priority))
- {
- SetDefaultCreator(inputSystemCreator);
- }
- break;
- case "ANX.Framework.NonXNA.ICreator":
- break;
- default:
- throw new InvalidOperationException(String.Format("unable to set a default system for creator of type '{0}'", type));
+ throw new AddInLoadingException("can't set preferred RenderSystem because a RenderSystem is alread in use.");
}
+
+ this.preferredRenderSystem = value;
}
}
- private string[] FetchSupportedPlattforms(Assembly assembly)
+ public string PreferredInputSystem
{
- string[] platforms = null;
- string[] res = assembly.GetManifestResourceNames();
-
- if (res != null)
+ get
{
- foreach (string ressource in res)
- {
- Stream manifestResourceStream = assembly.GetManifestResourceStream(ressource);
-
- if (manifestResourceStream != null)
- {
- using (ResourceReader resourceReader = new ResourceReader(manifestResourceStream))
- {
- IDictionaryEnumerator dict = resourceReader.GetEnumerator();
- while (dict.MoveNext())
- {
- if (string.Equals(dict.Key.ToString(), "SupportedPlatforms", StringComparison.InvariantCultureIgnoreCase) &&
- dict.Value.GetType() == typeof(string))
- {
- platforms = dict.Value.ToString().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
- return platforms;
- }
- }
- resourceReader.Close();
- }
- }
- }
+ return this.preferredInputSystem;
}
+ set
+ {
+ if (this.preferredInputSystemLocked && !this.preferredInputSystem.Equals(value, StringComparison.InvariantCultureIgnoreCase))
+ {
+ throw new AddInLoadingException("can't set preferred InputSystem because a InputSystem is alread in use.");
+ }
- return platforms;
+ this.preferredInputSystem = value;
+ }
}
+ public string PreferredSoundSystem
+ {
+ get
+ {
+ return this.preferredSoundSystem;
+ }
+ set
+ {
+ if (this.preferredSoundSystemLocked && !this.preferredSoundSystem.Equals(value, StringComparison.InvariantCultureIgnoreCase))
+ {
+ throw new AddInLoadingException("can't set preferred SoundSystem because a SoundSystem is alread in use.");
+ }
+
+ this.preferredSoundSystem = value;
+ }
+ }
+
+ public void PreventRenderSystemChange()
+ {
+ this.preferredRenderSystemLocked = true;
+ }
+
+ public void PreventInputSystemChange()
+ {
+ this.preferredInputSystemLocked = true;
+ }
+
+ public void PreventSoundSystemChange()
+ {
+ this.preferredSoundSystemLocked = true;
+ }
+
+ private AddInType GetAddInType(Type t)
+ {
+ if (typeof(IRenderSystemCreator).IsAssignableFrom(t))
+ {
+ return AddInType.RenderSystem;
+ }
+ else if (typeof(IInputSystemCreator).IsAssignableFrom(t))
+ {
+ return AddInType.InputSystem;
+ }
+ else if (typeof(ISoundSystemCreator).IsAssignableFrom(t))
+ {
+ return AddInType.SoundSystem;
+ }
+ else
+ {
+ return AddInType.Unknown;
+ }
+ }
}
}
diff --git a/ANX.Framework/NonXNA/AddInType.cs b/ANX.Framework/NonXNA/AddInType.cs
new file mode 100644
index 00000000..d9dd491a
--- /dev/null
+++ b/ANX.Framework/NonXNA/AddInType.cs
@@ -0,0 +1,62 @@
+#region Using Statements
+using System;
+
+#endregion
+
+#region License
+
+//
+// This file is part of the ANX.Framework created by the "ANX.Framework developer group".
+//
+// This file is released under the Ms-PL license.
+//
+//
+//
+// Microsoft Public License (Ms-PL)
+//
+// This license governs use of the accompanying software. If you use the software, you accept this license.
+// If you do not accept the license, do not use the software.
+//
+// 1.Definitions
+// The terms "reproduce," "reproduction," "derivative works," and "distribution" have the same meaning
+// here as under U.S. copyright law.
+// A "contribution" is the original software, or any additions or changes to the software.
+// A "contributor" is any person that distributes its contribution under this license.
+// "Licensed patents" are a contributor's patent claims that read directly on its contribution.
+//
+// 2.Grant of Rights
+// (A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations
+// in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to
+// reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution
+// or any derivative works that you create.
+// (B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in
+// section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed
+// patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution
+// in the software or derivative works of the contribution in the software.
+//
+// 3.Conditions and Limitations
+// (A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks.
+// (B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your
+// patent license from such contributor to the software ends automatically.
+// (C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution
+// notices that are present in the software.
+// (D) If you distribute any portion of the software in source code form, you may do so only under this license by including
+// a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or
+// object code form, you may only do so under a license that complies with this license.
+// (E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees,
+// or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the
+// extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a
+// particular purpose and non-infringement.
+
+#endregion // License
+
+namespace ANX.Framework.NonXNA
+{
+ public enum AddInType
+ {
+ Unknown,
+ RenderSystem,
+ InputSystem,
+ SoundSystem
+ }
+}
diff --git a/ANX.Framework/Properties/AssemblyInfo.cs b/ANX.Framework/Properties/AssemblyInfo.cs
index 92220570..0b552257 100644
--- a/ANX.Framework/Properties/AssemblyInfo.cs
+++ b/ANX.Framework/Properties/AssemblyInfo.cs
@@ -31,8 +31,8 @@ using System.Runtime.InteropServices;
//
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
// übernehmen, indem Sie "*" eingeben:
-[assembly: AssemblyVersion("0.4.32.*")]
-[assembly: AssemblyFileVersion("0.4.32.0")]
+[assembly: AssemblyVersion("0.4.33.*")]
+[assembly: AssemblyFileVersion("0.4.33.0")]
[assembly:InternalsVisibleTo("ANX.Framework.Windows.DX10")]
[assembly:InternalsVisibleTo("ANX.RenderSystem.Windows.DX11")]
diff --git a/InputSystems/ANX.InputSystem.OpenTK/Creator.cs b/InputSystems/ANX.InputSystem.OpenTK/Creator.cs
index 99fc34c7..0f9f8796 100644
--- a/InputSystems/ANX.InputSystem.OpenTK/Creator.cs
+++ b/InputSystems/ANX.InputSystem.OpenTK/Creator.cs
@@ -98,6 +98,7 @@ namespace ANX.InputSystem.OpenTK
get
{
logger.Debug("returning a new OpenTK GamePad device");
+ AddInSystemFactory.Instance.PreventInputSystemChange();
return new GamePad();
}
}
@@ -107,6 +108,7 @@ namespace ANX.InputSystem.OpenTK
get
{
logger.Debug("returning a new OpenTK Mouse device");
+ AddInSystemFactory.Instance.PreventInputSystemChange();
return new Mouse();
}
}
@@ -116,6 +118,7 @@ namespace ANX.InputSystem.OpenTK
get
{
logger.Debug("returning a new OpenTK Keyboard device");
+ AddInSystemFactory.Instance.PreventInputSystemChange();
return new Keyboard();
}
}
diff --git a/InputSystems/ANX.InputSystem.OpenTK/Properties/AssemblyInfo.cs b/InputSystems/ANX.InputSystem.OpenTK/Properties/AssemblyInfo.cs
index bdb16075..3874dd34 100644
--- a/InputSystems/ANX.InputSystem.OpenTK/Properties/AssemblyInfo.cs
+++ b/InputSystems/ANX.InputSystem.OpenTK/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
// übernehmen, indem Sie "*" eingeben:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("0.0.1.0")]
-[assembly: AssemblyFileVersion("0.0.1.0")]
+[assembly: AssemblyVersion("0.0.2.0")]
+[assembly: AssemblyFileVersion("0.0.2.0")]
diff --git a/InputSystems/ANX.InputSystem.Recording/Creator.cs b/InputSystems/ANX.InputSystem.Recording/Creator.cs
index eeb68018..a3abd491 100644
--- a/InputSystems/ANX.InputSystem.Recording/Creator.cs
+++ b/InputSystems/ANX.InputSystem.Recording/Creator.cs
@@ -60,23 +60,39 @@ namespace ANX.InputSystem.Recording
{
public IGamePad GamePad
{
- get { return new RecordingGamePad(); }
+ get
+ {
+ AddInSystemFactory.Instance.PreventInputSystemChange();
+ return new RecordingGamePad();
+ }
}
public IMouse Mouse
{
- get { return new RecordingMouse(); }
+ get
+ {
+ AddInSystemFactory.Instance.PreventInputSystemChange();
+ return new RecordingMouse();
+ }
}
public IKeyboard Keyboard
{
- get { return new RecordingKeyboard(); }
+ get
+ {
+ AddInSystemFactory.Instance.PreventInputSystemChange();
+ return new RecordingKeyboard();
+ }
}
#if XNAEXT
public IMotionSensingDevice MotionSensingDevice
{
- get { return new RecordingMotionSensingDevice(); }
+ get
+ {
+ AddInSystemFactory.Instance.PreventInputSystemChange();
+ return new RecordingMotionSensingDevice();
+ }
}
#endif
diff --git a/InputSystems/ANX.InputSystem.Recording/Properties/AssemblyInfo.cs b/InputSystems/ANX.InputSystem.Recording/Properties/AssemblyInfo.cs
index a6c23285..3f9b012e 100644
--- a/InputSystems/ANX.InputSystem.Recording/Properties/AssemblyInfo.cs
+++ b/InputSystems/ANX.InputSystem.Recording/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
// übernehmen, indem Sie "*" eingeben:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("0.0.1.0")]
-[assembly: AssemblyFileVersion("0.0.1.0")]
+[assembly: AssemblyVersion("0.0.2.0")]
+[assembly: AssemblyFileVersion("0.0.2.0")]
diff --git a/InputSystems/ANX.InputSystem.Windows.Kinect/Creator.cs b/InputSystems/ANX.InputSystem.Windows.Kinect/Creator.cs
index f71ff9c1..1f14f40d 100644
--- a/InputSystems/ANX.InputSystem.Windows.Kinect/Creator.cs
+++ b/InputSystems/ANX.InputSystem.Windows.Kinect/Creator.cs
@@ -95,7 +95,11 @@ namespace ANX.InputSystem.Windows.Kinect
public IMotionSensingDevice MotionSensingDevice
{
- get { return new Kinect(); }
+ get
+ {
+ AddInSystemFactory.Instance.PreventInputSystemChange();
+ return new Kinect();
+ }
}
public IKeyboard Keyboard
diff --git a/InputSystems/ANX.InputSystem.Windows.Kinect/Properties/AssemblyInfo.cs b/InputSystems/ANX.InputSystem.Windows.Kinect/Properties/AssemblyInfo.cs
index 724595a8..2be16cc8 100644
--- a/InputSystems/ANX.InputSystem.Windows.Kinect/Properties/AssemblyInfo.cs
+++ b/InputSystems/ANX.InputSystem.Windows.Kinect/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
// übernehmen, indem Sie "*" eingeben:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("0.5.3.0")]
-[assembly: AssemblyFileVersion("0.5.3.0")]
+[assembly: AssemblyVersion("0.5.4.0")]
+[assembly: AssemblyFileVersion("0.5.4.0")]
diff --git a/InputSystems/ANX.InputSystem.Windows.XInput/Creator.cs b/InputSystems/ANX.InputSystem.Windows.XInput/Creator.cs
index b51287fb..6f31c1e6 100644
--- a/InputSystems/ANX.InputSystem.Windows.XInput/Creator.cs
+++ b/InputSystems/ANX.InputSystem.Windows.XInput/Creator.cs
@@ -96,6 +96,7 @@ namespace ANX.InputSystem.Windows.XInput
get
{
logger.Debug("returning a new XInput GamePad device");
+ AddInSystemFactory.Instance.PreventInputSystemChange();
return new GamePad();
}
}
@@ -105,6 +106,7 @@ namespace ANX.InputSystem.Windows.XInput
get
{
logger.Debug("returning a new XInput Mouse device");
+ AddInSystemFactory.Instance.PreventInputSystemChange();
return new Mouse();
}
}
@@ -114,6 +116,7 @@ namespace ANX.InputSystem.Windows.XInput
get
{
logger.Debug("returning a new XInput Keyboard device");
+ AddInSystemFactory.Instance.PreventInputSystemChange();
return new Keyboard();
}
}
@@ -121,7 +124,7 @@ namespace ANX.InputSystem.Windows.XInput
#if XNAEXT
public IMotionSensingDevice MotionSensingDevice
{
- get {return null; }
+ get { return null; }
}
#endif
}
diff --git a/InputSystems/ANX.InputSystem.Windows.XInput/Properties/AssemblyInfo.cs b/InputSystems/ANX.InputSystem.Windows.XInput/Properties/AssemblyInfo.cs
index 3d5de665..0a676532 100644
--- a/InputSystems/ANX.InputSystem.Windows.XInput/Properties/AssemblyInfo.cs
+++ b/InputSystems/ANX.InputSystem.Windows.XInput/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
// übernehmen, indem Sie "*" eingeben:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("0.6.2.0")]
-[assembly: AssemblyFileVersion("0.6.2.0")]
+[assembly: AssemblyVersion("0.6.3.0")]
+[assembly: AssemblyFileVersion("0.6.3.0")]
diff --git a/RenderSystems/ANX.Framework.Windows.DX10/Creator.cs b/RenderSystems/ANX.Framework.Windows.DX10/Creator.cs
index f5f9fa8a..e34fb9ba 100644
--- a/RenderSystems/ANX.Framework.Windows.DX10/Creator.cs
+++ b/RenderSystems/ANX.Framework.Windows.DX10/Creator.cs
@@ -84,26 +84,32 @@ namespace ANX.Framework.Windows.DX10
public GameHost CreateGameHost(Game game)
{
+ AddInSystemFactory.Instance.PreventRenderSystemChange();
return new WindowsGameHost(game);
}
public INativeGraphicsDevice CreateGraphicsDevice(PresentationParameters presentationParameters)
{
+ AddInSystemFactory.Instance.PreventRenderSystemChange();
return new GraphicsDeviceWindowsDX10(presentationParameters);
}
public INativeBuffer CreateIndexBuffer(GraphicsDevice graphics, IndexElementSize size, int indexCount, BufferUsage usage)
{
+ AddInSystemFactory.Instance.PreventRenderSystemChange();
return new IndexBuffer_DX10(graphics, size, indexCount, usage);
}
public INativeBuffer CreateVertexBuffer(GraphicsDevice graphics, VertexDeclaration vertexDeclaration, int vertexCount, BufferUsage usage)
{
+ AddInSystemFactory.Instance.PreventRenderSystemChange();
return new VertexBuffer_DX10(graphics, vertexDeclaration, vertexCount, usage);
}
public INativeEffect CreateEffect(GraphicsDevice graphics, ANX.Framework.Graphics.Effect managedEffect, Stream vertexShaderByteCode, Stream pixelShaderByteCode)
{
+ AddInSystemFactory.Instance.PreventRenderSystemChange();
+
Effect_DX10 effect = new Effect_DX10(graphics, managedEffect, vertexShaderByteCode, pixelShaderByteCode);
return effect;
@@ -111,6 +117,8 @@ namespace ANX.Framework.Windows.DX10
public INativeEffect CreateEffect(GraphicsDevice graphics, ANX.Framework.Graphics.Effect managedEffect, System.IO.Stream byteCode)
{
+ AddInSystemFactory.Instance.PreventRenderSystemChange();
+
Effect_DX10 effect = new Effect_DX10(graphics, managedEffect, byteCode);
return effect;
@@ -118,6 +126,8 @@ namespace ANX.Framework.Windows.DX10
public Texture2D CreateTexture(GraphicsDevice graphics, string fileName)
{
+ AddInSystemFactory.Instance.PreventRenderSystemChange();
+
//TODO: implement
throw new NotImplementedException();
@@ -131,26 +141,32 @@ namespace ANX.Framework.Windows.DX10
public INativeBlendState CreateBlendState()
{
+ AddInSystemFactory.Instance.PreventRenderSystemChange();
return new BlendState_DX10();
}
public INativeRasterizerState CreateRasterizerState()
{
+ AddInSystemFactory.Instance.PreventRenderSystemChange();
return new RasterizerState_DX10();
}
public INativeDepthStencilState CreateDepthStencilState()
{
+ AddInSystemFactory.Instance.PreventRenderSystemChange();
return new DepthStencilState_DX10();
}
public INativeSamplerState CreateSamplerState()
{
+ AddInSystemFactory.Instance.PreventRenderSystemChange();
return new SamplerState_DX10();
}
public byte[] GetShaderByteCode(PreDefinedShader type)
{
+ AddInSystemFactory.Instance.PreventRenderSystemChange();
+
if (type == PreDefinedShader.SpriteBatch)
{
return ShaderByteCode.SpriteBatchByteCode;
@@ -187,6 +203,8 @@ namespace ANX.Framework.Windows.DX10
public System.Collections.ObjectModel.ReadOnlyCollection GetAdapterList()
{
+ AddInSystemFactory.Instance.PreventRenderSystemChange();
+
SharpDX.DXGI.Factory factory = new Factory();
List adapterList = new List();
@@ -239,11 +257,15 @@ namespace ANX.Framework.Windows.DX10
public INativeTexture2D CreateTexture(GraphicsDevice graphics, SurfaceFormat surfaceFormat, int width, int height, int mipCount)
{
+ AddInSystemFactory.Instance.PreventRenderSystemChange();
+
return new Texture2D_DX10(graphics, width, height, surfaceFormat, mipCount);
}
public INativeRenderTarget2D CreateRenderTarget(GraphicsDevice graphics, int width, int height, bool mipMap, SurfaceFormat preferredFormat, DepthFormat preferredDepthFormat, int preferredMultiSampleCount, RenderTargetUsage usage)
{
+ AddInSystemFactory.Instance.PreventRenderSystemChange();
+
return new RenderTarget2D_DX10(graphics, width, height, mipMap, preferredFormat, preferredDepthFormat, preferredMultiSampleCount, usage);
}
}
diff --git a/RenderSystems/ANX.Framework.Windows.DX10/Properties/AssemblyInfo.cs b/RenderSystems/ANX.Framework.Windows.DX10/Properties/AssemblyInfo.cs
index fb2eac95..4224b410 100644
--- a/RenderSystems/ANX.Framework.Windows.DX10/Properties/AssemblyInfo.cs
+++ b/RenderSystems/ANX.Framework.Windows.DX10/Properties/AssemblyInfo.cs
@@ -32,7 +32,7 @@ using System.Runtime.InteropServices;
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
// übernehmen, indem Sie "*" eingeben:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("0.7.10.0")]
-[assembly: AssemblyFileVersion("0.7.10.0")]
+[assembly: AssemblyVersion("0.7.11.0")]
+[assembly: AssemblyFileVersion("0.7.11.0")]
[assembly: InternalsVisibleTo("ANX.Framework.ContentPipeline")]
diff --git a/RenderSystems/ANX.Framework.Windows.GL3/Creator.cs b/RenderSystems/ANX.Framework.Windows.GL3/Creator.cs
index bd2845e2..2a4fe6f6 100644
--- a/RenderSystems/ANX.Framework.Windows.GL3/Creator.cs
+++ b/RenderSystems/ANX.Framework.Windows.GL3/Creator.cs
@@ -106,20 +106,25 @@ namespace ANX.Framework.Windows.GL3
public GameHost CreateGameHost(Game game)
{
logger.Info("creating OpenGL3 GameHost");
- return new WindowsGameHost(game);
+ AddInSystemFactory.Instance.PreventRenderSystemChange();
+ return new WindowsGameHost(game);
}
#endregion
#region CreateEffect
public INativeEffect CreateEffect(GraphicsDevice graphics, Effect managedEffect, Stream byteCode)
{
+ AddInSystemFactory.Instance.PreventRenderSystemChange();
+
return new EffectGL3(managedEffect, byteCode);
}
public INativeEffect CreateEffect(GraphicsDevice graphics, Effect managedEffect,
Stream vertexShaderByteCode, Stream pixelShaderByteCode)
{
- return new EffectGL3(managedEffect, vertexShaderByteCode, pixelShaderByteCode);
+ AddInSystemFactory.Instance.PreventRenderSystemChange();
+
+ return new EffectGL3(managedEffect, vertexShaderByteCode, pixelShaderByteCode);
}
#endregion
@@ -127,7 +132,8 @@ namespace ANX.Framework.Windows.GL3
INativeGraphicsDevice IRenderSystemCreator.CreateGraphicsDevice(
PresentationParameters presentationParameters)
{
- return new GraphicsDeviceWindowsGL3(presentationParameters);
+ AddInSystemFactory.Instance.PreventRenderSystemChange();
+ return new GraphicsDeviceWindowsGL3(presentationParameters);
}
#endregion
@@ -144,7 +150,8 @@ namespace ANX.Framework.Windows.GL3
public INativeTexture2D CreateTexture(GraphicsDevice graphics,
SurfaceFormat surfaceFormat, int width, int height, int mipCount)
{
- return new Texture2DGL3(surfaceFormat, width, height, mipCount);
+ AddInSystemFactory.Instance.PreventRenderSystemChange();
+ return new Texture2DGL3(surfaceFormat, width, height, mipCount);
}
#endregion
@@ -161,7 +168,8 @@ namespace ANX.Framework.Windows.GL3
public INativeBuffer CreateIndexBuffer(GraphicsDevice graphics,
IndexElementSize size, int indexCount, BufferUsage usage)
{
- return new IndexBufferGL3(size, indexCount, usage);
+ AddInSystemFactory.Instance.PreventRenderSystemChange();
+ return new IndexBufferGL3(size, indexCount, usage);
}
#endregion
@@ -179,7 +187,8 @@ namespace ANX.Framework.Windows.GL3
VertexDeclaration vertexDeclaration, int vertexCount,
BufferUsage usage)
{
- return new VertexBufferGL3(vertexDeclaration, vertexCount, usage);
+ AddInSystemFactory.Instance.PreventRenderSystemChange();
+ return new VertexBufferGL3(vertexDeclaration, vertexCount, usage);
}
#endregion
@@ -190,7 +199,8 @@ namespace ANX.Framework.Windows.GL3
/// Native Blend State.
public INativeBlendState CreateBlendState()
{
- return new BlendStateGL3();
+ AddInSystemFactory.Instance.PreventRenderSystemChange();
+ return new BlendStateGL3();
}
#endregion
@@ -201,7 +211,8 @@ namespace ANX.Framework.Windows.GL3
/// Native Rasterizer State.
public INativeRasterizerState CreateRasterizerState()
{
- return new RasterizerStateGL3();
+ AddInSystemFactory.Instance.PreventRenderSystemChange();
+ return new RasterizerStateGL3();
}
#endregion
@@ -212,7 +223,8 @@ namespace ANX.Framework.Windows.GL3
/// Native Depth Stencil State.
public INativeDepthStencilState CreateDepthStencilState()
{
- return new DepthStencilStateGL3();
+ AddInSystemFactory.Instance.PreventRenderSystemChange();
+ return new DepthStencilStateGL3();
}
#endregion
@@ -223,7 +235,8 @@ namespace ANX.Framework.Windows.GL3
/// Native Sampler State.
public INativeSamplerState CreateSamplerState()
{
- return new SamplerStateGL3();
+ AddInSystemFactory.Instance.PreventRenderSystemChange();
+ return new SamplerStateGL3();
}
#endregion
@@ -235,7 +248,9 @@ namespace ANX.Framework.Windows.GL3
/// Byte code of the shader.
public byte[] GetShaderByteCode(PreDefinedShader type)
{
- if (type == PreDefinedShader.SpriteBatch)
+ AddInSystemFactory.Instance.PreventRenderSystemChange();
+
+ if (type == PreDefinedShader.SpriteBatch)
{
return ShaderByteCode.SpriteBatchByteCode;
}
@@ -271,7 +286,9 @@ namespace ANX.Framework.Windows.GL3
/// List of graphics adapters.
public ReadOnlyCollection GetAdapterList()
{
- var result = new List();
+ AddInSystemFactory.Instance.PreventRenderSystemChange();
+
+ var result = new List();
foreach (DisplayDevice device in DisplayDevice.AvailableDisplays)
{
var displayModeCollection = new DisplayModeCollection();
@@ -330,7 +347,8 @@ namespace ANX.Framework.Windows.GL3
DepthFormat preferredDepthFormat, int preferredMultiSampleCount,
RenderTargetUsage usage)
{
- return new RenderTarget2DGL3(width, height, mipMap, preferredFormat,
+ AddInSystemFactory.Instance.PreventRenderSystemChange();
+ return new RenderTarget2DGL3(width, height, mipMap, preferredFormat,
preferredDepthFormat, preferredMultiSampleCount, usage);
}
#endregion
diff --git a/RenderSystems/ANX.Framework.Windows.GL3/Properties/AssemblyInfo.cs b/RenderSystems/ANX.Framework.Windows.GL3/Properties/AssemblyInfo.cs
index e4a660f6..4728138b 100644
--- a/RenderSystems/ANX.Framework.Windows.GL3/Properties/AssemblyInfo.cs
+++ b/RenderSystems/ANX.Framework.Windows.GL3/Properties/AssemblyInfo.cs
@@ -32,7 +32,7 @@ using System.Runtime.InteropServices;
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
// übernehmen, indem Sie "*" eingeben:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("0.5.7.0")]
-[assembly: AssemblyFileVersion("0.5.7.0")]
+[assembly: AssemblyVersion("0.5.8.0")]
+[assembly: AssemblyFileVersion("0.5.8.0")]
[assembly: InternalsVisibleTo("ANX.Framework.ContentPipeline")]
diff --git a/RenderSystems/ANX.RenderSystem.Windows.DX11/Creator.cs b/RenderSystems/ANX.RenderSystem.Windows.DX11/Creator.cs
index 72a92a6d..795377ae 100644
--- a/RenderSystems/ANX.RenderSystem.Windows.DX11/Creator.cs
+++ b/RenderSystems/ANX.RenderSystem.Windows.DX11/Creator.cs
@@ -89,53 +89,62 @@ namespace ANX.RenderSystem.Windows.DX11
public GameHost CreateGameHost(Game game)
{
+ AddInSystemFactory.Instance.PreventRenderSystemChange();
+
throw new NotImplementedException();
//return new WindowsGameHost(game);
}
public INativeGraphicsDevice CreateGraphicsDevice(PresentationParameters presentationParameters)
{
+ AddInSystemFactory.Instance.PreventRenderSystemChange();
+
throw new NotImplementedException();
//return new GraphicsDeviceWindowsDX11_1(presentationParameters);
}
public INativeBuffer CreateIndexBuffer(GraphicsDevice graphics, IndexElementSize size, int indexCount, BufferUsage usage)
{
+ AddInSystemFactory.Instance.PreventRenderSystemChange();
+
throw new NotImplementedException();
//return new IndexBuffer_DX 11(graphics, size, indexCount, usage);
}
public INativeBuffer CreateVertexBuffer(GraphicsDevice graphics, VertexDeclaration vertexDeclaration, int vertexCount, BufferUsage usage)
{
+ AddInSystemFactory.Instance.PreventRenderSystemChange();
+
return new VertexBuffer_DX11(graphics, vertexDeclaration, vertexCount, usage);
}
public INativeEffect CreateEffect(GraphicsDevice graphics, Effect effect, Stream vertexShaderByteCode, Stream pixelShaderByteCode)
{
+ AddInSystemFactory.Instance.PreventRenderSystemChange();
+
throw new NotImplementedException();
//return new Effect_DX11(graphics, vertexShaderByteCode, pixelShaderByteCode);
}
public INativeEffect CreateEffect(GraphicsDevice graphics, Effect effect, System.IO.Stream byteCode)
{
+ AddInSystemFactory.Instance.PreventRenderSystemChange();
+
throw new NotImplementedException();
//return new Effect_DX11(graphics, byteCode);
}
public Texture2D CreateTexture(GraphicsDevice graphics, string fileName)
{
+ AddInSystemFactory.Instance.PreventRenderSystemChange();
+
throw new NotImplementedException();
-
- //GraphicsDeviceWindowsDX10 graphicsDX10 = graphics.NativeDevice as GraphicsDeviceWindowsDX10;
- //SharpDX.Direct3D10.Texture2D nativeTexture = SharpDX.Direct3D10.Texture2D.FromFile(graphicsDX10.NativeDevice, fileName);
- //Texture2D_DX10 texture = new Texture2D_DX10(graphics, nativeTexture.Description.Width, nativeTexture.Description.Height);
- //texture.NativeTexture = nativeTexture;
-
- //return texture;
}
public Texture2D CreateTexture(GraphicsDevice graphics, SurfaceFormat surfaceFormat, int width, int height, int mipCount, byte[] colorData)
{
+ AddInSystemFactory.Instance.PreventRenderSystemChange();
+
throw new NotImplementedException();
/*
@@ -205,36 +214,48 @@ namespace ANX.RenderSystem.Windows.DX11
public INativeBlendState CreateBlendState()
{
+ AddInSystemFactory.Instance.PreventRenderSystemChange();
+
throw new NotImplementedException();
}
public INativeRasterizerState CreateRasterizerState()
{
+ AddInSystemFactory.Instance.PreventRenderSystemChange();
+
throw new NotImplementedException();
}
public INativeDepthStencilState CreateDepthStencilState()
{
+ AddInSystemFactory.Instance.PreventRenderSystemChange();
+
throw new NotImplementedException();
}
public INativeSamplerState CreateSamplerState()
{
+ AddInSystemFactory.Instance.PreventRenderSystemChange();
+
throw new NotImplementedException();
}
public byte[] GetShaderByteCode(PreDefinedShader type)
{
+ AddInSystemFactory.Instance.PreventRenderSystemChange();
+
throw new NotImplementedException();
}
public System.Collections.ObjectModel.ReadOnlyCollection GetAdapterList()
{
+ AddInSystemFactory.Instance.PreventRenderSystemChange();
+
throw new NotImplementedException();
}
@@ -247,6 +268,8 @@ namespace ANX.RenderSystem.Windows.DX11
public Framework.NonXNA.RenderSystem.INativeRenderTarget2D CreateRenderTarget(GraphicsDevice graphics, int width, int height, bool mipMap, SurfaceFormat preferredFormat, DepthFormat preferredDepthFormat, int preferredMultiSampleCount, RenderTargetUsage usage)
{
+ AddInSystemFactory.Instance.PreventRenderSystemChange();
+
throw new NotImplementedException();
}
}
diff --git a/RenderSystems/ANX.RenderSystem.Windows.DX11/Properties/AssemblyInfo.cs b/RenderSystems/ANX.RenderSystem.Windows.DX11/Properties/AssemblyInfo.cs
index aecb276a..cffaef81 100644
--- a/RenderSystems/ANX.RenderSystem.Windows.DX11/Properties/AssemblyInfo.cs
+++ b/RenderSystems/ANX.RenderSystem.Windows.DX11/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Buildnummer
// Revision
//
-[assembly: AssemblyVersion("0.1.2.0")]
-[assembly: AssemblyFileVersion("0.1.2.0")]
+[assembly: AssemblyVersion("0.1.3.0")]
+[assembly: AssemblyFileVersion("0.1.3.0")]
diff --git a/Samples/Kinect/Game1.cs b/Samples/Kinect/Game1.cs
index 3519e24e..25dbf98c 100644
--- a/Samples/Kinect/Game1.cs
+++ b/Samples/Kinect/Game1.cs
@@ -17,7 +17,6 @@ namespace Kinect
MotionSensingDeviceState kinectState;
public Game1()
- : base("DirectX10", "Kinect")
{
graphics = new GraphicsDeviceManager(this);
Content.RootDirectory = "SampleContent";
diff --git a/Samples/Kinect/Program.cs b/Samples/Kinect/Program.cs
index c7f402fa..4ac27ec5 100644
--- a/Samples/Kinect/Program.cs
+++ b/Samples/Kinect/Program.cs
@@ -1,4 +1,5 @@
using System;
+using ANX.Framework.NonXNA;
namespace Kinect
{
@@ -10,6 +11,8 @@ namespace Kinect
///
static void Main(string[] args)
{
+ AddInSystemFactory.Instance.PreferredInputSystem = "Kinect";
+
using (Game1 game = new Game1())
{
game.Run();
diff --git a/Samples/SimpleSprite/Game1.cs b/Samples/SimpleSprite/Game1.cs
index 7e144467..8beef8a2 100644
--- a/Samples/SimpleSprite/Game1.cs
+++ b/Samples/SimpleSprite/Game1.cs
@@ -77,7 +77,6 @@ namespace WindowsGame1
private int lastFps = 60;
public Game1()
- : base("DirectX10")
{
graphics = new GraphicsDeviceManager(this);
graphics.PreparingDeviceSettings += new EventHandler(graphics_PreparingDeviceSettings);
diff --git a/Samples/TextRendering/Game1.cs b/Samples/TextRendering/Game1.cs
index a7edc398..3f5a8bca 100644
--- a/Samples/TextRendering/Game1.cs
+++ b/Samples/TextRendering/Game1.cs
@@ -65,7 +65,6 @@ namespace TextRendering
SpriteFont debugFont;
public Game1()
- : base("OpenGL3")
{
graphics = new GraphicsDeviceManager(this);
graphics.PreparingDeviceSettings += new EventHandler(graphics_PreparingDeviceSettings);
diff --git a/Samples/TextRendering/Program.cs b/Samples/TextRendering/Program.cs
index 7a273121..bb3ce45d 100644
--- a/Samples/TextRendering/Program.cs
+++ b/Samples/TextRendering/Program.cs
@@ -1,4 +1,5 @@
using System;
+using ANX.Framework.NonXNA;
namespace TextRendering
{
@@ -10,6 +11,8 @@ namespace TextRendering
///
static void Main(string[] args)
{
+ AddInSystemFactory.Instance.PreferredRenderSystem = "OpenGL3";
+
using (Game1 game = new Game1())
{
game.Run();
diff --git a/Samples/WindowsGame/Game1.cs b/Samples/WindowsGame/Game1.cs
index bd25b26f..7c15a2a0 100644
--- a/Samples/WindowsGame/Game1.cs
+++ b/Samples/WindowsGame/Game1.cs
@@ -64,8 +64,7 @@ namespace WindowsGame1
GraphicsDeviceManager graphics;
SpriteBatch spriteBatch;
- public Game1(string renderSystem, string inputSystem, string audioSystem)
- : base(renderSystem, inputSystem, audioSystem)
+ public Game1()
{
graphics = new GraphicsDeviceManager(this);
Content.RootDirectory = "SampleContent";
diff --git a/Samples/WindowsGame/Program.cs b/Samples/WindowsGame/Program.cs
index 7ccad686..ff722829 100644
--- a/Samples/WindowsGame/Program.cs
+++ b/Samples/WindowsGame/Program.cs
@@ -19,7 +19,11 @@ namespace WindowsGame1
AddInSelector selector = new AddInSelector();
if (selector.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
- using (Game1 game = new Game1(selector.cbRenderSystem.Text, selector.cbInputSystems.CheckedItems[0].ToString(), selector.cbAudioSystem.Text))
+ AddInSystemFactory.Instance.PreferredRenderSystem = selector.cbRenderSystem.Text;
+ AddInSystemFactory.Instance.PreferredSoundSystem = selector.cbAudioSystem.Text;
+ AddInSystemFactory.Instance.PreferredInputSystem = selector.cbInputSystems.CheckedItems[0].ToString();
+
+ using (Game1 game = new Game1())
{
game.Run();
}
diff --git a/SoundSystems/ANX.SoundSystem.OpenAL/Properties/AssemblyInfo.cs b/SoundSystems/ANX.SoundSystem.OpenAL/Properties/AssemblyInfo.cs
index 20e687f5..b3055b2e 100644
--- a/SoundSystems/ANX.SoundSystem.OpenAL/Properties/AssemblyInfo.cs
+++ b/SoundSystems/ANX.SoundSystem.OpenAL/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
// übernehmen, indem Sie "*" eingeben:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("0.0.1.0")]
-[assembly: AssemblyFileVersion("0.0.1.0")]
+[assembly: AssemblyVersion("0.0.2.0")]
+[assembly: AssemblyFileVersion("0.0.2.0")]
diff --git a/SoundSystems/ANX.SoundSystem.Windows.XAudio/Properties/AssemblyInfo.cs b/SoundSystems/ANX.SoundSystem.Windows.XAudio/Properties/AssemblyInfo.cs
index 3802bf09..e92d4178 100644
--- a/SoundSystems/ANX.SoundSystem.Windows.XAudio/Properties/AssemblyInfo.cs
+++ b/SoundSystems/ANX.SoundSystem.Windows.XAudio/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
// übernehmen, indem Sie "*" eingeben:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("0.0.2.0")]
-[assembly: AssemblyFileVersion("0.0.2.0")]
+[assembly: AssemblyVersion("0.0.3.0")]
+[assembly: AssemblyFileVersion("0.0.3.0")]