- Online Community Forums » Programming Questions » Radians to rotate_sprite

Credits go to miran for helping out!
This thread is locked; no one can reply to it. rss feed Print
Radians to rotate_sprite
Ceagon Xylas
Member #5,495
February 2005

I'm so not in a programming state of mind, but I still want to get this done. How do I convert radians to respond correctly to allegro's rotate_sprite()?

I know that

Degrees     Radians     Fixed(?)
360°     =   PI*2    =    256
180°     =    PI     =    128
90°      =   PI/2    =    64

I'm not using degrees at all, so ignore that. I'm just showing I understand what is going on, I just dont know how to convert radians to fixed (if that's what you call it.)

Member #2,407
June 2002

float allegro_degrees = radians*128.0/M_PI;
// or
fixed allegro_degrees = ftofix(radians*128.0/M_PI);

sig used to be here

Ceagon Xylas
Member #5,495
February 2005

Woo! Thanks a ton!
Hehe yeah, I figured that after the first example didn't work =]

Go to: