Did you already check the resources of GameDev? Look at the section Programming-General/Graphics, where you will find an aricle titled "Texture Mapping". It explains the principle of linear texture mapping, wich is exactly what you need for 2d. http://www.gamedev.net/reference/programming/graphics/article366.asp
2D Rotation
Blake
[This message has been edited by Blake (edited September 19, 1999).]
Abrash: Black book of graphics programming (a must-have)
The bible: Computer graphics, principles and practice
And the less theory, more code series: Graphics Gems 1-(whatever)...
You will be amazed by the knowledge compiled into these books ..
/NJ
I think it would be best to have pre-rotated bitmaps and set it up so that when theuser presses the left arrow key, it rotates it 15 degrees to the left (or some other increment you can count by)
1) Setup a rectangular polygon (4 vectors)
2) rotate vectors clockwise or counterclockwise
3) Blit pixels line by line onto polygon
Voila!
Simple simple simple but I don't know enough trigonometry to be able to rotate points. That's all I need to know how to do.
I went and bought a cheap trig book today and I can already tell the book explains exactly what it is I'm trying to do. I will post the fruits of my labor in the form of a tutorial when I am successful. However, I still welcome any examples. My e-mail is blake@cyberstation.net.
Thanks to all that replied!
Blake
The calculation I use for finding an angle is:
x = Sin((90 + ang) * pi / 180) * rad
y = Sin(ang * pi / 180) * rad
This may or may not be what you're looking for. You feed it pi, rad(the radius) and ang(the angle) and it gives you the x,y relative to 0,0.
Oh, and that was in VB. I don't know exactly what it would be in C, sorry. Should be a staright-forward conversion though.
Hope this helps.
BTW- does anyone know how to do the blitting on an angle, but in DirectX? Or do you just read each pixel and rotate it yourself?
------------------
Lack