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,15 +168,23 @@ namespace ANX.Framework
logger.Info("creating GameHost");
//TODO: error handling if creator is null
this.host = AddInSystemFactory.Instance.GetDefaultCreator<IRenderSystemCreator>().CreateGameHost(this);
IRenderSystemCreator creator = AddInSystemFactory.Instance.GetDefaultCreator<IRenderSystemCreator>();
if (creator != null)
{
this.host = creator.CreateGameHost(this);
this.host.Activated += new EventHandler<EventArgs>(this.HostActivated);
this.host.Deactivated += new EventHandler<EventArgs>(this.HostDeactivated);
this.host.Suspend += new EventHandler<EventArgs>(this.HostSuspend);
this.host.Resume += new EventHandler<EventArgs>(this.HostResume);
this.host.Idle += new EventHandler<EventArgs>(this.HostIdle);
this.host.Exiting += new EventHandler<EventArgs>(this.HostExiting);
this.host.Activated += new EventHandler<EventArgs>(this.HostActivated);
this.host.Deactivated += new EventHandler<EventArgs>(this.HostDeactivated);
this.host.Suspend += new EventHandler<EventArgs>(this.HostSuspend);
this.host.Resume += new EventHandler<EventArgs>(this.HostResume);
this.host.Idle += new EventHandler<EventArgs>(this.HostIdle);
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");
this.content = new ContentManager(this.gameServices);

View File

@ -224,7 +224,7 @@ namespace ANX.Framework.NonXNA
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

View File

@ -34,6 +34,10 @@
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<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">
<HintPath>..\..\lib\OpenTK\OpenTK.dll</HintPath>
</Reference>

View File

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

View File

@ -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.4.0")]
[assembly: AssemblyFileVersion("0.5.4.0")]
[assembly: AssemblyVersion("0.5.5.0")]
[assembly: AssemblyFileVersion("0.5.5.0")]
[assembly: InternalsVisibleTo("ANX.Framework.ContentPipeline")]

View File

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

View File

@ -103,6 +103,10 @@
<Project>{5CA3CDF5-4D2C-42AC-AD08-641BD3992B75}</Project>
<Name>ANX.InputSystem.OpenTK</Name>
</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">
<Project>{E5D69E75-D77C-493F-BBDA-6F9E73B82549}</Project>
<Name>ANX.InputSystem.Windows.Kinect</Name>