Sep 6, 2012 at 11:28 AM
Edited Sep 6, 2012 at 1:26 PM
I'm having some trouble loading a a skin definition file from a resource.
I have UserInterfaceBeeb.resx containing BeebSkin which points to
The contents of that file are taken from the nuclex source package and modified to point to
BeebSheet.png instead of SuaveSheet.png
I've added skin.xsd to the solution.
I've added an XNA Content Project called NuclexContent and to that I've added
BeebSheet.png, DefaultFont.spritefont, TitleFont.spritefont
I have not yet added BeebSheet.xnb, DefaultFont.xnb, TitleFont.xnb to
UserInterfaceBeeb.resx yet, mainly because I haven't figured out the paths yet.
In my game constructor I have:
Viz = Nuclex.UserInterface.Visuals.Flat.FlatGuiVisualizer.FromResource(Services, Resources.UserInterfaceBeeb.ResourceManager, "BeebSkin");
When I run it, FromResource throws the error:
Unable to cast object of type 'System.String' to type 'System.Byte'.
I've never worked with resources or xna content so I'm at a loss about what to do.
Is this just because I haven't got around to adding the .xnb files to the xna content project? Or something else?
I'd appreciate any help anyone can give. Thanks.
I tried this line: Viz = Nuclex.UserInterface.Visuals.Flat.FlatGuiVisualizer.FromFile(Services, "Resources\\UserInterface\\Beeb\\Beeb.skin.xml");
and specified that Beeb.skin.xml be copied to the output directory. It finds the file ok but throws the exception:
The GraphicsDevice must not be null when creating new resources.
Parameter name: graphicsDevice
I see now I was calling the FromFile too early. I called it in Initialize and it no longer throws the ArgumentNullException and just throws an exception about missing fonts (which I expected).
I'm still curious to know what I'm doing wrong with the resources method, but I can proceed using FromFile now.
I got the spritefont files to compile to Nuclex Framework sprite fonts through the nuclex font importer but now when debugging I get the following exception:
Error loading "TitleFont". File not found.
The InnerException to that is:
Error loading "Resources\UserInterface\Beeb\TitleFont.xnb". File not found.
I verified that the xnb files were built and exist in:
What am I doing wrong?