improve error message in CreateDevice

This commit is contained in:
Chris Forbes
2011-05-05 20:31:03 +12:00
parent 1d406bde75
commit 75588b050e

View File

@@ -135,12 +135,13 @@ namespace OpenRA.Graphics
static IGraphicsDevice CreateDevice( Assembly rendererDll, int width, int height, WindowMode window, bool vsync ) static IGraphicsDevice CreateDevice( Assembly rendererDll, int width, int height, WindowMode window, bool vsync )
{ {
var argTypes = new Type[] { typeof( int ), typeof( int ), typeof( WindowMode ), typeof( bool ) };
var argValues = new object[] { width, height, window, vsync };
foreach( RendererAttribute r in rendererDll.GetCustomAttributes( typeof( RendererAttribute ), false ) ) foreach( RendererAttribute r in rendererDll.GetCustomAttributes( typeof( RendererAttribute ), false ) )
{ return (IGraphicsDevice)r.Type.GetConstructor( argTypes ).Invoke( argValues );
return (IGraphicsDevice)r.Type.GetConstructor( new Type[] { typeof( int ), typeof( int ), typeof( WindowMode ), typeof( bool ) } )
.Invoke( new object[] { width, height, window, vsync } ); throw new InvalidOperationException("Renderer DLL is missing RendererAttribute to tell us what type to use!");
}
throw new NotImplementedException();
} }
internal IVertexBuffer<Vertex> GetTempVertexBuffer() internal IVertexBuffer<Vertex> GetTempVertexBuffer()