Abstract
LISPBUILDER-SDL comprises several of packages that allow game development using Common Lisp. LISPBUILDER-SDL provides a set of bindings and Lispy abstractions for SDL and other graphics, sound, physics, character animation and 3D libraries. LISPBUILDER-SDL core functionality includes window and event management, 2D graphics, 3D graphics using OpenGL and sound support. The goal for the LISPBUILDER-SDL project is to become a useful resource for the development of games in Lisp.
SDL provides the low-level 2D rendering support. LISPBUILDER-SDL adds 2D graphical effects such as rotation, rendering circles, polygons, squares, Bezier and Cuttmull-Rom curves as well as bitmap font support. Additional packages provide native C drawing functions, True Type font rendering, loading of multiple image formats, a sound mixer and networking support. The lispbuilder packages are meant to work together with each package providing a specific core set of functionality. For example, an image that is loaded by lispbuilder-sdl-image may be rotated using lispbuilder-sdl-gfx. Text may be rendered to a surface using lispbuilder-sdl-ttf and finally blitted to the display using lispbuilder-sdl.
- lispbuilder-sdl-gfx: 2D graphical effects such as zooming, rotation, circles, polygons and squares, using SDL_gfx
- lispbuilder-sdl-image: Support for multople image formats such as PNG and JPG, using SDL_image
- lispbuilder-sdl-mixer: Sound mixing, using SDL_mixer a multi-channel audio mixer library
- lispbuilder-sdl-ttf: True-type font rendering, using SDL_ttf
- lispbuilder-sdl-net: Networking, using SDL_net a cross-platform, blocking network library
Current Version: The version of LISPBUILDER-SDL to use is the latest version in SVN.
This example was created with the following code:
(sdl:with-init () (sdl:window 320 240) (sdl:draw-surface (load-image "lisp.bmp")) (sdl:update-display) (sdl:with-events () (:quit-event () t) (:video-expose-event (sdl:update-display))))
The following table describes the status of LISPBUILDER-SDL on the major Common Lisp implementations:
Lisp Implementation | LISPBUILDER-SDL Status | Comments | ||
---|---|---|---|---|
Win32 | Linux | MacOS | ||
CLISP v2.38 | Working | Working | Working | |
Lispworks v4.4.6 Personal | Working | Working | Working | |
Allegro Express 8.0 | Unknown | Working | Unknown | |
OpenMCL | NA | NA | Unknown | |
SBCL | Working | Working | Unknown | |
CMUCL | Not Working | Not Working | Not Working |
See the LISPBUILDER documentation for downloads.
See the LISPBUILDER documentation for installation instructions.
Enter the following at the REPL to compile and load the LISPBUILDER-SDL package:
(asdf:operate 'asdf:load-op :lispbuilder-sdl)ASDF will take care of loading the CFFI and :LISPBUILDER-SDL dependencies. The SDL.dll library will also be loaded into the Lisp image at this time.
Enter the following at the REPL to compile and load the examples included in the LISPBUILDER-SDL-EXAMPLES package:
(asdf:operate 'asdf:load-op :lispbuilder-sdl-examples)
Run the examples by entering any of the following at the REPL:
(SDL-EXAMPLES:BEZIER) (SDL-EXAMPLES:BMP-SAMPLE) (SDL-EXAMPLES:CIRCLE-1) (SDL-EXAMPLES:CIRCLE-2) (SDL-EXAMPLES:CIRCLE-3) (SDL-EXAMPLES:CIRCLE-4) (SDL-EXAMPLES:CIRCLE-5) (SDL-EXAMPLES:DISTANCE-2D) (SDL-EXAMPLES:FLOOD-FILL) (SDL-EXAMPLES:INBUILT-FONTS) (SDL-EXAMPLES:LINE-DRAWING) (SDL-EXAMPLES:MANDELBROT) (SDL-EXAMPLES:METABALLS) (SDL-EXAMPLES:MOUSE-2D) (SDL-EXAMPLES:MOUSE-PAINTER) (SDL-EXAMPLES:PIXELS-1) (SDL-EXAMPLES:PIXELS-2) (SDL-EXAMPLES:PIXELS-3) (SDL-EXAMPLES:PIXELS-4) (SDL-EXAMPLES:POINTS-AND-LINES) (SDL-EXAMPLES:RANDOM-RECTS) (SDL-EXAMPLES:RANDOM-BOX-1) (SDL-EXAMPLES:RANDOM-BOX-2) (SDL-EXAMPLES:RANDOM-BOX-3) (SDL-EXAMPLES:RANDOM-BOX-4) (SDL-EXAMPLES:RECURSIVE-RECTS) (SDL-EXAMPLES:SETUP-AND-DRAW) (SDL-EXAMPLES:SIMPLE-FONT-DEMO) (SDL-EXAMPLES:STROKE) (SDL-EXAMPLES:VERTICES) (SDL-EXAMPLES:WIDTH-HEIGHT)
None.
LISPBUILDER-SDL is distributed under the MIT-style license.
Functions and symbols exported from the LISPBUILDER-SDL package are
accessible from the LISPBUILDER-SDL:
prefix or the
shorter form SDL:
nickname.
The cffi/
directory contains the raw CFFI bindings.
These bindings may be automatically generated by SWIG or created by hand.
CFFI translation functions perform simple low-level conversions for example,
converting Lisp strings to C strings and back (see cffi-translate.lisp
).
All functions in cffi/
accept and return foreign objects only.
The base/
directory defines wrappers over the functions in cffi/
.
The functions in base/
accept keyword arguments and accept NIL instead
of CFFI:NULL-POINTER where appropriate. Generally functions in base/
accept and return foreign
objects. base/
may perform some type checks (IS-VALID-PTR SURFACE) but
this layer is meant to be lean. Someone who implements a graphics engine
might use this layer instead of sdl/
if speed is a concern.
There are no fancy drawing primitives in this layer.
The sdl/
directory defines the abstractions over cffi/
and base/
.
Foreign objects are passed around sdl/
neatly wrapped in CLOS objects, using TRIVIAL-GARBAGE for
automatic garbage collection (minimize foreign objects being left on the
heap). There are no functions in sdl/
that accept or return foreign
objects (with the exception of the functions that create the CLOS
wrapper objects) Functions in sdl/
call down into
cffi/
and base/
as appropriate. All LISPBUILDER-SDL symbols available in
SDL:
are exported from sdl/
, with symbols imported into sdl/
from
cffi/
and base/
as appropriate (e.g. WITH-EVENTS). All drawing primitives are
defined in this layer; circles, rectangles, lines, triangles, with-bezier etc.
Functions in sdl/
implement a lot of type checking.
An example of the difference between base/
and sdl/
is
WITH-RECTANGLE. The WITH-RECTANGLE macro in base/
creates and destroys a foreign
SDL_Rect. The WITH-RECTANGLE macro in sdl/
will create and destroy
a RECTANGLE object.
The SDL library and SDL subsystems must be initialized prior to use. This is handled automatically when using the macro WITH-INIT. WITH-INIT also uninitialises the SDL library upon exit. More detailed information on the LISPBUILDER-SDL initialisation process can be found in the documentation for WITH-INIT.
(WITH-INIT (SDL-INIT-VIDEO) ...)
A window must be created to display any kind of output. A window of a specific pixel width and height is created using the function WINDOW. WINDOW takes additional keyword parameters to set the requested video mode, color bit depth, the window title and the icon title. More detailed information can be found in in the documentation for WINDOW.
(WITH-INIT (SDL-INIT-VIDEO) (WINDOW 320 240))
LISPBUILDER-SDL provides the WITH-EVENTS macro that simplifies the game loop and handling SDL events. Event handlers are defined by specifying the event type a well as an optional list of fields specific to that event.
More detailed information on all SDL events (Keyboard events, Joystick events, User events etc.) can be found in in the documentation for WITH-EVENTS.
For example, to process the current x and y mouse position when the mouse is moved:
(:MOUSE-MOTION-EVENT (:X X-POS :Y Y-POS) ...)
Or to process the x and y relative mouse positions when the mouse is moved:
(:MOUSE-MOTION-EVENT (:X-REL relative-x :Y-REL relative-y) ...)
The only event that must be handled with WITH-EVENTS is the :QUIT-EVENT. If :QUIT-EVENT is ignored then it is impossible for the user to close the SDL Window or exit the game loop.
(WITH-EVENTS () (:QUIT-EVENT () T) (:MOUSE-MOTION-EVENT (:X mouse-x :Y mouse-y) ...))
In addition to handling events, WITH-EVENTS also manages the game loop. Introducing the :IDLE event. :IDLE, although not technically an actual event, is executed once per game loop after all events have been processed in the SDL event queue. :IDLE is where the user can place code that needs to be executed once per game loop and that is not 'event' driven. This code may involve updating world physics, updating the state of game objects and rendering sprites to the display.
(WITH-EVENTS () (:QUIT-EVENT () T) (:MOUSE-MOTION-EVENT (:X mouse-x :Y mouse-y) ...) (:IDLE () (UPDATE-DISPLAY)))
WITH-EVENTS can also limit execution of the the game loop to a specific number
of iterations a second using FRAME-RATE. This effectively limits the number of
frames displayed per second. To set the frame rate to 60 frames per second,
(SETF (SDL:FRAME-RATE) 60)
. To unlock the frame rate effectively running the game loop as fast
as the CPU will allow set the FRAME-RATE to NIL, (SETF (SDL:FRAME-RATE) NIL)
The SDL display surface needs to be updated once per game loop, as described in the section SDL Display.
(SETF (FRAME-RATE) 30) (WITH-EVENTS () ...)
LISPBUILDER-SDL supports the SDL RECTANGLE and COLOR primitives. These are described below.
A new rectangle is created by the function RECTANGLE. The function RECTANGLE-FROM-EDGES will create a new rectangle from the specified top left and bottom right coordinates. The function RECTANGLE-FROM-MIDPOINT-* will create a new rectangle from midpoint.
The macros WITH-RECTANGLE and WITH-RECTANGLEs will create a new rectangle and free this rectangle when it goes out of scope.
The rectangle position and width and height can be inspected and modified using the following functions: X, Y, WIDTH and HEIGHT. X2 and Y2 will return the (+ x width) and (+ y height) of the rectangle respectively.
Additional functions that operate on rectangles are as follows:
A new SDL color is created by COLOR, returning either a new RGB or RGBA color.
RGB/A color componets can be manipulated using the functions R, G, B, A, SET-COLOR and SET-COLOR-*. Two colors may be compared using COLOR=.
Functions that accept a color parameter will most likely bind color to *DEFAULT-COLOR* when unspecified. The macro WITH-COLOR will bind a color to *DEFAULT-COLOR* within the scope of this macro. When *DEFAULT-COLOR* is bound to a color, all subsequent drawing functions will use this implied color while it remains in scope.
Additional functions that operate on colors are as follows:
LISPBULDER-SDL contains several predefined colors; *BLACK*, *WHITE*, *RED*, *GREEN*, *BLUE*, *YELLOW*, *CYAN*, *MAGENTA*.
LISPBUILDER-SDL provides low-level drawing support for several primitives. Most primitives can be drawn with or without alpha transparency. In addition, the filled primitives can be drawn with a single pixel outline (or stroke) that is a different color to the fill color.
Drawing functions require a target surface and color. LISPBUILDER-SDL uses defaults for both target surface (*DEFAULT-SURFACE*) and color (*DEFAULT-COLOR*) unless these are otherwise specified by the user. The macros with-surface, and with-surfaces will bind a surface to *DEFAULT-SURFACE* within the scope these macros. For example, instead of specifying a target surface for each draw-* function a user may bind *DEFAULT-SURFACE* to a surface once and subsequent draw-* functions will use this implied surface while it remains in scope.
(DRAW-POINT (sdl:point :x x1 :y y1) :surface a-surface :color *white*) (DRAW-POINT (sdl:point :x x2 :y y2) :surface a-surface :color *white*) (DRAW-POINT (sdl:point :x x3 :y y3) :surface a-surface :color *white*) (DRAW-POINT (sdl:point :x x4 :y y4) :surface a-surface :color *white*)
Now, we use WITH-SURFACE to bind a surface to *DEFAULT-SURFACE*.
(WITH-SURFACE (a-surface) (DRAW-POINT (sdl:point :x x1 :y y1) :color *white*) (DRAW-POINT (sdl:point :x x2 :y y2) :color *white*) (DRAW-POINT (sdl:point :x x3 :y y3) :color *white*) (DRAW-POINT (sdl:point :x x4 :y y4) :color *white*))
We can use WITH-COLOR to bind *DEFAULT-COLOR* to *WHITE*:
(WITH-SURFACE (a-surface) (WITH-COLOR (*white*) (DRAW-POINT (sdl:point :x x1 :y y1)) (DRAW-POINT (sdl:point :x x2 :y y2)) (DRAW-POINT (sdl:point :x x3 :y y3)) (DRAW-POINT (sdl:point :x x4 :y y4)))
Finally, if the target surface is the display then *WITH-SURFACE* is not required as :SURFACE when NIL will be bound to *DEFAULT-DISPLAY* as a default. So the above code can be shortened as follows:
(WITH-COLOR (*white*) (DRAW-POINT (sdl:point :x x1 :y y1)) (DRAW-POINT (sdl:point :x x2 :y y2)) (DRAW-POINT (sdl:point :x x3 :y y3)) (DRAW-POINT (sdl:point :x x4 :y y4)))
LISPBUILDER-SDL contains several bitmap fonts of different sizes and faces (italics/bolded). See INITIALISE-FONT for the complete list of built-in fonts.
Fonts are initialised using INITIALISE-DEFAULT-FONT, or INITIALISE-FONT. The resouces allocated to a font are freed by FREE-FONT. A font must be initialised prior to use.
LISPBUILDER-SDL provides the macros WITH-DEFAULT-FONT and WITH-FONT for the above functions that bind *DEFAULT-FONT* to font within the scope of the macro.
LISPBUILDER-SDL supports the rendering of colored text over a transparent background (Solid rendering), and the rendering of colored text over a solid colored background (Shaded rendering). Text may be left, right or center justified. Text can be drawn directly to a target surface using DRAW-STRING-SOLID and DRAW-STRING-SHADED. Text can be rendered to a new surface of character height and string width using RENDER-STRING-SOLID and RENDER-STRING-SHADED. This new surface may be optionally cached in the font object. A cached surface font can be accessed using CACHED-SURFACE) and can be blitted to a target surface using DRAW-FONT.
The font rendering functions accept a font object. This font parameter is bound to *DEFAULT-FONT* when unspecified. The function INITIALISE-DEFAULT-FONT and the macros WITH-FONT and WITH-DEFAULT-FONT will bind a font to *DEFAULT-FONT* within the scope of these macros. When *DEFAULT-FONT* is bound to a font, all subsequent font drawing or font rendering functions will use this implied font while it remains in scope.
(WITH-COLOR (*WHITE*) (WITH-FONT (*FONT-8x8*) (DRAW-STRING-SOLID-* "Font is 8x8." 10 10) (WITH-FONT (*FONT-10x20*) (DRAW-STRING-SOLID-* "Font is 10x20." 10 20)) (DRAW-STRING-SOLID-* "Font is 8x8 again." 10 40)))
An SDL surface, SURFACE, represents an area of graphical memory that can be drawn or rendered to, for example the video framebuffer or an image that is loaded from disk.
A surface is created:
Functions that accept a surface parameter will most likely bind surface to *DEFAULT-SURFACE* when unspecified. The macros WITH-SURFACE and WITH-SURFACES will bind a surface to *DEFAULT-SURFACE* within the scope of these macro. When *DEFAULT-SURFACE* is bound to a surface, all subsequent drawing functions will use this implied surface while it remains in scope.
A surface can be explicitely freed by calling FREE-SURFACE.
BMP images are loaded from disk using LOAD-IMAGE. Support for additional image formats is provided in the LISPBUILDER-SDL-IMAGE package. A surface is saved to disk as a BMP image using SAVE-IMAGE.
(DRAW-SURFACE (LOAD-IMAGE "sdl.bmp") :surface *default-display*)
A SURFACE stores its own position X/Y coordinates. These coordinates can be inspected and modified using the following functions: X, Y, WIDTH and HEIGHT.
Additional functions and macros that manage surface coordinates are as follows:
The functions BLIT-SURFACE and DRAW-SURFACE will blit or draw a source surface onto a destination surface using the position coordinates stored in the source surface. DRAW-SURFACE-AT will draw the source surface at a specified position.
The composition rules that determine how the source surface is composed over the destination surface are described in the description of BLIT-SURFACE. FILL-SURFACE fill will the target surface with a single color. Drawing Primitives describes how *DEFAULT-SURFACE* is used when calling blitting operations.
Use SET-COLOR-KEY, CLEAR-COLOR-KEY and SET-ALPHA to modify the key color and alpha transparency properties of a surface after the surface has been created.
Set a clipping rectangle to limit the draw area on a destination surface. The clipping rectangle for a surface is manipulated using GET-CLIP-RECT and SET-CLIP-RECT. When this surface is the destination of a blit, only the area within the clip rectangle will be drawn into.
Set a cell rectangle to limit the surface area on the source surface. The cell rectangle for a surface is manipulated using CLEAR-CELL and SET-CELL. When this surface is the source of a blit, only the areas within the cell rectangle will be used. The cell is useful when only a small area of the source surface needs to be blitted to the destination surface. For example a sequence of images composed into a single sprite sheet and only the current frame of animation is to be drawn to the display at any one time.
The functions UPDATE-DISPLAY and UPDATE-SURFACE update the SDL display surface (or OpenGL context) and general SDL surfaces respectively.
The SDL display surface must be updated at least once each game loop using the function UPDATE-DISPLAY. This function will call SDL-GL-SWAP-BUFFERS to update the OpenGL display, or SDL-FLIP to update the SDL surface depending on the current *OPENGL-CONTEXT*. The display can be filled with a background color using CLEAR-DISPLAY.
The properties of an SDL surface can be queried using SURFACE-INFO. The properties of the SDL display and video hardware can be queried using VIDEO-INFO. The screen resolutions supported by a particular set of video flags can be retrieved using LIST-MODES. A pointer to the native SDL window can be retrieved using GET-NATIVE-WINDOW. The name of the video driver can be retrieved as a STRING using VIDEO-DRIVER-NAME.
The the current state of the cursor is returned using QUERY-CURSOR, and is set using SHOW-CURSOR.
Putting this all together, we can write short example showing a white rectangle that follows the users mouse movements within an SDL Window. Exit the example by closing the window or pressing the Esc key on the keyboard.
;; Initialise SDL and the Video subsystem (WITH-INIT (SDL-INIT-VIDEO) (WINDOW 320 240) ; Open a window, 320 x 240 (SETF (FRAME-RATE) 30) ; Lock the frame rate to 30 fps (WITH-EVENTS () (:QUIT-EVENT () T) ; Absolutely have to handle the :QUIT-EVENT (:KEY-DOWN-EVENT (:KEY key) (WHEN (KEY= key :SDL-KEY-ESCAPE) (PUSH-QUIT-EVENT))) (:MOUSE-MOTION-EVENT (:X mouse-x :Y mouse-y) (CLEAR-DISPLAY *black*) ;; Draw the box with center at the mouse x/y coordinates. (DRAW-BOX-* (- mouse-x (/ 50 2)) (- mouse-y (/ 50 2)) 50 50 :color *white*)) (:IDLE () (UPDATE-DISPLAY))))
...
*black*
*blue*
*cyan*
*default-color*
*default-display*
*default-font*
*default-font-path*
*default-position*
*default-rectangle*
*default-surface*
*external-init-on-startup*
*external-quit-on-exit*
*font-10x20*
*font-5x7*
*font-5x8*
*font-6x10*
*font-6x12*
*font-6x13*
*font-6x13b*
*font-6x13o*
*font-6x9*
*font-7x13*
*font-7x13b*
*font-7x13o*
*font-7x14*
*font-7x14b*
*font-8x13*
*font-8x13b*
*font-8x13o*
*font-8x8*
*font-9x15*
*font-9x15b*
*font-9x18*
*font-9x18b*
*green*
*magenta*
*opengl-context*
*red*
*sdl-initialized*
*white*
*yellow*
a
all-integers?
any-color-but-this
b
bit-depth
blit-surface
cached-surface
calculate-curve
cast
cast-all-to-int
cast-to-int
catmull-rom-spline
char-height
char-width
check-types
clear-cell
clear-color-key
clear-display
color
color
color-*
color-a
color=
convert-surface
copy-point
copy-surface
create-list-if-not
create-path
create-rwops-from-file
create-surface
distance
distance-*
draw-bezier
draw-box
draw-box-*
draw-circle
draw-circle-*
draw-curve
draw-filled-circle
draw-filled-circle-*
draw-font
draw-font
draw-font-at
draw-font-at-*
draw-hline
draw-line
draw-line-*
draw-point
draw-point-*
draw-polygon
draw-rectangle
draw-rectangle-*
draw-shape
draw-string-shaded
draw-string-shaded-*
draw-string-solid
draw-string-solid-*
draw-surface
draw-surface-at
draw-surface-at-*
draw-trigon
draw-vline
fill-surface
fill-surface-*
flood-fill
flood-fill-*
flood-fill-stack
flood-fill-stack-*
fp
fp-cell
fp-position
frame-rate
free-cached-surface
free-color
free-font
free-rectangle
free-rwops
free-surface
g
get-clip-rect
get-native-window
get-point
get-position
get-rectangle
get-surface-rect
height
init-sdl
init-sub-systems
initialise-default-font
initialise-font
initialize-on-startup
initialized-sub-systems-p
is-valid-ptr
key=
list-modes
list-sub-systems
load-image
map-color
pack-color
point
point-*
position-*
push-quit-event
push-user-event
query-cursor
quit-on-exit
quit-sdl
quit-sub-systems
r
random+1
random-rectangle
read-point
rectangle
rectangle
rectangle-*
rectangle-from-edges
rectangle-from-edges-*
rectangle-from-midpoint-*
render-string-shaded
render-string-solid
return-sub-systems-of-status
rotate-surface
rwops
save-image
sdl-any-format
sdl-async-blit
sdl-color
sdl-doublebuf
sdl-fullscreen
sdl-get-ticks
sdl-hw-accel
sdl-hw-palette
sdl-hw-surface
sdl-init-audio
sdl-init-cdrom
sdl-init-eventthread
sdl-init-everything
sdl-init-joystick
sdl-init-noparachute
sdl-init-on-startup
sdl-init-timer
sdl-init-video
sdl-iyuv-overlay
sdl-no-frame
sdl-opengl
sdl-pre-alloc
sdl-quit-on-exit
sdl-resizable
sdl-rle-accel
sdl-rle-accel-ok
sdl-src-alpha
sdl-src-color-key
sdl-surface
sdl-sw-surface
sdl-uyvy-overlay
sdl-yuy2-overlay
sdl-yv12-overlay
sdl-yvyu-overlay
set-alpha
set-cell
set-cell-*
set-clip-rect
set-color
set-color-*
set-color-key
set-frame-rate
set-point
set-point-*
set-position
set-position-*
set-rectangle
set-rectangle-*
set-surface
set-surface-*
show-cursor
surface
surface
surface-info
to-degree
to-radian
update-display
update-surface
update-surface-*
video-driver-name
video-info
width
window
with-bezier
with-color
with-curve
with-default-font
with-events
with-font
with-init
with-locked-surface
with-locked-surfaces
with-point
with-rectangle
with-rectangles
with-shape
with-surface
with-surface-slots
with-surfaces
within-range
within-range-*
x
x2
y
y2
[Special variable]
*black*
The
COLOR
black.
[Special variable]
*blue*
The
COLOR
blue.
[Special variable]
*cyan*
The
COLOR
cyan.
[Special variable]
*default-color*
Functions that accept the
KEY
word parameterCOLOR
will most likely bind to the symbol*DEFAULT-COLOR*
ifCOLOR
is not specified, automatically using whatever color is referenced by*DEFAULT-COLOR*
.A color is bound to
*DEFAULT-COLOR*
by the following macro: WITH-COLOR.Example
(DRAW-BOX A-BOX :SURFACE SDL:DEFAULT-DISPLAY* :COLOR SDL:*BLACK*) (DRAW-BOX B-BOX :SURFACE SDL:DEFAULT-DISPLAY* :COLOR SDL:*BLACK*) (DRAW-BOX C-BOX :SURFACE SDL:DEFAULT-DISPLAY* :COLOR SDL:*BLACK*)
The above can be shortened by setting
*DEFAULT-COLOR*
to*BLACK*
.(WITH-SURFACE (DISP SDL:*DEFAULT-DISPLAY*) (WITH-COLOR (COL SDL:*BLACK*) (DRAW-BOX A-BOX) (DRAW-BOX B-BOX) (DRAW-BOX C-BOX)))
[Special variable]
*default-display*
The symbol
*DEFAULT-DISPLAY*
is bound to the current display surface DISPLAY-SURFACE) by the function WINDOW).
[Special variable]
*default-font*
[Special variable]
*default-font-path*
[Special variable]
*default-position*
[Special variable]
*default-rectangle*
[Special variable]
*default-surface*
Functions that accept the
KEY
word parameterSURFACE
will most likely bind to the symbol*DEFAULT-SURFACE*
ifSURFACE
is not specified, automatically using whatever surface is referenced by*DEFAULT-SURFACE*
.A surface is bound to
*DEFAULT-SURFACE*
by the following macros: WITH-SURFACE, and WITH-SURFACES.Example
(DRAW-SURFACE SURF-1 :SURFACE SDL:*DEFAULT-DISPLAY*) (DRAW-SURFACE SURF-2 :SURFACE SDL:*DEFAULT-DISPLAY*) (DRAW-SURFACE SURF-2 :SURFACE SDL:*DEFAULT-DISPLAY*)
The above can be shortened using by setting the
*DEFAULT-SURFACE*
to the display surface.(WITH-SURFACE (DISP SDL:*DEFAULT-DISPLAY*) (DRAW-SURFACE SURF-1) (DRAW-SURFACE SURF-2) (DRAW-SURFACE SURF-2))
[Special variable]
*external-init-on-startup*
The list of functions that are called from INIT-SDL.
[Special variable]
*external-quit-on-exit*
The list of functions that are called from QUIT-SDL.
[Special variable]
*font-10x20*
Contains the font data for an 10x20 bitmap font.
[Special variable]
*font-5x7*
Contains the font data for an 5x7 bitmap font.
[Special variable]
*font-5x8*
Contains the font data for an 5x8 bitmap font.
[Special variable]
*font-6x10*
Contains the font data for an 6x10 bitmap font.
[Special variable]
*font-6x12*
Contains the font data for an 6x12 bitmap font.
[Special variable]
*font-6x13*
Contains the font data for an 6x13 bitmap font.
[Special variable]
*font-6x13b*
Contains the font data for an 6x13 bitmap font.
[Special variable]
*font-6x13o*
Contains the font data for an 6x13 bitmap font.
[Special variable]
*font-6x9*
Contains the font data for an 6x9 bitmap font.
[Special variable]
*font-7x13*
Contains the font data for an 7x13 bitmap font.
[Special variable]
*font-7x13b*
Contains the font data for an 7x13 bitmap font.
[Special variable]
*font-7x13o*
Contains the font data for an 7x13 bitmap font.
[Special variable]
*font-7x14*
Contains the font data for an 7x14 bitmap font.
[Special variable]
*font-7x14b*
Contains the font data for an 7x14 bitmap font.
[Special variable]
*font-8x13*
Contains the font data for an 8x13 bitmap font.
[Special variable]
*font-8x13b*
Contains the font data for an 8x13 bitmap font.
[Special variable]
*font-8x13o*
Contains the font data for an 8x13 bitmap font.
[Special variable]
*font-8x8*
Contains the font data for an 8x8 bitmap font.
[Special variable]
*font-9x15*
Contains the font data for an 9x15 bitmap font.
[Special variable]
*font-9x15b*
Contains the font data for an 9x15 bitmap font.
[Special variable]
*font-9x18*
Contains the font data for an 9x18 bitmap font.
[Special variable]
*font-9x18b*
Contains the font data for an 9x18 bitmap font.
[Special variable]
*green*
The
COLOR
green.
[Special variable]
*magenta*
The
COLOR
magenta.
[Special variable]
*opengl-context*
The symbol
*OPENGL-CONTEXT*
isT
when an OpenGL display context is created, andNIL
otherwise. UPDATE-SURFACE will call SDL-GL-SWAP-BUFFERS when*OPENGL-CONTEXT*
isT
, and SDL-FLIP otherwise.
[Special variable]
*red*
The
COLOR
red.
[Special variable]
*sdl-initialized*
[Special variable]
*white*
The
COLOR
white.
[Special variable]
*yellow*
The
COLOR
yellow.
[Generic accessor]
a color => result
(setf (a color) value)
Returns the alpha component of color
COLOR
as anINTEGER
.
[Specialized accessor]
a (color color-a) => result
(setf (a (color color-a)) value)
Returns the alpha color component of the color
COLOR
as anINTEGER
.
[Method]
a (color color) => result
Returns
NIL
asCOLOR
has no alpha component.
[Macro]
all-integers? &rest values => result
Returns
T
if all values areINTEGERS
.
[Generic function]
any-color-but-this color => result
Returns a new color that is different to the color
COLOR
.
[Method]
any-color-but-this color => result
Returns a new color that is different to the color
COLOR
.
[Generic accessor]
b color => result
(setf (b color) value)
Returns the blue component of color
COLOR
as anINTEGER
.
[Specialized accessor]
b (color color) => result
(setf (b (color color)) value)
Returns the blue color component of the color
COLOR
as anINTEGER
.
[Function]
bit-depth surface => result
Returns the bit depth (the number of bytes per pixel, or bpp) of the surface
SURFACE
as anINTEGER
.
[Function]
blit-surface src &optional surface => result
[Generic accessor]
cached-surface sdl-font => result
(setf (cached-surface sdl-font) value)
[Specialized accessor]
cached-surface (sdl-font sdl-font) => result
(setf (cached-surface (sdl-font sdl-font)) value)
[Function]
calculate-curve p1 p2 p3 p4 segments => result
[Macro]
cast type value => result
Coerces the value
VALUE
to the typeTYPE
.
[Macro]
cast-all-to-int &rest values => result
Casts the values in
REST
toFIXNUM
s.
[Macro]
cast-to-int value => result
Casts the value
VALUE
to aFIXNUM
.
[Function]
catmull-rom-spline val v0 v1 v2 v3 => result
[Generic function]
char-height bitmap-font => result
[Method]
char-height (bitmap-font bitmap-font) => result
[Generic function]
char-width bitmap-font => result
[Method]
char-width (bitmap-font bitmap-font) => result
[Macro]
check-types type &rest rest => result
Performs
CHECK-TYPE
on items in rest.
[Function]
clear-cell &key surface => result
[Function]
clear-color-key &key surface rle-accel => result
[Function]
clear-display color &key surface update-p => result
Fills the display
SURFACE
using colorCOLOR
.SURFACE
is bound to*DEFAULT-DISPLAY*
if unspecified. The display is updated whenUPDATE-P
isT
.
[Standard class]
color
An SDL color containing
INTEGER
Red, Green and Blue color components.
[Function]
color &key r g b a => result
Creates and returns a new COLOR from the soecified red
R
, greenG
, and blueB
color components. WhenA
is anINTEGER
, will return a new COLOR-A with the alpha transparency.
[Generic function]
color-* color => result
Returns the RGB/A components of color as a spread. If
COLOR
contains an alpha component thenRESULT
is(VALUES R G B A)
IfCOLOR
contains no alpha component thenRESULT
is(VALUES R G B)
[Method]
color-* (color foreign-color) => result
Not implemented yet. Returns
NIL
[Method]
color-* (color color-a) => result
Returns the read, green, blue and alpha components of the color
COLOR
as a spread.
[Method]
color-* (color color) => result
Returns the read, green and blue components of the color
COLOR
as a spread.
[Standard class]
color-a
An SDL color containing
INTEGER
Red, Green, Blue and Alpha color components.
[Generic function]
color= color1 color2 => result
Returns
T
if colors match, returnsNIL
otherwise.
[Method]
color= (color1 color-a) (color2 color-a) => result
Returns
T
if theRGBA
colors match, returnsNIL
otherwise.
[Method]
color= (color1 color) (color2 color) => result
Returns
T
if theRGB
colors match, returnsNIL
otherwise.
[Method]
color= color1 color2 => result
Returns
NIL
. This is a catch all when anRGB
color is compared with anRGBA
color.
[Function]
convert-surface &key surface key-color alpha-value free-p => result
[Function]
copy-point point => result
Returns a copy of the point
POINT
.
[Function]
copy-surface &key surface key-color alpha-value type rle-accel => result
[Function]
create-list-if-not var => result
If
VAR
is not already a list, then returns(LIST VAR)
.
[Function]
create-path filename &optional path => result
Creates a new path from
FILENAME
andPATH
.
[Function]
create-rwops-from-file filename => result
Creates and returns a new
RWOPS
object from the file at locationFILENAME
.
[Function]
create-surface width height &key bpp surface key-color alpha-value type rle-accel => result
[Function]
distance p1 p2 => result
Returns the distance between the
POINT
sP1
andP2
.
[Function]
distance-* x1 y1 x2 y2 => result
Returns the distance between the coordinates
X1
,Y1
andX2
,Y2
.
[Function]
draw-bezier points type &key clipping-p surface color segments => result
Draw a bezier curve of color
COLOR
to the surfaceSURFACE
. The shape of the Bezier curve is defined by several control points. A control point is a vertex containing an X and Y coordinate pair.Parameters
VERTICES
is the list of control points of typeSDL:POINT
.TYPE
describes the line style used to draw the curve and may be one of:LINE-STRIP
,:LINES
, or:POINTS
. Use:LINE-STRIP
to draw a single continuous line through the specified waypoints. Use:LINES
to draw a line between alternate waypoint pairs. Use:POINTS
to draw a single pixel at each waypoint.SEGMENTS
is the number of segments used to draw the curve. Default is 10 segments if unspecified. The greater the number of segments, the smoother the curve.SURFACE
is the target surface, of typeSDL:SDL-SURFACE
. Bound toSDL:*DEFAULT-SURFACE*
if unspecified.COLOR
is the line color, of typeSDL:COLOR
orSDL:COLOR-A
. Bound toSDL:*DEFAULT-COLOR*
if unspecified.CLIPPING-P
when left as the default valueT
will ensure that the shape is clipped to the dimensions ofSURFACE
. SDL will core dump if pixels are drawn outside a surface. It is therefore safer to leaveCLIPPING-P
asT
.Example
(DRAW-BEZIER (LIST (SDL:POINT :X 60 :Y 40) (SDL:POINT :X 160 :Y 10) (SDL:POINT :X 170 :Y 150) (SDL:POINT :X 60 :Y 150)) :LINE-STRIP)
[Function]
draw-box rect &key clipping-p surface color stroke-color alpha => result
See DRAW-BOX-*.
Parameters
RECT
is the rectangle to fill, of typeSDL:RECTANGLE
.
[Function]
draw-box-* x y w h &key clipping-p surface color stroke-color alpha => result
Draws a filled rectangle of color
COLOR
to surfaceSURFACE
.Parameters
X
andY
are theINTEGER
coordinates of the top-left corner of the rectangle.W
andH
are the width and height of the rectangle, of typeINTEGER
.SURFACE
is the target surface, of typeSDL:SDL-SURFACE
. Bound toSDL:*DEFAULT-SURFACE*
if unspecified.COLOR
is the fill color, of typeSDL:COLOR
orSDL:COLOR-A
. Bound toSDL:*DEFAULT-COLOR*
if unspecified.STROKE-COLOR
when notNIL
will draw a1
pixel line of colorCOLOR
around the perimiter of the box.ALPHA
when between0
and255
is used as the alpha transparency value when blitting the rectangle ontoSURFACE
. Note: An intermediate surface is created, the rectangle is drawn onto this intermediate surface and then this surface is blitted toSURFACE
.CLIPPING-P
whenT
will clip the shape to the dimensions ofSURFACE
. The default isNIL
as the SDL library will perform the necessary clipping automatically.
[Function]
draw-circle p1 r &key surface color alpha => result
See DRAW-CIRCLE-*.
Parameters
P1
is the X/Y coordinate of the center of the circle, of typeSDL:POINT
.
[Function]
draw-circle-* x0 y0 r &key surface color alpha => result
Draws a circle circumference of color
COLOR
to the surfaceSURFACE
. Use DRAW-FILLED-CIRCLE-* to draw a filled circle.Parameters
X
andY
specify the center coordinate of the circle, of typeINTEGER
.R
is the circle r, of typeINTEGER
.SURFACE
is the target surface, of typeSDL:SDL-SURFACE
. Bound toSDL:*DEFAULT-SURFACE*
if unspecified.COLOR
is the circumference color, of typeSDL:COLOR
orSDL:COLOR-A
. Bound toSDL:*DEFAULT-COLOR*
if unspecified.ALPHA
when between0
and255
is used as the alpha transparency value when blitting the rectangle ontoSURFACE
. Note: An intermediate surface is created, the rectangle is drawn onto this intermediate surface and then this surface is blitted toSURFACE
.CLIPPING-P
when left as the default valueT
will ensure that the shape is clipped to the dimensions ofSURFACE
. SDL will core dump if pixels are drawn outside a surface. It is therefore safer to leaveCLIPPING-P
asT
.
[Function]
draw-curve points type &key clipping-p surface color segments => result
Draw a Cattmul-Rom spline using color
COLOR
to the surfaceSURFACE
. The shape of the curve is defined by waypoints. A waypoint is a vertex containing an X and Y coordinate pair.Parameters
POINTS
is a list of waypoints or vetices for the spline, of typeSDL:POINT
TYPE
describes the line style used to draw the curve and may be one of:LINE-STRIP
,:LINES
, or:POINTS
. Use:LINE-STRIP
to draw a single continuous line through the specified waypoints. Use:LINES
to draw a line between alternate waypoint pairs. Use:POINTS
to draw a single pixel at each waypoint.SEGMENTS
is the number of segments used to draw the Catmull-Rom spline. Default is 10 segments if unspecified. The greater the number of segments, the smoother the spline.SURFACE
is the target surface, of typeSDL:SDL-SURFACE
.COLOR
is the line color, of typeSDL:COLOR
orSDL:COLOR-A
. Bound toSDL:*DEFAULT-COLOR*
if unspecified.CLIPPING-P
when left as the default valueT
will ensure that the shape is clipped to the dimensions ofSURFACE
. SDL will core dump if pixels are drawn outside a surface. It is therefore safer to leaveCLIPPING-P
asT
.Example
(DRAW-CURVE (LIST (SDL:POINT :X 60 :Y 40) (SDL:POINT :X 160 :Y 10) (SDL:POINT :X 170 :Y 150) (SDL:POINT :X 60 :Y 150)) :LINE-STRIP 10)
[Function]
draw-filled-circle p1 r &key surface color stroke-color alpha => result
See DRAW-FILLED-CIRCLE-*.
Parameters
P1
is the X/Y coordinate of the center of the filled circle, of typeSDL:POINT
.
[Function]
draw-filled-circle-* x0 y0 r &key surface color stroke-color alpha => result
Draws a filled circle of color
COLOR
to the surfaceSURFACE
.Parameters
X
andY
specify the center coordinate of the circle, of typeINTEGER
.R
is the circle radius, of typeINTEGER
.SURFACE
is the target surface, of typeSDL:SDL-SURFACE
. Bound toSDL:*DEFAULT-SURFACE*
if unspecified.COLOR
is the fill color, of typeSDL:COLOR
orSDL:COLOR-A
. Bound toSDL:*DEFAULT-COLOR*
if unspecified.STROKE-COLOR
when notNIL
will draw a1
pixel line of colorCOLOR
around the perimiter of the circleALPHA
when between0
and255
is used as the alpha transparency value when blitting the rectangle ontoSURFACE
. Note: An intermediate surface is created, the rectangle is drawn onto this intermediate surface and then this surface is blitted toSURFACE
.CLIPPING-P
when left as the default valueT
will ensure that the shape is clipped to the dimensions ofSURFACE
. SDL will core dump if pixels are drawn outside a surface. It is therefore safer to leaveCLIPPING-P
asT
.
[Generic function]
draw-font &key font surface => result
Blit the cached surface in the font
FONT
to the destination surfaceSURFACE
. The cached surface is created during a previous call to any of the DRAW-STRING* functions. Uses thePOSITION
of the cached surface to render at X/Y coordinates on the destinationSURFACE
. This function can provide a speed increase upon redraws when the text inFONT
remains unchanged between screen updates.
[Function]
draw-font &key font surface => result
Blit the cached surface in the font
FONT
to the destination surfaceSURFACE
. The cached surface is created during a previous call to any of the DRAW-STRING* functions. Uses thePOSITION
of the cached surface to render at X/Y coordinates on the destinationSURFACE
. This function can provide a speed increase upon redraws when the text inFONT
remains unchanged between screen updates.
[Generic function]
draw-font-at position &key font surface => result
See DRAW-FONT.
Parameters
POINT
is theX
andY
coordinates of the theFONT
s cached surface, of typePOINT
.
[Method]
draw-font-at position &key font surface => result
See DRAW-FONT.
POINT
is the X/Y position of the the font's cached surface.POINT
is of typePOINT
.
[Generic function]
draw-font-at-* x y &key font surface => result
See DRAW-FONT
Parameters
X
andY
are theINTEGER
position coordinates of theFONT
s cached surface.
[Method]
draw-font-at-* x y &key font surface => result
See DRAW-FONT.
Parameters
POINT
is theX
andY
coordinates of the theFONT
s cached surface, of typePOINT
.
[Function]
draw-hline x0 x1 y &key surface color clipping-p => result
Draw a horizontal line of color
COLOR
fromX0
toX1
throughY
onto the surfaceSURFACE
.Parameters
X0
andX1
are the horizontal start and end points of the line, of typeINTEGER
.Y
is the verticalINTEGER
coordinate that the horizontal line must intersect.SURFACE
is the target surface, of typeSDL:SDL-SURFACE
. Bound toSDL:*DEFAULT-SURFACE*
if unspecified.COLOR
is the line color, of typeSDL:COLOR
orSDL:COLOR-A
. Bound toSDL:*DEFAULT-COLOR*
if unspecified.CLIPPING-P
whenT
will clip the shape to the dimensions ofSURFACE
. The default isNIL
as the SDL library will perform the necessary clipping automatically.
[Function]
draw-line p1 p2 &key surface color clipping-p => result
See DRAW-LINE-*.
Parameters
POINT1
andPOINT2
are the start and end x/y co-ordinates of the line, of typeSDL:POINT
.
[Function]
draw-line-* x0 y0 x1 y1 &key surface color clipping-p => result
Draws a line of color
COLOR
to the surfaceSURFACE
.Parameters
X0
Y0
are the start X/Y coordinates of the line, of typeINTEGER
.X1
Y1
are the end X/Y coordinates of the line, of typeINTEGER
.SURFACE
is the target surface, of typeSDL:SDL-SURFACE
. Bound toSDL:*DEFAULT-SURFACE*
if unspecified.COLOR
is the line color, of typeSDL:COLOR
orSDL:COLOR-A
. Bound toSDL:*DEFAULT-COLOR*
if unspecified.CLIPPING-P
when left as the default valueT
will ensure that the shape is clipped to the dimensions ofSURFACE
. SDL will core dump if pixels are drawn outside a surface. It is therefore safer to leaveCLIPPING-P
asT
.
[Function]
draw-point point &key clipping-p surface color => result
See DRAW-POINT-*.
Parameters
POSITION
is theX
/Y
coordinates of the pixel, of typePOINT
.
[Function]
draw-point-* x y &key clipping-p surface color => result
Draw a single pixel of color
COLOR
to the surfaceSURFACE
at the specifiedX
andY
coordiates.Parameters
X
andY
specify the coordinates of the pixel, and are of typeINTEGER
.SURFACE
is the target surface, of typeSDL:SDL-SURFACE
. Bound toSDL:*DEFAULT-SURFACE*
if unspecified.COLOR
is the pixel color, of typeSDL:COLOR
orSDL:COLOR-A
. Bound toSDL:*DEFAULT-COLOR*
if unspecified.CLIPPING-P
when left as the default valueT
will ensure that the shape is clipped to the dimensions ofSURFACE
. SDL will core dump if pixels are drawn outside a surface. It is therefore safer to leaveCLIPPING-P
asT
.
[Function]
draw-polygon vertices &key surface color clipping-p => result
Draw the circumference of a polygon of color
COLOR
to surface SURFACE using the vertices inPOINTS
. Use DRAW-FILLED-POLYGON-* to draw a filled polygon.Parameters
POINTS
is the list of vertices for the polygon.POINTS
is a list ofSDL:POINT
s.SURFACE
is the target surface, of typeSDL:SDL-SURFACE
. Bound toSDL:*DEFAULT-SURFACE*
if unspecified.COLOR
is the circumference color, of typeSDL:COLOR
orSDL:COLOR-A
. Bound toSDL:*DEFAULT-COLOR*
if unspecified.CLIPPING-P
when left as the default valueT
will ensure that the shape is clipped to the dimensions ofSURFACE
. SDL will core dump if pixels are drawn outside a surface. It is therefore safer to leaveCLIPPING-P
asT
.
[Function]
draw-rectangle rect &key clipping-p surface color alpha => result
See DRAW-RECTANGLE-*.
Parameters
RECT
is the rectangle to draw, of typeSDL:RECTANGLE
.
[Function]
draw-rectangle-* x y w h &key clipping-p surface color alpha => result
Draw a rectangle outline of color
COLOR
to the surfaceSURFACE
.Parameters
X
andY
are theINTEGER
coordinates of the top-left corner of the rectangle.W
andH
are the width and height of the rectangle, of typeINTEGER
.SURFACE
is the target surface, of typeSDL:SDL-SURFACE
. Bound toSDL:*DEFAULT-SURFACE*
if unspecified.COLOR
is the line color, of typeSDL:COLOR
orSDL:COLOR-A
. Bound toSDL:*DEFAULT-COLOR*
if unspecified.ALPHA
when between0
and255
is used as the alpha transparency value when blitting the rectangle ontoSURFACE
. Note: An intermediate surface is created, the rectangle is drawn onto this intermediate surface and then this surface is blitted toSURFACE
.CLIPPING-P
whenT
will clip the shape to the dimensions ofSURFACE
. The default isNIL
as the SDL library will perform the necessary clipping automatically.
[Function]
draw-shape points type &key clipping-p surface color => result
Draw a polygon of color
COLOR
to the surfaceSURFACE
using the vertices inPOINTS
.Parameters
POINTS
is a list of vertices, of typeSDL:POINT
TYPE
describes the line style used to draw the polygon and may be one of:LINE-STRIP
,:LINES
, or:POINTS
. Use:LINE-STRIP
to draw a single continuous line through the specified waypoints. Use:LINES
to draw a line between alternate waypoint pairs. Use:POINTS
to draw a single pixel at each waypoint.SURFACE
is the target surface, of typeSDL:SDL-SURFACE
. Bound toSDL:*DEFAULT-SURFACE*
if unspecified.COLOR
is the line color, of typeSDL:COLOR
orSDL:COLOR-A
. Bound toSDL:*DEFAULT-COLOR*
if unspecified.CLIPPING-P
when left as the default valueT
will ensure that the shape is clipped to the dimensions ofSURFACE
. SDL will core dump if pixels are drawn outside a surface. It is therefore safer to leaveCLIPPING-P
asT
.Example
(DRAW-SHAPE (LIST (SDL:POINT :X 60 :Y 40) (SDL:POINT :X 160 :Y 10) (SDL:POINT :X 170 :Y 150) (SDL:POINT :X 60 :Y 150)) :LINE-STRIP)
[Function]
draw-string-shaded string p1 fg-color bg-color &key justify surface font => result
See DRAW-STRING-SHADED-*.
Parameters
P1
is theX
andY
coordinates to render the text, of typeSDL:POINT
.
[Function]
draw-string-shaded-* string x y fg-color bg-color &key justify surface font => result
Draw text
STRING
at locationX
Y
using fontFONT
with text colorFG-COLOR
and background colorBG-COLOR
onto surfaceSURFACE
. The surface background is filled withBG-COLOR
so the surface cannot be keyed over other surfaces.
STRING
is the text to render.X
andY
are theX
andY
coordinates, asINTEGERS
.FG-COLOR
color is the text color, of typeSDL-COLOR
BG-COLOR
color is the background color used to fill the surfaceSURFACE
, of typeSDL-COLOR
FONT
is the font face used to render the text. Of typeFONT
. Bound to*DEFAULT-FONT*
if unspecified.SURFACE
is the target surface, of typeSDL-SURFACE
. Bound to*DEFAULT-SURFACE*
if unspecified.Returns
- Returns the surface
SURFACE
.Example
(DRAW-STRING-SHADED-* "Hello World!" 0 0 F-COLOR B-COLOR :SURFACE A-SURFACE)
[Function]
draw-string-solid string p1 &key justify surface font color => result
See DRAW-STRING-SOLID-*.
Parameters
P1
is theX
andX
coordinates to render the text, of typePOINT
.
[Function]
draw-string-solid-* string x y &key justify surface font color => result
Draw text
STRING
at locationX
Y
using fontFONT
with colorCOLOR
onto surfaceSURFACE
. The text is keyed ontoSURFACE
.Parameters
STRING
is the text to render.X
andY
are theX
andY
position coordinates, asINTEGERS
.FONT
is the font face used to render the string. Of typeFONT
. Bound to*DEFAULT-FONT*
if unspecified.SURFACE
is the target surface, of typeSDL-SURFACE
. Bound to*DEFAULT-SURFACE*
if unspecified.COLOR
color is the text color, of typeSDL-COLOR
.Returns
- Returns the surface
SURFACE
.Example
(DRAW-STRING-SOLID-* "Hello World!" 0 0 :SURFACE A-SURFACE :COLOR A-COLOR)
[Function]
draw-surface src &key surface => result
[Function]
draw-surface-at src point &key surface => result
[Function]
draw-surface-at-* src x y &key surface => result
[Function]
draw-trigon p1 p2 p3 &key surface color clipping-p => result
Draw the outline of a trigon or triangle, of color
COLOR
to surfaceSURFACE
. Use DRAW-FILLED-TRIGON-* to draw a filled trigon.Parameters
P1
,P2
andP3
specify the vertices of the trigon, of typeSDL:POINT
.SURFACE
is the target surface, of typeSDL:SDL-SURFACE
. Bound toSDL:*DEFAULT-SURFACE*
if unspecified.COLOR
is the circumference color, of typeSDL:COLOR
orSDL:COLOR-A
. Bound toSDL:*DEFAULT-COLOR*
if unspecified.CLIPPING-P
when left as the default valueT
will ensure that the shape is clipped to the dimensions ofSURFACE
. SDL will core dump if pixels are drawn outside a surface. It is therefore safer to leaveCLIPPING-P
asT
.
[Function]
draw-vline x y0 y1 &key surface color clipping-p => result
Draw a vertical line of color
COLOR
fromY0
toY1
throughX
onto the surfaceSURFACE
.Parameters
X
is the horizontalINTEGER
coordinate that the vertical line must intersect.Y0
andY1
are the vertical start and end points of the line, of typeINTEGER
.SURFACE
is the target surface, of typeSDL:SDL-SURFACE
. Bound toSDL:*DEFAULT-SURFACE*
if unspecified.COLOR
is the line color, of typeSDL:COLOR
orSDL:COLOR-A
. Bound toSDL:*DEFAULT-COLOR*
if unspecified.CLIPPING-P
whenT
will clip the shape to the dimensions ofSURFACE
. The default isNIL
as the SDL library will perform the necessary clipping automatically.
[Function]
fill-surface color &key template surface update-p clipping-p => result
fill the entire surface with the specified R G B A color. Use :template to specify the SDLRect to be used as the fill template. Use :update-p to call SDLUpdateRect, using :template if provided. This allows for a 'dirty recs' screen update.
[Function]
fill-surface-* color x y w h &key surface update-p clipping-p => result
[Function]
flood-fill point &key surface color => result
See FLOOD-FILL-*.
Parameters
- POINT is the position to state the fill, of type
POINT
.
[Function]
flood-fill-* x y &key surface color => result
Performs a flood fill of surface
SURFACE
with colorCOLOR
. The fill starts at the position specified by theX
andY
coordinates. Uses a stack based flood fill that does a lot of consing because it uses PUSH/POP as the stack. This function is fast.Parameters
X
andY
areINTEGER
coordinates.SURFACE
is the target surface, of typeSDL:SDL-SURFACE
. Bound toSDL:*DEFAULT-SURFACE*
if unspecified.COLOR
is the fill color, of typeSDL:COLOR
orSDL:COLOR-A
. Bound toSDL:*DEFAULT-COLOR*
if unspecified.
[Function]
flood-fill-stack point &key surface color => result
See FLOOD-FILL-STACK-*.
Parameters
- POINT is the position to state the fill, of type
POINT
.
[Function]
flood-fill-stack-* x y &key surface color => result
See FLOOD-FILL-*.
FLOOD-FILL-STACK-*
is maintains an internal array-based stack.Note: More of an experiment to see if an array would be faster than a bunch of consing. The timing of both functions indicates they run at the same speed. With compiler declarations it may have better results. Another disadvantage to this is it preallocates the stack, chewing up quite a bit of ram.
[Generic accessor]
fp object => result
(setf (fp rwops) value)
Returns the default foreign object for
OBJECT
.
[Method]
fp (object sdl-font) => result
Returns the cached surface
SURFACE
inFONT
, orNIL
if the font does not contain a cached surface.
[Specialized accessor]
fp (object rwops) => result
(setf (fp (rwops rwops)) value)
[Specialized accessor]
fp (object rectangle-array) => result
(setf (fp (rwops rectangle-array)) value)
[Method]
fp (object sdl-surface) => result
[Specialized accessor]
fp (object rectangle) => result
(setf (fp (rwops rectangle)) value)
[Specialized accessor]
fp (object foreign-color) => result
(setf (fp (rwops foreign-color)) value)
[Specialized accessor]
fp (object color-a) => result
(setf (fp (rwops color-a)) value)
[Specialized accessor]
fp (object color) => result
(setf (fp (rwops color)) value)
[Generic accessor]
fp-cell sdl-surface => result
(setf (fp-cell sdl-surface) value)
[Specialized accessor]
fp-cell (sdl-surface sdl-surface) => result
(setf (fp-cell (sdl-surface sdl-surface)) value)
[Generic function]
fp-position object => result
Returns the default foreign SDL_Rect object for
OBJECT
.
[Method]
fp-position (object sdl-font) => result
Returns the
X
andY
coordinates of the cached surfaceSURFACE
inFONT
, asPOINT
.
[Method]
fp-position (object sdl-surface) => result
[Function]
frame-rate => result
Returns the specified frame rate, not the actual frame rate.
[Generic function]
free-cached-surface font => result
Frees resources allocated to the cached surface
SURFACE
inFONT
, if any. Sets theFONT
sCACHED-SURFACE
slot to NIL.
[Method]
free-cached-surface (font sdl-font) => result
Frees resources allocated to the cached surface
SURFACE
inFONT
, if any. Sets theFONT
sCACHED-SURFACE
slot to NIL.
[Generic function]
free-color color => result
Free's resources allocated to COLOR. Meant specifically for the SDL_Color foreign object.
COLOR
andCOLOR-A
are ignored.
[Method]
free-color (color foreign-color) => result
[Method]
free-color (color sdl-color) => result
[Generic function]
free-font font => result
Free's the resources allocated to the
FONT
.
[Method]
free-font (font bitmap-font) => result
Free resources associated with the bitmap font
FONT
.
[Method]
free-font (font sdl-font) => result
Free's the resources allocated to the
FONT
.
[Generic function]
free-rectangle rectangle => result
Free's the resources allocated to
RECTANGLE
. Specifically free's the wrapped SDL_Rect foreign object.
[Method]
free-rectangle (rectangle rectangle) => result
Frees the resources allocated to the rectangle
RECTANGLE
.
[Method]
free-rectangle (rectangle null-rectangle) => result
Does nothing. A
NULL-RECTANGLE
cannot be freed.
[Generic function]
free-rwops rwops => result
Free's the resources allocated to
RWOPS
. Specifically free's the wrapped SDL_rwops foreign object.
[Method]
free-rwops (rwops rwops) => result
Free's the wrapped foreign SDL_rwops object.
[Generic function]
free-surface surface => result
Free's the resources allocated to
SURFACE
. Specifically free's the wrapped SDL_Surface foreign object.
[Method]
free-surface (surface surface) => result
Free the foreign SDLSurface and the SDLRect used for position. Also free the SDL_Rect used as the cell mask.
[Method]
free-surface (surface sdl-surface) => result
[Generic accessor]
g color => result
(setf (g color) value)
Returns the green component of color
COLOR
as anINTEGER
.
[Specialized accessor]
g (color color) => result
(setf (g (color color)) value)
Returns the green color component of the color
COLOR
as anINTEGER
.
[Function]
get-clip-rect &key surface rectangle => result
[Function]
get-native-window => result
Returns a foreign pointer to the native SDL display window.
[Generic function]
get-point object => result
Returns the
X
andY
coordinates of objectOBJ
as aPOINT
.
[Method]
get-point (object sdl-surface) => result
Returns the
X
andY
position coordinates of the surfaceSURFACE
as aPOINT
.
[Method]
get-point (object rectangle) => result
Returns the
X
andY
coordinates of rectangleRECTANGLE
as aPOINT
.
[Method]
get-point (object vector) => result
Returns the point
POINT
.
[Generic function]
get-position object => result
See GET-POINT
[Method]
get-position (object sdl-surface) => result
See GET-POINT.
[Method]
get-position (object rectangle) => result
See GET-POINT
[Generic function]
get-rectangle rectangle => result
[Method]
get-rectangle (rectangle rectangle) => result
Returns the rectangle
RECTANGLE
.
[Function]
get-surface-rect &key surface rectangle => result
[Generic accessor]
height obj => result
(setf (height obj) value)
Returns the height of the object.
[Specialized accessor]
height (obj sdl-font) => result
(setf (height (obj sdl-font)) value)
Returns the
INTEGER
height of the cached surfaceSURFACE
inFONT
.
[Specialized accessor]
height (obj sdl-surface) => result
(setf (height (obj sdl-surface)) value)
Returns the height of the surface
SURFACE
as anINTEGER
.
[Specialized accessor]
height (obj rectangle) => result
(setf (height (obj rectangle)) value)
Returns the
INTEGER
height of the rectangleRECTANGLE
.
[Function]
init-sdl &optional init => result
Initalizes the SDL library when the
OPTIONAL
parameterINIT
isT
, or the value returned by SDL-INIT-ON-STARTUP isT
.
[Function]
init-sub-systems &optional flags => result
Initializes the SDL subsystems specified in
FLAGS
.FLAGS
is anINTEGER
bitmask containing the logior of zero or more of:SDL-INIT-EVERYTHING
,SDL-INIT-VIDEO
,SDL-INIT-CDROM
,SDL-INIT-AUDIO
,SDL-INIT-TIMER
,SDL-INIT-JOYSTICK
,SDL-INIT-EVENTTHREAD
andSDL-INIT-NOPARACHUTE
.
INIT-SUB-SYSTEMS
can be called only after SDL is succesfully initialized by INIT-SDL.
[Function]
initialise-default-font &optional font-definition => result
Calls INITIALISE-FONT to create a new
BITMAP-FONT
fromFONT-DEFINITION
.FONT-DEFINITION
is set to*font-8x8*
if unspecified. Binds the symbol*DEFAULT-FONT*
to the new font. Reutns the new font, orNIL
if the font cannot be created.
[Function]
initialise-font font-definition => result
Creates a new
BITMAP-FONT
object from the font data inFONT-DEFINITION
. Returns the new bitmap font, orNIL
if the font cannot be created.FONT-DEFINITION
must be one of the following built-in fonts:*FONT-10X20*, *FONT-5X7*, *FONT-5X8*, *FONT-6X10*, *FONT-6X12*, *FONT-6X13*, *FONT-6X13B*, *FONT-6X13O*, *FONT-6X9*, *FONT-7X13*, *FONT-7X13B*, *FONT-7X13O*, *FONT-7X14*, *FONT-7X14B*, *FONT-8X13*, *FONT-8X13B*, *FONT-8X13O*, *FONT-8X8*, *FONT-9X15*, *FONT-9X15B*, *FONT-9X18* OR *FONT-9X18B*
.
[Function]
initialize-on-startup &rest flags => result
Sets the SDL subsystems that must be initialized in subsequent calls to INIT-SUB-SYSTEMS.
Parameters
FLAGS
may be one or more of:SDL-INIT-EVERYTHING
,SDL-INIT-VIDEO
,SDL-INIT-CDROM
,SDL-INIT-AUDIO
,SDL-INIT-TIMER
,SDL-INIT-JOYSTICK
,SDL-INIT-EVENTTHREAD
andSDL-INIT-NOPARACHUTE
.Returns
- Returns an INTEGER bitmask of the SDL subsystems in
FLAGS
.Example
(INITIALIZE-ON-STARTUP SDL:SDL-INIT-VIDEO SDL:SDL-INIT-CDROM)
[Function]
initialized-sub-systems-p => result
Returns a list of the initialized SDL subsystems.
[Function]
is-valid-ptr pointer => result
Returns T if pointer is not NULL and is a valid CFFI pointer to a foreign object.
[Function]
key= key1 key2 => result
[Function]
list-modes flags &optional surface => result
Returns a LIST of vectors sorted largest to smallest that contains the width and height dimensions of the screen that will support the pixel format of the specified surface
SURFACE
and video flagsFLAGS
.LIST-MODES
must be called after SDL is initialised using INIT-SDL or WITH-INIT.Parameters
FLAGS
is a bitmasked logior of one or more of the following; SDL-SW-SURFACE, SDL-HW-SURFACE, SDL-ASYNC-BLIT, SDL-ANY-FORMAT, SDL-HW-PALETTE, SDL-DOUBLEBUF, SDL-FULLSCREEN, SDL-OPENGL, SDL-RESIZABLE and SDL-NO-FRAME.SURFACE
A surface of type SDL-SURFACE, orNIL
. WHENNIL
, the pixel format will be that returned by SDL-GET-VIDEO-INFO.Returns
- Returns a list of
VECTOR
s of display dimensions, sorted largest to smallest, that will support the pixel format of surfaceSURFACE
; for example(#(1024 768) #(640 480) #(512 384) #(320 240))
. ReturnsNIL
if there are no dimensions available for a particular pixel format. ReturnsT
if any dimension will support the pixel format and video flags.Example
(LIST-MODES '(SDL-HW-SURFACE SDL-FULLSCREEN))
[Function]
list-sub-systems flag => result
Returns a list of SDL subsystems that are specified in
FLAGS
.
FLAGS
is anINTEGER
bitmask containing the logior of zero or more of:SDL-INIT-EVERYTHING
,SDL-INIT-VIDEO
,SDL-INIT-CDROM
,SDL-INIT-AUDIO
,SDL-INIT-TIMER
,SDL-INIT-JOYSTICK
,SDL-INIT-EVENTTHREAD
andSDL-INIT-NOPARACHUTE
.
[Generic function]
load-image source &key key-color alpha-value image-type force free => result
Creates and returns a new surface from the source
SOURCE
.Parameters
SOURCE
is the source of the image.KEY-COLOR
sets the color key to be used for the surface, of typeCOLOR
, or 'COLOR-A`.ALPHA-VALUE
sets the alpha value of the surface, of type INTEGER. Must be in the range 0-255. 255 is opaque, 0 is transparent.IMAGE-TYPE
specifies the type of image to load.FORCE
forces an image to be loaded asIMAGE-TYPE
.FREE
free's resources inSOURCE
after creating a newSDL_Surface
.Returns
- Returns a new
SURFACE
, orNIL
ifSOURCE
does not contain a valid image.
[Method]
load-image (source string) &key key-color alpha-value image-type force free => result
Load a BMP image from a file at location
FILENAME
.Parameters
FILENAME
is the location of the image file on disk, as aSTRING
.KEY-COLOR
when notNIL
is the color to be used as the transpart pixel. WhenKEY-COLOR
isNIL
, the surface is created without a key color. See SET-COLOR-KEY for more detailed information.ALPHA
when between0
and255
will set the level of alpha transparency for the new surface. WhenALPHA
isNIL
, the new surface is created without alpha transparency. See SET-ALPHA for more detailed information.
[Generic function]
map-color color &optional surface => result
Maps the color
COLOR
to the pixel format of the surfaceSURFACE
and returns the pixel value that best approximates the color value of the surfaceSURFACE
. If the surface has a palette (8-bit) the index of the closest matching color in the palette will be returned. If the surface has an alpha component it will be returned as all1
bits (fully opaque). If the surface color depth is less than 32-bpp then the unused upper bits of the return value can safely be ignored (e.g., with a 16-bpp format the return value can be assigned to a Uint16, and similarly a Uint8 for an 8-bpp format).
[Method]
map-color (color color-a) &optional surface => result
Maps the RBGA color
COLOR
to the pixel format of the surfaceSURFACE
and returns the pixel value that best approximates the color value of the surfaceSURFACE
. If the surface has a palette (8-bit) the index of the closest matching color in the palette will be returned. If thesurface has no alpha component the alpha value will be ignored (as it will be in formats with a palette). If the surface color depth is less than 32-bpp then the unused upper bits of the return value can safely be ignored (e.g., with a 16-bpp format the return value can be assigned to a Uint16, and similarly a Uint8 for an 8-bpp format).
[Method]
map-color (color color) &optional surface => result
Maps the RBG color
COLOR
to the pixel format of the surfaceSURFACE
and returns the pixel value that best approximates the color value of the surfaceSURFACE
. If the surface has a palette (8-bit) the index of the closest matching color in the palette will be returned. If the surface has an alpha component it will be returned as all1
bits (fully opaque). If the surface color depth is less than 32-bpp then the unused upper bits of the return value can safely be ignored (e.g., with a 16-bpp format the return value can be assigned to a Uint16, and similarly a Uint8 for an 8-bpp format).
[Generic function]
pack-color color => result
Packs the color components in
COLOR
into a four byteINTEGER
.
[Method]
pack-color (color color-a) => result
Packs the RGBA color components in color into a four byte
INTEGER
.
[Method]
pack-color (color color) => result
Packs the RGB color components in color into a four byte
INTEGER
.
[Function]
point &key x y => result
Creates a new
POINT
set to the specified horizontalX
and verticalY
coordinate.
[Generic function]
point-* point => result
Returns the
X
andY
coordinates of the object as a spread. TheRESULT
is(VALUES X Y)
[Method]
point-* (point sdl-surface) => result
Returns the
X
andY
position coordinates of the surfaceSURFACE
as a spread.
[Method]
point-* (point rectangle) => result
Returns the
X
andY
coordinates of the rectangleRECTANGLE
as a spread. TheRESULT
is(VALUES X Y)
[Method]
point-* (point vector) => result
Returns the
X
andY
coordinates of the pointPOINT
as a spread.
[Generic function]
position-* obj => result
See POINT-*
[Method]
position-* (obj sdl-surface) => result
See POSITION.
[Method]
position-* (obj rectangle) => result
See POINT-*
[Method]
position-* (obj vector) => result
See POINT-*.
[Function]
push-quit-event => result
Pushes a new
SDL_Event
of type:SDL-QUIT-EVENT
onto the event queue.
[Function]
push-user-event &key code data1 data2 => result
Pushes a new
SDL_Event
of type:SDL-USER-EVENT
onto the event queue.
[Function]
query-cursor => result
Queries the current state of the cursor. Returns
T
if the cursor is enabled and shown on the display. ReturnsNIL
if the cursor is disabled and hidden.
[Function]
quit-on-exit &rest flags => result
Sets one or more SDL subsystems that must be uninitialized in subsequent calls to QUIT-SUB-SYSTEMS.
Parameters
FLAGS
may be one or more of:SDL-INIT-EVERYTHING
,SDL-INIT-VIDEO
,SDL-INIT-CDROM
,SDL-INIT-AUDIO
,SDL-INIT-TIMER
,SDL-INIT-JOYSTICK
,SDL-INIT-EVENTTHREAD
,SDL-INIT-NOPARACHUTE
.Returns
- Returns an INTEGER bitmask of the SDL subsystems in
FLAGS
.Example
(QUIT-ON-EXIT SDL:SDL-INIT-VIDEO SDL:SDL-INIT-CDROM)
[Function]
quit-sdl &optional quit => result
Uninitalizes the SDL library when the
OPTIONAL
parameterQUIT
isT
, or the value returned by SDL-QUIT-ON-EXIT isT
.
[Function]
quit-sub-systems &optional flags => result
Uninitializes the SDL subsystems specified in the
INTEGER
bitmaskFLAGS
.FLAGS
contains the logior of zero or more of:SDL-INIT-EVERYTHING
,SDL-INIT-VIDEO
,SDL-INIT-CDROM
,SDL-INIT-AUDIO
,SDL-INIT-TIMER
,SDL-INIT-JOYSTICK
,SDL-INIT-EVENTTHREAD
,SDL-INIT-NOPARACHUTE
.
QUIT-SUB-SYSTEMS
can be called only after SDL is successfully intialized using INIT-SDL.
[Generic accessor]
r color => result
(setf (r color) value)
Returns the red component of color
COLOR
as anINTEGER
.
[Specialized accessor]
r (color color) => result
(setf (r (color color)) value)
Returns the red color component of the color
COLOR
as anINTEGER
.
[Function]
random+1 rnd => result
Returns a random number in the range 0 > num <= rnd.
[Function]
random-rectangle bound-w bound-h &optional rectangle => result
Creates and return s a new
RECTANGLE
of random x, y width and height within the specified bounds of widthBOUND-W
and heightBOUND-H
.RECTANGLE
if unset will force the creation of a newRECTANGLE
object.RECTANGLE
if set will be modified with the coordinates.
[Function]
read-point point &key clipping-p surface => result
[Standard class]
rectangle
A
RECTANGLE
object manages the foreign SDL_Rect object.
[Function]
rectangle &key x y w h fp null => result
Creates a new
RECTANGLE
from the specifiedX
,Y
, widthW
and heightH
. IfFP' is
NILthen a foreign SDL_Rect is created. If
FPis a pointer to a foreign SDL_Rect object then
FPis used. If
NULLis
NIL, then a new
RECTANGLEis returned. If
NULLnot
NIL` then a NULL-RECTANGLE` is created.
[Generic function]
rectangle-* obj => result
Returns the
X
,Y
,WIDTH
andHEIGHT
coordinates of the object as a spread. TheRESULT
is(VALUES X Y WIDTH HEIGHT)
[Method]
rectangle-* (obj sdl-surface) => result
Returns the
X
,Y
,WIDTH
andHEIGHT
values of the surfaceSURFACE
as a spread. TheRESULT
is(VALUES X Y WIDTH HEIGHT)
[Method]
rectangle-* (obj rectangle) => result
Returns the
X
,Y
,WIDTH
andHEIGHT
coordinates of the rectangleRECTANGLE
as a spread. TheRESULT
is(VALUES X Y WIDTH HEIGHT)
[Function]
rectangle-from-edges p1 p2 &optional rectangle => result
P1
andP2
arePOINTS
that specify the bounds of theRECTANGLE
.P1
specifies the top left coordinate.P2
specifies the lower right coordinate.
[Function]
rectangle-from-edges-* x1 y1 x2 y2 &optional rectangle => result
Returns a new
RECTANGLE
using the bounds specified by theINTEGERS
X1
,X2
,Y1
andY2
. The coordinates of the rectangle are X = X1, Y = Y1, WIDTH = (- X2 X1), HEIGHT = (- Y2 Y1)Parameters
X1
,Y1
specify the top left coordinate asINTEGERS
.X2
,Y2
specify the bottom right coordinate asINTEGERS
.RECTANGLE
if unset will force the creation of a newRECTANGLE
object.RECTANGLE
if set will be modified with the coordinates.
[Function]
rectangle-from-midpoint-* x y w h &optional rectangle => result
Returns a
RECTANGLE
of widthW
and heightH
with the rectangle mid-point at coordinatesX
andY
.RECTANGLE
if unset will force the creation of a newRECTANGLE
object.RECTANGLE
if set will be modified with the coordinates.
[Function]
render-string-shaded string fg-color bg-color &key font free cache => result
Render the string
STRING
using fontFONT
with text colorFG-COLOR
and background colorBG-COLOR
to a newSURFACE
. The dimensions of the new surface are height ==FONT
height, and width ==FONT
width *STRING
length. The surface background is filled withBG-COLOR
so the surface cannot be keyed over other surfaces. Use:CACHE T
to cache the new surface in theFONT
object. When:FREE T
any exisiting cached surface inFONT
is automatically freed. When:FREE NIL
the caller is responsible for freeing any existing cached surface inFONT
.Parameters
STRING
is the text to render.FONT
is the font face used to render theSTRING
. Of typeFONT
. Bound to*DEFAULT-FONT*
if unspecified.FG-COLOR
color is the text color, of typeSDL-COLOR
BG-COLOR
color is the background color used to fill the surface, of typeSDL-COLOR
FREE
whenT
will free any exisiting cached surface inFONT
.CACHE
whenT
will cache the newly created SURFACE inFONT
. Any cached surface can be accessed using CACHED-SURFACE and can be blitted to a target surface using DRAW-FONT.Returns
- Returns a new cached surface
SDL-SURFACE
.Example
(RENDER-STRING-SHADED "Hello World!" F-COLOR B-COLOR)
[Function]
render-string-solid string &key font color free cache => result
Render the string
STRING
using fontFONT
with text colorCOLOR
to a newSURFACE
. The dimensions of the new surface are height ==FONT
height, and width ==FONT
width *STRING
length. The surface background is transparent and therefore can be keyed over other surfaces. Use:CACHE T
to cache the new surface in theFONT
object. When:FREE T
any exisiting cached surface inFONT
is automatically freed. When:FREE NIL
the caller is responsible for freeing any existing cached surface inFONT
.Parameters
STRING
is the text to render.FONT
is the font face used to render theSTRING
. Of typeFONT
. Bound to*DEFAULT-FONT*
if unspecified.COLOR
color is the text color, of typeSDL-COLOR
.FREE
whenT
will free any exisitng cached surface inFONT
.CACHE
whenT
will cache the newly created SURFACE inFONT
. Any cached surface can be accessed using CACHED-SURFACE and can be blitted to a target surface using DRAW-FONT.Returns
- Returns a new cached surface
SDL-SURFACE
.Example
(DRAW-STRING-SOLID "Hello World!" :COLOR A-COLOR)
[Function]
return-sub-systems-of-status flags status => result
Returns the status
STATUS
of the the specified SDL subsystems inFLAGS
as an INTEGER bitmask.Parameters
FLAGS
may contain a logior of zero or more of:SDL-INIT-EVERYTHING
,SDL-INIT-VIDEO
,SDL-INIT-CDROM
,SDL-INIT-AUDIO
,SDL-INIT-TIMER
,SDL-INIT-JOYSTICK
,SDL-INIT-EVENTTHREAD
,SDL-INIT-NOPARACHUTE
.STATUS
whenT
determines the status of initialised subsystems.STATUS
whenNIL
, determines the status of uninitialised subsystems.Returns
- Returns an INTEGER bitmask of the SDL subsystems in
FLAGS
that are initialised whenSTATUS
isT
or uninitialised whenSTATUS
isNIL
.
[Function]
rotate-surface degrees &key surface free-p key-color alpha-value => result
Returns a new
SURFACE
rotated0
,90
,180
, or270
degrees.Parameters
DEGREES
is the number of degrees to rotate the surface. Must be one of0
,90
,180
, or270
degrees.SURFACE
is the surface to rotate, of typeSDL-SURFACE
. Bound to*DEFAULT-SURFACE*
if unspecified.FREE-P
when not 'NIL' will free the surfaceSURFACE
.KEY-COLOR
when notNIL
is the color to be used as the transpart pixel.When
KEY-COLORis
NIL`, the surface is created without a key color. See SET-COLOR-KEY for more detailed information.ALPHA
when between0
and255
will set the level of alpha transparency for the new surface. WhenALPHA
isNIL
, the new surface is created without alpha transparency. See SET-ALPHA for more detailed information.
[Standard class]
rwops
A wrapper around a foreign SDL_RWops object.
[Function]
save-image surface filename => result
Saves the surface
SURFACE
as a BMP image to a file at locationFILENAME
.
[Constant]
sdl-any-format
Applies to DISPLAY-SURFACE.
- When passed as a
FLAG
to WINDOW; Causes SDL to return a DISPLAY-SURFACE of any pixel depth if the requested pixel depth is unavailable.- When read from the
FLAGS
field in DISPLAY-SURFACE; Indicates that the surface was created withSDL-ANY-FORMAT
.Normally, if a DISPLAY-SURFACE of the requested bits-per-pixel (bpp) is not available, SDL will emulate one with a shadow surface. Passing
SDL-ANY-FORMAT
prevents this and causes SDL to use the DISPLAY-SURFACE surface, regardless of its pixel depth.
[Constant]
sdl-async-blit
Applies to DISPLAY-SURFACE.
- When passed as a
FLAG
to WINDOW; Enables the use of asynchronous updates of the DISPLAY-SURFACE.- When read from the
FLAGS
field in SURFACE or DISPLAY-SURFACE; Indicates if the surface uses asynchronous blits when possible.Asynchronous blits usually slows down blitting on single CPU machines, but may provide a speed increase on SMP systems.
[Standard class]
sdl-color
Root class defining an SDL color. All colors in SDL must inherit from this class.
[Constant]
sdl-doublebuf
Applies to DISPLAY-SURFACE.
- When passed as a
FLAG
to WINDOW; Enable hardware double buffering; only valid with SDL-HW-SURFACE.- When read from the
FLAGS
field in DISPLAY-SURFACE; Indicages that the surface is double buffered.Calling SDL-FLIP will flip the buffers and update the screen. All drawing will take place on the surface that is not displayed at the moment. If double buffering could not be enabled then SDL-FLIP will just perform a SDL-UPDATE-RECT on the entire screen.
[Constant]
sdl-fullscreen
Applies to DISPLAY-SURFACE.
- When passed as a
FLAG
to WINDOW; SDL will attempt to use a fullscreen mode. If a hardware resolution change is not possible (for whatever reason), the next higher resolution will be used and the display window centered on a black background.- When read from the
FLAGS
field in DISPLAY-SURFACE; Indicates that the surface is full-screen.
[Function]
sdl-get-ticks => result
[Constant]
sdl-hw-accel
Applies to SURFACE and DISPLAY-SURFACE.
- When read from the
FLAGS
field in SURFACE and DISPLAY-SURFACE; Indicates that surface blitting will use hardware acceloration.
[Constant]
sdl-hw-palette
Applies to SURFACE and DISPLAY-SURFACE.
- When passed as a
FLAG
to WINDOW; Gives SDL exclusive palette access to DISPLAY-SURFACE.- When read from the
FLAGS
field in SURFACE or DISPLAY-SURFACE; Indicates that the surface has an exclusive palette.Without this flag you may not always get the the colors you request with SDL-SET-COLORS or SDL-SET-PALETTE.
[Constant]
sdl-hw-surface
Applies to SURFACE and DISPLAY-SURFACE.
- When passed as a
FLAG
to WINDOW or CREATE-SURFACE; Create the SURFACE or DISPLAY-SURFACE in video memory.- When read from the
FLAGS
field in SURFACE or DISPLAY-SURFACE; Indicates if the surface is stored in video memory.This will allow SDL to take advantage of Video->Video blits (which are often accelerated).
[Constant]
sdl-init-audio
[Constant]
sdl-init-cdrom
[Constant]
sdl-init-eventthread
[Constant]
sdl-init-everything
[Constant]
sdl-init-joystick
[Constant]
sdl-init-noparachute
[Function]
sdl-init-on-startup => result
Returns
T
if the SDL library must be initialised in INIT-SDL, or WITH-INIT. ReturnsNIL
otherwise.
[Constant]
sdl-init-timer
[Constant]
sdl-init-video
[Constant]
sdl-iyuv-overlay
[Constant]
sdl-no-frame
Applies to DISPLAY-SURFACE.
- When passed as a
FLAG
to WINDOW; If possible,SDL-NO-FRAME
causes SDL to create a window with no title bar or frame decoration.- When read from the
FLAGS
field in DISPLAY-SURFACE; Note: Per the SDL documentation, this is not stored inFLAGS
.Fullscreen modes automatically have this flag set.
[Constant]
sdl-opengl
Applies to DISPLAY-SURFACE.
- When passed as a
FLAG
to WINDOW; Create an OpenGL rendering context. You should have previously set OpenGL video attributes with SDL-GL-SET-ATTRIBUTE.- When read from the
FLAGS
field in DISPLAY-SURFACE; Indicates that the surface has an OpenGL rendering context.
[Constant]
sdl-pre-alloc
Applies to SURFACE.
- When read from the
FLAGS
field in SURFACE; Indicates that surface uses preallocated memory.
[Function]
sdl-quit-on-exit => result
Returns
T
if the SDL library must be uninitialised in QUIT-SDL, or WITH-INIT. ReturnsNIL
otherwise.
[Constant]
sdl-resizable
Applies to DISPLAY-SURFACE.
- When passed as a
FLAG
to WINDOW; Create a resizable window.- When read from the
FLAGS
field in DISPLAY-SURFACE; Indicates that the surface is resizable.When the window is resized by the user a :VIDEO-RESIZE-EVENT event is generated and WINDOW can be called again with the new size.
[Constant]
sdl-rle-accel
Applies to SURFACE
- When passed as a
FLAG
to SET-COLOR-KEY; The surface will be drawn using RLE acceleration when drawn with BLIT-SURFACE, and DRAW-SURFACE. The surface will actually be encoded for RLE acceleration the first time BLIT-SURFACE, DRAW-SURFACE or CONVERT-SURFACE is called on the surface.- When read from the
FLAGS
field in SURFACE; Indicates that colorkey blitting is accelerated with RLE.RLE acceleration can substantially speed up blitting of images with large horizontal runs of transparent pixels (i.e., pixels that match the key color). The key must be of the same pixel format as the surface, MAP-COLOR is often useful for obtaining an acceptable value.
[Constant]
sdl-rle-accel-ok
Applies to SURFACE.
[Constant]
sdl-src-alpha
Applies to SURFACE.
- When passed as a
FLAG
to CREATE-SURFACE and SET-ALPHA; Turns on alpha-blending for blits from this surface. If SDL-HW-SURFACE is also specified and alpha-blending blits are hardware-accelerated, then the surface will be placed in video memory if possible. If the screen is a hardware surface and alpha-blending blits are hardware-accelerated then the SDL-HW-SURFACE flag will be set. Use SET-ALPHA to set or clear this flag after surface creation.- When read from the
FLAGS
field in SURFACE; Indicates that surface blitting uses alpha blending.
[Constant]
sdl-src-color-key
Applies to SURFACE.
- When passed as a
FLAG
to CREATE-SURFACE and SET-COLOR-KEY; Turns on color keying for blits from this surface. If SDL-HW-SURFACE is also specified and color keyed blits are hardware-accelerated, then SDL will attempt to place the surface in video memory. If the screen is a hardware surface and color keyed blits are hardware-accelerated then the SDL-HW-SURFACE flag will be set. Use SET-COLOR-KEY to set or clear this flag after surface creation.- When read from the
FLAGS
field in SURFACE; Indicates that the surface uses colorkey blitting.
[Standard class]
sdl-surface
A wrapper for a foreign object of type SDL_Surface. ASDL-SURFACE
object contains:
- a foreign SDL_Surface,
- a foreign SDL_Rect used to position the surface for blitting operations, and
- an SDL_Rect that defines the bounds of the surface to use when blitting.
[Constant]
sdl-sw-surface
Applies to SURFACE and DISPLAY-SURFACE.
- When passed as a
FLAG
to WINDOW or CREATE-SURFACE; Create the SURFACE or DISPLAY-SURFACE in system memory.- When read from the
FLAGS
field in SURFACE or DISPLAY-SURFACE; Indicates if the surface is stored in system memory.This improves the performance of pixel level access, however you may not be able to take advantage of some types of hardware blitting.
[Constant]
sdl-uyvy-overlay
[Constant]
sdl-yuy2-overlay
[Constant]
sdl-yv12-overlay
[Constant]
sdl-yvyu-overlay
[Function]
set-alpha alpha &key surface rle-accel => result
Adjust the alpha
ALPHA
properties of a surfaceSURFACE
. Also enables or disables alpha blending.Parameters
ALPHA
whenNIL
will ignore all alpha information when blitting the surface.ALPHA
when notNIL
is anINTEGER
value between0
and255
with0
being transparent and255
being opaque. Note: The per-surface alpha value of 128 is considered a special case and is optimised, so it's much faster than other per-surface values.RLE-ACCEL
whenT
wil use RLE information when blitting. See RLE-ACCEL.Alpha effects
Alpha has the following effect on surface blitting:
- RGBA to RGB with SDL-SRC-ALPHA: The source is alpha-blended with the destination, using the alpha channel. SDL-SRC-COLOR-KEY and the per-surface alpha are ignored.
- RGBA to RGB without SDL-SRC-ALPHA: The RGB data is copied from the source. The source alpha channel and the per-surface alpha value are ignored. If SDL-SRC-COLOR-KEY is set, only the pixels not matching the colorkey value are copied.
- RGB to RGBA with SDL-SRC-ALPHA: The source is alpha-blended with the destination using the per-surface alpha value. If SDL-SRC-COLOR-KEY is set, only the pixels not matching the colorkey value are copied. The alpha channel of the copied pixels is set to opaque.
- RGB to RGBA without SDL-SRC-ALPHA: The RGB data is copied from the source and the alpha value of the copied pixels is set to opaque. If SDL-SRC-COLOR-KEY is set, only the pixels not matching the colorkey value are copied.
- RGBA to RGBA with SDL-SRC-ALPHA: The source is alpha-blended with the destination using the source alpha channel. The alpha channel in the destination surface is left untouched. SDL-SRC-COLOR-KEY is ignored.
- RGBA to RGBA without SDL-SRC-ALPHA: The RGBA data is copied to the destination surface. If SDL-SRC-COLOR-KEY is set, only the pixels not matching the colorkey value are copied.
- RGB to RGB with SDL-SRC-ALPHA: The source is alpha-blended with the destination using the per-surface alpha value. If SDL-SRC-COLOR-KEY is set, only the pixels not matching the colorkey value are copied.
- RGB to RGB without SDL-SRC-ALPHA: The RGB data is copied from the source. If SDL-SRC-COLOR-KEY is set, only the pixels not matching the colorkey value are copied.
Note: When blitting, the presence or absence of SDL-SRC-ALPHA is relevant only on the source surface, not the destination.
Note: Note that RGBA to RGBA blits (with SDL-SRC-ALPHA set) keep the alpha of the destination surface. This means that you cannot compose two arbitrary RGBA surfaces this way and get the result you would expect from "overlaying" them; the destination alpha will work as a mask.
Note: Also note that per-pixel and per-surface alpha cannot be combined; the per-pixel alpha is always used if available.
[Function]
set-cell rectangle &key surface => result
[Function]
set-cell-* x y w h &key surface => result
[Function]
set-clip-rect rectangle &key surface => result
[Generic function]
set-color dst src => result
Copies the RGB/A color components to teh destination color
DST
from the source colorSRC
.
[Method]
set-color (dst sdl-color) (src sdl-color) => result
Copies the color components from the source color
SRC
to the destination colorDST
.
[Generic function]
set-color-* color &key r g b a => result
Sets the red
R
, greenG
, blueB
and alphaA
components of the colorCOLOR
.R
,G
,B
andA
areKEY
word parameters having default values of0
if unspecified.
[Method]
set-color-* (color sdl-color) &key r g b a => result
Sets the components of the color
COLOR
to the redR
, greenG
, blueBLUE
or alphaA
color components.
[Function]
set-color-key color &key surface rle-accel => result
Sets the color key (transparent pixel)
COLOR
in a blittable surfaceSURFACE
.Paremeters
[Function]
set-frame-rate rate => result
[Generic function]
set-point dst src => result
Copies the
X
andY
coordinates to the destinationDST
from the sourceSRC
.
[Method]
set-point (dst sdl-surface) (src vector) => result
Sets the
X
andY
position coordinates of the surfaceSURFACE
.POSITION
is aPOINT
.
[Method]
set-point (dst rectangle) (src vector) => result
Copies the
X
andY
coordinates to the destination rectangleRECTANGLE
from the source pointPOSITION
.
[Method]
set-point (dst vector) (src vector) => result
Sets the
X
andY
coordinates of the destination pointDST
to the coordinates in the source pointSRC
. Returns the destination pointDST
.
[Generic function]
set-point-* obj &key x y => result
Sets the
X
andY
coordinates of the objectOBJ
.X
andY
areKEY
word parameters.
[Method]
set-point-* (obj sdl-surface) &key x y => result
Sets the
X
andY
position coordinates of the surfaceSURFACE
.X
andY
areINTEGERS
.
[Method]
set-point-* (obj rectangle) &key x y => result
Sets the
X
andY
coordinates of the rectangleRECTANGLE
.X
andY
areKEY
word parameters.
[Method]
set-point-* (obj vector) &key x y => result
Sets the
X
andY
coordinates of the pointPOINT
toX
andY
.
[Generic function]
set-position dst src => result
See SET-POINT
[Method]
set-position (dst sdl-surface) (src vector) => result
See SET-POINT.
[Method]
set-position (dst rectangle) (src vector) => result
Sets the
X
andY
coordinates of the rectangleRECTANGLE
from the pointPOSITION
.
[Method]
set-position (dst vector) (src vector) => result
See SET-POINT.
[Generic function]
set-position-* obj &key x y => result
See SET-POINT-*
[Method]
set-position-* (obj sdl-surface) &key x y => result
See SET-POINT-*.
[Method]
set-position-* (obj rectangle) &key x y => result
Sets the
X
andY
coordinates of the rectangleRECTANGLE
.X
andY
areKEY
word parameters.
[Method]
set-position-* (obj vector) &key x y => result
See SET-POINT-*.
[Generic function]
set-rectangle dst src => result
Copies the
X
,Y
,WIDTH
andHEIGHT
coordinates to the destination rectangleDST
from the source rectangleSRC
.
[Method]
set-rectangle (dst rectangle) (src rectangle) => result
Copies the
X
,Y
,WIDTH
andHEIGHT
coordinates to the destination rectangleDST
from the source rectangleSRC
.
[Generic function]
set-rectangle-* rectangle &key x y w h => result
Sets the
X
,Y
,WIDTH
andHEIGHT
coordinates of the rectangleRECTANGLE
.X
,Y
,WIDTH
andHEIGHT
areKEY
word parameters having default values of0
if unspecified.
[Method]
set-rectangle-* (rectangle rectangle) &key x y w h => result
Sets the coordinates of the rectangle
RECTANGLE
to the specifiedX
,Y
, widthW
and heightHEIGHT
coordinates.X
,Y
,W
andH
areKEY
word parameters of typeINTEGER
. Returns the rectangleRECTANGLE
as RESULT.
[Generic function]
set-surface surface position => result
Sets the coordinates of the surface SURFACE to
POSITION
, where position is of typePOINT
.
[Method]
set-surface (surface sdl-surface) (position vector) => result
Sets the coordinates of the surface
SURFACE
toPOSITION
, where position is of typePOINT
.
[Generic function]
set-surface-* surface &key x y => result
Sets the coordinates of the surface
SURFACE
.X
andY
areKEY
word parameters having default values of0
if unspecified.
[Method]
set-surface-* (surface sdl-surface) &key x y => result
Sets the coordinates of the surface
SURFACE
to the speadX
andY
INTEGER
coordinates.X
andY
areKEY
word parameters having default values of0
if unspecified.
[Function]
show-cursor state => result
Disables the cursor when state is
NIL
, otherwise enables the cursor.
[Standard class]
surface
A subclass of 'SDL-SURFACE' that holds a standard SDL_Surface object. This object will be garbage collected and the surface freed when out of scope.
[Function]
surface surface-fp &optional display => result
Creates a new
SURFACE
or a newDISPLAY-SURFACE
whenDISPLAY
isT
.SURFACE-FP
must be a pointer to a valid SDL_Surface foreign object.
[Function]
surface-info surface &optional info => result
Returns information about the SDL surface
SURFACE
.Parameters
SURFACE
is an SDL surface of type SDL-SURFACE.INFO
must be one ofNIL
, SDL-SW-SURFACE, SDL-HW-SURFACE, SDL-ASYNC-BLIT, SDL-ANY-FORMAT, SDL-HW-PALETTE, SDL-DOUBLEBUF, SDL-FULLSCREEN, SDL-OPENGL, SDL-RESIZABLESDL-HW-ACCEL, SDL-SRC-COLOR-KEY, SDL-RLE-ACCEL, SDL-SRC-ALPHA or SDL-PRE-ALLOC.Returns
INFO
whenNIL
will return a list of all enabled surface flags. Otherwise will return the status ofINFO
asT
orNIL
if supported by the surface.Example
(SURFACE-INFO A-SURFACE '(SDL-HW-SURFACE SDL-HW-PALETTE SDL-HW-ACCELL))
[Function]
to-degree radian => result
Converts radians to degrees.
[Function]
to-radian degree => result
Converts degrees to radians.
[Function]
update-display &optional surface => result
When OPENGL-CONTEXT is
NIL
;UPDATE-DISPLAY
will flip the SDL video buffers and update the screenSURFACE
ifSDL-HW-SURFACE
is set in WINDOW. If double buffering is not enabled then SDL will perform an SDL-UPDATE-RECT on the entire screen.When OPENGL-CONTEXT is
T
;UPDATE-DISPLAY
will call SDL-GL-SWAP-BUFFERS to update the OpenGL display context.
SURFACE
is bound to*DEFAULT-DISPLAY*
if unspecified.
[Function]
update-surface surface &optional template => result
[Function]
update-surface-* surface x y w h => result
[Function]
video-driver-name => result
Returns the driver name of the initialised video driver. The driver name is a
STRING
containing a one-word identifier like "x11" or "windib". Returns 'NIL' if the video driver is not already initialised with INIT-SDL or WITH-INIT.Example
(sdl:with-init () (sdl:video-driver-name)) >> "windib"
[Function]
video-info info => result
Returns information about the video hardware.
GET-VIDEO-INFO
must be called after SDL is initialised using INIT-SDL or WITH-INIT. IfGET-VIDEO-INFO
is called before WINDOW, the information returned is of the best video mode. IfGET-VIDEO-INFO
is called after WINDOW, the information returned is of the current video mode.Parameters
INFO
must be one of:HW-AVAILABLE
,:WM-AVAILABLE
,:BLIT-HW
,:BLIT-HW-CC
,:BLIT-HW-A
,:BLIT-SW
,:BLIT-SW-CC
,:BLIT-SW-A
,:BLIT-FILL
,:VIDEO-MEM
,:PIXEL-FORMAT
,:CURRENT-W
or:CURRENT-H
.Example
(video-info :video-mem)
[Generic accessor]
width obj => result
(setf (width obj) value)
Returns the width of the object.
[Specialized accessor]
width (obj sdl-font) => result
(setf (width (obj sdl-font)) value)
Returns the
INTEGER
width of the cached surfaceSURFACE
inFONT
.
[Specialized accessor]
width (obj sdl-surface) => result
(setf (width (obj sdl-surface)) value)
Returns the width of the surface
SURFACE
as anINTEGER
.
[Specialized accessor]
width (obj rectangle) => result
(setf (width (obj rectangle)) value)
Returns the
INTEGER
width of the rectangleRECTANGLE
.
[Function]
window width height &key bpp flags title-caption icon-caption => result
Creates a new SDL window of pixel width
WIDTH
and heightHEIGHT
using SDL_SetVideoMode.Use
SDL-SW-SURFACE
if you plan on doing per-pixel manipulations, or blit surfaces with alpha channels, and require a high framerate. When you use hardware surfaces likeSDL-HW-SURFACE
, SDL copies the surfaces from video memory to system memory when you lock them, and back when you unlock them. This can cause a major performance hit. (Be aware that you may request a hardware surface, but receive a software surface. Many platforms can only provide a hardware surface when usingSDL-FULL-SCREEN.)
SDL-HW-SURFACE` is best used when the surfaces you'll be blitting can also be stored in video memory.Note: To control the position on the screen when creating a windowed surface, set the environment variables
SDL_VIDEO_CENTERED=center
orSDL_VIDEO_WINDOW_POS=x,y
. These may be set using SDL-PUT-ENV.Parameters
WIDTH
the pixel width of the window, of typeINTEGER
.HEIGHT
the pixel height of the window, of typeINTEGER
. IfWIDTH
andHEIGHT
are both0
, then the width and height of the current video mode is used (or the desktop mode, if no mode has been set).BPP
the number of bits per pixel. Defaults to0
which is the current display bits per pixel. Note: ABPP
of24
uses the packed representation of 3 bytes/pixel. For the more common 4 bytes/pixel mode, use aBPP
of 32.FLAGS
is a bitmasked logior of one or more of the following; SDL-SW-SURFACE, SDL-HW-SURFACE, SDL-ASYNC-BLIT, SDL-ANY-FORMAT, SDL-HW-PALETTE, SDL-DOUBLEBUF, SDL-FULLSCREEN, SDL-OPENGL, SDL-RESIZABLE and SDL-NO-FRAME.TITLE-CAPTION
is the title that appears in the Window title bar, of typeSTRING
.ICON-CAPTION
is the title that appears when the Window is minimized, of typeSTRING
.Returns
- Returns a new
DISPLAY-SURFACE
if successful,NIL
if unsuccessful. Whatever flags SDL_SetVideoMode could satisfy are set in the flags member ofSURFACE
. TheSURFACE
returned is freed by SDL and should never be freed by the caller. This rule includes consecutive calls toWINDOW
(i.e. upon resize or resolution change) - any existing surface will be released automatically by SDL.Example
(WINDOW 320 240 :TITLE-CAPTION "Random-Rects" :ICON-CAPTION "Random-Rects" :FLAGS '(SDL-DOUBLEBUF SDL-FULLSCREEN))
[Macro]
with-bezier (shape-type &optional segments) declaration* statement* => result
Draw a bezier curve of color
*DEFAULT-COLOR*
to the surface*DEFAULT-SURFACE*
. The shape of the Bezier curve is defined by control points. A control point is a vertex containing an X and Y coordinate pair.The number of segments
SEGENTS
used to draw the Bezier curve defaults to 10. The greater the number of segments, the smoother the Bezier curve.Local Methods
A vertex may be added using:
ADD-VERTEX
which accepts anPOINT
, orADD-VERTEX-*
which is the x/y spread version
ADD-VERTEX
andADD-VERTEX-*
are valid only within the scop ofWITH-BEZIER
.Parameters
SHAPE-TYPE
is one of:LINE-STRIP
,:LINES
, or:POINTS
. WhenSHAPE-TYPE
is:LINE-STRIP
, a single continuous line is drawn through the specified waypoints. WhenSHAPE-TYPE
is:LINES
, a line is drawn to alternate waypoint pairs. WhenSHAPE-TYPE
is:POINTS
, a single point is drawn at each waypoint.SEGMENTS
is the number of segments used to draw the Bezier curve. Default is 10 segments if unspecified. The greater the number of segments, the smoother the curve.Example
(SDL:WITH-COLOR (COL (SDL:COLOR)) (WITH-BEZIER (30) (ADD-VERTEX-* 60 40) (ADD-VERTEX-* 160 10) (ADD-VERTEX-* 170 150) (ADD-VERTEX-* 60 150)))
[Macro]
with-color (var &optional color free-p) declaration* statement* => result
A convience macro that binds
*DEFAULT-COLOR*
toVAR
within the scope ofWITH-COLOR
.VAR
is set toCOLOR
whenCOLOR
is notNIL
.VAR
must be of typeSDL-COLOR
.VAR
is freed using FREE-COLOR whenFREE-P
is notNIL
.
[Macro]
with-curve (shape-type &optional segments) declaration* statement* => result
Draw a Cattmul-Rom spline of color
*DEFAULT-COLOR*
to the surface*DEFAULT-SURFACE*
. The shape of the curve is defined by waypoints. A waypoint is a vertex containing an X and Y coordinate pair.Local Methods
A vertex may be added using:
ADD-VERTEX
which accepts anSDL:POINT
, orADD-VERTEX-*
which is the x/y spread version
ADD-VERTEX
andADD-VERTEX-*
are valid only within the scope ofWITH-CURVE
.Parameters
SHAPE-TYPE
describes the line style used to draw the curve and may be one of:LINE-STRIP
,:LINES
, or:POINTS
. Use:LINE-STRIP
to draw a single continuous line through the specified waypoints. Use:LINES
to draw a line between alternate waypoint pairs. Use:POINTS
to draw a single pixel at each waypoint.SEGMENTS
is the number of segments used to draw the Catmull-Rom spline. Default is 10 segments if unspecified. The greater the number of segments, the smoother the spline.Example
(SDL:WITH-COLOR (COL (SDL:COLOR)) (WITH-CURVE (:LINE-STRIP 30) (ADD-VERTEX-* 60 40) (ADD-VERTEX-* 160 10) (ADD-VERTEX-* 170 150) (ADD-VERTEX-* 60 150)))
[Macro]
with-default-font (font) declaration* statement* => result
Sets
*DEFAULT-FONT*
to the bitmap font inFONT
within the scope ofWITH-DEFAULT-FONT
.Example
(WITH-DEFAULT-FONT (new-font) (DRAW-CHARACTER-SHADED-* "Hello World!" 0 0 F-COLOR B-COLOR))
[Macro]
with-events (&optional type) declaration* statement* => result
WITH-EVENTS
is a convenience macro for managing the main game loop. It processes incoming SDL events and limits the game loop to the specified number of frames per second.Both the SDL-POLL-EVENT and SDL-WAIT-EVENT event mechanisms are supported by specifying the
TYPE
as:POLL
or:WAIT
respectively.NOTE:
WITH-EVENTS
must be called in the same thread used to set the video mode.Example
(SDL:WITH-EVENTS (:POLL) (:QUIT-EVENT () T) (:KEY-DOWN-EVENT (:KEY KEY) (WHEN (SDL:KEY= KEY :SDL-KEY-ESCAPE) (SDL:PUSH-QUIT-EVENT))) (:VIDEO-EXPOSE-EVENT () (SDL:UPDATE-DISPLAY))))))
Frame Rate Limiting
The frame rate is specified using FRAME-RATE. For example to set the frame rate to 60 frames per second:
(SETF (SDL:FRAME-RATE) 60)
Event Syntax
Events are specified using the format
(:EVENT-TYPE (&KEYS KEYS))
EVENT-TYPE
must be one of the followingKEY
words;:ACTIVE-EVENT, :KEY-DOWN-EVENT, :KEY-UP-EVENT, :MOUSE-MOTION-EVENT, :MOUSE-BUTTON-DOWN-EVENT, :MOUSE-BUTTON-UP-EVENT, :JOY-AXIS-MOTION-EVENT, :JOY-BUTTON-DOWN-EVENT, :JOY-BUTTON-UP-EVENT, :JOY-HAT-MOTION-EVENT, :JOY-BALL-MOTION-EVENT, :VIDEO-RESIZE-EVENT, :VIDEO-EXPOSE-EVENT, :SYS-WM-EVENT, :QUIT-EVENT, :USER-EVENT
or:IDLE
.KEYS
specify the members of the event to return and are specific to each event type. These are discussed in detail below.NOTE:
:QUIT-EVENT
must returnT
to exit theWITH-EVENT
macro.NOTE:
:IDLE
is ignored whenTYPE
is:WAIT
.Polling for Events
When
TYPE
is:POLL
,WITH-EVENTS
will continually poll for currently pending events. If no events are available then the game loop is run and the forms in:IDLE
are executed.Waiting for Events
When
TYPE
is:WAIT
,WITH-EVENTS
will sleep indefinitely for the next available event. If no events are available then the game loop is paused.The :IDLE Event
(:IDLE () &BODY BODY)
The
:IDLE
event is special in that it is not generated by SDL. Rather the forms in:IDLE
are executed once each game loop after event queue is emptied.:IDLE
is ignored when the event mechanism specified byTYPE
is:WAIT
.Active Event
(:ACTIVE-EVENT (:GAIN GAIN :STATE STATE) &BODY BODY)
When the mouse leaves or enters the window area an
SDL-APP-MOUSE-FOCUS
type activation event is generated. If the mouse has entered the window thenGAIN
will be1
, otherwiseGAIN
will be0
. AnSDL-APP-INPUT-FOCUS
type activation event occurs when the application loses or gains keyboard focus, usually when a different application is made active. Finally, anSDL-APP-ACTIVE
type event occurs when the application is either minimised/iconified,GAIN
is0
, or restored. A single event can have multiple values set inSTATE
. Note: This event does not occur when an application window is first created.
GAIN
is0
if the event is a loss or1
if it is a gain.STATE
a bitmask of the following values:SDL-APP-MOUSE-FOCUS
if mouse focus was gained or lost,SDL-APP-INPUT-FOCUS
if input focus was gained or lost, andSDL-APP-ACTIVE
if the application was iconified,GAIN
is0
, or restoredGAIN
is1
.Keyboard Events
(:KEY-DOWN-EVENT (:STATE STATE :SCANCODE SCANCODE :KEY KEY :MOD MOD :UNICODE UNICODE) &BODY BODY) (:KEY-UP-EVENT (:STATE STATE :SCANCODE SCANCODE :KEY KEY :MOD MOD :UNICODE UNICODE) &BODY BODY)
A keyboard event generally occurs when a key is released or when a key is pressed. The information on the key that generated the event is stored in
KEY
andMOD
.The
SDL-CAPS-LOCK
andSDL-NUM-LOCK
keys are special cases and report anSDL-KEY-DOWN
when first pressed, then anSDL-RELEASED
when released and pressed again. These keys KEYUP and KEYDOWN events are therefore analogous to the state of the caps lock and num lock LEDs rather than the keys themselves. These special cases are required for compatibility with Sun workstations.Note: Repeating
SDL-KEY-DOWN
events will occur if key repeat is enabled using SDL-ENABLE-KEY-REPEAT.
STATE
isSDL-PRESSED
orSDL-RELEASED
if the key is pressed or released respectively.SCANCODE
is the hardware-dependent scancode returned by the keyboard.KEY
is is the SDL-defined value of the key that generated the event. The SDL-defined value forKEY
generally takes the following format::SDL-KEY-0
to:SDL-KEY-1
for numeric keys.SDL-KEY-a
toSDL-KEY-z
for alpha keys in the range a-z. Other keys are generally spelled out, for exampleSDL-KEY-PAGEDOWN
,SDL-KEY-F1
orSDL-KEY-NUMLOCK
.MOD
is current state of the keyboard modifiers as explained in SDL_GetModState. One or more of:SDL-KEY-MOD-NONE, :SDL-KEY-MOD-LSHIFT, :SDL-KEY-MOD-RSHIFT, :SDL-KEY-MOD-LCTRL, :SDL-KEY-MOD-RCTRL, :SDL-KEY-MOD-LALT, :SDL-KEY-MOD-RALT, :SDL-KEY-MOD-LMETA, :SDL-KEY-MOD-RMETA, :SDL-KEY-MOD-NUM, :SDL-KEY-MOD-CAPS, :SDL-KEY-MOD-MODE or :SDL-KEY-MOD-RESERVED
.UNICODE
is the translated character. The unicode field is only used when UNICODE translation is enabled with SDL_EnableUNICODE. If unicode is non-zero then this is the UNICODE character corresponding to the keypress. If the high 9 bits of the character are 0, then this maps to the equivalent ASCII character.Mouse Motion Event
(:MOUSE-MOTION-EVENT (:STATE STATE :X X :Y Y :X-REL X-REL :Y-REL Y-REL) &BODY BODY)
A
MOUSE-MOTION-EVENT
event occurs when the mouse moves within the application window or when SDL-WARP-MOUSE is called. Both the absoluteX
andY
and relativeX-REL
andY-REL
coordinates are reported along with the current button stateSTATE
. The button state can be interpreted using SDL-BUTTON, see SDL-GET-MOUSE-STATE.If the cursor is hidden using SDL-SHOW-CURSOR and the input is grabbed using SDL-WM-GRAB-INPUT, then the mouse will give relative motion events even when the cursor reaches the edge of the screen. This is currently only implemented on Windows and Linux/Unix-alikes.
STATE
is the current button state.X
is theX
coordinates of the mouseY
is theY
coordinates of the mouseX-REL
is the relative motion in theX
directionY-REL
is the relative motion in theY
directionMouse Button Events
(:MOUSE-BUTTON-DOWN-EVENT (:BUTTON BUTTON :STATE STATE :X X :Y Y) &BODY BODY) (:MOUSE-BUTTON-UP-EVENT (:BUTTON BUTTON :STATE STATE :X X :Y Y) &BODY BODY)
When a mouse button press or release is detected the number of the button pressed (from 1 to 255, with 1 usually being the left button and 2 the right) is placed into
BUTTON
, the position of the mouse when this event occured is stored in theX
and theY
fields.Mouse wheel events are reported as buttons 4 (up) and 5 (down). Two events are generated i.e. a
SDL-MOUSE-BUTTON-DOWN
followed by aSDL-MOUSE-BUTTON-UP
event.
BUTTON
is the mouse button index which is one ofSDL-BUTTON-LEFT
,SDL-BUTTON-MIDDLE
,SDL-BUTTON-RIGHT
,SDL-BUTTON-WHEELUP
orSDL-BUTTON-WHEELDOWN
.STATE
is the state of the button which isSDL-PRESSED
orSDL-RELEASED
.X
is theX
coordinates of the mouse at press/release time.Y
is theY
coordinates of the mouse at press/release time.Joystick Motion Event
(:JOY-AXIS-MOTION-EVENT (:WHICH WHICH :AXIS AXIS :VALUE VALUE) &BODY BODY)
A JOY-AXIS-MOTION-EVENT event occurs whenever a user moves an axis on the joystick.
WHICH
is the joystick device index. The index of the joystick that reported the event.AXIS
is the joystick axis indexVALUE
is the current position of the axis (range: -32768 to 32767)Joystick Button Events
(:JOY-BUTTON-DOWN-EVENT (:WHICH WHICH :BUTTON BUTTON :STATE STATE) &BODY BODY) (:JOY-BUTTON-UP-EVENT (:WHICH WHICH :BUTTON BUTTON :STATE STATE) &BODY BODY)
A
JOY-BUTTON-DOWN-EVENT
orJOY-BUTTON-DOWN-EVENT
event occurs whenever a user presses or releases a button on a joystick.
WHICH
is the index of the joystick that reported the event.BUTTON
is the button pressed that caused the event.STATE
is the current state of the button and is eitherSDL-PRESSED
orSDL-RELEASED
.Joystick Hat Motion Event
(:JOY-HAT-MOTION-EVENT (:WHICH WHICH :HAT HAT :VALUE VALUE) &BODY BODY)
A
JOY-HAT-MOTION-EVENT
event occurs when ever a user moves a hat on the joystick.
WHICH
is the index of the joystick that reported the event.HAT
is the index of the hat that generated the event.VALUE
is the current position of the hat, a bitwise OR'd combination of the following valuesSDL-HAT-CENTERED
,SDL-HAT-UP
,SDL-HAT-RIGHT
,SDL-HAT-DOWN
,SDL-HAT-LEFT
,SDL-HAT-RIGHT-UP
,SDL-HAT-RIGHT-DOWN
,SDL-HAT-LEFT-UP
andSDL-HAT-LEFT-DOWN
.Joystick Ball Motion Event
(:JOY-BALL-MOTION-EVENT (:WHICH WHICH :BALL BALL :X-REL X-REL :Y-REL Y-REL) &BODY BODY)
A
JOY-BALL-MOTION-EVENT
event occurs when a user moves a trackball on the joystick. Trackballs only return relative motion.
WHICH
is the index of the joystick that reported the event.BALL
is the index of the trackball that generated the event.X-REL
is the change inX
position of the ball since it was last polled (last cycle of the event loop).Y-REL
is the change inY
position of the ball since it was last polled (last cycle of the event loop).Quit Event
(:QUIT-EVENT () &BODY BODY)
If
QUIT-EVENT
is filtered or ignored then it is impossible for the user to close the window. IfQUIT-EVENT
is accepted and returnsT
then the application window will be closed. Note: Screen updates will continue to report success even though the application is no longer visible. IfQUIT-EVENT
is accepted and returnsNIL
then the application window will not be closed. SDL_QUIT-REQUESTED will return non-zero if aQUIT-EVENT
event is pending.SDL Window Resize Event
(:VIDEO-RESIZE-EVENT (:W W :H H) ...)
When
SDL-RESIZABLE
is passed as a flag to WINDOW, the user is allowed to resize the application window. When the window is resized aVIDEO-RESIZE-EVENT
event is reported, with the new window width and height values stored inW
andH
respectively. When anVIDEO-RESIZE-EVENT
event is recieved the window should be resized to the new dimensions using WINDOW.
W
is the window width as anINTEGER
.H
is the window height as an INTERGER`.SDL Window Expose Event
(:VIDEO-EXPOSE-EVENT () ...)
VIDEO-EXPOSE-EVENT
is triggered when the screen has been modified outside of the application, usually by the window manager, and needs to be redrawn.System Window Events
(:SYS-WM-EVENT () ...)
The system window manager event contains a pointer to system-specific information about unknown window manager events. If this event is enabled using SDL-EVENT-STATE, it will be generated whenever unhandled events are received from the window manager. This can be used, for example, to implement cut-and-paste in your application. If you want to obtain system-specific information about the window manager, you can fill in the version member of a
SDL-SYS-WM-INFO
structure using SDL-VERSION, and pass it to the function: SDL-GET-WM-INFOUser
(:USER-EVENT (:TYPE TYPE :CODE CODE :DATA1 DATA1 :DATA2 DATA2) ...)
USER-EVENT
is unique in that it is created by the user not SDL.USER-EVENT
can be pushed onto the event queue using PUSH-USER-EVENT. The contents of the event are completely up to the programmer.
TYPE
is a value fromSDL-USER-EVENT to
(- SDL-NUM-EVENTS 1)` inclusive.CODE
is a user defined event codeDATA1
is a user defined data pointerDATA2
is a user defined data pointerSyntax
(WITH-EVENTS (TYPE) (:ACTIVE-EVENT (:GAIN GAIN :STATE STATE) ... ) (:KEY-DOWN-EVENT (:STATE STATE :SCANCODE SCANCODE :KEY KEY :MOD MOD :UNICODE UNICODE) ... ) (:KEY-UP-EVENT (:STATE STATE :SCANCODE SCANCODE :KEY KEY :MOD MOD :UNICODE UNICODE) ...) (:MOUSE-MOTION-EVENT (:STATE STATE :X X :Y Y :X-REL X-REL :Y-REL Y-REL) ...) (:MOUSE-BUTTON-DOWN-EVENT (:BUTTON BUTTON :STATE STATE :X X :Y Y) ...) (:MOUSE-BUTTON-UP-EVENT (:BUTTON BUTTON :STATE STATE :X X :Y Y) ...) (:JOY-AXIS-MOTION-EVENT (:WHICH WHICH :AXIS AXIS :VALUE VALUE) ...) (:JOY-BUTTON-DOWN-EVENT (:WHICH WHICH :BUTTON BUTTON :STATE STATE) ...) (:JOY-BUTTON-UP-EVENT (:WHICH WHICH :BUTTON BUTTON :STATE STATE) ...) (:JOY-HAT-MOTION-EVENT (:WHICH WHICH :HAT HAT :VALUE VALUE) ...) (:JOY-BALL-MOTION-EVENT (:WHICH WHICH :BALL BALL :X-REL X-REL :Y-REL Y-REL) ...) (:VIDEO-RESIZE-EVENT (:W W :H H) ...) (:VIDEO-EXPOSE-EVENT () ...) (:SYS-WM-EVENT () ...) (:USER-EVENT (:TYPE TYPE :CODE CODE :DATA1 DATA1 :DATA2 DATA2) ...) (:QUIT-EVENT () ... T) (:IDLE () ... ))
[Macro]
with-font (font font-definition) declaration* statement* => result
Creates a new bitmap font
BITMAP-FONT
and sets*DEFAULT-FONT*
to the bitmap font inFONT
within the scope ofWITH-FONT
. Frees the bitmap font whenWITH-FONT
goes out of scope.Example
(WITH-FONT (new-font *font-8x8*) (DRAW-CHARACTER-SHADED-* "Hello World!" 0 0 F-COLOR B-COLOR))
[Macro]
with-init flags declaration* statement* => result
WITH-INIT
is a convenience macro that will attempt to initialise the SDL library and SDL subsystems prior to executing the forms inBODY
. Upon exitWITH-INIT
will uninitialize the SDL library and SDL subsystems.The lispbuilder-sdl initialization routines are somewhat complicated by the fact that a Lisp development environment will load a foreign library once but then initialise and uninitialise the library multiple times. A C/C++ development environment will open and then close a library after each execution, freeing all resources left hanging by incomplete or buggy uninitialise functions. C libraries may therefore frequently core dump in a Lisp environment when resources are not feed properly prior to the library being reinitialized.
LISPBUILDER-SDL provides functionality affording the programmer a finer granularity of control of the initialisation/uninitialisation of foreign libraries. The fuctions that provide these capabilities are as follows:
- INITIALIZE-ON-STARTUP
- QUIT-ON-EXIT
- LIST-SUB-SYSTEMS
- RETURN-SUB-SYSTEMS-OF-STATUS
- INIT-SUB-SYSTEMS
- QUIT-SUB-SYSTEMS
- INIT-SDL
- QUIT-SDL
Defaults
- By default
WITH-INIT
will only initialise theSDL-INIT-VIDEO
SDL subsystem. Additional SDL subsystems can be initialized by calling INITIALIZE-ON-STARTUP.- By default
WITH-INIT
will only uninitialise theSDL-INIT-VIDEO
SDL subsystem. Additional SDL subsystems can be uninitialized by calling QUIT-ON-EXIT.Initialisation/Uninitialisation of the SDL library
The SDL library is initialised only:
- If the library is not yet already initialized, or
- SDL-INIT-ON-STARTUP is
T
.The SDL library is uninitialised only:
- When SDL-QUIT-ON-EXIT is
T
.Initialisation/Uninitialisation of external libraries
Hooks are provided to allow external libraries to be initialized or uninitialised automatically following the initialisation or uninitialisation of the SDL library.
To initialise an external library, push a function that initialises the external library onto
*EXTERNAL-INIT-ON-STARTUP*
. The function must take no arguments. For example:(defun init-ttf () (if (is-init) t (sdl-ttf-cffi::ttf-init))) (pushnew 'init-ttf sdl:*external-init-on-startup*)
To uninitialise an external library, push a function that uninitialises the external library onto
*EXTERNAL-QUIT-ON-EXIT*
. The function must take no arguments. For example:(defun quit-ttf () (if (is-init) (sdl-ttf-cffi::ttf-quit))) (pushnew 'quit-ttf sdl:*external-quit-on-exit*)
Parameters
FLAGS
may be one or more of:SDL-INIT-EVERYTHING
,SDL-INIT-VIDEO
,SDL-INIT-CDROM
,SDL-INIT-AUDIO
,SDL-INIT-TIMER
,SDL-INIT-JOYSTICK
,SDL-INIT-EVENTTHREAD
andSDL-INIT-NOPARACHUTE
. Note: WhenFLAGS
is set byWITH-INIT
, subsequent calls to INITIALIZE-ON-STARTUP and QUIT-ON-EXIT are ignored.WITH-INIT
will only initialize and uninitialize the subsytems specified inFLAGS
.Example
(with-init (SDL-INIT-VIDEO SDL-INIT-CDROM SDL-INIT-AUDIO) ....) (with-init () (INITIALIZE-ON-STARTUP SDL-INIT-VIDEO SDL-INIT-CDROM SDL-INIT-AUDIO) (QUIT-ON-EXIT SDL-INIT-VIDEO SDL-INIT-CDROM SDL-INIT-AUDIO) ....)
[Macro]
with-locked-surface (var &optional surface) declaration* statement* => result
[Macro]
with-locked-surfaces bindings &rest body => result
[Macro]
with-point (var &optional point) declaration* statement* => result
A convenience macro that binds
*DEFAULT-POINT*
toVAR
within the scope ofWITH-POINT
.VAR
must be of typePOINT
. IfPOINT
is notNIL
, thenVAR is set to
POINT`.
[Macro]
with-rectangle (var &optional rectangle free-p) declaration* statement* => result
A convenience macro that binds
*DEFAULT-RECTANGLE*
toVAR
within the scope ofWITH-RECTANGLE
.VAR
must be of typeRECTANGLE
.VAR
is set toRECTANGLE
whenRECTANGLE
is notNIL
.VAR
is freed whenFREE-P
isT
.Example
(WITH-RECTANGLE (a-rect (RECTANGLE :x 0 :y 0 :w 100 :h 100)) ...)
[Macro]
with-rectangles bindings declaration* statement* => result
A convenience macro that binds multiple rectangles as per WITH-RECTANGLE.
Example
(WITH-RECTANGLES ((a-rect (RECTANGLE :x 0 :y 0 :w 100 :h 100)) ((b-rect (RECTANGLE :x 0 :y 100 :w 100 :h 100)) ((c-rect (RECTANGLE :x 0 :y 200 :w 100 :h 100))) ...)
[Macro]
with-shape (shape-type) declaration* statement* => result
Draw a polygon of color
*DEFAULT-COLOR*
to the surface*DEFAULT-SURFACE*
.Local Methods
A vertex may be added using:
ADD-VERTEX
which accepts anSDL:POINT
, orADD-VERTEX-*
which is the x/y spread versionADD-VERTEX and ADD-VERTEX-* are valid only within the scop of WITH-SHAPE.
Parameters
SHAPE-TYPE
describes the line style used to draw the shape and may be one of:LINE-STRIP
,:LINES
, or:POINTS
. Use:LINE-STRIP
to draw a single continuous line through the specified waypoints. Use:LINES
to draw a line between alternate waypoint pairs. Use:POINTS
to draw a single pixel at each waypoint.Example
(SDL:WITH-COLOR (COL (SDL:COLOR)) (WITH-SHAPE (:POINTS) (ADD-VERTEX-* 60 40) (ADD-VERTEX-* 160 10) (ADD-VERTEX-* 170 150) (ADD-VERTEX-* 60 150)))
[Macro]
with-surface (var &optional surface free-p) declaration* statement* => result
[Macro]
with-surface-slots (var &optional surface) declaration* statement* => result
[Macro]
with-surfaces bindings &rest body => result
[Function]
within-range p1 p2 distance => result
Returns true
T
, if the distance between thePOINT
sP1
P2
is <= the distanceDISTANCE
.
[Function]
within-range-* x1 y1 x2 y2 distance => result
Returns true
T
, if the distance between the coordinatesX1
,Y1
andX2
,Y2
is <= the distanceDISTANCE
.
[Generic accessor]
x obj => result
(setf (x obj) value)
Returns the x coordinate of the object.
[Specialized accessor]
x (obj sdl-font) => result
(setf (x (obj sdl-font)) value)
Returns the
X
position of the cached surfaceSURFACE
inFONT
.
[Specialized accessor]
x (obj sdl-surface) => result
(setf (x (obj sdl-surface)) value)
Returns the x position coordinate of the surface
SURFACE
as anINTEGER
.
[Specialized accessor]
x (obj rectangle) => result
(setf (x (obj rectangle)) value)
Returns the
X
position coordinate of the rectangleRECTANGLE
as anINTEGER
.
[Specialized accessor]
x (obj vector) => result
(setf (x (obj vector)) value)
Returns the
X
coordindate of the pointPOINT
as anINTEGER
.
[Generic accessor]
x2 obj => result
(setf (x2 obj) value)
Returns
(+ X WIDTH)
of the object.
[Specialized accessor]
x2 (obj rectangle) => result
(setf (x2 (obj rectangle)) value)
Sets the WIDTH of the rectangle
RECTANGLE
to(- X2 X)
[Generic accessor]
y obj => result
(setf (y obj) value)
Returns the y coordinate of the object.
[Specialized accessor]
y (obj sdl-font) => result
(setf (y (obj sdl-font)) value)
Returns the
Y
position of the cached surfaceSURFACE
inFONT
.
[Specialized accessor]
y (obj sdl-surface) => result
(setf (y (obj sdl-surface)) value)
Returns the y position coordinate of the surface
SURFACE
as anINTEGER
.
[Specialized accessor]
y (obj rectangle) => result
(setf (y (obj rectangle)) value)
Returns the
Y
position coordinate of the rectangleRECTANGLE
as anINTEGER
.
[Specialized accessor]
y (obj vector) => result
(setf (y (obj vector)) value)
Returns the
Y
coordindate of the pointPOINT
as anINTEGER
.
[Generic accessor]
y2 obj => result
(setf (y2 obj) value)
Returns
(+ Y HEIGHT)
of the object.
[Specialized accessor]
y2 (obj rectangle) => result
(setf (y2 (obj rectangle)) value)
Returns
(+ Y HEIGHT)
of the rectangleRECTANGLE
.