Simple 2D graphics

Started by
6 comments, last by Vanz 16 years, 3 months ago
Hi, was wondering if you could help out a newb... I just downloaded VC++ 2008 Express and the developers SDK (5.2.3790.2075.51.PlatformSDK_Svr2003R2_rtm_22) and the DirectX9.0C SDK (Summer 2004), all mu include dir's are set up nicely... I would now like to be able to move some simple 2d objects around a .bmp background. Looking through the developers SDK and the DX SDK browser all I see is 3d samples. I'd really like to start with and get good at 2d, can anyone please share some 2d graphic code (url, good book, sdk ref ...etc)... Thanks, Vanz
Advertisement
For 2D you're better off with the SDL API (http://www.libsdl.org/). Especially if you're just starting out, trying to use a 3D API might be too steep a learning curve.

-me
Thanks Palidine,

I've actually built a few successful 3d applications so quite I'm familar with 3d DirectX already, the problem is I can't seem to locate any 2d code that works in VC++ 2005/2008 Express. The code I have found in old books or Googled, seems incompatible with VC++ 2005/2008 Express (so many errors), I solve error after error but I'm finding this frustrating and would like to try and find some clean 2d code that is stable (not even going after all the warnings)...

I would also like to stay with DirectX and not OpenGl if possible...

Thanks,

There is a section on building a Game Display on DirectX Tutorial.com which takes you through the ID3DXSprite interface (from the perspective of building a HUD for a 3D game). You will learn the basics though, and it's based on a DX SDK more recent than the one you have.
Quote:Original post by Palidine
For 2D you're better off with the SDL API (http://www.libsdl.org/). Especially if you're just starting out, trying to use a 3D API might be too steep a learning curve.

-me



I second this, and strongly recommend Lazy Foos Tutorials which take you through 2d games, then briefly touch on getting OpenGL (and therefore 3d games) working on SDL.
I just wanted to see if he would actually do it. Also, this test will rule out any problems with system services.
It's not too hard with directX - the way that I would do it is to...

1) set your camera into orthographic perspective
2) use vertex quads (only need 1) (device->SetTexture() is a beautiful thing)
- sometimes i see problems with people try to scroll the world on conjunction with using the ID3DXSprite. I think there is a way around it, but not quite sure atm.

The setup of directX 2D is very similar to that of 3D, just change the projection matrix to the one specified above.

Once D3DX is setup, it's super easy to use.

Quote:Original post by stringa
It's not too hard with directX - the way that I would do it is to...

1) set your camera into orthographic perspective
2) use vertex quads (only need 1) (device->SetTexture() is a beautiful thing)
- sometimes i see problems with people try to scroll the world on conjunction with using the ID3DXSprite. I think there is a way around it, but not quite sure atm.

The setup of directX 2D is very similar to that of 3D, just change the projection matrix to the one specified above.

Once D3DX is setup, it's super easy to use.


Point taken. Its a good idea to play with both systems for about a week, and continue with the one you find easiest, since this is your a self confessed "noob". When you learn the basics, you will be able to apply what you learned to any similar discipline.
I just wanted to see if he would actually do it. Also, this test will rule out any problems with system services.
Quote:Original post by Cantos
There is a section on building a Game Display on DirectX Tutorial.com which takes you through the ID3DXSprite interface (from the perspective of building a HUD for a 3D game). You will learn the basics though, and it's based on a DX SDK more recent than the one you have.


Thanks Cantos, that site works great and code runs well too!

As for the SDL stuff it looks interesting but I'm not fond of getting caught up in a wrapper, when you run into trouble your kind of on an island, not sure how extensive the include files are but it looks pretty good... just like to stick as close to native dx if I can...

Thanks

Vanz

This topic is closed to new replies.

Advertisement