0
votes

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...

1
Could it be that you have to specify the folder in which the file is located? e.g.: Content.Load("Content\Ball.dds"); ? And you could also try to add the full path into the string if that does not work.UnholySheep

1 Answers

0
votes

In SharpDX.Toolkit content is loaded from a folder relative to the folder where your program is located. Also you should mark the texture with build action ToolkitTexture (open file properties in Visual Studio).

After build, the file should be copied to a path like this:

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

(the extension may be different - I don't remember exactly).

After this, you can load the asset by calling ballTexture = Content.Load(@"Content\Ball");

Alternatively, you can set the root path for content manager during initialization:

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

All this is demonstrated in SharpDX Toolkit samples (located in Samples\SharpDXToolkitSamples.sln).