Required engine side assetts - what to do with them?
I'm working on a (very) simple engine for XNA, I need to load up some very basic assetts incl开发者_StackOverflow中文版uding a short sound blip, blank texture and font.
My problem is doing this engine side, I would much prefer to keep it separate to the game side code. Would this be possible or am I going to have to 'cheat' and explicitly add the content to the game side project?
Assuming you have the "Engine" and the "Game" project in the one solution:
Simply create a content project for (in) the Engine project (right click, add, new content project). The built content will be copied along with the DLL. If it has the same "Content Root Directory" name as your game's content project, then the result will be a merging of all the content into that one directory.
The ContentManager
class basically works on directories. So if you merge the directories, you can simply pass your game's ContentManager to your engine. Otherwise just create a new one.
精彩评论