Sharing content between WinForms project and XNA game project

Started by
2 comments, last by LordRhys 11 years, 2 months ago

I've made a XNA library which serves as a graphics engine for a game I'm making. The game project references the library as a .dll. Currently the library has the assets it requires (effect files, default textures, etc) embedded in a resource file so I can copy just the .dll file and nothing else and it works fine.

What I want to do next is create a level editor for the game as a WinForms project. I'm using this WinForms example to start on, and I managed to get a screen rendering with the engine properly. Where I'm having problem is with using the game assets. The game project compiles the assets as .xnb's and I would like to use these files in the editor. How should the editor reference these files?

Since WinForms projects cannot use XNA Content projects directly, I created a standard project called "Editor Content", and then have that refer to the game's Content project. The problem with this is that all the game's content files get recompiled every time I compile the WinForms project, even if none of these files have been changed. Ideally I want to the game's .xnb's to be copied automatically to the editor's working directory. However, if there is a better way to share the assets between a XNA game project and a WinForms project, let me know.

New game in progress: Project SeedWorld

My development blog: Electronic Meteor

Advertisement
In the always popular Nick Gravelyn Tile Engine series, he uses the Winforms project in his editor.
Perhaps you can get some hints from those.

I think it's videos 3B, 4B that starts the editor development.

http://www.youtube.com/playlist?list=PL0A865073DA96A7DA

In the always popular Nick Gravelyn Tile Engine series, he uses the Winforms project in his editor.
Perhaps you can get some hints from those.

I think it's videos 3B, 4B that starts the editor development.

http://www.youtube.com/playlist?list=PL0A865073DA96A7DA

While this doesn't answer my question directly, I did look at the videos and found them helpful not just in loading content but in using WinForms in general to make a level editor, so I'm gonna bookmark those. I also looked at the other XNA WinForms sample that compile .xnb content on the fly. That seems like a good enough solution for my needs.

New game in progress: Project SeedWorld

My development blog: Electronic Meteor

you could also look atthe RPG tutorial from here: http://xnagpa.net/xna4rpg.html , the Editor is WinForms and he uses the Content pipeline from the game to access the resources

This topic is closed to new replies.

Advertisement