Winforms sample - best way to load Effect?

Last post 04-18-2008, 11:34 AM by Shawn Hargreaves. 3 replies.
Sort Posts: Previous Next
  •  04-18-2008, 2:00 AM

    Winforms sample - best way to load Effect?

    I have a winforms project based on the 2nd winforms sample (content loading).  I don't want to dynamically run the content importer at run time - at least for most things - like my .fx files - I'd rather have it put at compile time into the .xnb file (I think?) like a normal game.

    What's the best way to go about doing that given that my project doesn't really know about content like a regular xna game project does?  Is there a way to "add that functionality" (e.g. the Content folder) to my project?

  •  04-18-2008, 2:50 AM

    Re: Winforms sample - best way to load Effect?

    The easiest way is to add a "Windows Game Library" project to your solution. This contains a Content project that you can use to import and compile your assets. Set the project's output folder to the same as your Winforms project.

    Note: This will create a dll and pcb file for the project which you can just delete after build.


    --
    Ruina et Stragos
    XNA SA
    --
  •  04-18-2008, 10:09 AM

    Re: Winforms sample - best way to load Effect?

    Thanks!

    I ended up making a new library project, and putting the content in there - and then the winforms project uses that library. 

    And somehow the library's content files are being copied to the output directory of the winforms project when I build - not sure how/why that's happening, but it's good.

  •  04-18-2008, 11:34 AM

    Re: Winforms sample - best way to load Effect?

    You can do this the same way we did for the spritefont in the sample. The section in the sample doc titled "Loading Content" explains how we set this up.

    --
    XNA Framework Developer
    blog - homepage
View as RSS news feed in XML
©2007 Microsoft Corporation. All rights reserved. Privacy Statement Terms of Use Code of Conduct Feedback