LISPBUILDER-SDL - API Reference


 

Abstract

The code comes with a BSD-style license so you can basically do with it whatever you want.

Download shortcut: http://weitz.de/files/lispbuilder-sdl.tar.gz.


 

Contents

  1. Download
  2. The LISPBUILDER-SDL dictionary
    1. *black*
    2. *blue*
    3. *cyan*
    4. *default-color*
    5. *default-display*
    6. *default-font*
    7. *default-font-path*
    8. *default-position*
    9. *default-rectangle*
    10. *default-simple-font*
    11. *default-surface*
    12. *external-init-on-startup*
    13. *external-quit-on-exit*
    14. *font-10x20*
    15. *font-5x7*
    16. *font-5x8*
    17. *font-6x10*
    18. *font-6x12*
    19. *font-6x13*
    20. *font-6x13b*
    21. *font-6x13o*
    22. *font-6x9*
    23. *font-7x13*
    24. *font-7x13b*
    25. *font-7x13o*
    26. *font-7x14*
    27. *font-7x14b*
    28. *font-8x13*
    29. *font-8x13b*
    30. *font-8x13o*
    31. *font-8x8*
    32. *font-9x15*
    33. *font-9x15b*
    34. *font-9x18*
    35. *font-9x18b*
    36. *green*
    37. *magenta*
    38. *opengl-context*
    39. *red*
    40. *sdl-initialized*
    41. *simple-font-4x5*
    42. *white*
    43. *yellow*
    44. a
    45. all-integers?
    46. alpha
    47. alpha-enabled-p
    48. any-color-but-this
    49. average-fps
    50. b
    51. bit-depth
    52. bitmap-font
    53. blit-surface
    54. cached-surface
    55. cast
    56. cast-all-to-int
    57. cast-to-int
    58. catmull-rom-spline
    59. char-height
    60. char-width
    61. check-types
    62. clear-cell
    63. clear-clip-rect
    64. clear-color-key
    65. clear-display
    66. clip-rect
    67. color
    68. color
    69. color-*
    70. color-a
    71. color-key
    72. color-key-enabled-p
    73. color=
    74. convert-surface
    75. convert-to-display-format
    76. copy-channel-to-alpha
    77. copy-point
    78. copy-surface
    79. create-list-if-not
    80. create-path
    81. create-rwops-from-file
    82. create-simple-font-definition
    83. create-surface
    84. disable-key-repeat
    85. display-surface
    86. distance
    87. distance-*
    88. draw-bezier
    89. draw-box
    90. draw-box-*
    91. draw-circle
    92. draw-circle-*
    93. draw-curve
    94. draw-ellipse
    95. draw-ellipse-*
    96. draw-filled-circle
    97. draw-filled-circle-*
    98. draw-filled-ellipse
    99. draw-filled-ellipse-*
    100. draw-filled-pie
    101. draw-filled-pie-*
    102. draw-filled-polygon
    103. draw-filled-trigon
    104. draw-font
    105. draw-font
    106. draw-font-at
    107. draw-font-at-*
    108. draw-hline
    109. draw-line
    110. draw-line-*
    111. draw-pie
    112. draw-pie-*
    113. draw-pixel
    114. draw-pixel-*
    115. draw-polygon
    116. draw-rectangle
    117. draw-rectangle-*
    118. draw-shape
    119. draw-string-blended
    120. draw-string-blended-*
    121. draw-string-shaded
    122. draw-string-shaded-*
    123. draw-string-solid
    124. draw-string-solid-*
    125. draw-surface
    126. draw-surface-at
    127. draw-surface-at-*
    128. draw-trigon
    129. draw-vline
    130. enable-alpha
    131. enable-color-key
    132. enable-key-repeat
    133. enable-key-repeat-p
    134. enable-rle-accel
    135. enable-unicode
    136. enable-unicode-p
    137. fill-surface
    138. fill-surface-*
    139. flood-fill
    140. flood-fill-*
    141. flood-fill-stack
    142. flood-fill-stack-*
    143. fp
    144. frame-rate
    145. free
    146. free-cached-surface
    147. g
    148. get-clip-rect
    149. get-font-ascent
    150. get-font-descent
    151. get-font-face-family-name
    152. get-font-face-style-name
    153. get-font-faces
    154. get-font-height
    155. get-font-line-skip
    156. get-font-size
    157. get-font-style
    158. get-glyph-metric
    159. get-key-state
    160. get-native-window
    161. get-point
    162. get-position
    163. get-rectangle
    164. get-surface-rect
    165. handle-key-down
    166. handle-key-up
    167. height
    168. image-p
    169. image-type-of
    170. init-sdl
    171. init-sub-systems
    172. initialise-default-font
    173. initialise-font
    174. initialise-input-util
    175. initialize-on-startup
    176. initialized-sub-systems-p
    177. is-font-face-fixed-width
    178. is-valid-ptr
    179. key-held-p
    180. key-held-time
    181. key-pressed-p
    182. key-repeat-delay
    183. key-repeat-interval
    184. key=
    185. list-modes
    186. list-sub-systems
    187. load-image
    188. map-color
    189. map-color-*
    190. num-joysticks
    191. pack-color
    192. pixel-alpha-enabled-p
    193. point
    194. point-*
    195. position-*
    196. push-quit-event
    197. push-user-event
    198. query-cursor
    199. quit-input-util
    200. quit-on-exit
    201. quit-sdl
    202. quit-sub-systems
    203. r
    204. random+1
    205. random-rectangle
    206. read-pixel
    207. read-pixel-*
    208. rectangle
    209. rectangle
    210. rectangle-*
    211. rectangle-from-edges
    212. rectangle-from-edges-*
    213. rectangle-from-midpoint-*
    214. render-string-blended
    215. render-string-shaded
    216. render-string-solid
    217. return-sub-systems-of-status
    218. rle-accel-enabled-p
    219. rotate-surface
    220. rotate-surface-xy
    221. rwops
    222. save-image
    223. sdl-any-format
    224. sdl-async-blit
    225. sdl-bitmap-font
    226. sdl-doublebuf
    227. sdl-fullscreen
    228. sdl-get-ticks
    229. sdl-hw-accel
    230. sdl-hw-palette
    231. sdl-hw-surface
    232. sdl-init-audio
    233. sdl-init-cdrom
    234. sdl-init-eventthread
    235. sdl-init-everything
    236. sdl-init-joystick
    237. sdl-init-noparachute
    238. sdl-init-on-startup
    239. sdl-init-timer
    240. sdl-init-video
    241. sdl-iyuv-overlay
    242. sdl-joystick-name
    243. sdl-no-frame
    244. sdl-opengl
    245. sdl-pre-alloc
    246. sdl-quit-on-exit
    247. sdl-resizable
    248. sdl-rle-accel
    249. sdl-rle-accel-ok
    250. sdl-src-alpha
    251. sdl-src-color-key
    252. sdl-surface
    253. sdl-sw-surface
    254. sdl-uyvy-overlay
    255. sdl-wm-grab-input
    256. sdl-yuy2-overlay
    257. sdl-yv12-overlay
    258. sdl-yvyu-overlay
    259. set-cell
    260. set-cell-*
    261. set-clip-rect
    262. set-color
    263. set-color-*
    264. set-default-font
    265. set-font-style
    266. set-gl-attribute
    267. set-point
    268. set-point-*
    269. set-position
    270. set-position-*
    271. set-rectangle
    272. set-rectangle-*
    273. set-surface
    274. set-surface-*
    275. show-cursor
    276. simple-font-definition
    277. surface
    278. surface-info
    279. time-scale
    280. to-degree
    281. to-radian
    282. update-display
    283. update-input-util
    284. update-surface
    285. update-surface-*
    286. video-dimensions
    287. video-driver-name
    288. video-info
    289. video-memory
    290. width
    291. window
    292. with-bezier
    293. with-color
    294. with-curve
    295. with-default-font
    296. with-events
    297. with-font
    298. with-foreign-color-copy
    299. with-init
    300. with-locked-surface
    301. with-locked-surfaces
    302. with-point
    303. with-rectangle
    304. with-rectangles
    305. with-shape
    306. with-surface
    307. with-surface-slots
    308. with-surfaces
    309. within-range
    310. within-range-*
    311. x
    312. x2
    313. y
    314. y2
    315. zoom-surface
  3. Acknowledgements

 

Download

LISPBUILDER-SDL together with this documentation can be downloaded from http://weitz.de/files/lispbuilder-sdl.tar.gz. The current version is 0.1.0.
 

The LISPBUILDER-SDL dictionary


[Special variable]
*black*


RGB COLOR black.


[Special variable]
*blue*


RGB COLOR blue.


[Special variable]
*cyan*


RGB COLOR cyan.


[Special variable]
*default-color*


Functions that accept the KEYword parameter COLOR will most likely bind to the symbol *DEFAULT-COLOR* by default if COLOR is not specified.

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*


Functions that accept the KEYword parameter FONT will most likely bind to the symbol *DEFAULT-FONT* by default if FONT is not specified.

A font is bound to *DEFAULT-FONT* by the following; WITH-DEFAULT-FONT, WITH-FONT and INITIALISE-DEFAULT-FONT.

Example
(draw-string-solid-* "draw string centered" 100 100  
                      :justify :center :color sdl:*white* :font a-font)  
(draw-string-solid-* "draw string left" 100 100  
                      :justify :left :color sdl:*white* :font a-font)  
(draw-string-solid-* "draw string right" 100 100  
                      :justify :right :color sdl:*white* :font a-font) 

The above can be shortened by setting *DEFAULT-FONT* to a-font.

(WITH-DEFAULT-FONT (a-font)  
  (WITH-COLOR (COL SDL:*WHITE*)  
    (DRAW-STRING-SOLID-* "draw string centered" 100 100 :JUSTIFY :CENTER)  
    (DRAW-STRING-SOLID-* "draw string left" 100 100 :JUSTIFY :LEFT)  
    (DRAW-STRING-SOLID-* "draw string right" 100 100 :JUSTIFY :RIGHT))) 


[Special variable]
*default-font-path*



[Special variable]
*default-position*



[Special variable]
*default-rectangle*



[Special variable]
*default-simple-font*



[Special variable]
*default-surface*


Functions that accept the KEYword parameter :SURFACE will most likely bind to the symbol *DEFAULT-SURFACE* by default if SURFACE is not specified.

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.

Packages


[Special variable]
*font-5x7*


Contains the font data for an 5x7 bitmap font.

Packages


[Special variable]
*font-5x8*


Contains the font data for an 5x8 bitmap font.

Packages


[Special variable]
*font-6x10*


Contains the font data for an 6x10 bitmap font.

Packages


[Special variable]
*font-6x12*


Contains the font data for an 6x12 bitmap font.

Packages


[Special variable]
*font-6x13*


Contains the font data for an 6x13 bitmap font.

Packages


[Special variable]
*font-6x13b*


Contains the font data for an 6x13 bitmap font.

Packages


[Special variable]
*font-6x13o*


Contains the font data for an 6x13 bitmap font.

Packages


[Special variable]
*font-6x9*


Contains the font data for an 6x9 bitmap font.

Packages


[Special variable]
*font-7x13*


Contains the font data for an 7x13 bitmap font.

Packages


[Special variable]
*font-7x13b*


Contains the font data for an 7x13 bitmap font.

Packages


[Special variable]
*font-7x13o*


Contains the font data for an 7x13 bitmap font.

Packages


[Special variable]
*font-7x14*


Contains the font data for an 7x14 bitmap font.

Packages


[Special variable]
*font-7x14b*


Contains the font data for an 7x14 bitmap font.

Packages


[Special variable]
*font-8x13*


Contains the font data for an 8x13 bitmap font.

Packages


[Special variable]
*font-8x13b*


Contains the font data for an 8x13 bitmap font.

Packages


[Special variable]
*font-8x13o*


Contains the font data for an 8x13 bitmap font.

Packages


[Special variable]
*font-8x8*


Contains the font data for an 8x8 bitmap font.

Packages


[Special variable]
*font-9x15*


Contains the font data for an 9x15 bitmap font.

Packages


[Special variable]
*font-9x15b*


Contains the font data for an 9x15 bitmap font.

Packages


[Special variable]
*font-9x18*


Contains the font data for an 9x18 bitmap font.

Packages


[Special variable]
*font-9x18b*


Contains the font data for an 9x18 bitmap font.

Packages


[Special variable]
*green*


RGB COLOR green.


[Special variable]
*magenta*


RGB COLOR magenta.


[Special variable]
*opengl-context*


The symbol *OPENGL-CONTEXT* is T when an OpenGL display context is created, and NIL otherwise. UPDATE-SURFACE will swap the OPENGL buffers when *OPENGL-CONTEXT* is T, and swap the SDL video buffers otherwise.


[Special variable]
*red*


RGB COLOR red.


[Special variable]
*sdl-initialized*



[Special variable]
*simple-font-4x5*



[Special variable]
*white*


RGB COLOR white.


[Special variable]
*yellow*


RGB COLOR yellow.


[Generic accessor]
a color => result
(setf (a color) value)



[Specialized accessor]
a (color color-a) => result
(setf (a (color color-a)) value)



[Method]
a (color color) => result



[Macro]
all-integers? &rest values => result


Returns T if all values are INTEGERS.


[Generic accessor]
alpha surface => result
(setf (alpha surface) value)



[Specialized accessor]
alpha (surface sdl-surface) => result
(setf (alpha (surface sdl-surface)) value)



[Generic accessor]
alpha-enabled-p surface => result
(setf (alpha-enabled-p surface) value)



[Specialized accessor]
alpha-enabled-p (surface sdl-surface) => result
(setf (alpha-enabled-p (surface sdl-surface)) value)



[Generic function]
any-color-but-this color => result


Returns a new color that is different to COLOR.


[Method]
any-color-but-this color => result



[Function]
average-fps &optional fpsmanager => result


Returns the average frame rate of the event loop calculated over a sliding window of 100 frames.


[Generic accessor]
b color => result
(setf (b color) value)



[Specialized accessor]
b (color color) => result
(setf (b (color color)) value)



[Function]
bit-depth &optional surface => result


Returns the number of bytes per pixel, or bpp, of SURFACE.


[Standard class]
bitmap-font



[Function]
blit-surface source &optional surface => result


Performs a fast blit of the SOURCE surface to the destination SURFACE. The area defined by the SOURCE cell is blitted to the area defined by the destination clipping rectangle. The blit function should not be called on a locked surface. The results of blitting operations vary greatly depending on whether a surface ALPHA channel is set on the source surface or not. The priorty of how color key and alpha attributes interact with surface blitting is as follows:

An ALPHA channel has the following effect on blitting operations:

Note: RGBA to RGBA blits (with ALPHA-ENABLED-P 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.


[Generic accessor]
cached-surface font => result
(setf (cached-surface font) value)



[Specialized accessor]
cached-surface (font font) => result
(setf (cached-surface (font font)) value)



[Macro]
cast type value => result


Coerces the value VALUE to the type TYPE.


[Macro]
cast-all-to-int &rest values => result


Casts the values in REST to FIXNUMs.


[Macro]
cast-to-int value => result


Casts the value VALUE to a FIXNUM.


[Function]
catmull-rom-spline val v0 v1 v2 v3 => result



[Generic accessor]
char-height bitmap-font-definition => result
(setf (char-height bitmap-font-definition) value)



[Method]
char-height (bitmap-font-definition bitmap-font) => result



[Specialized accessor]
char-height (bitmap-font-definition bitmap-font-definition) => result
(setf (char-height (bitmap-font-definition bitmap-font-definition)) value)



[Generic accessor]
char-width bitmap-font-definition => result
(setf (char-width bitmap-font-definition) value)



[Method]
char-width (bitmap-font-definition bitmap-font) => result



[Specialized accessor]
char-width (bitmap-font-definition bitmap-font-definition) => result
(setf (char-width (bitmap-font-definition bitmap-font-definition)) value)



[Macro]
check-types type &rest rest => result


Performs CHECK-TYPE on items in rest.


[Function]
clear-cell &key surface index => result


Sets the CELL at INDEX to the bounds of SURFACE.


[Function]
clear-clip-rect &optional surface => result


Removes the clipping RECTANGLE.


[Function]
clear-color-key &key surface => result


Disables the color key.


[Function]
clear-display color &key surface update => result


Fills the display SURFACE using color COLOR. SURFACE is bound to *DEFAULT-DISPLAY* if unspecified. The display is updated when UPDATE is T.


[Generic accessor]
clip-rect surface => result
(setf (clip-rect surface) value)



[Specialized accessor]
clip-rect (surface sdl-surface) => result
(setf (clip-rect (surface sdl-surface)) value)



[Standard class]
color


A color containing INTEGER Red, Green and Blue components. Free using FREE.


[Function]
color &key r g b a => result


Returns a new RGB COLOR from the specified Red, Green, and Blue components. Returns a new RGBA COLOR-A from the specified Red, Green, Blue, and Alpha components.


[Generic function]
color-* color => result


Returns the RGB/A color components as a spread. COLOR-A returns (VALUES R G B A). COLOR returns (VALUES R G B)


[Method]
color-* (color color-a) => result



[Method]
color-* (color color) => result



[Standard class]
color-a


An color containing INTEGER Red, Green, Blue and Alpha components. Free using FREE.


[Generic accessor]
color-key simple-font-definition => result
(setf (color-key simple-font-definition) value)



[Specialized accessor]
color-key (simple-font-definition simple-font-definition) => result
(setf (color-key (simple-font-definition simple-font-definition)) value)



[Specialized accessor]
color-key (simple-font-definition sdl-surface) => result
(setf (color-key (simple-font-definition sdl-surface)) value)



[Generic accessor]
color-key-enabled-p surface => result
(setf (color-key-enabled-p surface) value)



[Specialized accessor]
color-key-enabled-p (surface sdl-surface) => result
(setf (color-key-enabled-p (surface sdl-surface)) value)



[Generic function]
color= color1 color2 => result


Returns T if the RGB<->RGB or RGBA<->RGBA color components in COLOR1 and COLOR2 match. Returns NIL otherwise.


[Method]
color= (color1 color-a) (color2 color-a) => result



[Method]
color= (color1 color) (color2 color) => result



[Method]
color= color1 color2 => result



[Function]
convert-surface &key surface to-surface enable-alpha enable-color-key free inherit type => result


Converts :SURFACE and returns a new surface matching the pixel format and color of :TO-SURFACE. Calls CONVERT-TO-DISPLAY-FORMAT if converting to the display format.

Use :ENABLE-COLOR-KEY or :ENABLE-ALPHA to take advantage of hardware colorkey or alpha blit acceleration. Enabling these flags once a surface is created will not necessarily utilize available harware acceleration if the surface was not initally created in video memory.

Will create the new surface in system menory when TYPE is :SW. Will attempt to create the new surface in video menory when TYPE is :HW, otherwise the surface is created in system memory if the combination of color key and alpha do not allow hardware acceleration.

The new surface will inherit the pixel, alpha and color key components of the source, unless :INHERIT is NIL.

Use :FREE to delete the source SURFACE.


[Function]
convert-to-display-format &key surface enable-alpha enable-color-key pixel-alpha free inherit => result


Returns a new surface matching the pixel format and color of the video frame buffer (*display surface*), that is suitable for fast blitting. The new surface will inherit the pixel, alpha and color key components of the source, *unless* :INHERIT is NIL`.

Use :ENABLE-COLOR-KEY or :ENABLE-ALPHA to take advantage of hardware colorkey or alpha blit acceleration. Enabling these flags once a surface is created will not necessarily utilize available harware acceleration if the surface was not initally created in video memory.

Use :PIXEL-ALPHA to enable the pixel alpha component (alpha mask of 0xFF) for the new surface.

Use :FREE to delete the source SURFACE.

Differences between CONVERT-TO-DISPLAY-FORMAT, CONVERT-SURFACE, COPY-SURFACE, and CREATE-SURFACE;


[Function]
copy-channel-to-alpha destination source &key channel => result



[Function]
copy-point point => result


Returns a copy of the point POINT.


[Function]
copy-surface &key cell cell-index surface color-key alpha pixel-alpha rle-accel type free inherit fill color-key-fill pixel-format => result


Returns a copy of :SURFACE.

Use :COLOR-KEY or :ALPHA to set the key color and surface alpha transparency. Hardware colorkey and alpha blit acceleration will be used if supported.

Will create the new surface in system menory when TYPE is :SW. Will attempt to create the new surface in video menory when TYPE is :HW, otherwise the surface is created in system memory if the combination of color key and alpha do not allow hardware acceleration.

The new surface will be filled with the old surface unless :FILL is NIL. The new surface will be filled with the color key of the old surface (if available) unless :COLOR-KEY-FILL is NIL.

The new surface will inherit the pixel, alpha and color key components of the source, unless :INHERIT is NIL.

Use :FREE to delete the source SURFACE.


[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 and PATH.


[Function]
create-rwops-from-file filename => result


Creates and returns a new RWOPS object from the file at location FILENAME.


[Function]
create-simple-font-definition width height char-map color-key filename &key pad-x pad-y => result



[Function]
create-surface width height &key bpp type color-key color-key-at pixel-alpha alpha rle-accel x y => result


Creates and returns a new SURFACE with the dimensions WIDTH and HEIGHT.

:COLOR-KEY sets the color key of the surface and enables color-keying.

:ALPHA sets the surface alpha transparency and enables alpha blending. This allows a pixel color of RGB with the surface A.

:PIXEL-ALPHA enables a pixel alpha component (alpha mask of 0xFF) on the new surface. This allows a pixel color of RGBA.

:RLE-ACCEL enables RLE blit acceleration.

:BPP is the pixel depth of the surface, and my be 8, 16, 24 or 32.

:TYPE attempts to create the SURFACE in video memory when :HW, and in system memory when :SW

:X and :Y are the positions of the SURFACE in screen coordinates.


[Function]
disable-key-repeat => result


Disables keyboard repeat.


[Standard class]
display-surface


The current display surface. Can be accessed using SDL:*DEFAULT-DISPLAY*.


[Function]
distance p1 p2 => result


Returns the distance between the POINTs P1 and P2.


[Function]
distance-* x1 y1 x2 y2 => result


Returns the distance between the coordinates X1, Y1 and X2, Y2.


[Function]
draw-bezier vertices &key clipping surface color segments style => result


Draw a bezier curve of COLOR to SURFACE. 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
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))  
               :style :SOLID) 
Packages


[Function]
draw-box rect &key clipping surface color stroke-color alpha => result


See DRAW-BOX-*.

Parameters
Packages


[Function]
draw-box-* x y w h &key clipping surface color stroke-color alpha => result


Draws a filled rectangle of COLOR to SURFACE.

Parameters
Packages


[Function]
draw-circle p1 r &key surface color alpha aa => result


See DRAW-CIRCLE-*.

Parameters
Packages


[Function]
draw-circle-* x0 y0 r &key surface color alpha aa => result


Draws a circle circumference of COLOR to SURFACE. Use DRAW-FILLED-CIRCLE-* to draw a filled circle.

Parameters
Packages


[Function]
draw-curve vertices &key clipping surface color segments style => result


Draw a Cattmul-Rom spline of COLOR to SURFACE. The shape of the curve is defined by waypoints. A waypoint is a vertex containing an X and Y coordinate pair.

Parameters
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))) 
Packages


[Function]
draw-ellipse p1 rx ry &key surface color aa => result


See DRAW-ELLIPSE-*.

Parameters
Packages


[Function]
draw-ellipse-* x y rx ry &key surface color aa => result


Draws an ellipse circumference of COLOR to the SURFACE. Use DRAW-FILLED-ELLIPSE-* to draw a filled ellipse.

Parameters
Packages


[Function]
draw-filled-circle p1 r &key surface color stroke-color alpha => result


See DRAW-FILLED-CIRCLE-*.

Parameters
Packages


[Function]
draw-filled-circle-* x0 y0 r &key surface color stroke-color alpha => result


Draws a filled circle of COLOR to SURFACE.

Parameters
Packages


[Function]
draw-filled-ellipse p1 rx ry &key surface color => result


See DRAW-FILLED-ELLIPSE-*.

Parameters
Packages


[Function]
draw-filled-ellipse-* x y rx ry &key surface color => result


Draws a filled ellipse of COLOR to the SURFACE.

Parameters
Packages


[Function]
draw-filled-pie p1 rad start end &key surface color => result


See DRAW-FILLED-PIE-*.

Parameters
Packages


[Function]
draw-filled-pie-* x y rad start end &key surface color => result


Draws a filled pie of COLOR to the SURFACE

Parameters
Packages


[Function]
draw-filled-polygon vertices &key surface color => result


Draw a filled polygon of COLOR to the SURFACE

Parameters
Packages


[Function]
draw-filled-trigon p1 p2 p3 &key surface color => result


Draw a filled trigon of COLOR to the SURFACE

Parameters
Packages


[Generic function]
draw-font &key font surface => result


Blit the cached SURFACE in font to the destination SURFACE. The cached surface is created during a previous call to any of the DRAW-STRING* functions.

Packages


[Function]
draw-font &key font surface => result



[Generic function]
draw-font-at position &key font surface => result


See DRAW-FONT. The cached surface is rendered at POSITION POINT.

Packages


[Method]
draw-font-at position &key font surface => result



[Generic function]
draw-font-at-* x y &key font surface => result


See DRAW-FONT. The cached surface is rendered at poisition X and Y.

Packages


[Method]
draw-font-at-* x y &key font surface => result



[Function]
draw-hline x0 x1 y &key surface color clipping template => result


Draw a horizontal line of COLOR from X0 to X1 through Y onto onto SURFACE.

Parameters
Packages


[Function]
draw-line p1 p2 &key surface color clipping aa => result


See DRAW-LINE-*.

Parameters
Packages


[Function]
draw-line-* x0 y0 x1 y1 &key surface color clipping aa => result


Draws a line of COLOR to SURFACE.

Parameters
Packages


[Function]
draw-pie p1 rad start end &key surface color => result


See DRAW-PIE-*.

Parameters
Packages


[Function]
draw-pie-* x y rad start end &key surface color => result


Draws a pie of COLOR to the SURFACE. Use DRAW-FILLED-PIE-* to draw a filled pie.

Parameters
Packages


[Function]
draw-pixel point &key clipping surface color => result


See DRAW-PIXEL-*.

Parameters
Packages


[Function]
draw-pixel-* x y &key clipping surface color => result


Draw a single pixel of COLOR to the SURFACE at the specified X and Y coordiates.

Parameters
Packages


[Function]
draw-polygon vertices &key surface color clipping aa => result


Draw the circumference of a polygon of COLOR to SURFACE using the vertices in POINTS. Use DRAW-FILLED-POLYGON-* to draw a filled polygon.

Parameters
Packages


[Function]
draw-rectangle rect &key clipping surface color alpha => result


See DRAW-RECTANGLE-*.

Parameters
Packages


[Function]
draw-rectangle-* x y w h &key clipping surface color alpha => result


Draw a rectangle outline of COLOR to SURFACE.

Parameters
Packages


[Function]
draw-shape vertices &key clipping surface color style => result


Draw a polygon of COLOR to SURFACE using VERTICES.

Parameters
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))) 
Packages


[Function]
draw-string-blended string p1 &key justify surface font color => result


See DRAW-STRING-BLENDED-*.

Parameters
Packages


[Function]
draw-string-blended-* string x y &key justify surface font color => result


Draw text STRING at location X Y using font FONT with color COLOR onto surface SURFACE. The text is keyed onto SURFACE.

Parameters
Returns
Example
(DRAW-STRING-SOLID-* "Hello World!" 0 0 :SURFACE A-SURFACE :COLOR A-COLOR) 
Packages


[Function]
draw-string-shaded string p1 fg-color bg-color &key justify surface font => result


See DRAW-STRING-SHADED-*.

Parameters
Packages


[Function]
draw-string-shaded-* string x y fg-color bg-color &key justify surface font => result


Draw text STRING at location X Y using font FONT with text color FG-COLOR and background color BG-COLOR onto surface SURFACE. The surface background is filled with BG-COLOR so the surface cannot be keyed over other surfaces.

Returns
Example
(DRAW-STRING-SHADED-* "Hello World!" 0 0 F-COLOR B-COLOR :SURFACE A-SURFACE) 
Packages


[Function]
draw-string-solid string p1 &key justify surface font color => result


See DRAW-STRING-SOLID-*.

Parameters
Packages


[Function]
draw-string-solid-* string x y &key justify surface font color => result


Draw text STRING at location X Y using font FONT with color COLOR onto surface SURFACE. The text is keyed onto SURFACE.

Parameters
Returns
Example
(DRAW-STRING-SOLID-* "Hello World!" 0 0 :SURFACE A-SURFACE :COLOR A-COLOR) 
Packages


[Function]
draw-surface src &key surface => result


See BLIT-SURFACE


[Function]
draw-surface-at src point &key surface => result


Draws the source surface to the destination surface at position POINT. See BLIT-SURFACE.


[Function]
draw-surface-at-* src x y &key surface => result


Draws the source surface to the destination surface at position X and Y. See BLIT-SURFACE


[Function]
draw-trigon p1 p2 p3 &key surface color clipping aa => result


Draw the outline of a trigon or triangle, of COLOR to SURFACE. Use DRAW-FILLED-TRIGON-* to draw a filled trigon.

Parameters
Packages


[Function]
draw-vline x y0 y1 &key surface color clipping template => result


Draw a vertical line of COLOR from Y0 to Y1 through X onto SURFACE.

Parameters
Packages


[Function]
enable-alpha value &key surface => result


Enable surface alpha blending for when T. Disable surface alpha blending when NIL. A SURFACE need not have a pixel alpha component (RGBA) to use surface alpha blending.


[Function]
enable-color-key value &key surface => result


Enables color keying when T. Disable color keying when NIL


[Function]
enable-key-repeat delay interval => result


Enables the keyboard repeat rate. DELAY specifies how long the key must be pressed before it begins repeating, it then repeats at the speed specified by INTERVAL. Both DELAY and INTERVAL are expressed in milliseconds. Setting DELAY or INTERVAL to NIL will set the default values of SDL-DEFAULT-REPEAT-DELAY and SDL-DEFAULT-REPEAT-INTERVAL respectively.


[Function]
enable-key-repeat-p => result


Returns the current keyboard DELAY and INTERVAL repeat rate in milliseconds as (VALUES DELAY INTERVAL).


[Function]
enable-rle-accel value &key surface => result


Enables RLE blit acceleration when T, disables RLE acceleration when NIL. RLE acceleration can substantially speed up blitting of images with large horizontal runs of transparent pixels (i.e., pixels that match the key color).


[Function]
enable-unicode state => result


Unicode translation is enabled with STATE is T, and disabled when STATE is NIL. To obtain the character codes corresponding to received keyboard events, Unicode translation must first be turned on using this function. The translation incurs a slight overhead for each keyboard event and is therefore disabled by default. For each subsequently received key down event, the unicode member of the SDL_keysym structure will then contain the corresponding character code, or zero for keysyms that do not correspond to any character code. Note that only key press events will be translated, not release events. Returns the previous unicode translation state.


[Function]
enable-unicode-p => result


Queries the current state of Unicode keyboard translation. Returns T if enabled, NIL if disabled.


[Function]
fill-surface color &key template surface update clipping => result


Fills surface with the specified COLOR. :TEMPLATE accepts a RECTANGLE defining the fill bounds. The surface is updated when :UPDATE`


[Function]
fill-surface-* r g b &key a template surface update clipping => result


Fill the surface with the specified color R G B :A A. See FILL-SURFACE.


[Function]
flood-fill point &key surface color => result


See FLOOD-FILL-*.

Parameters


[Function]
flood-fill-* x y &key surface color => result


Performs a flood fill of surface SURFACE with color COLOR. The fill starts at the position specified by the X and Y 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


[Function]
flood-fill-stack point &key surface color => result


See FLOOD-FILL-STACK-*.

Parameters


[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 rectangle-array => result
(setf (fp rectangle-array) value)


Returns the foreign pointer in FOREIGN-OBJECT


[Specialized accessor]
fp (rectangle-array rectangle-array) => result
(setf (fp (rectangle-array rectangle-array)) value)



[Specialized accessor]
fp (rectangle-array color-a) => result
(setf (fp (rectangle-array color-a)) value)



[Specialized accessor]
fp (rectangle-array color) => result
(setf (fp (rectangle-array color)) value)



[Method]
fp (rectangle-array foreign-object) => result



[Accessor]
frame-rate &optional fpsmanager => result
(setf (frame-rate &optional fpsmanager) rate)


Manage the target frame rate for the game loop. RATE > 0 will lock the game loop to the specified frame rate, and calculate the average frame rate over a number of frames. RATE = 0 will unlock the frame rate, and calculate the average frame rate over a number of frames. RATE < 0 will unlock the frame rate. The average frane rate is not calculated.

See WITH-EVENTS, and AVERAGE-FPS.


[Generic function]
free foreign-object => result


The general explicit cleanup method for the FOREIGN-OBJECT wrapper class. Objects that subclass FOREIGN-OBJECT should specify an :AFTER method on FREE to clean up any additional fields, if necessary.


[Method]
free (foreign-object display-surface) => result


Freeing the display surface is not a valid operation.


[Method]
free (foreign-object color) => result



[Method]
free (foreign-object foreign-object) => result



[Generic function]
free-cached-surface font => result



[Method]
free-cached-surface (font font) => result



[Generic accessor]
g color => result
(setf (g color) value)



[Specialized accessor]
g (color color) => result
(setf (g (color color)) value)



[Function]
get-clip-rect &key surface rectangle => result


Returns the clipping RECTANGLE.


[Function]
get-font-ascent &key font => result


Returns the maximum pixel ascent of all glyphs of font FONT. This can also be interpreted as the distance from the top of the font to the baseline. It could be used when drawing an individual glyph relative to a top point, by combining it with the glyph's maxy metric to resolve the top of the rectangle used when blitting the glyph on the screen.

Parameters
Returns
Packages


[Function]
get-font-descent &key font => result


Returns the maximum pixel descent of all glyphs of font FONT. This can also be interpreted as the distance from the baseline to the bottom of the font. It could be used when drawing an individual glyph relative to a bottom point, by combining it with the glyph’s maxy metric to resolve the top of the rectangle used when blitting the glyph on the screen.

Parameters
Returns
Packages


[Function]
get-font-face-family-name &key font => result


Returns the current font face family name of font FONT or NIL if the information is unavailable.

Parameters
Returns
Packages


[Function]
get-font-face-style-name &key font => result


Returns the current font face style name of font FONT, or NIL if the information is unavailable.

Parameters
Returns
Packages


[Function]
get-font-faces &key font => result


Returns the number of faces 'sub-fonts' available in the font FONT. This is a count of the number of specific fonts (based on size and style and other typographical features perhaps) contained in the font itself. It seems to be a useless fact to know, since it can’t be applied in any other SDL_TTF functions.

Parameters
Returns
Packages


[Function]
get-font-height &key font => result


Returns the maximum pixel height of all glyphs of font FONT. Use this height for rendering text as close together vertically as possible, though adding at least one pixel height to it will space it so they can't touch. Remember that SDL_TTF doesn't handle multiline printing so you are responsible for line spacing, see GET-FONT-LINE-SKIP as well.

Parameters
Returns
Packages


[Function]
get-font-line-skip &key font => result


Returns the recommended pixel height of a rendered line of text of the font FONT. This is usually larger than the GET-FONT-HEIGHT of the font.

Parameters
Returns
Packages


[Function]
get-font-size text &key size font => result


Calculates and returns the resulting SIZE of the SDL:SURFACE that is required to render the text TEXT, or NIL on error. No actual rendering is performed, however correct kerning is calculated for the actual width. The height returned is the same as returned using GET-FONT-HEIGHT.

Parameters
Returns
Packages


[Function]
get-font-style &key font => result


Returns the rendering style of the font FONT. If no style is set then :STYLE-NORMAL is returned, or NIL upon error.

Parameters
Returns
Packages


[Function]
get-glyph-metric ch &key metric font => result


Returns the glyph metrics METRIC for the character CH, or NIL upon error.

Parameters
Returns
Example
(GET-GLYPH-METRIC UNICODE-CHAR :METRIC :MINX :FONT *DEFAULT-FONT*) 
Packages


[Function]
get-key-state key => result


Returns the current keypress state of the key KEY. Returns T if the SDL-KEY is pressed, returns NIL if SDL-KEY is not pressed. Note: Use SDL_PumpEvents to update the state array. Note: This function gives you the current state after all events have been processed, so if a key or button has been pressed and released before you process events, then the pressed state will never show up in the getstate calls. Note: This function doesn't take into account whether shift has been pressed or not. For example: (GET-KEY-STATE :SDL-KEY-F1)


[Function]
get-native-window => result


Returns a foreign pointer to the native SDL display window.


[Generic function]
get-point object => result


Returns the X and Y coordinates of object OBJ as a POINT.


[Method]
get-point (object sdl-surface) => result


Returns the POINT position coordinates of SURFACE.


[Method]
get-point (object rectangle) => result


Returns the X and Y coordinates of rectangle RECTANGLE as a POINT.


[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 obj => result


Returns the rectangle RECTANGLE.


[Method]
get-rectangle (obj rectangle) => result


Returns the rectangle RECTANGLE.


[Function]
get-surface-rect &key surface rectangle => result



[Function]
handle-key-down key => result



[Function]
handle-key-up key => result



[Generic accessor]
height obj => result
(setf (height obj) value)



[Method]
height (obj font) => result



[Method]
height (obj sdl-surface) => result


Returns the height of SURFACE as an INTEGER.


[Specialized accessor]
height (obj rectangle) => result
(setf (height (obj rectangle)) value)


Returns the INTEGER height of the rectangle RECTANGLE.


[Generic function]
image-p source image-type => result


Returns T when the image type in SOURCE is of IMAGE-TYPE. Returns NIL otherwise. Attempts to detect the image type using the magic number contained in the image if one is available. NIL is always returned for images of type TGA as a TGA image does not contain a magic number. IMAGE-TYPE must be one of :BMP, :GIF, :JPG, :LBM, :PCX, :PNG, :PNM, :TIF, :XCF, :XPM or :XV.

Example
(RWOPS-P SOURCE :IMAGE-TYPE :BMP)  
(IMAGE-P "image.bmp" :IMAGE-TYPE :BMP) 
Packages


[Generic function]
image-type-of source => result


Returns the type of image in source SOURCE. Attempts to detect the image type using the magic number contained in the image if one is available. Returns one of :BMP, :GIF, :JPG, :LBM, :PCX, :PNG, :PNM, :TIF, :XCF, :XPM or :XV, if the image type can be determined. Returns NIL if the image cannot be determined (The magic number is not supported or the magic number is not found). NIL is always returned for images of type TGA as a TGA image does not contain a magic number.

Example
(IMAGE-TYPE-OF SOURCE)  
(IMAGE-TYPE-OF "image.bmp") 
Packages


[Function]
init-sdl &optional init => result


Initalizes the SDL library when the OPTIONAL parameter INIT is T, or the value returned by SDL-INIT-ON-STARTUP is T.


[Function]
init-sub-systems &optional flags => result


Initializes the SDL subsystems specified in FLAGS. FLAGS is an INTEGER 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 and SDL-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


Returns a new SDL-BITMAP-FONT initialized from FONT-DEFINITION data, or NIL if the font cannot be created. FONT-DEFINITION is set to *font-8x8* if unspecified. Binds the symbol *DEFAULT-FONT* to the new font to be used as the default for subsequent font rendering or drawing operations.

Packages


[Generic function]
initialise-font font-definition => result


Returns a new SDL-BITMAP-FONT initialized from FONT-DEFINITION data, or NIL 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*.

Packages


[Method]
initialise-font (font-definition simple-font-definition) => result



[Method]
initialise-font (font-definition bitmap-font-definition) => result



[Function]
initialise-input-util => result


Initialises the input util system. This just creates the data structure that key press information is stored in, and maintains a global variable to track initialisation status.

Parameters
Returns


[Function]
initialize-on-startup &rest flags => result


Sets the SDL subsystems that must be initialized in subsequent calls to INIT-SUB-SYSTEMS.

Parameters
Returns
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-font-face-fixed-width &key font => result


Returns T if the font face is of a fixed width, or NIL otherwise. Fixed width fonts are monospace, meaning every character that exists in the font is the same width.

Parameters
Returns
Packages


[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-held-p key => result



[Function]
key-held-time key => result



[Function]
key-pressed-p key => result



[Function]
key-repeat-delay => result


Returns the current key repeat delay, in milliseconds.


[Function]
key-repeat-interval => result


Returns the current key repeat interval, in milliseconds.


[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 flags FLAGS. LIST-MODES must be called after SDL is initialised using INIT-SDL or WITH-INIT.

Parameters
Returns
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 an INTEGER 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 and SDL-INIT-NOPARACHUTE.


[Generic function]
load-image source &key color-key alpha image-type force free-rwops color-key-at => result


Creates and returns a new SURFACE from the image in SOURCE, or returns NIL if SOURCE does not contain a valid image or the image type cannot be determined.

The magic number if present is be used to determine the image type. To load an image when the magic number is unavailable (image formats such as TGA do not contain a magic number), specify the image type using :IMAGE-TYPE. All non-magicable image formats, such as TGA, must be specified using IMAGE-TYPE. To load a TGA image use :IMAGE-TYPE :TGA

Parameters
Example
Packages


[Method]
load-image (source string) &key color-key alpha image-type force free-rwops color-key-at => result


Returns a new SURFACE from the file at location FILENAME.


[Method]
load-image (source vector) &key color-key alpha image-type force free-rwops color-key-at => result


Returns a new SURFACE from the byte array in SOURCE.


[Method]
load-image (source rwops) &key color-key alpha image-type force free-rwops color-key-at => result


Returns a new SURFACE from the RWOPS in SOURCE.


[Generic function]
map-color color &optional surface => result


Maps COLOR or COLOR-A to the pixel format of SURFACE and returns the pixel value that best approximates the color value of the surface. 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 all 1 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



[Method]
map-color (color color) &optional surface => result



[Generic function]
map-color-* r g b a &optional surface => result


Maps the color specified by the R, G, B, and A color components to the pixel format of SURFACE and returns the pixel value that best approximates the color value of the surface. If A is not NIL then the color is assumed to contain an alpha component. See MAP-COLOR for more details.


[Method]
map-color-* (r integer) (g integer) (b integer) a &optional surface => result



[Function]
num-joysticks => result



[Generic function]
pack-color color => result


Packs COLOR or COLOR-A into a four byte INTEGER.


[Method]
pack-color (color color-a) => result



[Method]
pack-color (color color) => result



[Generic function]
pixel-alpha-enabled-p surface => result


Returns T if a pixel alpha component (RGBA) is available, or NIL if unavailable (RGB). Note: The pixel alpha component differs from the surface alpha component which is retrieved using ALPHA-ENABLED-P.


[Method]
pixel-alpha-enabled-p (surface sdl-surface) => result



[Function]
point &key x y => result


Creates a new POINT set to the specified horizontal X and vertical Y coordinate.


[Generic function]
point-* point => result


Returns the X and Y coordinates of the object as a spread. The RESULT is (VALUES X Y)


[Method]
point-* (point sdl-surface) => result


Returns the X and Y position coordinates of SURFACE as a spread.


[Method]
point-* (point rectangle) => result


Returns the X and Y coordinates of the rectangle RECTANGLE as a spread. The RESULT is (VALUES X Y)


[Method]
point-* (point vector) => result


Returns the X and Y coordinates of the point POINT 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. Returns NIL if the cursor is disabled and hidden.


[Function]
quit-input-util => result


This is called when you quit your app to free up the key information data

Parameters
Returns


[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
Returns
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 parameter QUIT is T, or the value returned by SDL-QUIT-ON-EXIT is T.


[Function]
quit-sub-systems &optional flags => result


Uninitializes the SDL subsystems specified in the INTEGER bitmask FLAGS. 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)



[Specialized accessor]
r (color color) => result
(setf (r (color color)) value)



[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 width BOUND-W and height BOUND-H. RECTANGLE if unset will force the creation of a new RECTANGLE object. RECTANGLE if set will be modified with the coordinates.


[Function]
read-pixel point &key clipping surface => result


See READ-PIXEL-*.

Parameters
Packages


[Function]
read-pixel-* x y &key clipping surface => result


Read the COLOR of the pixel at X and Y coordiates from SURFACE.

Parameters
Packages


[Standard class]
rectangle


A RECTANGLE object manages the foreign SDL_Rect object. Free using FREE.


[Function]
rectangle &key x y w h fp => result


Creates a new RECTANGLE from the specified X, Y, width W and height H. If FP&#039; is NIL then a foreign SDL_Rect is created. If FP is a pointer to a foreign SDL_Rect object then FP` is used.


[Generic function]
rectangle-* obj => result


Returns the X, Y, WIDTH and HEIGHT coordinates of the object as a spread. The RESULT is (VALUES X Y WIDTH HEIGHT)


[Method]
rectangle-* (obj sdl-surface) => result


Returns the fields X, Y, WIDTH and HEIGHT from SURFACE as a spread.


[Method]
rectangle-* (obj rectangle) => result


Returns the X, Y, WIDTH and HEIGHT coordinates of the rectangle RECTANGLE as a spread. The RESULT is (VALUES X Y WIDTH HEIGHT)


[Function]
rectangle-from-edges p1 p2 &optional rectangle => result


See RECTANGLE-FROM-EDGES-*.


[Function]
rectangle-from-edges-* x1 y1 x2 y2 &optional rectangle => result


Returns a new RECTANGLE using the bounds specified by the INTEGERS X1, X2, Y1 and Y2. The coordinates of the rectangle are X = X1, Y = Y1, WIDTH = (- X2 X1), HEIGHT = (- Y2 Y1)

Parameters


[Function]
rectangle-from-midpoint-* x y w h &optional rectangle => result


Returns a RECTANGLE of width W and height H with the rectangle mid-point at coordinates X and Y. RECTANGLE if unset will force the creation of a new RECTANGLE object. RECTANGLE if set will be modified with the coordinates.


[Function]
render-string-blended string &key font color free cache => result


Render the string STRING using font FONT with text color COLOR to a new SURFACE. 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 the FONT object. When :FREE T any exisiting cached surface in FONT is automatically freed. When :FREE NIL the caller is responsible for freeing any existing cached surface in FONT.

Parameters
Returns
Example
(DRAW-STRING-SOLID "Hello World!" :COLOR A-COLOR) 
Packages


[Function]
render-string-shaded string fg-color bg-color &key font free cache => result


Render the string STRING using font FONT with text color FG-COLOR and background color BG-COLOR to a new SURFACE. The dimensions of the new surface are height == FONT height, and width == FONT width * STRING length. The surface background is filled with BG-COLOR so the surface cannot be keyed over other surfaces. Use :CACHE T to cache the new surface in the FONT object. When :FREE T any exisiting cached surface in FONT is automatically freed. When :FREE NIL the caller is responsible for freeing any existing cached surface in FONT.

Parameters
Returns
Example
(RENDER-STRING-SHADED "Hello World!" F-COLOR B-COLOR) 
Packages


[Function]
render-string-solid string &key font color free cache => result


Render the string STRING using font FONT with text color COLOR to a new SURFACE. 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 the FONT object. When :FREE T any exisiting cached surface in FONT is automatically freed. When :FREE NIL the caller is responsible for freeing any existing cached surface in FONT.

Parameters
Returns
Example
(DRAW-STRING-SOLID "Hello World!" :COLOR A-COLOR) 
Packages


[Function]
return-sub-systems-of-status flags status => result


Returns the status STATUS of the the specified SDL subsystems in FLAGS as an INTEGER bitmask.

Parameters
Returns


[Generic accessor]
rle-accel-enabled-p surface => result
(setf (rle-accel-enabled-p surface) value)



[Specialized accessor]
rle-accel-enabled-p (surface sdl-surface) => result
(setf (rle-accel-enabled-p (surface sdl-surface)) value)



[Function]
rotate-surface degrees &key surface free zoom smooth => result


Returns a new SURFACE rotated to DEGREES.

Parameters
Packages


[Function]
rotate-surface-xy degrees &key surface free zoomx zoomy smooth => result


Returns a new SURFACE rotated to DEGREES.

Parameters
Packages


[Standard class]
rwops


A wrapper around a foreign SDL_RWops object. Free using FREE.


[Function]
save-image surface filename => result


Saves the SURFACE as a BMP image to a file at location FILENAME.


[Constant]
sdl-any-format


Applies to DISPLAY-SURFACE.

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.

Asynchronous blits usually slows down blitting on single CPU machines, but may provide a speed increase on SMP systems.


[Standard class]
sdl-bitmap-font


The SDL-BITMAP-FONT object manages the resources for a bitmap font. Prior to the first call to a RENDER-STRING* function, the cached SURFACE is NIL.

The cached surface is created by a call to any of the RENDER-STRING* functions. Use DRAW-FONT, DRAW-FONT-AT or DRAW-FONT-AT-* to draw the cached surface.

Free using FREE


[Constant]
sdl-doublebuf


Applies to DISPLAY-SURFACE.

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.


[Function]
sdl-get-ticks => result



[Constant]
sdl-hw-accel


Applies to SURFACE and DISPLAY-SURFACE.


[Constant]
sdl-hw-palette


Applies to SURFACE and DISPLAY-SURFACE.

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.

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. Returns NIL otherwise.


[Constant]
sdl-init-timer



[Constant]
sdl-init-video



[Constant]
sdl-iyuv-overlay



[Function]
sdl-joystick-name device-index => result



[Constant]
sdl-no-frame


Applies to DISPLAY-SURFACE.

Fullscreen modes automatically have this flag set.


[Constant]
sdl-opengl


Applies to DISPLAY-SURFACE.


[Constant]
sdl-pre-alloc


Applies to SURFACE.


[Function]
sdl-quit-on-exit => result


Returns T if the SDL library must be uninitialised in QUIT-SDL, or WITH-INIT. Returns NIL otherwise.


[Constant]
sdl-resizable


Applies to DISPLAY-SURFACE.

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

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.


[Constant]
sdl-src-color-key


Applies to SURFACE.


[Standard class]
sdl-surface


A wrapper for the foreign SDL_Surface object.


[Constant]
sdl-sw-surface


Applies to SURFACE and DISPLAY-SURFACE.

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



[Function]
sdl-wm-grab-input mode => result



[Constant]
sdl-yuy2-overlay



[Constant]
sdl-yv12-overlay



[Constant]
sdl-yvyu-overlay



[Function]
set-cell rectangle &key surface index => result


Sets the CELL at INDEX to the bounds of RECTANGLE. Note: When SURFACE is the source of a blit, only the area within the cell rectangle is drawn.


[Function]
set-cell-* x y w h &key surface index => result


Sets the CELL at INDEX to a rectangle bounded by X, Y, W and H. Note: When SURFACE is the source of a blit, only the area within the cell rectangle is drawn.


[Function]
set-clip-rect rectangle &key surface => result


See CLIP-RECT.


[Generic function]
set-color dst src => result


Copies the RGB/A color components to the destination DST from the source SRC.


[Method]
set-color (dst color) (src color) => result



[Generic function]
set-color-* color &key r g b a => result


Sets COLOR to the red R, green G, blue B and alpha A color components.


[Method]
set-color-* (color color) &key r g b a => result



[Generic function]
set-default-font font => result


Sets the font FONT as the default font to be used for subsequent font rendering or drawing operations. Binds the symbol *DEFAULT-FONT* to font. Functions that take a FONT argument use *DEFAULT-FONT* unless otherwise specified. Returns a new FONT, or NIL if unsuccessful.


[Method]
set-default-font (font bitmap-font) => result



[Function]
set-font-style style &key font => result


Sets the rendering style STYLE of font FONT. This will flush the internal cache of previously rendered glyphs, even if there is no change in style, so it may be best to check the current style using GET-FONT-STYLE first.

Parameters
Packages


[Function]
set-gl-attribute attribute value => result



[Generic function]
set-point dst src => result


Copies the X and Y coordinates to the destination DST from the source SRC.


[Method]
set-point (dst sdl-surface) (src vector) => result


Sets the POINT position coordinates of SURFACE.


[Method]
set-point (dst rectangle) (src vector) => result


Copies the X and Y coordinates to the destination rectangle RECTANGLE from the source point POSITION.


[Method]
set-point (dst vector) (src vector) => result


Sets the X and Y coordinates of the destination point DST to the coordinates in the source point SRC. Returns the destination point DST.


[Generic function]
set-point-* obj &key x y => result


Sets the X and Y coordinates of the object OBJ. X and Y are KEYword parameters.


[Method]
set-point-* (obj sdl-surface) &key x y => result


Sets the X and Y position coordinates of SURFACE. X and Y are integers.


[Method]
set-point-* (obj rectangle) &key x y => result


Sets the X and Y coordinates of the rectangle RECTANGLE. X and Y are KEYword parameters.


[Method]
set-point-* (obj vector) &key x y => result


Sets the X and Y coordinates of the point POINT to X and Y.


[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 and Y coordinates of the rectangle RECTANGLE from the point POSITION.


[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 and Y coordinates of the rectangle RECTANGLE. X and Y are KEYword 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 and HEIGHT coordinates to the destination rectangle DST from the source rectangle SRC.


[Method]
set-rectangle (dst rectangle) (src rectangle) => result


Copies the X, Y, WIDTH and HEIGHT coordinates to the destination rectangle DST from the source rectangle SRC.


[Generic function]
set-rectangle-* rectangle &key x y w h => result


Sets the X, Y, WIDTH and HEIGHT coordinates of the rectangle RECTANGLE. X, Y, WIDTH and HEIGHT are KEYword parameters having default values of 0 if unspecified.


[Method]
set-rectangle-* (rectangle rectangle) &key x y w h => result


Sets the coordinates of the rectangle RECTANGLE to the specified X, Y , width W and height HEIGHT coordinates. X, Y, W and H are KEYword parameters of type INTEGER. Returns the rectangle RECTANGLE as RESULT.


[Generic function]
set-surface surface position => result


Sets the coordinates of the surface SURFACE to POSITION, where position is of type POINT.


[Method]
set-surface (surface sdl-surface) (position vector) => result


See SET-POINT.


[Generic function]
set-surface-* surface &key x y => result


Sets the coordinates of the surface SURFACE. X and Y are KEYword parameters having default values of 0 if unspecified.


[Method]
set-surface-* (surface sdl-surface) &key x y => result


See SET-POINT-*.


[Function]
show-cursor state => result


Disables the cursor when state is NIL, otherwise enables the cursor.


[Standard class]
simple-font-definition



[Standard class]
surface


This object is garbage collected and the SDL_Surface object freed when out of scope. Free using FREE.


[Function]
surface-info surface &optional info => result


Returns information about the SDL surface SURFACE.

Parameters
Returns

INFO when NIL will return a list of all enabled surface flags. Otherwise will return INFO as T or NIL if supported by the surface.

Example
(SURFACE-INFO A-SURFACE '(SDL-HW-SURFACE SDL-HW-PALETTE SDL-HW-ACCELL)) 


[Function]
time-scale &optional fpsmanager => result



[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 screen SURFACE if SDL-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-input-util time => result


This must be called once for each time period you are updating the application, in order to update keypress information.

Parameters
Returns


[Function]
update-surface surface &optional template => result


Updates the surface


[Function]
update-surface-* surface x y w h => result


See UPDATE-SURFACE.


[Function]
video-dimensions => result


Returns the best video dimensions if called before a window is created, using WINDOW. Returns the current video dimensions if called after a window is created. Must be called after SDL is initialized using INIT-SDL or WITH-INIT


[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 &optional info => result


Returns information about the video hardware. GET-VIDEO-INFO must be called after SDL is initialised using INIT-SDL or WITH-INIT. If GET-VIDEO-INFO is called before WINDOW, the information returned is of the best video mode. If GET-VIDEO-INFO is called after WINDOW, the information returned is of the current video mode.

Parameters
Example
(video-info :HW-AVAILABLE) 


[Function]
video-memory => result


Returns the amount of video memory of the graphics hardware. Must be called after SDL is initialized using INIT-SDL or WITH-INIT.


[Generic accessor]
width obj => result
(setf (width obj) value)



[Method]
width (obj font) => result



[Method]
width (obj sdl-surface) => result


Returns the width of SURFACE as an INTEGER.


[Specialized accessor]
width (obj rectangle) => result
(setf (width (obj rectangle)) value)


Returns the INTEGER width of the rectangle RECTANGLE.


[Function]
window width height &key bpp flags title-caption icon-caption => result


Creates a new SDL window of pixel width WIDTH and height HEIGHT 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 like SDL-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 using SDL-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 or SDL_VIDEO_WINDOW_POS=x,y. These may be set using SDL-PUT-ENV.

Parameters
Returns
Example
(WINDOW 320 240 :TITLE-CAPTION "Random-Rects" :ICON-CAPTION "Random-Rects"  
                 :FLAGS '(SDL-DOUBLEBUF SDL-FULLSCREEN)) 


[Macro]
with-bezier (&optional style segments) declaration* statement* => result


Draw a bezier curve of *DEFAULT-COLOR* to *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 and ADD-VERTEX-* are valid only within the scop of WITH-BEZIER.

Parameters
Example
(SDL:WITH-COLOR (COL (SDL:COLOR))  
   (WITH-BEZIER ()  
     (ADD-VERTEX-* 60  40)  
     (ADD-VERTEX-* 160 10)  
     (ADD-VERTEX-* 170 150)  
     (ADD-VERTEX-* 60  150))) 
Packages


[Macro]
with-color (var &optional color free) declaration* statement* => result


A convience macro that binds *DEFAULT-COLOR* to VAR within the scope of WITH-COLOR. VAR is set to COLOR when COLOR is not NIL.VAR must be of type COLOR, or COLOR-A. VAR is freed using FREE when FREE is T.


[Macro]
with-curve (&optional style segments) declaration* statement* => result


Draw a Cattmul-Rom spline of *DEFAULT-COLOR* to *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 and ADD-VERTEX-* are valid only within the scope of WITH-CURVE.

Parameters
Example
(SDL:WITH-COLOR (COL (SDL:COLOR))  
   (WITH-CURVE (:SOLID 30)  
     (ADD-VERTEX-* 60  40)  
     (ADD-VERTEX-* 160 10)  
     (ADD-VERTEX-* 170 150)  
     (ADD-VERTEX-* 60  150))) 
Packages


[Macro]
with-default-font (font) declaration* statement* => result


Sets *DEFAULT-FONT* to FONT within the scope of WITH-DEFAULT-FONT.

Example
(WITH-DEFAULT-FONT (new-font)  
    (DRAW-CHARACTER-SHADED-* "Hello World!" 0 0 F-COLOR B-COLOR)) 
Packages


[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 (&amp;KEYS KEYS))

NOTE: :QUIT-EVENT must return T to exit the WITH-EVENT macro.

NOTE: :IDLE is ignored when TYPE 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 by TYPE 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 then GAIN will be 1, otherwise GAIN will be 0. An SDL-APP-INPUT-FOCUS type activation event occurs when the application loses or gains keyboard focus, usually when a different application is made active. Finally, an SDL-APP-ACTIVE type event occurs when the application is either minimised/iconified, GAIN is 0, or restored. A single event can have multiple values set in STATE. Note: This event does not occur when an application window is first created.

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 and MOD.

The SDL-CAPS-LOCK and SDL-NUM-LOCK keys are special cases and report an SDL-KEY-DOWN when first pressed, then an SDL-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.

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 absolute X and Y and relative X-REL and Y-REL coordinates are reported along with the current button state STATE. 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.

Mouse 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 the X and the Y 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 a SDL-MOUSE-BUTTON-UP event.

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.

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 or JOY-BUTTON-DOWN-EVENT event occurs whenever a user presses or releases a button on a joystick.

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.

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.

Quit Event
(:QUIT-EVENT ()  
   &BODY BODY) 

If QUIT-EVENT is filtered or ignored then it is impossible for the user to close the window. If QUIT-EVENT is accepted and returns T then the application window will be closed. Note: Screen updates will continue to report success even though the application is no longer visible. If QUIT-EVENT is accepted and returns NIL then the application window will not be closed. SDL_QUIT-REQUESTED will return non-zero if a QUIT-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 a VIDEO-RESIZE-EVENT event is reported, with the new window width and height values stored in W and H respectively. When an VIDEO-RESIZE-EVENT event is recieved the window should be resized to the new dimensions using WINDOW.

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-INFO

User
(: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.

Syntax
(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


Sets *DEFAULT-FONT* to a new BITMAP-FONT in FONT within the scope of WITH-FONT. Frees FONT when WITH-FONT goes out of scope, and sets *DEFAULT-FONT* to NIL.

Example
(WITH-FONT (new-font *font-8x8*)  
    (DRAW-CHARACTER-SHADED-* "Hello World!" 0 0 F-COLOR B-COLOR)) 
Packages


[Macro]
with-foreign-color-copy (struct color) declaration* statement* => result


Creates and assigns a new foreign SDL_Color to STRUCT. Then copies the color components from COLOR into STRUCT. STRUCT is free'd when out of scope.


[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 in BODY. Upon exit WITH-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:

Defaults
Initialisation/Uninitialisation of the SDL library

The SDL library is initialised only:

The SDL library is uninitialised only:

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
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* to VAR within the scope of WITH-POINT. VAR must be of type POINT. If POINT is not NIL, then VAR is set to POINT`.


[Macro]
with-rectangle (var &optional rectangle free) declaration* statement* => result


A convenience macro that binds *DEFAULT-RECTANGLE* to VAR within the scope of WITH-RECTANGLE. VAR must be of type RECTANGLE. VAR is set to RECTANGLE when RECTANGLE is not NIL. VAR is freed when FREE is T.

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 (&optional style) declaration* statement* => result


Draw a polygon of *DEFAULT-COLOR* to *DEFAULT-SURFACE*.

Local Methods

A vertex may be added using:

ADD-VERTEX and ADD-VERTEX-* are valid only within the scop of WITH-SHAPE.

Parameters
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))) 
Packages


[Macro]
with-surface (var &optional surface free) 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 the POINTs P1 P2 is <= the distance DISTANCE.


[Function]
within-range-* x1 y1 x2 y2 distance => result


Returns true T, if the distance between the coordinates X1, Y1 and X2, Y2 is <= the distance DISTANCE.


[Generic accessor]
x obj => result
(setf (x obj) value)



[Specialized accessor]
x (obj font) => result
(setf (x (obj font)) value)



[Specialized accessor]
x (obj sdl-surface) => result
(setf (x (obj sdl-surface)) value)


Returns the X position coordinate of SURFACE as an INTEGER.


[Specialized accessor]
x (obj rectangle) => result
(setf (x (obj rectangle)) value)


Returns the X position coordinate of the rectangle RECTANGLE as an INTEGER.


[Specialized accessor]
x (obj vector) => result
(setf (x (obj vector)) value)


Returns the X coordindate of the point POINT as an INTEGER.


[Generic accessor]
x2 obj => result
(setf (x2 obj) value)



[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)



[Specialized accessor]
y (obj font) => result
(setf (y (obj font)) value)



[Specialized accessor]
y (obj sdl-surface) => result
(setf (y (obj sdl-surface)) value)


Returns the Y position coordinate of SURFACE as an INTEGER.


[Specialized accessor]
y (obj rectangle) => result
(setf (y (obj rectangle)) value)


Returns the Y position coordinate of the rectangle RECTANGLE as an INTEGER.


[Specialized accessor]
y (obj vector) => result
(setf (y (obj vector)) value)


Returns the Y coordindate of the point POINT as an INTEGER.


[Generic accessor]
y2 obj => result
(setf (y2 obj) value)



[Specialized accessor]
y2 (obj rectangle) => result
(setf (y2 (obj rectangle)) value)


Returns (+ Y HEIGHT) of the rectangle RECTANGLE.


[Function]
zoom-surface zoomx zoomy &key surface free smooth => result


Returns a new SURFACE scaled to ZOOMX and ZOOMY.

Parameters
Packages

 

Acknowledgements

This documentation was prepared with DOCUMENTATION-TEMPLATE.

$Header: /usr/local/cvsrep/documentation-template/output.lisp,v 1.14 2008/05/29 08:23:37 edi Exp $

BACK TO MY HOMEPAGE