Jump to content
  • Advertisement

Archived

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

Placenta

Frustation with Rotation

This topic is 6627 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 am just learning how to use DirectX..... I created a simple wrapper that loads bitmaps unloads them loads sound and unloads them. The problem is i am making a Asteroids clone and our teacher is a loser who isnt offering us any help with how to rotate things he wants us to figure it out ourself... (we had like a week to learn directX) Can anyone out there helo me figure out how to rotate a bitmap? Is there a way other then just drawing a ton of bitmaps and unloading one and then reloading one each time the person pushes left? Wouldnt this cause the bitmap to flicker AAARG its driving me crazy! Any help would be appreciated! Regards Placenta

Share this post


Link to post
Share on other sites
Advertisement
There is a way to rotate bitmaps but it requiers hardware support (I think).

The way a do it is place all the bitmaps of the diffrent directions in one bitmap and then I use the source RECT of the blit to determen what part of the bitmap (direction) that should be shown

Share this post


Link to post
Share on other sites
I don''t know if you know how to do texture mapping, but it can be used to rotate a sprite. You don''t have to use OpenGL or Direct3D or anything, just software to rotate the 4 points that are the corners of the sprite. Then you draw the sprite according to the rotated corners. There is some trig involved, but that''s what I would do if I were you.

---
www.crazycrackerz.org

Share this post


Link to post
Share on other sites
Keep all the bitmaps of rotated ships loaded up. Have a variable of the direction of the ship as the index of an array of the surfaces with the prerotated sprites in. Then, when the number exceeds the array indexing reset it back to zero because that means it has done a full turn. When the person presses left add to the direction and when they press right subtract. Or the other way round.

------------------------------
#pragma twice

Share this post


Link to post
Share on other sites
Just render the rotations before the game (in your graphics program). Then you don''t need to do any rotation calculations. Any paint program will do this.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!