سؤال

I've decided to try out SharpDX for my first Windows Phone game but I'm having troubles setting up Content Pipeline working.

I have tried creating an XNA Content Project and dummy XNA Game Library project (just to reference Content project from) but I've got SharpDX.Toolkit.Content.AssetNotFoundException when I tried to load a texture.

Second try was to use XNA 4.0 Content Compiler to get .xnb file and add it manually to my project but again I've got AssetNotFoundException.

The Content.RootDirectory is set to correct value ("Content", the name of an XNA Content Project in first try, and a name of folder containing .xnb file in second try), so that's probably not an issue.

So, the real question is, how to load a Texture2D from file in SharpDX project?

هل كانت مفيدة؟

المحلول

SharpDX Toolkit is not a XNA compatible API/implementation, and thus, is not able to load XNA content. It is a high level API for Direct3D11, with some XNA like interfaces/features (SpriteBatch, BasicEffect, ContentManager...etc.) but not binary compatible with XNA. If you want to work with legacy XNA projects, you will have to use a library like MonoGame

نصائح أخرى

Have you tried to create Windows Phone 8 project using MonoGame project template? MonoGame make it a lot easier to create XNA game on WP8 (it uses SharpDX under the cover). You can download the latest framework from here: http://monogame.codeplex.com/releases/view/102870

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top