[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] Updated sdl.egg
From: |
Alex Shinn |
Subject: |
Re: [Chicken-users] Updated sdl.egg |
Date: |
Mon, 25 Oct 2004 02:00:03 -0500 |
User-agent: |
Wanderlust/2.10.1 (Watching The Wheels) SEMI/1.14.6 (Maruoka) FLIM/1.14.6 (Marutamachi) APEL/10.6 Emacs/21.3 (i386-pc-linux-gnu) MULE/5.0 (SAKAKI) |
At Sun, 24 Oct 2004 12:00:43 +0100, Tony Garnock-Jones wrote:
>
> v0.1.1 alpha - new functions for SDL_image and SDL_rotozoom.
Hi! Thanks a lot for the SDL bindings, I've been meaning to do this
myself but haven't had time. I can help you test though ;)
A few comments:
For the naming convention you translate SDL_StudlyCaps into
sdl-studlycaps, but sdl-studly-caps is more Schemey, and is also the
naming style used in both guile-sdl and gauche-sdl.
It would be a nice shorthand to be able to say
(make-sdl-color r g b)
instead of
(fill-sdl-color! (make-sdl-color) r g b)
You have a comment on line 215 of sdl.scm:
;; %%% clip_rect?
Setting a clip rect means restricting all changes to a specific
rectangle within a surface. It's very useful for animations and
sprite operations, and should definitely be included. A quick
implementation would be something like:
(define sdl-set-clip-rect
(foreign-lambda unsigned-short "SDL_SetClipRect" SDL_Surface SDL_Rect))
(define sdl-get-clip-rect
(foreign-lambda* SDL_Rect ((SDL_Surface s))
"SDL_Rect *r;"
"r = (SDL_Rect *) malloc(sizeof(SDL_Rect));"
"SDL_GetClipRect(s, r);"
"return r;"))
but this fails to handle NULL rects (used for disabling the clip rect)
correctly.
A handy idiom with clip rects is the following utility:
(define (sdl-with-clip-rect r thunk)
(let* ((s (sdl-getvideosurface))
(orig-clip-rect (sdl-get-clip-rect s)))
(dynamic-wind
(lambda () (sdl-set-clip-rect s r))
thunk
(lambda () (sdl-set-clip-rect s orig-clip-rect)))))
which could optionally take 3 arguments with the 1st argument being
the surface.
Thanks again!
--
Alex