JulNadeauCA / libagar

Cross-Platform GUI Toolkit (stable)
https://libagar.org/
BSD 2-Clause "Simplified" License
377 stars 41 forks source link

AG_Redraw() and AG_SchedEvent() do not function unless a actual interrupt is handle by AG_EventLoop #58

Closed WallyZambotti closed 1 year ago

WallyZambotti commented 3 years ago

Issuing AG_Redraw() requests are stacked but not processed in the event loop until such time that an actual interrupt (such as mouse motion) is handled by AG_EventLoop.

The same is true for AG_SchedEvent. AG_SchedEvent does not generate a timer event as described unless some other interrupt such as keyboard or mouse movement occurs.

Tested on versions 1.5.0 and 1.6.0. Version 1.5.0 produced unreliable intermittent results but on rare occasion did work!!! Version 1,6,0 never worked.

Attached source code demonstrates issue.

agartestredraw_c.txt

Compile command \:

cc agar-config --cflags agartestredraw.c -o agartestredraw agar-config --libs

Environment is Ubuntu 20,04, AGAR-1.6.0 (https://stable.hypertriton.com/agar/agar-1.6.0.tar.gz)

The program generates a simulated static display. The static should generate constantly but will only generate when the mouse is moved over the window.

JulNadeauCA commented 1 year ago

This is as expected. AG_Redraw() only sets the "dirty" flag on a Window and marks it as needing a graphics update, but it does not force an immediate redraw. The (AG_RedrawOn* family of functions can be used to force a redraw periodically or based on a particular condition. AG_WindowUpdate() can also be used to force an immediate redraw on an entire Window.