Sign in to follow this  
Mateo1041

[SlimDX] Having a lot of trouble getting started with SlimDX

Recommended Posts

I've gone through the example projects, but they're all tied to the SampleFramework. Is there a way to just start with a single project that isn't tied to anything but the SlimDX reference? Basically, I just want to draw a sprite on the screen. But I'm having a tough time finding any semblance of a SlimDX tutorial on how to do so. :-( Am I just not looking in the right places? Any help would really be appreciated. I've done a lot of development in the past, but not with DirectX. EDIT: I'm using Visual Studio 2008 and while I'd ideally like to do this in VB, C is an option too.

Share this post


Link to post
Share on other sites
The MiniTri sample represents the absolute slashed back minimum. The tricky bit with VB is they give you a Form right from the beginning and have you start writing in Form_Load rather than the main function. Still, you can run basically the same code in Form_Load and it shouldn't make a difference at all. The Application_Idle event represents the actual render function; instead of rendering a single triangle you can set up a Sprite object instead.

Remember also that you can go off Managed DirectX tutorials and convert them to SlimDX with relatively minimal changes. Unfortunately SlimDX is not very well set up for beginners right now. (We're working on that, but limited resources and all.) Managed DirectX tutorials can get you off the ground, with regards to how to get basic application setup working. After that it's fairly straightforward to port either MDX or native C++ code to SlimDX, after you get a feel for how the basic structure of SlimDX is designed.

Share this post


Link to post
Share on other sites
Thanks. Yes, I have looked at the "MiniTri" example. But it appears tied to and requires something called "SampleFramework". From what it looks like, all samples are tied to this. Is the SampleFramework really needed?

Share this post


Link to post
Share on other sites
There are two reasons why we have a sample framework. The first is to give an example of how a framework might be written, one that includes window management, device set up and tear down, and properly timing an update loop. Therefore, the samples using the sample framework show it in action.

The second reason is because we were getting complaints about our samples not running on all computers, since we were just hard-coding a set of device parameters instead of checking for ones that are valid. The only two options here were to duplicate a large amount of set up code for each sample that would make each more complex and difficult to follow, or extract that common code out and make it into a framework used by all.

Share this post


Link to post
Share on other sites
Thanks guys. I made the MiniTri example its own project and am trying to work off that. How do I create a single sprite, or better yet, a batch of sprites on the screen?

I discovered this:
http://ilovevb.net/Web/blogs/nimble2d/archive/2008/02/12/doing-2d-in-slimdx.aspx

The "Sprite(Device)" constructor is in the official reference, but doesn't appear to work in the MiniTri example using the following line of code:

varSB = new Sprite(Device);

Am I doing something wrong? :-(

Share this post


Link to post
Share on other sites
I would actually suggest getting a book on DirectX to learn SlimDX (that is once you have programming down). The APIs are pretty similar from what I see (except for some minor things).

Share this post


Link to post
Share on other sites
Thanks. I'm just going by what I find online...which isn't much for a beginner using SlimDX. :-( I've done a lot of web development and some older Visual Basic and C++, but this is quite different.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this