These are available in module
Return the exact truncation (rounding to zero) of number.
This is “safer” than simply
for some Guile versions.
(define scale 0.180281690140845) (inexact->exact scale) ⇒ 3247666210160131/18014398509481984 ; Guile 1.8.7 ⇒ 0 ; Guile 1.4.x (exact-truncate scale) ⇒ 0
Return the exact floor (rounding to negative infinity) of number.
Set default clip rect to rect, call thunk, and restore it. thunk is a procedure that takes no arguments.
Return a new 32bpp RGBA surface with dimensions w by h pixels.
The surface has flag
The masks are as follows:
red #x000000FF green #x0000FF00 blue #x00FF0000 alpha #xFF000000
Return a new 32bpp RGBA square surface with edge-len sides. (Both width and height are edge-len, an integer.)
Return a new surface made by rotating square by angle degrees.
The square retains its original size.
If the new surface has flag
src-alpha set, use
(sdl gfx) blit-rgba, otherwise
(sdl sdl) blit-surface,
for the resizing blit.
Optional arg mksquare is a procedure of one arg that creates a
square surface. If unspecified, use
roto-zoom-surface for interpretation of angle.
Return a closure that manages a single rectangle object.
Calling the closure with no args returns the rectangle object.
Otherwise, the messages
#:y return the rectangle’s width, height, horizontal
offset and vertical offset, respectively;
and the messages
#:y!, followed by an integer, update the rectangle’s
width, height, horizontal offset and vertical offset, respectively.
Optional arg rect specifies a rectangle object to manage instead of allocating a new one.
Return a rectangle made from parsing the geometry string spec,
which typically has the form
+X+Y is optional
(defaults to “+0+0”), and
integers. Actually, the
+ can also be a
-. If spec
cannot be parsed, return
(rectangle<-geometry-string "42x43+44+45") ⇒ #<SDL-Rect 42x43+44+45> (rectangle<-geometry-string "42x43-10-20") ⇒ #<SDL-Rect 42x43+-10+-20> (rectangle<-geometry-string "42x43") ⇒ #<SDL-Rect 42x43+0+0> (rectangle<-geometry-string "42") ⇒ #f
Note that the print representation of a rectangle always has “+”. The
term “geometry string” derives from the X Window System, where many
programs take a
-g for short) command-line
Return a procedure
P that checks the event queue for timeout
ms, polling every slice ms. If an event arrives during that time,
#t. Otherwise return
#f. Optional arg
get-timeout-events is either a list of events to be pushed on the
queue in the case of timeout, or a thunk to be called that produces such a
list. If get-timeout-events is specified, return the result of
another event queue polling. (This may still be
#f if the pushed
events are masked in some way.)
P is called with a single arg, a pre-constructed event object. This
interface is congruent with that of
Return a new rectangle with the same width and height as surface. Optional second and third arg (which must appear together or not at all) specifies the x and y components, respectively, to use instead of the default of 0 (zero).
Return a new rectangle copied from rect.
Optional second arg modify specifies which portions,
if any, to modify using the values in the rest args.
If modify is
#:xy, the two args specify
y values. If modify is
#:wh, the two args specify new
rect ⇒ #<SDL-Rect 3x4+1+2> (copy-rectangle rect) ⇒ #<SDL-Rect 3x4+1+2> (copy-rectangle rect #:xy 11 22) ⇒ #<SDL-Rect 3x4+11+22> (copy-rectangle rect #:wh 33 44) ⇒ #<SDL-Rect 33x44+1+2>
Create a new surface and blit surface onto it. The new surface has the same pixel format as surface. Return the new surface.
Optional second arg clip is a rectangle describing the portion of surface to copy (default is the entire surface).
Arrange to ignore all event types except those in types
(see event-type enums). As a special case, if types
#f, arrange to not ignore any event types (all are enabled).
In the following procs, those named ending with
three values, each a thunk (unless specified otherwise) handling the
three-phase calling convention, namely init, next, and
(call-with-values (lambda () (foo/3p ...)) (lambda (init! foo! done!) (init!) (let loop ((continue? (foo!))) (and continue? (loop (foo!)))) (done!)))
foo! returns non-
#f to indicate that the
looping is not yet complete.
Return three values, each a thunk, that can be used to loop for
sec seconds, blitting onto realized at location (a
#f to indicate the origin) the alpha-composition
of image and its replacement (both surfaces), to effect a
fade-in of replacement over image. The alpha value
is directly proportional to the time between the “next!” phase call
and the “init!” phase call.
realized may be either a surface, in which case at the end of each
loop it is shown via
update-rect; or a pair whose CAR is
a surface and whose CDR is a thunk that should do the showing.
Note that location is used for blitting, so its width and height should match those of image and replacement.
Return three values, the first a procedure of one arg, the other two
thunks, that can be used to toroidally pan surface by dx
and dy pixels. This means that data disappearing from one side
of the surface (left, right, top, bottom) is rotated to appear at the
other side (right, left, bottom, top). The
init! procedure takes
one arg count, the number of pans to do.
Positive dx moves surface data to the left (panning right), and likewise, positive dy, up (panning down).
Optional third arg sub is a rectangle object specifying a subset of the surface. The default is to pan the entire surface.
Optional fourth arg batch? non-
#f means to call
update-rect on the (sub)surface after all the panning is done.
The default is to update the surface after each pan. Batch mode is
useful for implementing variable-speed panning, for example:
(define (pan dir) (call-with-values (lambda () (toroidal-panner/3p screen (* dir 21) (* dir 12) #f #t)) (lambda (init! next! done!) (lambda (count) (init! count) (let loop ((continue? (next!))) (and continue? (loop (next!)))) (done!))))) (define pan-away (pan 1)) (define pan-back (pan -1)) (define ramp (map 1+ (append (make-list 21 0) (identity (iota 12)) (reverse! (iota 12)) (make-list 21 0)))) (for-each pan-away ramp) (for-each pan-back ramp)