Jump to content
  • Advertisement
Sign in to follow this  
Mateo1041

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

This topic is 3669 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
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
MiniTri, at least for D3D 9, doesn't use the sample framework. If there's a reference to it that's a mistake and it can be removed.

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
Also the SlimDX architecture is basically the same as the C++ interface. Thus alot of the C++ tutorials on how to do things can be easily translated to slimDX.

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
Quote:
Original post by Promit
Define "doesn't appear to work".


"The name 'varSB' does not exist in the current context"

Sorry. Really appreciate the help.

Share this post


Link to post
Share on other sites
Sprite varSB = new Sprite(Device);

And I strongly, strongly suggest you work on getting programming basics down before tackling graphics.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!