Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Page Flip Effect

This thread is locked; no one can reply to it. rss feed Print
Page Flip Effect
SaintBass
Member #16,076
September 2015
avatar

Hi everyone, i'm programming a game and i need a "page flip effect" some idea?.
Thanks for the help :)

pkrcel
Member #14,001
February 2012

Sorry but it's a bit vague, you mean like an animation of a page flipping while (I presume) the player is reading a book? (like in an rpg of sorts?)

It is unlikely that Google shares your distaste for capitalism. - Derezo
If one had the eternity of time, one would do things later. - Johan Halmén

Mark Oates
Member #1,146
March 2001
avatar

Yea, maybe a bit more information? :). There are a bunch of different ways to do a page flip animation. What kind of thing did you have in mind?

SaintBass
Member #16,076
September 2015
avatar

The book is the creation of the heroe is something like this: http://pageflip-books.com/#meetpageflip/page/1

You can select the race, class, name and all the attributes of the heroe.

Mark Oates
Member #1,146
March 2001
avatar

OK. :)

What version of Allegro are you using? Allegro 5 or Allegro 4?

SaintBass
Member #16,076
September 2015
avatar

Allegro 5 :)

beoran
Member #12,636
March 2011

It's easy enough, I think, if you have your pages as bitmaps. Set up a clipping rectangle with void al_set_clipping_rectangle(int x, int y, int width, int height), then draw the page bitmap rotated with al_draw_rotated_bitmap(). You may need to use transformations (rotation and translation) to make the final result look good.

Mark Oates
Member #1,146
March 2001
avatar

Probably the easiest way to achieve an effect like that is to use al_draw_scaled_bitmap(), and scale the bitmap horizontally. (Each page would be an ALLEGRO_BITMAP) It would give you rectangular shaped pages; without perspective. Here's a mock-animation of what it might look like:

609734

Probably the most elaborate way would be to setup a 3D projection and create a mesh of ALLEGRO_VERTEX that deforms like paper as you flip it.

[edit: I don't know why the proportions on that gif are all messed up. hmm. something to do with the forum image embedding?]

SaintBass
Member #16,076
September 2015
avatar

Thanks for the help guys i´m going to try the ALLEGRO_VERTEX Effect. :D

Go to: