Rotating bitmaps
I have drawn a bitmap of a car on the screen using the BitBlt function. When I press the right arrow key I want the car to rotate to the right.
How would I do the rotate part of the code without making 50 different bitmaps for each of the cars position?
thx alot
Lalle
There are a few methods. You could switch to using a 3D engine, and it''s easy as pie to rotate.
OR.
You could use some fancy math and rotate the image manually, sampling the data from the original to estimate what each pixel will look like in the end.
The problem with the second approach is that if you do it each time you turn the car, it could get computationally expensive, and of course, it could look like crap. If you''re sticking to 2D, it''d be better to use some drawing package to do the rotating for you and load up all those rotated images in memory.
G''luck,
-Alamar
OR.
You could use some fancy math and rotate the image manually, sampling the data from the original to estimate what each pixel will look like in the end.
The problem with the second approach is that if you do it each time you turn the car, it could get computationally expensive, and of course, it could look like crap. If you''re sticking to 2D, it''d be better to use some drawing package to do the rotating for you and load up all those rotated images in memory.
G''luck,
-Alamar
I''ve got an example of rotating 2D images on my webpage, Useless Code. Of course the source code is included. Feel to use my code.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement