wizzomafizzo / lispbuilder

Automatically exported from code.google.com/p/lispbuilder
0 stars 0 forks source link

no official way to access the foreign SDL_Event #13

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I have to develop a CL binding to Agar (http://libagar.org) which is among
other things a GUI library that provides standard widgets in SDL/GL
contexts. To have SDL-Events processed by Agar one has to call the
following function:
  void AG_ProcessEvent(SDL_Event *event);
That means I need the foreign SDL_Event.

This, however, is effectively hidden away by the with-events macro. But, of
course, I don't want to implement another main loop facility if I am not
forced to do so. I'd like to keep with-events.

The SDL_Event is bound to a gensym-ed variable name in a let-form in
with-events. My current hack is to add an optional parameter to the
with-events macro definition after :poll/:wait and to use the specified
value as the varname instead of the gensym form if a value is specified.
That would probably suffice but I would have to distribute my with-events
hack along with my project when it's ready to be published.

Could you add an "official" facility to grab the SDL_Event?

Original issue reported on code.google.com by jakres on 29 Jan 2010 at 11:43

GoogleCodeExporter commented 9 years ago
Good suggestion. I will add this in the next day or so.

Original comment by Clruok...@gmail.com on 11 Feb 2010 at 10:03

GoogleCodeExporter commented 9 years ago
Thank you very much.

By the way it would be nice as well, if one could switch on the event type like
with-events does. For example, the cond wherein the handlers are expanded could 
be
outsourced into a separate macro. What do you think of this? Please tell me, if 
I
should create a separate issue ticket for it. But it depends on this ticket 
anyway.

Original comment by jakres on 16 Feb 2010 at 10:06

GoogleCodeExporter commented 9 years ago
Modified with-events as suggested;

(defmacro with-events ((&optional (type :poll) (sdl-event (new-event))) &body 
events)

Note that SDL-EVENT is freed automatically by WITH-EVENTS.

I'm not sure I understand your other request. Please describe in a little more 
detail 
in a separate issue.

Original comment by Clruok...@gmail.com on 26 Mar 2010 at 8:08

GoogleCodeExporter commented 9 years ago
Please use sdl:*sdl-event* to retrieve the current SDL_event.

Original comment by Clruok...@gmail.com on 27 Mar 2010 at 6:40