Howdy, Stranger!

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

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

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.