![]() |
|
I have a problem with animation |
Loki66
Member #17,089
May 2019
|
I created two small programs in which a circle is moved; |
AceBlkwell
Member #13,038
July 2011
![]() |
This is probably a silly question but are you drawing direct to screen or are you drawing to a buffer page first? A few of my first attempts at moving graphics I drew lines and squares directly to screen. Then I would have to blank out and draw next position. Wasn’t bad but led to some flicker. It didn’t look smooth. |
dthompson
Member #5,749
April 2005
![]() |
I can't open .rar from my phone, but a couple things you might want to check:
______________________________________________________ |
Loki66
Member #17,089
May 2019
|
I looked at the guide of allegro.cc and github, but they are not detailed, there are no examples. |
MikiZX
Member #17,092
June 2019
|
I've tried your source code (using a larger bitmap file I already had on my disk) and the animation appears good. I've tested on Windows10. Possibly you can provide more details regarding your system? EDIT: I am not sure to understand if you are looking for Allegro5 examples? I think you know about these but just in case, examples are included with the GitHub repo: https://github.com/liballeg/allegro5/tree/master/examples |
Doctor Cop
Member #16,833
April 2018
![]() |
MikiZX said: EDIT: I am not sure to understand if you are looking for Allegro5 examples? I think you know about these but just in case, examples are included with the GitHub repo: https://github.com/liballeg/allegro5/tree/master/examples What do you think, which example would be best fitting as a starter template for new projects? As it's very hard for most people to write the same code over and over.
|
Edgar Reynaldo
Major Reynaldo
May 2007
![]() |
The wiki has a getting started guide you can find here : https://wiki.allegro.cc/index.php?title=Getting_Started#Using_Allegro 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 |
dthompson
Member #5,749
April 2005
![]() |
The wiki's quickstart has barebones code. Edit: 🐌 ______________________________________________________ |
Edgar Reynaldo
Major Reynaldo
May 2007
![]() |
🐇 One thing you want to note is that you're moving very quickly in terms of pixels. 12 or 20 pixels per update? That's 720 or 1200 pixels per second, which is very fast, and unless you draw some kind of trail it will appear to 'teleport'. 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 |
Loki66
Member #17,089
May 2019
|
Hi everyone float fl_FPS = al_get_display_refresh_rate(display); // verifica la frequenza di aggiornamento del monitor timer = al_create_timer(1.0 / fl_FPS); the excessive speed of animation is an example, but it is not fluid even at low speeds. |
Edgar Reynaldo
Major Reynaldo
May 2007
![]() |
https://en.wikipedia.org/wiki/Computer_animation Please describe your problem exactly. Is it tearing? Is it jerking? Is it teleporting across the screen? Some people perceive things differently. Also, if your timer is not synchronized with vsync, it will update during the middle of a screen redraw. 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 |
Loki66
Member #17,089
May 2019
|
yes the image is tearing. source code: timer = al_create_timer(1.0 / FPS); /*************************************************************************** but nothing has changed. moreover the animation is not fluid, that is, the bitmap does a small one |
Edgar Reynaldo
Major Reynaldo
May 2007
![]() |
Jerking is caused by a delay in rendering. This could be caused by missing the vsync and hitting the next one. That would instantly halve your framerate, as well as make it jerky. I compiled your program against Allegro 5.2.5 and it ran fine for me. It did jerk just a little bit at first, but smoothed out quickly. If enabling vsync didn't do anything, then either your graphics card has vsync disabled (in which case al_create_display should return 0), or you're out of sync. Try synchronizing your timer with the display. al_wait_for_vsync(); al_start_timer(timer);
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 |
Doctor Cop
Member #16,833
April 2018
![]() |
Thanks dthompson and Edgar for this. This will help students to get started and I will not have to create a new template every time.
|
Loki66
Member #17,089
May 2019
|
PROBLEM SOLVED |
dthompson
Member #5,749
April 2005
![]() |
Gotta love integrated graphics Doctor Cop said: Thanks dthompson and Edgar for this No problem, it's what we do. (though Edgar does it far more.) ______________________________________________________ |
Edgar Reynaldo
Major Reynaldo
May 2007
![]() |
That's because I refuse to let allegro.cc die. :heart:
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 |
GullRaDriel
Member #3,861
September 2003
![]() |
He's even making me post again ^^ "Code is like shit - it only smells if it is not yours" |
|