Allegro.cc Forums » Programming Questions » Manually doing al_draw_rotated_bitmap?

 This thread is locked; no one can reply to it.
 Manually doing al_draw_rotated_bitmap?
 jmasterx Member #11,410 October 2009 Here is my issue.I'm making a cards game where the cards unfold in an arc. I want to do point in poly test to find out if the mouse is on the rotated bitmap instead of point in AABB test because of the rotation. The issue is i'm not quite sure how al_draw_rotated_bitmap goes from A(Left, Top) to A' (Left,Top) .Could someone give me an example on how Given rectangle A B C D, how I could get A' B' C' D' where rectangle ' = al_draw_rotated_bitmap rectangle.Lets say I have a bitmap with Width 400, Height 600. If I did:al_draw_rotated_bitmap(fourBySixBMP, 60,80,90,100,1.27f,0); Where would be the resulting 4 points. I would then use a point in polygon test which would be easy to do.Thanks Agui GUI API -> https://github.com/jmasterx/Agui Agui 0.2 Release Thread -> https://www.allegro.cc/forums/thread/612830
 Trent Gamblin Member #261 April 2000 I think if you think of it in reverse, it'll be much easier. Don't rotated you bounding box, rotate the mouse click point.
 jmasterx Member #11,410 October 2009 I know how to rotate a point around the origin, then if I want it to be around another point I just subtract that point, rotate then bring it back. That's fine. Except the part I'm unsure about is how to do the same thing with al_draw_rotated_bitmap. Maybe what you could tell me is:Given a bitmap of arbitrary size, if I wanted to rotate it 90 degrees around point 60,60 , how would I provide the parameters to al_draw_rotated bitmap. I guess cx and cy would be width / 2 and height / 2 for me, then would I put dx, dy as 60,60, and then angle as 90 deg in rad?Thanks Agui GUI API -> https://github.com/jmasterx/Agui Agui 0.2 Release Thread -> https://www.allegro.cc/forums/thread/612830
 Trent Gamblin Member #261 April 2000 cx, cy are the pivot point in the bitmap. Usually when you rotate you give the center pixel of the bitmap as cx, cy, but not always. If you wanted to spin a card on it's corner, you could use 0, 0. Whatever you specify as cx, cy, that point gets placed on dx, dy and then the bitmap is rotated around that.
 jmasterx Member #11,410 October 2009 Alright that helps clear it up ThanksI think what I may be looking for is to translate before I rotate, maybe allegro transformations can help, or maybe I can solve for dx, dy. Agui GUI API -> https://github.com/jmasterx/Agui Agui 0.2 Release Thread -> https://www.allegro.cc/forums/thread/612830
 Go to: Allegro Development Installation, Setup & Configuration Allegro.cc Comments Off-Topic Ordeals The Depot Game Design & Concepts Programming Questions Recent Threads