Demo: User events
Create a demo file about how to use sdl2:user-event. The demo should cover topics such as:
- Registering new event type symbols (
register-event!
). - Allocating, initializing, and pushing a user event onto the SDL2 event queue (
alloc-event
,event-type-set!
,push-event!
). - Various ways to use the event's code, data1, and data2 fields.
- Evicting data and storing a pointer, then retrieving it later (
object-evict
,object->pointer
,pointer->object
,object-release
). Explain that evicted data is copied, and the user should only store small, simple data structures in the data fields. - Storing a symbol in the data fields, then using that symbol as a key to a global hash table.
- Using the two pointer addresses to carry integers.
- Evicting data and storing a pointer, then retrieving it later (
See also issue #18.