Sign in to follow this  

Switching From DirectDraw to Direct3D for 2D Based Games?

This topic is 3505 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

Hello, Well for the past few days I have been experimenting with DirectDraw and C# and must say I found it really interesting, however running into problems with bitmaps not rendering properly (not showing correct sizes etc.) which I have also seen on engines based on DirectDraw, so I am assuming this may mean there is some limitation on the bitmaps you can use with DirectDraw in some way, and I am aware that DirectDraw is deprecated now which would explain why it is hard to come across help on the net as I found out this weekend while spending hours on end looking to see if anyone had documented this problem before. While trying to find a solution to my problem I have read a lot of people recommending to people using Direct3D for 2D based games as opposed to DirectDraw, however while looking for tutorials using Direct3D + C# 90% of the time I am coming across tutorials that seem to be based on (what I thought was the purpose of Direct3D) 3D rendering, however at this moment in time I am not interested in creating a 3D game, nor do I think I have the knowledge to do so, but would just like to continue work on what I did start to create. Can someone please post an example of how I would go about the following method using Direct3D: Initialize the device Create a new surface which contains a bitmap Draw that surface (or part of) to the backbuffer Flip that to the primary surface Or to sum it up how to work with 2D sprites, or if anyone has any links to tutorials which actually explain the code it would be appreciated. Thanks in advance.

Share this post


Link to post
Share on other sites
Quote:
Original post by thre3dee
Wasn't the DirectDraw API made redundant a while ago in favor of Direct3D?


From what I have read that seems to be the case, which is why I am looking on information on where to get started with Direct3D performing the simple task of drawing a bitmap to the back buffer and then flipping it (well it was a simple task in DirectDraw), just having problems gathering information on how to do it in Direct3D.

Share this post


Link to post
Share on other sites
Direct3D Is deffinately the way to go... It may take longer and alot more code to get going, but it'll add alot more flexability and speed. All graphics cards (I believe Geforece2 and up don't support 2d acceleration anymore).

look into using an orthogonal projection if you're doing 2D, it'll make everything flat no matter what kind of depth is implied by your coordinates.

"Beginning Game Programming" by Jonnathan S. Harbour, is a great book for learning the basic of Direct3D, and shows you the ID3DXSprite interface, wich is pretty much the replacement for DirectDraw.

this article and many other here on gamedev have great examples on how to do 2D in 3D apis.

Share this post


Link to post
Share on other sites
Quote:
Original post by freeworld
Direct3D Is deffinately the way to go... It may take longer and alot more code to get going, but it'll add alot more flexability and speed. All graphics cards (I believe Geforece2 and up don't support 2d acceleration anymore).

look into using an orthogonal projection if you're doing 2D, it'll make everything flat no matter what kind of depth is implied by your coordinates.

"Beginning Game Programming" by Jonnathan S. Harbour, is a great book for learning the basic of Direct3D, and shows you the ID3DXSprite interface, wich is pretty much the replacement for DirectDraw.

this article and many other here on gamedev have great examples on how to do 2D in 3D apis.


I was looking to do it in C#, but thanks for the link, this article from what I have read so far seems quite informative.

The thing that has put me off using DirectX and C++ so far is that I have seen numerous books which all seem good but then when it comes to compiling don't work or wont work in newer compilers such as VS05 or VS08, I have one book and the code was compiled using Visual Studio 6 which from what I read is no longer compatible with the DirectX SDK.

If anyone can suggest books on C++ and DirectX (preferbly that lean towards 2D rendering) that are deffinitely compatible with VS2005 / VS2008 I would be very interested.

Edit: freeworld - I just took a look at that book on Google and I gotta admit it seems like it could be incrediblly usefull, it was also compiled with Visual Studio 6 however :-(

Share this post


Link to post
Share on other sites

This topic is 3505 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.

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