|
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.
This is a function that can be used to rotate the picture. In the end, I became a tortoise.:( I repeatedly checked my code.No speed reduction. This is bug?Or function characteristic? |
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: |
Edgar Reynaldo
Major Reynaldo
May 2007
|
Well I hope you're not converting like that. ;P double deg = rad*180.0/M_PI; My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
Chris Katko
Member #1,881
January 2002
|
Whoops! -----sig: |
Edgar Reynaldo
Major Reynaldo
May 2007
|
Katko, C'mon, it's basic fundamental math skills here people. How many degrees are there in a circle? How many radians? If they are the same then they are equal. Put one on each side of an equation. Then divide both sides by one side or the other. You get 1 = 360.0 Degrees / 2.0*PI Radians which also equals it's own inverse. Now if you multiply a number by one you haven't changed it! If you want to go from degrees to radians, you divide by 360 and multiply by 2*PI. Conversely, multiply by 360 degrees and divide by 2*PI radians. You're gonna have to show more code. We can't guess what you're doing. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
keprast
Member #16,794
January 2018
|
@Chris Katko
------------------------------ |
pkrcel
Member #14,001
February 2012
|
Sorry to drop in abruptly but the expression arc - pi / 2.0 Should evaluate always to 0, as I don't see arc being changed anywhere in the (small) code you posted If you're having a speed problem, on a modern system the al_draw_rotated_bitmap alone shouldn't be causing that. It is unlikely that Google shares your distaste for capitalism. - Derezo |
|