我会如何将Content.RootDirectory设置为绝对路径,以便我可以从Content以外的地方加载?.NET 4.0 + XNA 4.0 - 给定绝对路径时Content.RootDirectory不工作?
我不认为我的意思来,因为这是给不存在的错误:
Content.RootDirectory = "C:\\Users\\pc user\\Desktop\\";
outputFont = Content.Load<SpriteFont>("SpriteFont1");
SpriteFont1.spritefont definitly存在于C:\用户\ PC用户\桌面。毫无疑问。
这是一个有效的SpriteFont类文件,我刚搬到它的内容,它是工作的罚款,到我的桌面,它是..呃..不。
我确实需要做到这一点,但如果你实际上无法从使用Content.Load的绝对路径加载Texture2Ds和SpriteFonts等,我愿意安装一个库或其他东西来做到这一点。
我希望我只是犯了一个'愚蠢的错误',它会起作用。
错误是:
ContentLoadException was unhandled
Error loading "SpriteFont1". File not found.
试试这个链接的例子如何开始.. http://msdn.microsoft.com/en-us/library/advertising-mobile-windows-phone -7-xna-api(MSADS.20).aspx找到许多使用C#类型的C#Content.RootDirectory进入Google搜索的示例 – MethodMan 2011-12-21 18:58:12