在MonoGame中添加内容 [英] Adding content in MonoGame

查看:95
本文介绍了在MonoGame中添加内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 Monogame 的新手.我正在尝试添加内容(图像),但是我不能这样做.在我看过的每个教程中,解决方案资源管理器都有一个文件夹,我可以在其中放置资产,但不能放置我的资产.

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");

推荐答案

右键单击您的解决方案,然后依次单击添加新项目.

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

从此处选择已安装> Visual C#> Monogame ,然后单击 MonoGame Content Project

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

执行完此操作后,您将在解决方案中看到您的内容项目.为了允许您的游戏使用它,请查看您的 Game 项目,然后右键单击参考.导航到解决方案>项目,然后选中 Content 项目旁边的复选框.

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 项目中,并像常规XNA游戏一样使用它们.

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

查看以下链接:

在XNA中加载内容 (MSDN)

Loading Content in XNA (MSDN)

这篇关于在MonoGame中添加内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆