Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[PATCH] library/sdl_types.imc #2

7 views
Skip to first unread message

Jens Rieks

unread,
Feb 13, 2004, 12:21:19 PM2/13/04
to chromatic, perl6-i...@perl.org
Hi,

This patch fixes _SDL_WaitEvent a bit; SDL_WaitEvent returns an integer and
not a SDL_Event.
It also introduces _SDL_PollEvent which is mostly a copy of _SDL_WaitEvent.
Finally, _SDL_loop is modified to allow an "idle" event entry that gets called
if no events are pending. If such an event is defined, _SDL_PollEvent is used
to check whether events are pending. The idle callback is made every 50ms,
"timer callback" might be a better name.

Maybe it can even be extenended to a more general timer callback; SDL supports
timer itself, but the problem that C callbacks are not yet supported well
enough.

It is also necessary to add code for SDL_PollEvent to library/sdl.pasm.
I propose to rename this file to sdl_init.pasm; I'am working on a sdl.imc file
that makes it much easier to use SDL with PIR, because it hides much of the
'internals'. I will send the file to the list in a few minutes (the
documentation if not yet sufficient at the moment).

jens

sdl_types.patch

Chromatic

unread,
Feb 18, 2004, 11:45:19 PM2/18/04
to Jens Rieks, perl6-i...@perl.org
On Fri, 2004-02-13 at 09:21, Jens Rieks wrote:

> This patch fixes _SDL_WaitEvent a bit; SDL_WaitEvent returns an integer and
> not a SDL_Event.
> It also introduces _SDL_PollEvent which is mostly a copy of _SDL_WaitEvent.
> Finally, _SDL_loop is modified to allow an "idle" event entry that gets called
> if no events are pending. If such an event is defined, _SDL_PollEvent is used
> to check whether events are pending. The idle callback is made every 50ms,
> "timer callback" might be a better name.

Thanks, applied with a few tweaks.

We can figure out a slightly nicer interface as we start to use it in
real PIR programs -- and from higher level languages.

> It is also necessary to add code for SDL_PollEvent to library/sdl.pasm.

Done.

> I propose to rename this file to sdl_init.pasm; I'am working on a sdl.imc file
> that makes it much easier to use SDL with PIR, because it hides much of the
> 'internals'. I will send the file to the list in a few minutes (the
> documentation if not yet sufficient at the moment).

I'm not sure of the best way to organize these. Maybe we should wait
until object support improves. On the other hand, I would like to see
how Perl 6 or Pirate would call these libraries before commiting one way
or the other.

-- c

Jens Rieks

unread,
Feb 19, 2004, 9:00:21 PM2/19/04
to chromatic, perl6-i...@perl.org
Hi,

Am Donnerstag, 19. Februar 2004 05:45 schrieb chromatic:
> On Fri, 2004-02-13 at 09:21, Jens Rieks wrote:
> > This patch fixes _SDL_WaitEvent a bit; SDL_WaitEvent returns an integer
> > and not a SDL_Event.
> > It also introduces _SDL_PollEvent which is mostly a copy of
> > _SDL_WaitEvent. Finally, _SDL_loop is modified to allow an "idle" event
> > entry that gets called if no events are pending. If such an event is
> > defined, _SDL_PollEvent is used to check whether events are pending. The
> > idle callback is made every 50ms, "timer callback" might be a better
> > name.
>
> Thanks, applied with a few tweaks.

Their is a "branch _poll" missing after the _idle block. Without it,
_SDL_WaitEvent is called after the first idle call.
A patch is attached.

> We can figure out a slightly nicer interface as we start to use it in
> real PIR programs -- and from higher level languages.
>
> > It is also necessary to add code for SDL_PollEvent to library/sdl.pasm.
>
> Done.
>
> > I propose to rename this file to sdl_init.pasm; I'am working on a sdl.imc
> > file that makes it much easier to use SDL with PIR, because it hides much
> > of the 'internals'. I will send the file to the list in a few minutes
> > (the documentation if not yet sufficient at the moment).
>
> I'm not sure of the best way to organize these. Maybe we should wait
> until object support improves. On the other hand, I would like to see
> how Perl 6 or Pirate would call these libraries before commiting one way
> or the other.
> -- c

jens

sdl_types.patch

Chromatic

unread,
Feb 19, 2004, 10:33:25 PM2/19/04
to Jens Rieks, perl6-i...@perl.org
On Thu, 2004-02-19 at 18:00, Jens Rieks wrote:

> Their is a "branch _poll" missing after the _idle block. Without it,
> _SDL_WaitEvent is called after the first idle call.
> A patch is attached.

Thanks, applied.

-- c

0 new messages