On Wed, May 26, 2010 at 09:53:25AM +0000, mike wrote: > Hi, > in "AG_SDL_GenericEventLoop", I find AG_WindowDraw will draw window in every > loop, even the window is valid. I want to know if i can realize the widget is > invalid before drawing it. because if drawing it in every time, it will waste > much source. So if i know it is valid, it will not be drew. > I know there is a invalid status for widget in some other GUI. And is there > the same one in agar? Further how to deal with the problem for some widgets, > which need not be drew again? > thanks
Hi, Thank you for your input. This has been just addressed in SVN (the fix will be included in the upcoming release). You can now check the "dirty" flag associated with the window structure to see if a redraw is necessary. The generic event loop now does this. The mechanism is a bit more complex than that of other GUIs, because Agar relies heavily on data bindings, as opposed to GUIs that are solely event driven. To accomodate this, a AG_RedrawOnChange() function was implemented so widgets can register timers monitoring given binding values at specific intervals, triggering a redraw whenever a change is detected. Widgets code can also use AG_Redraw() to trigger an unconditional redraw. On a related note, if you're using the AG_Textbox or AG_Editable widgets on strings that are not externally modified, make sure to pass the AG_TEXTBOX_STATIC or AG_EDITABLE_STATIC flag. This prevents periodical redrawing, as well as some expensive character set conversions. _______________________________________________ Agar mailing list [email protected] http://libagar.org/lists.html
