Allegro flicker free animation - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Allegro flicker free animation

How do i do flicker free animation with allegro. I made a white rectangle (40x40) move across the screen, an it flickered VERY much. I did not insert a vsync(), because in a game i would not like to wait for retraces.

So, how can i create flicker free animation???


Comments

  • : How do i do flicker free animation with allegro. I made a white rectangle (40x40) move across the screen, an it flickered VERY much. I did not insert a vsync(), because in a game i would not like to wait for retraces.

    : So, how can i create flicker free animation???



    Flickering is caused by the VR (vertical

    retrace) or no double buffer. Every C/C++

    game waits for the VB and implmements a double

    buffer. You have no choice.



    // Animation example



    while (Animate)

    {

    Draw(); // Draw Sprites to DB

    Move(); // Change coordinates

    VR(); // Wait for VR

    CopyDB(); // Copy DB to screen

    }



    // VR function



    void VR()

    {

    while ((inp(0x03DA) & 0x08)) {};

    while (!(inp(0x03DA) & 0x08)) {};

    }



    (Personally, I wouldn't recommend C/C++ to

    beginning game programmers. Java is much easier, cuz everything is predefined. Check out: http://www.javagamepark.com).






Sign In or Register to comment.