added some more logging and exception handling to trace errors on linux

This commit is contained in:
Glatzemann 2011-12-01 10:31:25 +00:00
parent a6a7d21612
commit fa035cb4df
7 changed files with 38 additions and 11 deletions

View File

@ -168,8 +168,10 @@ namespace ANX.Framework
logger.Info("creating GameHost"); logger.Info("creating GameHost");
//TODO: error handling if creator is null IRenderSystemCreator creator = AddInSystemFactory.Instance.GetDefaultCreator<IRenderSystemCreator>();
this.host = AddInSystemFactory.Instance.GetDefaultCreator<IRenderSystemCreator>().CreateGameHost(this); if (creator != null)
{
this.host = creator.CreateGameHost(this);
this.host.Activated += new EventHandler<EventArgs>(this.HostActivated); this.host.Activated += new EventHandler<EventArgs>(this.HostActivated);
this.host.Deactivated += new EventHandler<EventArgs>(this.HostDeactivated); this.host.Deactivated += new EventHandler<EventArgs>(this.HostDeactivated);
@ -177,6 +179,12 @@ namespace ANX.Framework
this.host.Resume += new EventHandler<EventArgs>(this.HostResume); this.host.Resume += new EventHandler<EventArgs>(this.HostResume);
this.host.Idle += new EventHandler<EventArgs>(this.HostIdle); this.host.Idle += new EventHandler<EventArgs>(this.HostIdle);
this.host.Exiting += new EventHandler<EventArgs>(this.HostExiting); this.host.Exiting += new EventHandler<EventArgs>(this.HostExiting);
}
else
{
logger.Error("could not fetch RenderSystem creator to create a game host...");
throw new NullReferenceException("could not fetch RenderSystem creator");
}
logger.Info("creating ContentManager"); logger.Info("creating ContentManager");
this.content = new ContentManager(this.gameServices); this.content = new ContentManager(this.gameServices);

View File

@ -224,7 +224,7 @@ namespace ANX.Framework.NonXNA
return defaultCreators[type] as T; return defaultCreators[type] as T;
} }
return default(T); throw new AddInLoadingException(String.Format("couldn't find a DefaultCreator of type '{0}'", type.FullName));
} }
public void SetDefaultCreator<T>(T creator) where T : class, ICreator public void SetDefaultCreator<T>(T creator) where T : class, ICreator

View File

@ -34,6 +34,10 @@
<PlatformTarget>x86</PlatformTarget> <PlatformTarget>x86</PlatformTarget>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="NLog, Version=2.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\lib\NLog\NLog.dll</HintPath>
</Reference>
<Reference Include="OpenTK"> <Reference Include="OpenTK">
<HintPath>..\..\lib\OpenTK\OpenTK.dll</HintPath> <HintPath>..\..\lib\OpenTK\OpenTK.dll</HintPath>
</Reference> </Reference>

View File

@ -6,6 +6,7 @@ using ANX.Framework.Graphics;
using ANX.Framework.NonXNA; using ANX.Framework.NonXNA;
using ANX.Framework.NonXNA.RenderSystem; using ANX.Framework.NonXNA.RenderSystem;
using OpenTK; using OpenTK;
using NLog;
#region License #region License
@ -61,6 +62,8 @@ namespace ANX.Framework.Windows.GL3
/// </summary> /// </summary>
public class Creator : IRenderSystemCreator public class Creator : IRenderSystemCreator
{ {
private static Logger logger = LogManager.GetCurrentClassLogger();
#region Public #region Public
/// <summary> /// <summary>
/// Name of the Creator implementation. /// Name of the Creator implementation.
@ -101,6 +104,7 @@ namespace ANX.Framework.Windows.GL3
#region CreateGameHost #region CreateGameHost
public GameHost CreateGameHost(Game game) public GameHost CreateGameHost(Game game)
{ {
logger.Info("creating OpenGL3 GameHost");
return new WindowsGameHost(game); return new WindowsGameHost(game);
} }
#endregion #endregion

View File

@ -32,7 +32,7 @@ using System.Runtime.InteropServices;
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern // Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
// übernehmen, indem Sie "*" eingeben: // übernehmen, indem Sie "*" eingeben:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.5.4.0")] [assembly: AssemblyVersion("0.5.5.0")]
[assembly: AssemblyFileVersion("0.5.4.0")] [assembly: AssemblyFileVersion("0.5.5.0")]
[assembly: InternalsVisibleTo("ANX.Framework.ContentPipeline")] [assembly: InternalsVisibleTo("ANX.Framework.ContentPipeline")]

View File

@ -1,5 +1,6 @@
using System; using System;
using System.Windows.Forms; using System.Windows.Forms;
using NLog;
#region License #region License
@ -53,6 +54,8 @@ namespace ANX.Framework.Windows.GL3
{ {
public class WindowsGameHost : GameHost public class WindowsGameHost : GameHost
{ {
private static Logger logger = LogManager.GetCurrentClassLogger();
#region Private #region Private
private Game game; private Game game;
private WindowsGameWindow gameWindow; private WindowsGameWindow gameWindow;
@ -75,7 +78,11 @@ namespace ANX.Framework.Windows.GL3
{ {
isQuitting = false; isQuitting = false;
game = setGame; game = setGame;
logger.Info("creating a new GameWindow");
gameWindow = new WindowsGameWindow(); gameWindow = new WindowsGameWindow();
logger.Info("hook up GameWindow events");
gameWindow.Activated += delegate gameWindow.Activated += delegate
{ {
OnActivated(); OnActivated();

View File

@ -103,6 +103,10 @@
<Project>{5CA3CDF5-4D2C-42AC-AD08-641BD3992B75}</Project> <Project>{5CA3CDF5-4D2C-42AC-AD08-641BD3992B75}</Project>
<Name>ANX.InputSystem.OpenTK</Name> <Name>ANX.InputSystem.OpenTK</Name>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\..\InputSystems\ANX.InputSystem.Recording\ANX.InputSystem.Recording.csproj">
<Project>{DB88DDEB-7281-405D-8FCA-5681B6B2BD7A}</Project>
<Name>ANX.InputSystem.Recording</Name>
</ProjectReference>
<ProjectReference Include="..\..\InputSystems\ANX.InputSystem.Windows.Kinect\ANX.InputSystem.Windows.Kinect.csproj"> <ProjectReference Include="..\..\InputSystems\ANX.InputSystem.Windows.Kinect\ANX.InputSystem.Windows.Kinect.csproj">
<Project>{E5D69E75-D77C-493F-BBDA-6F9E73B82549}</Project> <Project>{E5D69E75-D77C-493F-BBDA-6F9E73B82549}</Project>
<Name>ANX.InputSystem.Windows.Kinect</Name> <Name>ANX.InputSystem.Windows.Kinect</Name>