Website may be up and down over next few months. I'm currently doing a complete overhaul of everything. Going back to simple individual .htm pages, new overall site theme, sanitizing and cleaning up html of all pages and blog posts, attempting to implement a new tooling and publishing system etc etc.

XNAContentCode

XNAContentCode is a utility meant to be called during the pre build event of what ever project you want it to process. What it does is parse the content project *.csproj file, and generate C# code that mirrors whatever game assets may be included in your GSE project. This allows you the ability to, instead of using strings, to use C# code to reference your game assets. Think of the VS.net Resources system, where you would type Resources.YourCustomResourceName, only XNAContentCode generates static classes (and nested classes if needed) and static const members that you can write code against instead of using strings.

For example say you had added a few game assets to your GSE project. After XNAContentCode is run you can reference those assets by typing Content.SomeGameAsset. This also has the advantage of giving you compile errors if you move or rename a game asset. Where as normally you would use a string in your code to access a game asset if you moved or renamed a game asset you would not know weather or not your game would work until run time when you ran the game, with XNAContentCode you can get feedback in the form of compile errors at design time.

XNAContentCode also allows you to specify a header and footer code files to pre-pend and append the code that XNAContentCode generates with your own custom wrapper code or comments. A typical usage of XNAContentCode is to add something like this to the pre build event of the desired project

"$(SolutionDir)XNAContentCode\bin\Debug\XNAContentCode.exe" "$(ProjectPath)"
"$(ProjectDir)Content.cs" "$(ProjectDir)Code\ContentHeader.txt" "$(ProjectDir)Code\ContentFooter.txt"
XNAContentCode.exe name of project Dest code file header file   footer file
------------------ --------------- -------------- ------------- -------------
XNAContentCode.exe SomePrj.csproj  Content.cs     header.txt    footer.txt

NOTE: Header and footer files are optional arguments.

Downloads

Creative Commons License
This work by Dean Lunz is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 2.5 Canada License. Permissions beyond the scope of this license may be available at http://contact.createdbyx.com/.

Created by: X

Just another personal website in this crazy online world

Name of author Dean Lunz (aka Created by: X)
Computer programming nerd, and tech geek.
About Me -- Resume