|
[Feature request] flipable "image" |
Ariesnl
Member #2,902
November 2002
|
I saw this in Qt (cute) an "image" with two sides.. two bitmaps that can be flipped over the X or Y axis .. just like a playing card. It would be a nice addition to Allegro. Should be doable since allegro already uses 3d stuff in orthographic projection. Perhaps one day we will find that the human factor is more complicated than space and time (Jean luc Picard) |
Edgar Reynaldo
Major Reynaldo
May 2007
|
This is actually really easy. If you're drawing a quad, simply draw the same quad with vertices in counter order. You could write a simple function that draws two sided bitmaps no problem. Don't really see why allegro needs it though, as it doesn't have a general use case. 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
|
al_draw_bitmap(,,,ALLEGRO_FLIP_HORIZONTAL) al_draw_bitmap(,,,ALLEGRO_FLIP_VERTICAL)
Or do you want a full animation? If so, that's the situation for a custom function written by yourself and not a generic library function. -----sig: |
Ariesnl
Member #2,902
November 2002
|
I don't mean a 2d flip.. but a 3d flip of a 2d bitmap.. or two actually.. This could be used in a lot of things. Not just cards.. Al_rotate_transform rotates around the Z axis wich is usual when doing 2d. 2 more rotation transforms around x and y should do the trick i think Perhaps one day we will find that the human factor is more complicated than space and time (Jean luc Picard) |
Edgar Reynaldo
Major Reynaldo
May 2007
|
No. You literally reverse the winding order of the vertices you pass, and it draws the reverse image. All you do is change the texture. Or if you're lazy, translate to the center of the image, rotate by PI around whatever axis you prefer, and then translate back. 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 |
Ariesnl
Member #2,902
November 2002
|
I think I was not clear... I want an effect of a "card" being turned upside down and vice versa Perhaps one day we will find that the human factor is more complicated than space and time (Jean luc Picard) |
Edgar Reynaldo
Major Reynaldo
May 2007
|
Okay then see the second part of my post just rotate by an angle other than pie. Use transforms. Say you have a playing card centered on x,y,z, then you do the following : 1// draw front
2al_draw_bitmap(frontside , tlx , tly , 0);
3
4ALLEGRO_TRANSFORM t;
5al_identity_transform(&t);
6
7al_translate_transform3d(&t , -x , -y , -z);
8al_rotate_transform3d(&t , vx , vy , vz , 2.0*M_PI*(time/3.0));
9al_translate_transform3d(&t , x , y , z);
10
11// draw back
12
13al_use_transform(&t);
14
15al_draw_bitmap(backside , tlx , tly , 0);
However, you'll probably have to use a perspective projection and the primitives addon to draw the quads instead of al_draw_bitmap. 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 |
Ariesnl
Member #2,902
November 2002
|
al_rotate_transform3d.. thnx, I'm gonna try it;) Perhaps one day we will find that the human factor is more complicated than space and time (Jean luc Picard) |
|