0

I just installed SharpDX 2.5.0 into Visual Studio, and now there is one really curios and unexpected errror:

I wanted to start with Atari's 'Pong', so i drew a .bmp file with a ball, convertet it into a .dds file with

Easy2Convert BMP to DDS

added it to the Content, and tried to load it. So i added this line

ballTexture = Content.Load("Ball");

but it failed with the message AssetNotFoundException, the same with

ballTexture = Content.Load("Ball.dds");

and there are hardly no tutorials to find, neither did i find an useful answer... Thats the full path to this picture:

H:\Programmieren\Pong\Pong\Content\Ball.dds

Looking forward to your answers, and please excuse my knowlegde, I was used to XNA, and it was much more easier...

4

1 回答 1

0

在 SharpDX.Toolkit 中,内容是从相对于您的程序所在文件夹的文件夹中加载的。此外,您应该使用构建操作标记纹理ToolkitTexture(在 Visual Studio 中打开文件属性)。

构建后,应将文件复制到如下路径:

H:\Programmieren\Pong\Pong\bin\Debug\Content\Ball.tkb`

(扩展名可能不同 - 我不记得确切)。

在此之后,您可以通过调用加载资产ballTexture = Content.Load(@"Content\Ball");

或者,您可以在初始化期间设置内容管理器的根路径:

Content.RootDirectory = "Content";
...
//and load the textures with
ballTexture = Content.Load(@"Ball");

所有这些都在 SharpDX Toolkit 示例(位于 中Samples\SharpDXToolkitSamples.sln)中得到了展示。

于 2013-11-06T08:36:14.017 回答