Archived

This topic is now archived and is closed to further replies.

GeekPlusPlus

DirectX9 for 2D Games... (again)

Recommended Posts

Hello guys. I''m looking into making an old school 2D game, but I''d like to make it in DirectX just to learn it. Already made my GDI Tetris clone, and GDI would be very simple for what I''m doing, but I think it''s time to move on. Now, i''ve already read all the stuff about using sprites on quads and DirectDraw isn''t supported since 7 yadda yadda... What I''m wondering is how the structure of a 2D game would be setup using DirectGraphics. I remember when I was doing the D3D tutorials that I had all the matricies setup, and the camera could be moved in and out, and I had my funky coloured spinning triangle. Well, I think I, and a lot of the peopel who ask this qestion, or questions simialar to this, just find it SO HARD to think of doing 2D that way... So my question is how do I start? How do I get my spash background behind my window? And I heard that I can''t use flip() because i''m not in full screen. I ahve to use blit.fast() or something like that. Also, does DirectGraphics have line drawing, polygone drawing, and brushes and pensa like the GDI or a set pixel? Or is it all sprites? Just so you know, I''m trying to make a Tank Wars clone, where you set your power and angle and shoot at other tanks. So I''d have trace lines (colour set pixels) from the shots and such. Maybe D3D isn''t good for something THAT 2D? Ok, I hope I''ve been clear enough and someone can help me out. - Newb Programmer: Geek++

Share this post


Link to post
Share on other sites
quote:
Original post by GeekPlusPlus
So my question is how do I start? How do I get my spash background behind my window? And I heard that I can''t use flip() because i''m not in full screen. I ahve to use blit.fast() or something like that.

Also, does DirectGraphics have line drawing, polygone drawing, and brushes and pensa like the GDI or a set pixel? Or is it all sprites?

There is no blit.fast() method. You use the equivalent of a Flip() method in both fullscreen and windowed modes. It''s called Present().

DirectGraphics has support for pixel plotting, and line drawing. It can also draw triangles so you can use that to get any shape of polygon you want.

As for starting, you start the same way you did your tetris clone. Setup some sort of wrapper for DirectGraphics, and just use the graphics routines you designed to do your drawing.

DirectGraphics should be groovy for something like Tank Wars (though I''m personally more partial to Scorched Earth).

Share this post


Link to post
Share on other sites
If you get the spinning triangle, you''re half way there. If you can draw one triangle, you can draw two triangles together to make a square or rectangle.

Then you just texture the rectangle and bam, you have a sprite.

There''s where you start,

--Vic--

Share this post


Link to post
Share on other sites
Try searching for articles on "textured quads". These quads are two triangles that can be rendered to represent your sprite(s). If you have no luck with the search then post back here...

Share this post


Link to post
Share on other sites
Wow, thanks guys.

This has been very helpfull. So my background is just a sprite (two triangles to make a quad) that covers the window.

I''ll look up sprites today, get back to you if I have more problems.

Thanks.

- Newb Programmer: Geek++

Share this post


Link to post
Share on other sites