Allegro.cc Forums » Programming Questions » ABOUT al_draw_rotated_bitmap()

 keprast Member #16,794 January 2018 Thank you for your help, my progress is very fast.But there is another problem.On the functions provided by ALLEGRO. ```al_draw_rotated_bitmap() ``` This is a function that can be used to rotate the picture.However, my angle add, then my speed reduction, even if only 0.1 angle.In the end, I became a tortoise.:(I repeatedly checked my code.No speed reduction.This is bug？Or function characteristic？-------------------------------------------------I just simply turn al_draw_bitmap into al_draw_rotated_bitmap.
 Chris Katko Member #1,881 January 2002 My first blind guess would be you're doing a unit conversion (from degrees to radians) BUT you forgot to add a .0 to the number so it's automatically converting it to an integer (chopping off all the precision!).``` al_draw_rotated_bitmap(my_bitmap, 0, 0, x, y, my_angle*360/2, 0); //no al_draw_rotated_bitmap(my_bitmap, 0, 0, x, y, my_angle*360/2.0, 0); //yes al_draw_rotated_bitmap(my_bitmap, 0, 0, x, y, my_angle*360.0/2.0, 0); //yes al_draw_rotated_bitmap(my_bitmap, 0, 0, x, y, my_angle*360.0/2, 0); //yes ``` where my_angle was originally in degrees, and you are converting it to radians using *360/2. -----sig:“Programs should be written for people to read, and only incidentally for machines to execute.” - Structure and Interpretation of Computer Programs"Political Correctness is fascism disguised as manners" --George Carlin
 keprast Member #16,794 January 2018 @Chris KatkoThat means his principle？I need to keep the accuracy of the arc.Using float, the precision will be lost.It will still reduce the speed.Float only guarantees six bits.------------------------------Anyway, my speed will still be reduced.I can only use a stupid way.Revise his speed at a time.------------------------------old code：```const float pi = 3.14; const float Vx_min = 4.2; const float Vy_min = 4.2; float arc = pi / 2.0; if (key[W] && !key[S] && !key[A] && !key[D]) { Vx = Vx*cos(arc); Vy = Vy*sin(arc); y -= Vy; x -= Vx; } al_draw_rotated_bitmap(wt, wtW / 2, wtH / 2, x + wtW / 2, y + wtH / 2, arc - pi / 2.0, 0); ``` ------------------------------Maybe,pi=3.1415926.Speed reduction is not recognized by eyes.But in that way, the efficiency is down.