Adding content in MonoGame

南笙酒味 提交于 2019-12-08 13:30:53

问题


I'm new to Monogame. I'm trying to add content (An image), but I can't do this. In each tutorial that I have seen, the solution explorer has a folder where I can put assets, but not mine.

I tried to add an image to the root folder, but it doesn't work.

hero = Content.Load<Texture2D>(@"Image1.png");

回答1:


Right click on your solution and click Add, then New Project.

From there, select Installed > Visual C# > Monogame, and click on the MonoGame Content Project

After you do this, you will see your content project in your solution. In order to allow your game to use it, look under your Game project, and right click References. Navigate to Solution > Projects and tick the checkbox next to your Content project.

You can now add your images to your Content project, and use them like a regular XNA game.

Check out these links:

  • Managing Content | Monogame

  • Loading Content in XNA (MSDN)



来源:https://stackoverflow.com/questions/24762860/adding-content-in-monogame

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!