On Aug 18, 12:46 pm, René Dudfield <[email protected]> wrote:
> However the event processing is not.  You can store all events up to
> each frame, and then only look at the events you care about each
> frame.  Your handle_events method for the imgui can run at a separate
> frequency to the graphics display.  This would set up the structures
> where you imgui calls can inspect the previous frames events if they
> need to.
>
> if button(16, 16, "press me!"):
>     print 'hello, world!'
For N events in the queue you have to call imgui code N times in the
event path (which somehow is some sort of context) and 1 time to draw
in draw path. Otherwise you'd loose events (like doubleclicks between
a frame).

Retained state between frames is a problem because you need to
remember it somewhere (like the button state). The proposed solution
to this is having a unique ID for each element that you can query out
of the context to hold the state. That's fairly fine for a single
button, but if you say draw your buttons from a loop or something it
becomes unpretty:

if button(context=context, id='mybutton', 16, 16, 'label'):
    for item in somedata:
        button(context=context, id='loop for somedata: %s' % id(item),
label=item.text)

Where it becomes completely hairy is how to implement layouts. Layouts
with inner-restrictions are still fairly doable, you just have to
commit to draw your stuff in exactly the right order as the layout can
use it (though luck if you don't happen to keep your data in exactly
the same order as the GUI). Layout with outer constraints, where you
might need to figure out offsets/sizes based on how elements push you
around left/right/top/down are virtually impossible to do.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/pyglet-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to