简体   繁体   English

在MonoGame中添加内容

[英]Adding content in MonoGame

I'm new to Monogame . 我是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");

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 从那里,选择Installed> Visual C#> Monogame ,然后单击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. 导航到解决方案>项目,然后选中Content项目旁边的复选框。

You can now add your images to your Content project, and use them like a regular XNA game. 您现在可以将图像添加到Content项目中,并像常规XNA游戏一样使用它们。

Check out these links: 查看以下链接:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM