You are looking at historical revision 32849 of this page. It may differ significantly from its current revision.
sdl2
- sdl2
- Introduction
- Help Wanted!
- Installation
- Demos and Examples
- Related Libraries
- Version History
- Reference Documentation
- Conventions
- Enums
- Struct Record Types
- sdl-audio-cvt
- sdl-audio-spec
- sdl-color
- sdl-cursor
- sdl-display-mode
- sdl-event
- sdl-controller-axis-event
- sdl-controller-button-event
- sdl-controller-device-event
- sdl-dollar-gesture-event
- sdl-drop-event
- sdl-joy-axis-event
- sdl-joy-ball-event
- sdl-joy-button-event
- sdl-joy-device-event
- sdl-joy-hat-event
- sdl-keyboard-event
- sdl-mouse-button-event
- sdl-mouse-motion-event
- sdl-mouse-wheel-event
- sdl-multi-gesture-event
- sdl-quit-event
- sdl-sys-wm-event
- sdl-text-editing-event
- sdl-text-input-event
- sdl-touch-finger-event
- sdl-user-event
- sdl-window-event
- sdl-finger
- sdl-joystick
- sdl-joystick-guid?
- sdl-keysym
- sdl-palette
- sdl-pixel-format
- sdl-point
- sdl-rect
- sdl-rwops
- sdl-surface
- sdl-sys-wm-info
- sdl-sys-wm-msg
- sdl-texture
- sdl-version
- sdl-window
- Procedures
Introduction
The sdl2 egg provides bindings to Simple DirectMedia Layer version 2 (SDL2). SDL is a popular library used in games and other media-rich software.
The sdl2 egg provides a programmer-friendly, convenient, and CHICKEN-idiomatic interface to SDL2. It takes care of the annoying low-level C stuff for you, so you can focus on making your game.
If a feature you need is not yet available, please file a feature request or contact a maintainer, so we can prioritize adding it.
- Project / Source Code Repository
- https://gitlab.com/chicken-sdl2/chicken-sdl2
- Issue Tracker
- https://gitlab.com/chicken-sdl2/chicken-sdl2/issues
- Maintainer
- John Croisant (john+chicken at croisant dot net)
- License
- BSD 2-Clause
Help Wanted!
This egg needs volunteers to help with several things:
- Writing API reference docs, guides, and tutorials
- Writing unit tests and semi-automated test programs
- Testing on different platforms and helping create good installation instructions
- Creating feature demos and example games/programs
If you wish to help in any way, please contact the project maintainer.
Installation
ATTENTION: The sdl2 egg has not been released yet. For now, you must download it from its source code repository and follow the instructions in the README.
When installing the egg, you should set the SDL2_FLAGS environment variable to a string of compiler flags to be used when compiling the egg. If you have the sdl2-config helper program installed on your system, you can set appropriate flags and install the extension like so (notice these are back ticks, not quotes):
SDL2_FLAGS=`sdl2-config --cflags --libs` chicken-install sdl2
If you do not have the sdl2-config helper program installed on your computer, you may manually specify SDL-related compiler flags (notice these are double quotes, not back ticks):
SDL2_FLAGS="-I/usr/local/include/SDL2 -L/usr/local/lib -lSDL2" chicken-install
The SDL2_FLAGS environment variable only needs to be set during installation of the egg, not during normal use.
Demos and Examples
After you have installed chicken-sdl2, you can try compiling and running chicken-sdl2 demos and examples.
The demos directory contains small programs demonstrating how to use various features of chicken-sdl2. E.g. to compile and run the basics demo:
csc demos/basics.scm demos/basics
The chicken-sdl2-examples repository contains complete example games and programs made with chicken-sdl2.
Related Libraries
The sdl2-image egg provides bindings to version 2 of the SDL_image library. It is built to be compatible with sdl2.
The sdl-base egg provides bindings to older versions of SDL. Its API is not compatible with sdl2.
Version History
sdl2 has not yet been released. Coming soon!
Reference Documentation
Conventions
- Procedure names are lower case and hyphenated.
- Procedures that return #t or #f are suffixed with "?".
- Procedures that cause a mutation or side effect are suffixed with "!".
- Procedures that set the value of an attribute are named like TYPE-ATTR-set!, e.g. sdl-rect-x-set!.
- In most cases, it is also possible to use (set! ...) to set the value of attributes, e.g. (set! (sdl-rect-x my-rect) 42).
- Some procedures return multiple values, e.g. sdl-window-size returns two values, the width and height. You can use receive, let-values, etc. to catch all the return values.
- Procedures that allocate a new object often have two versions, one without an asterisk and one with an asterisk, e.g. sdl-make-surface and sdl-make-surface*.
- The version without an asterisk returns an object whose memory will be automatically freed when the object is garbage collected. It is recommended to use this version for safety, unless you have a good reason to do manual memory management.
- The version with an asterisk returns an object that must be manually freed when you are done with it, using e.g. sdl-free-surface!. This is slightly more efficient (especially if you are allocating hundreds or thousands of objects), but if you forget to free it, your program will leak memory.
- Many procedures that return an enum symbol or a list of enum symbols, also have a "raw" version that returns an integer value, e.g. sdl-event-type and sdl-event-type-raw.
- Setters that accept an enum symbol will also accept the corresponding integer value. Setters that accept a list of enum symbols will also accept an integer representing bitwise-or'd integer flags or masks.
Enums
The sdl2 egg uses symbols instead of integer constants, for things like event types, keyboard keys, and init flags. See the enum tables for details.
Struct Record Types
[procedure] (sdl-struct-null? record)Returns #t if the given record instance is wrapping a null pointer. record can be an instance of any of the struct record types provided by this library. Usually this indicates that the underlying struct has been manually freed (e.g. using sdl-free-surface!). It is an error to get or set any field of a record that is wrapping a null pointer. So, you can use this procedure to check whether it is safe to use the record.
sdl-audio-cvt
sdl-audio-cvt is a record type that wraps a pointer to a SDL_AudioCVT struct.
[procedure] (sdl-audio-cvt? obj) → booleanReturns #t if obj is a sdl-audio-cvt.
[procedure] (sdl-audio-cvt-needed audio-cvt) → fixnumGet the value of the SDL_AudioCVT's "needed" field, as an integer.
[procedure] (sdl-audio-cvt-src-format audio-cvt) → symbolGet the value of the SDL_AudioCVT's "src_format" field, as a symbol.
[procedure] (sdl-audio-cvt-src-format-raw audio-cvt) → fixnumGet the value of the SDL_AudioCVT's "src_format" field, as an integer. See also sdl-audio-cvt-src-format.
[procedure] (sdl-audio-cvt-dst-format audio-cvt) → symbolGet the value of the SDL_AudioCVT's "dst_format" field, as a symbol.
[procedure] (sdl-audio-cvt-dst-format-raw audio-cvt) → fixnumGet the value of the SDL_AudioCVT's "dst_format" field, as an integer. See also sdl-audio-cvt-dst-format.
[procedure] (sdl-audio-cvt-rate-incr audio-cvt) → doubleGet the value of the SDL_AudioCVT's "rate_incr" field, as a double precision floating point number.
[procedure] (sdl-audio-cvt-buf audio-cvt) → pointerGet the value of the SDL_AudioCVT's "buf" field, as a pointer to an array of Uint8 numbers. Use sdl-audio-cvt-len to get the length of the array.
[procedure] (sdl-audio-cvt-len audio-cvt) → fixnumGet the value of the SDL_AudioCVT's "len" field, as an integer. This is the length of the array returned by sdl-audio-cvt-buf.
[procedure] (sdl-audio-cvt-len-cvt audio-cvt) → fixnumGet the value of the SDL_AudioCVT's "len_cvt" field, as an integer.
[procedure] (sdl-audio-cvt-len-mult audio-cvt) → fixnumGet the value of the SDL_AudioCVT's "len_mult" field, as an integer.
[procedure] (sdl-audio-cvt-len-ratio audio-cvt) → doubleGet the value of the SDL_AudioCVT's "len_ratio" field, as a double precision floating point number.
sdl-audio-spec
sdl-audio-spec is a record type that wraps a pointer to a SDL_AudioSpec struct.
[procedure] (sdl-audio-spec? obj) → booleanReturns #t if obj is a sdl-audio-spec.
[procedure] (sdl-audio-spec-freq audio-spec) → fixnum[setter] (set! (sdl-audio-spec-freq audio-spec) val)
[setter] (sdl-audio-spec-freq-set! audio-spec freq)
Get or set the value of the SDL_AudioSpec's "freq" field, as an integer (int).
[procedure] (sdl-audio-spec-format audio-spec) → symbol[setter] (set! (sdl-audio-spec-format audio-spec) format)
[setter] (sdl-audio-spec-format-set! audio-spec format)
Get or set the value of the SDL_AudioSpec's "format" field, as a symbol. When setting, either a symbol or an integer will be accepted.
[procedure] (sdl-audio-spec-format-raw audio-spec) → fixnum[setter] (set! (sdl-audio-spec-format-raw audio-spec) val)
Get or set the value of the SDL_AudioSpec's "format" field, as an integer. See also sdl-audio-spec-format.
[procedure] (sdl-audio-spec-channels audio-spec) → fixnum[setter] (set! (sdl-audio-spec-channels audio-spec) val)
[setter] (sdl-audio-spec-channels-set! audio-spec channels)
Get or set the value of the SDL_AudioSpec's "channels" field, as an integer (Uint8).
[procedure] (sdl-audio-spec-silence audio-spec) → fixnumReturns the value of the SDL_AudioSpec's "silence" field, as an integer (Uint8).
[procedure] (sdl-audio-spec-samples audio-spec) → fixnum[setter] (set! (sdl-audio-spec-samples audio-spec) val)
[setter] (sdl-audio-spec-samples-set! audio-spec samples)
Get or set the value of the SDL_AudioSpec's "samples" field, as an integer (Uint16).
[procedure] (sdl-audio-spec-size audio-spec) → fixnumReturns the value of the SDL_AudioSpec's "size" field, as an integer (Uint32).
[procedure] (sdl-audio-spec-userdata audio-spec) → pointer[setter] (set! (sdl-audio-spec-userdata audio-spec) val)
[setter] (sdl-audio-spec-userdata-set! audio-spec userdata)
Get or set the value of the SDL_AudioSpec's "userdata" field, as a pointer.
sdl-color
sdl-color is a record type that wraps a pointer to a SDL_Color struct.
Procedures related to sdl-color each have an alias spelled as "colour", for the convenience of anyone who spells it that way. Aside from the name difference, the procedures behave exactly the same.
[procedure] (sdl-color? obj) → boolean[procedure] (sdl-colour? obj) → boolean
Returns #t if obj is a sdl-color.
[procedure] (sdl-make-color #!optional r g b a) → sdl-color[procedure] (sdl-make-colour #!optional r g b a) → sdl-color
Allocate and initialize a new sdl-color instance. The instance will have a finalizer, so that the underlying struct's memory will automatically be freed when the record instance is garbage collected. It is not necessary to call sdl-free-color!, although it is safe to do so.
r g b and a are the red, green, blue, and alpha (opacity) fields of the color. They must be integers in the range 0 to 255 (inclusive). r g and b default to 0. a defaults to 255 (full opacity).
[procedure] (sdl-alloc-color) → sdl-color[procedure] (sdl-alloc-colour) → sdl-color
Allocate (but do not initialize) a new sdl-color instance. You probably want to use sdl-make-color instead.
The instance will have a finalizer, so that the underlying struct's memory will automatically be freed when the record instance is garbage collected. It is not necessary to call sdl-free-color!, although it is safe (and sometimes useful) to do so.
[procedure] (sdl-alloc-color*) → sdl-color[procedure] (sdl-alloc-colour*) → sdl-color
Allocate (but do not initialize) a new sdl-color instance. This is like sdl-alloc-color, except that the instance will not have a finalizer, so the underlying struct's memory will not be automatically freed when the instance is garbage collected. You must manually call sdl-free-color! on the record instance when you are done with it; otherwise, your program will leak memory.
[procedure] (sdl-free-color! color)[procedure] (sdl-free-colour! color)
Manually free the memory of the given sdl-color instance. The instance's pointer will be set to null (see sdl-struct-null?), so you cannot get or set any field of the instance after it has been freed. It is safe to free an instance that has a finalizer. It is safe to free an instance that has already been freed.
[procedure] (sdl-color-r color) → fixnum[procedure] (sdl-colour-r color) → fixnum
[setter] (set! (sdl-color-r color) r)
[setter] (set! (sdl-colour-r color) r)
[setter] (sdl-color-r-set! color r)
[setter] (sdl-colour-r-set! color r)
Get or set the "r" (red) field of the sdl-color, as an integer in the range 0 to 255 (inclusive).
[procedure] (sdl-color-g color) → fixnum[procedure] (sdl-colour-g color) → fixnum
[setter] (set! (sdl-color-g color) g)
[setter] (set! (sdl-colour-g color) g)
[setter] (sdl-color-g-set! color g)
[setter] (sdl-colour-g-set! color g)
Get or set the "g" (green) field of the sdl-color, as an integer in the range 0 to 255 (inclusive).
[procedure] (sdl-color-b color) → fixnum[procedure] (sdl-colour-b color) → fixnum
[setter] (set! (sdl-color-b color) b)
[setter] (set! (sdl-colour-b color) b)
[setter] (sdl-color-b-set! color b)
[setter] (sdl-colour-b-set! color b)
Get or set the "b" (blue) field of the sdl-color, as an integer in the range 0 to 255 (inclusive).
[procedure] (sdl-color-a color) → fixnum[procedure] (sdl-colour-a color) → fixnum
[setter] (set! (sdl-color-a color) a)
[setter] (set! (sdl-colour-a color) a)
[setter] (sdl-color-a-set! color a)
[setter] (sdl-colour-a-set! color a)
Get or set the "a" (alpha) field of the sdl-color, as an integer in the range 0 to 255 (inclusive).
[setter] (sdl-color-set! color #!optional r g b a) → color[setter] (sdl-colour-set! color #!optional r g b a) → color
Set multiple fields of the sdl-color. If any of the arguments are not #f, that field of the color will be set. Any arguments that are #f will cause no change to that field of the color. Returns color after it is modified.
[procedure] (sdl-color->list color) → list of fixnums[procedure] (sdl-colour->list color) → list of fixnums
Returns a list (r g b a) containing all the fields of the sdl-color.
sdl-cursor
sdl-cursor is a record type that wraps a pointer to a SDL_Cursor struct.
[procedure] (sdl-cursor? obj) → booleanReturns #t if obj is a sdl-cursor.
sdl-display-mode
sdl-display-mode is a record type that wraps a pointer to a SDL_DisplayMode struct.
[procedure] (sdl-display-mode? obj) → booleanReturns #t if obj is a sdl-display-mode.
[procedure] (sdl-alloc-display-mode) → sdl-display-modeAllocate (but do not initialize) a new sdl-display-mode instance.
The instance will have a finalizer, so that the underlying struct's memory will automatically be freed when the record instance is garbage collected. It is not necessary to call sdl-free-display-mode!, although it is safe (and sometimes useful) to do so.
[procedure] (sdl-alloc-display-mode*) → sdl-display-modeLike sdl-alloc-display-mode, except that the instance will not have a finalizer, so the underlying struct's memory will not be automatically freed when the instance is garbage collected. You must manually call sdl-free-display-mode! on the record instance when you are done with it; otherwise, your program will have a memory leak.
[procedure] (sdl-free-display-mode! display-mode)Manually free the memory of the given sdl-display-mode instance. The instance's pointer will be set to null (see sdl-struct-null?), so you cannot get or set any field of the instance after it has been freed. It is safe to free an instance that has a finalizer. It is safe to free an instance that has already been freed.
[procedure] (sdl-display-mode-format display-mode) → symbol[setter] (set! (sdl-display-mode-format display-mode) val)
[setter] (sdl-display-mode-format-set! display-mode)
TODO: Docs.
[procedure] (sdl-display-mode-format-raw display-mode) → fixnum[setter] (set! (sdl-display-mode-format-raw display-mode) val)
TODO: Docs. See also sdl-display-mode-format.
[procedure] (sdl-display-mode-w display-mode) → fixnum[setter] (set! (sdl-display-mode-w display-mode) val)
[setter] (sdl-display-mode-w-set! display-mode)
TODO: Docs.
[procedure] (sdl-display-mode-h display-mode) → fixnum[setter] (set! (sdl-display-mode-h display-mode) val)
[setter] (sdl-display-mode-h-set! display-mode)
TODO: Docs.
[procedure] (sdl-display-mode-refresh-rate display-mode) → fixnum[setter] (set! (sdl-display-mode-refresh-rate display-mode) val)
[setter] (sdl-display-mode-refresh-rate-set! display-mode)
TODO: Docs.
sdl-event
sdl-event is a record type that wraps a pointer to a SDL_Event. There are many specific event structs in SDL, and the sdl-event record type wraps them all. Each event struct has a corresponding variant of sdl-event, described below. Each variant has one or more associated event type symbols.
Variant of sdl-event | Underlying struct | Event type symbol(s) |
---|---|---|
sdl-controller-axis-event | SDL_ControllerAxisEvent | controller-axis-motion |
sdl-controller-button-event | SDL_ControllerButtonEvent | controller-button-down
controller-button-up |
sdl-controller-device-event | SDL_ControllerDeviceEvent | controller-device-added
controller-device-removed controller-device-remapped |
sdl-dollar-gesture-event | SDL_DollarGestureEvent | dollar-gesture
dollar-record |
sdl-drop-event | SDL_DropEvent | drop-file |
sdl-joy-axis-event | SDL_JoyAxisEvent | joy-axis-motion |
sdl-joy-ball-event | SDL_JoyBallEvent | joy-ball-motion |
sdl-joy-button-event | SDL_JoyButtonEvent | joy-button-down
joy-button-up |
sdl-joy-device-event | SDL_JoyDeviceEvent | joy-device-added
joy-device-removed |
sdl-joy-hat-event | SDL_JoyHatEvent | joy-hat-motion |
sdl-keyboard-event | SDL_KeyboardEvent | key-down
key-up |
sdl-mouse-button-event | SDL_MouseButtonEvent | mouse-button-down
mouse-button-up |
sdl-mouse-motion-event | SDL_MouseMotionEvent | mouse-motion |
sdl-mouse-wheel-event | SDL_MouseWheelEvent | mouse-wheel |
sdl-multi-gesture-event | SDL_MultiGestureEvent | multi-gesture |
sdl-quit-event | SDL_QuitEvent | quit |
sdl-sys-wm-event | SDL_SysWMEvent | sys-wm |
sdl-text-editing-event | SDL_TextEditingEvent | text-editing |
sdl-text-input-event | SDL_TextInputEvent | text-input |
sdl-touch-finger-event | SDL_TouchFingerEvent | finger-down
finger-up finger-motion |
sdl-user-event | SDL_UserEvent | user |
sdl-window-event | SDL_WindowEvent | window |
Returns #t if obj is any variant of sdl-event.
[procedure] (sdl-alloc-event)Allocate (but do not initialize) a new sdl-event instance. You can set the event's type with sdl-event-type-set! to choose what variant of sdl-event it should be.
The instance will have a finalizer, so that the underlying struct's memory will automatically be freed when the record instance is garbage collected. It is not necessary to call sdl-free-event!, although it is safe (and sometimes useful) to do so.
[procedure] (sdl-alloc-event*)Like sdl-alloc-event, except that the instance will not have a finalizer, so the underlying struct's memory will not be automatically freed when the instance is garbage collected. You must manually call sdl-free-event! on the record instance when you are done with it; otherwise, your program will leak memory.
[procedure] (sdl-free-event! event)Manually free the memory of the given sdl-event. You can use this procedure with any variant of sdl-event. The instance's pointer will be set to null (see sdl-struct-null?), so you cannot get or set any field of the instance after it has been freed. It is safe to free an instance that has a finalizer. It is safe to free an instance that has already been freed.
[procedure] (sdl-event-type event) → symbol[setter] (set! (sdl-event-type event) val)
[setter] (sdl-event-type-set! event)
Get or set the sdl-event's event type, as a event type symbol. You can use this procedure with any variant of sdl-event. Setting this will change what variant of sdl-event it is. E.g. if you set it to the symbol 'key-down, the event will become a sdl-keyboard-event.
[procedure] (sdl-event-type-raw event) → fixnum[setter] (set! (sdl-event-type-raw event) val)
[setter] (sdl-event-type-raw-set! event)
Get or set the sdl-event's event type, as a nonnegative integer. You can use this procedure with any variant of sdl-event. See also sdl-event-type.
[procedure] (sdl-event-timestamp event) → fixnum[setter] (set! (sdl-event-timestamp event) val)
[setter] (sdl-event-timestamp-set! event)
Get or set the event timestamp, as a nonnegative integer representing the time that the event occurred, in milliseconds since the SDL timer system was initialized. You can use this procedure with any variant of sdl-event.
sdl-controller-axis-event
sdl-controller-axis-event is a variant of sdl-event that wraps a pointer to a SDL_ControllerAxisEvent.
[procedure] (sdl-controller-axis-event? obj) → booleanReturns #t if obj is a sdl-controller-axis-event.
[procedure] (sdl-controller-axis-event-which event) → fixnum[setter] (set! (sdl-controller-axis-event-which event) val)
[setter] (sdl-controller-axis-event-which-set! event)
TODO: Docs.
[procedure] (sdl-controller-axis-event-axis event) → fixnum[setter] (set! (sdl-controller-axis-event-axis event) val)
[setter] (sdl-controller-axis-event-axis-set! event)
TODO: Docs.
[procedure] (sdl-controller-axis-event-value event) → fixnum[setter] (set! (sdl-controller-axis-event-value event) val)
[setter] (sdl-controller-axis-event-value-set! event)
TODO: Docs.
sdl-controller-button-event
sdl-controller-button-event is a variant of sdl-event that wraps a pointer to a SDL_ControllerButtonEvent.
[procedure] (sdl-controller-button-event? obj) → booleanTODO: Docs.
[procedure] (sdl-controller-button-event-which event) → fixnum[setter] (set! (sdl-controller-button-event-which event) val)
[setter] (sdl-controller-button-event-which-set! event)
TODO: Docs.
[procedure] (sdl-controller-button-event-button event) → fixnum[setter] (set! (sdl-controller-button-event-button event) val)
[setter] (sdl-controller-button-event-button-set! event)
TODO: Docs.
[procedure] (sdl-controller-button-event-state event) → boolean[setter] (set! (sdl-controller-button-event-state event) val)
[setter] (sdl-controller-button-event-state-set! event)
TODO: Docs.
sdl-controller-device-event
sdl-controller-device-event is a variant of sdl-event that wraps a pointer to a SDL_ControllerDeviceEvent.
[procedure] (sdl-controller-device-event? obj) → booleanReturns #t if obj is a sdl-controller-device-event.
[procedure] (sdl-controller-device-event-which event) → fixnum[setter] (set! (sdl-controller-device-event-which event) val)
[setter] (sdl-controller-device-event-which-set! event)
TODO: Docs.
sdl-dollar-gesture-event
sdl-dollar-gesture-event is a variant of sdl-event that wraps a pointer to a SDL_DollarGestureEvent.
[procedure] (sdl-dollar-gesture-event? obj) → booleanReturns #t if obj is a sdl-dollar-gesture-event.
[procedure] (sdl-dollar-gesture-event-touch-id event) → fixnum[setter] (set! (sdl-dollar-gesture-event-touch-id event) val)
[setter] (sdl-dollar-gesture-event-touch-id-set! event)
TODO: Docs.
[procedure] (sdl-dollar-gesture-event-gesture-id event) → fixnum[setter] (set! (sdl-dollar-gesture-event-gesture-id event) val)
[setter] (sdl-dollar-gesture-event-gesture-id-set! event)
TODO: Docs.
[procedure] (sdl-dollar-gesture-event-num-fingers event) → fixnum[setter] (set! (sdl-dollar-gesture-event-num-fingers event) val)
[setter] (sdl-dollar-gesture-event-num-fingers-set! event)
TODO: Docs.
[procedure] (sdl-dollar-gesture-event-error event) → float[setter] (set! (sdl-dollar-gesture-event-error event) val)
[setter] (sdl-dollar-gesture-event-error-set! event)
TODO: Docs.
[procedure] (sdl-dollar-gesture-event-x event) → float[setter] (set! (sdl-dollar-gesture-event-x event) val)
[setter] (sdl-dollar-gesture-event-x-set! event)
TODO: Docs.
[procedure] (sdl-dollar-gesture-event-y event) → float[setter] (set! (sdl-dollar-gesture-event-y event) val)
[setter] (sdl-dollar-gesture-event-y-set! event)
TODO: Docs.
sdl-drop-event
sdl-drop-event is a variant of sdl-event that wraps a pointer to a SDL_DropEvent.
[procedure] (sdl-drop-event? obj) → booleanReturns #t if obj is a sdl-drop-event.
[procedure] (sdl-drop-event-file event) → string[setter] (set! (sdl-drop-event-file event) val)
[setter] (sdl-drop-event-file-set! event)
TODO: Docs.
sdl-joy-axis-event
sdl-joy-axis-event is a variant of sdl-event that wraps a pointer to a SDL_JoyAxisEvent.
[procedure] (sdl-joy-axis-event? obj) → booleanReturns #t if obj is a sdl-joy-axis-event.
[procedure] (sdl-joy-axis-event-which event) → fixnum[setter] (set! (sdl-joy-axis-event-which event) val)
[setter] (sdl-joy-axis-event-which-set! event)
Returns the joystick ID number of the joystick that caused the event.
[procedure] (sdl-joy-axis-event-axis event) → fixnum[setter] (set! (sdl-joy-axis-event-axis event) val)
[setter] (sdl-joy-axis-event-axis-set! event)
Returns the number of the axis that was moved.
[procedure] (sdl-joy-axis-event-value event) → fixnum[setter] (set! (sdl-joy-axis-event-value event) val)
[setter] (sdl-joy-axis-event-value-set! event)
Returns the new value of the axis, as an integer in the range -32768 to 32767 (inclusive).
sdl-joy-ball-event
sdl-joy-ball-event is a variant of sdl-event that wraps a pointer to a SDL_JoyBallEvent.
[procedure] (sdl-joy-ball-event? obj) → booleanReturns #t if obj is a sdl-joy-ball-event.
[procedure] (sdl-joy-ball-event-which event) → fixnum[setter] (set! (sdl-joy-ball-event-which event) val)
[setter] (sdl-joy-ball-event-which-set! event)
Returns the joystick ID number of the joystick that caused the event.
[procedure] (sdl-joy-ball-event-ball event) → fixnum[setter] (set! (sdl-joy-ball-event-ball event) val)
[setter] (sdl-joy-ball-event-ball-set! event)
Returns the number of the trackball that was moved.
[procedure] (sdl-joy-ball-event-xrel event) → fixnum[setter] (set! (sdl-joy-ball-event-xrel event) val)
[setter] (sdl-joy-ball-event-xrel-set! event)
Returns an integer (possibly negative) indicating how the trackball position changed on the X axis, relative to its previous position.
[procedure] (sdl-joy-ball-event-yrel event) → fixnum[setter] (set! (sdl-joy-ball-event-yrel event) val)
[setter] (sdl-joy-ball-event-yrel-set! event)
Returns an integer (possibly negative) indicating how the trackball position changed on the Y axis, relative to its previous position.
sdl-joy-button-event
sdl-joy-button-event is a variant of sdl-event that wraps a pointer to a SDL_JoyButtonEvent.
[procedure] (sdl-joy-button-event? obj) → booleanReturns #t if obj is a sdl-joy-button-event.
[procedure] (sdl-joy-button-event-which event) → fixnum[setter] (set! (sdl-joy-button-event-which event) val)
[setter] (sdl-joy-button-event-which-set! event)
Returns the joystick ID number of the joystick that caused the event.
[procedure] (sdl-joy-button-event-button event) → fixnum[setter] (set! (sdl-joy-button-event-button event) val)
[setter] (sdl-joy-button-event-button-set! event)
Returns the number of the button that was pressed or released.
[procedure] (sdl-joy-button-event-state event) → boolean[setter] (set! (sdl-joy-button-event-state event) val)
[setter] (sdl-joy-button-event-state-set! event)
Returns #t if the button was pressed, or #f if the button was released. You can also find out by checking the event type: 'joy-button-down for pressed, or 'joy-button-up for released.
sdl-joy-device-event
sdl-joy-device-event is a variant of sdl-event that wraps a pointer to a SDL_JoyDeviceEvent.
[procedure] (sdl-joy-device-event? obj) → booleanReturns #t if obj is a sdl-joy-device-event.
[procedure] (sdl-joy-device-event-which event) → fixnum[setter] (set! (sdl-joy-device-event-which event) val)
[setter] (sdl-joy-device-event-which-set! event)
Returns the joystick ID number of the joystick that caused the event.
sdl-joy-hat-event
sdl-joy-hat-event is a variant of sdl-event that wraps a pointer to a SDL_JoyHatEvent.
[procedure] (sdl-joy-hat-event? obj) → booleanReturns #t if obj is a sdl-joy-hat-event.
[procedure] (sdl-joy-hat-event-which event) → fixnum[setter] (set! (sdl-joy-hat-event-which event) val)
[setter] (sdl-joy-hat-event-which-set! event)
Returns the joystick ID number of the joystick that caused the event.
[procedure] (sdl-joy-hat-event-hat event) → fixnum[setter] (set! (sdl-joy-hat-event-hat event) val)
[setter] (sdl-joy-hat-event-hat-set! event)
Returns the number of the hat that was moved.
[procedure] (sdl-joy-hat-event-value event) → symbol[setter] (set! (sdl-joy-hat-event-value event) val)
[setter] (sdl-joy-hat-event-value-set! event)
Returns a joystick hat position symbol indicating the new joystick hat position.
[procedure] (sdl-joy-hat-event-value-raw event) → fixnum[setter] (set! (sdl-joy-hat-event-value-raw event) val)
[setter] (sdl-joy-hat-event-value-raw-set! event)
Returns an integer indicating the new joystick hat position. See also sdl-joy-hat-event-value.
sdl-keyboard-event
sdl-keyboard-event is a variant of sdl-event that wraps a pointer to a SDL_KeyboardEvent.
[procedure] (sdl-keyboard-event? obj) → booleanReturns #t if obj is a sdl-keyboard-event.
[procedure] (sdl-keyboard-event-window-id event) → fixnum[setter] (set! (sdl-keyboard-event-window-id event) val)
[setter] (sdl-keyboard-event-window-id-set! event)
Returns the ID number of the sdl-window that had keyboard focus at the time this event occurred, or 0 if no sdl-window had keyboard focus.
[procedure] (sdl-keyboard-event-state event) → boolean[setter] (set! (sdl-keyboard-event-state event) val)
[setter] (sdl-keyboard-event-state-set! event)
Returns #t if the key was pressed, or #f if the key was released. You can also find out by checking the event type: 'key-down for pressed, or 'key-up for released.
[procedure] (sdl-keyboard-event-repeat event) → fixnum[setter] (set! (sdl-keyboard-event-repeat event) val)
[setter] (sdl-keyboard-event-repeat-set! event)
Returns non-zero if this is a "key repeat" event (caused by the user pressing and holding the key for some time), or zero if this is not a "key repeat" event.
[procedure] (sdl-keyboard-event-keysym event) → sdl-keysym[setter] (set! (sdl-keyboard-event-keysym event) val)
[setter] (sdl-keyboard-event-keysym-set! event)
Returns a copy of the sdl-keysym representing the key that was pressed or released. Modifying the returned sdl-keysym will not change the event, but setting this field to a new sdl-keysym will change the event.
Instead of using this procedure, it is more efficient and convenient to directly access the fields of the event's keysym, using one of these procedures:
- sdl-keyboard-event-sym
- sdl-keyboard-event-scancode
- sdl-keyboard-event-mod
[setter] (set! (sdl-keyboard-event-sym event) val)
[setter] (sdl-keyboard-event-sym-set! event)
Returns a keyboard keycode symbol representing the key that was pressed or released. Setting this will change the event.
[procedure] (sdl-keyboard-event-sym-raw event) → fixnum[setter] (set! (sdl-keyboard-event-sym-raw event) val)
[setter] (sdl-keyboard-event-sym-raw-set! event)
Returns an integer representing a keyboard keycode of the key that was pressed or released. Setting this will change the event. See also sdl-keyboard-event-sym.
[procedure] (sdl-keyboard-event-scancode event) → symbol[setter] (set! (sdl-keyboard-event-scancode event) val)
[setter] (sdl-keyboard-event-scancode-set! event)
Returns a keyboard scancode symbol representing the key that was pressed or released. Setting this will change the event.
[procedure] (sdl-keyboard-event-scancode-raw event) → fixnum[setter] (set! (sdl-keyboard-event-scancode-raw event) val)
[setter] (sdl-keyboard-event-scancode-raw-set! event)
Returns an integer representing a keyboard scancode of the key that was pressed or released. Setting this will change the event. See also sdl-keyboard-event-scancode.
[procedure] (sdl-keyboard-event-mod event) → list of symbols[setter] (set! (sdl-keyboard-event-mod event) val)
[setter] (sdl-keyboard-event-mod-set! event)
Returns a list of zero or more keyboard modifier symbols, representing the modifier keys that were being pressed at the time the event occurred. Setting this will change the event.
[procedure] (sdl-keyboard-event-mod-raw event) → fixnum[setter] (set! (sdl-keyboard-event-mod-raw event) val)
[setter] (sdl-keyboard-event-mod-raw-set! event)
Returns an integer representing a bitfield of keyboard modifiers, representing the modifier keys that were being pressed at the time the event occurred. Setting this will change the event. See also sdl-keyboard-event-mod.
sdl-mouse-button-event
sdl-mouse-button-event is a variant of sdl-event that wraps a pointer to a SDL_MouseButtonEvent.
[procedure] (sdl-mouse-button-event? obj) → booleanReturns #t if obj is a sdl-mouse-button-event.
[procedure] (sdl-mouse-button-event-window-id event) → fixnum[setter] (set! (sdl-mouse-button-event-window-id event) val)
[setter] (sdl-mouse-button-event-window-id-set! event)
Returns the ID number of the sdl-window that had mouse focus at the time this event occurred, or 0 if no sdl-window had mouse focus.
[procedure] (sdl-mouse-button-event-which event) → fixnum[setter] (set! (sdl-mouse-button-event-which event) val)
[setter] (sdl-mouse-button-event-which-set! event)
TODO: Docs.
[procedure] (sdl-mouse-button-event-button event) → symbol[setter] (set! (sdl-mouse-button-event-button event) val)
[setter] (sdl-mouse-button-event-button-set! event)
Returns a mouse button symbol indicating which button was pressed or released.
[procedure] (sdl-mouse-button-event-button-raw event) → fixnum[setter] (set! (sdl-mouse-button-event-button-raw event) val)
[setter] (sdl-mouse-button-event-button-raw-set! event)
Returns an integer indicating which button was pressed or released. See also sdl-mouse-button-event-button.
[procedure] (sdl-mouse-button-event-state event) → boolean[setter] (set! (sdl-mouse-button-event-state event) val)
[setter] (sdl-mouse-button-event-state-set! event)
Returns #t if the button was pressed, or #f if the button was released. You can also find out by checking the event type: 'mouse-button-down for pressed, or 'mouse-button-up for released.
[procedure] (sdl-mouse-button-event-x event) → fixnum[setter] (set! (sdl-mouse-button-event-x event) val)
[setter] (sdl-mouse-button-event-x-set! event)
Returns the X position (in pixels) of the mouse cursor at the time the button was pressed or released.
[procedure] (sdl-mouse-button-event-y event) → fixnum[setter] (set! (sdl-mouse-button-event-y event) val)
[setter] (sdl-mouse-button-event-y-set! event)
Returns the Y position (in pixels) of the mouse cursor at the time the button was pressed or released.
sdl-mouse-motion-event
sdl-mouse-motion-event is a variant of sdl-event that wraps a pointer to a SDL_MouseMotionEvent.
[procedure] (sdl-mouse-motion-event? obj) → booleanReturns #t if obj is a sdl-mouse-motion-event.
[procedure] (sdl-mouse-motion-event-window-id event) → fixnum[setter] (set! (sdl-mouse-motion-event-window-id event) val)
[setter] (sdl-mouse-motion-event-window-id-set! event)
Returns the ID number of the sdl-window that had mouse focus at the time this event occurred, or 0 if no sdl-window had mouse focus.
[procedure] (sdl-mouse-motion-event-which event) → fixnum[setter] (set! (sdl-mouse-motion-event-which event) val)
[setter] (sdl-mouse-motion-event-which-set! event)
TODO: Docs.
[procedure] (sdl-mouse-motion-event-state event) → list of symbols[setter] (set! (sdl-mouse-motion-event-state event) val)
[setter] (sdl-mouse-motion-event-state-set! event)
Returns a list of zero or more mouse button mask symbols, representing the mouse buttons that were being pressed at the time this event occurred.
[procedure] (sdl-mouse-motion-event-state-raw event) → fixnum[setter] (set! (sdl-mouse-motion-event-state-raw event) val)
[setter] (sdl-mouse-motion-event-state-raw-set! event)
Returns an integer representing the mouse buttons that were being pressed at the time this event occurred. See also sdl-mouse-motion-event-state
[procedure] (sdl-mouse-motion-event-x event) → fixnum[setter] (set! (sdl-mouse-motion-event-x event) val)
[setter] (sdl-mouse-motion-event-x-set! event)
Returns the X coordinate (in pixels) of the mouse cursor at the time the event occurred.
[procedure] (sdl-mouse-motion-event-y event) → fixnum[setter] (set! (sdl-mouse-motion-event-y event) val)
[setter] (sdl-mouse-motion-event-y-set! event)
Returns the Y coordinate (in pixels) of the mouse cursor at the time the event occurred.
[procedure] (sdl-mouse-motion-event-xrel event) → fixnum[setter] (set! (sdl-mouse-motion-event-xrel event) val)
[setter] (sdl-mouse-motion-event-xrel-set! event)
Returns how much the mouse cursor moved on the X axis (in pixels) since its previous position.
[procedure] (sdl-mouse-motion-event-yrel event) → fixnum[setter] (set! (sdl-mouse-motion-event-yrel event) val)
[setter] (sdl-mouse-motion-event-yrel-set! event)
Returns how much the mouse cursor moved on the Y axis (in pixels) since its previous position.
sdl-mouse-wheel-event
sdl-mouse-wheel-event is a variant of sdl-event that wraps a pointer to a SDL_MouseWheelEvent.
[procedure] (sdl-mouse-wheel-event? obj) → booleanReturns #t if obj is a sdl-mouse-wheel-event.
[procedure] (sdl-mouse-wheel-event-window-id event) → fixnum[setter] (set! (sdl-mouse-wheel-event-window-id event) val)
[setter] (sdl-mouse-wheel-event-window-id-set! event)
Returns the ID number of the sdl-window that had mouse focus at the time this event occurred, or 0 if no sdl-window had mouse focus.
[procedure] (sdl-mouse-wheel-event-which event) → fixnum[setter] (set! (sdl-mouse-wheel-event-which event) val)
[setter] (sdl-mouse-wheel-event-which-set! event)
TODO: Docs.
[procedure] (sdl-mouse-wheel-event-x event) → fixnum[setter] (set! (sdl-mouse-wheel-event-x event) val)
[setter] (sdl-mouse-wheel-event-x-set! event)
TODO: Docs.
[procedure] (sdl-mouse-wheel-event-y event) → fixnum[setter] (set! (sdl-mouse-wheel-event-y event) val)
[setter] (sdl-mouse-wheel-event-y-set! event)
TODO: Docs.
sdl-multi-gesture-event
sdl-multi-gesture-event is a variant of sdl-event that wraps a pointer to a SDL_MultiGestureEvent.
[procedure] (sdl-multi-gesture-event? obj) → booleanReturns #t if obj is a sdl-multi-gesture-event.
[procedure] (sdl-multi-gesture-event-touch-id event) → fixnum[setter] (set! (sdl-multi-gesture-event-touch-id event) val)
[setter] (sdl-multi-gesture-event-touch-id-set! event)
TODO: Docs.
[procedure] (sdl-multi-gesture-event-dtheta event) → float[setter] (set! (sdl-multi-gesture-event-dtheta event) val)
[setter] (sdl-multi-gesture-event-dtheta-set! event)
TODO: Docs.
[procedure] (sdl-multi-gesture-event-ddist event) → float[setter] (set! (sdl-multi-gesture-event-ddist event) val)
[setter] (sdl-multi-gesture-event-ddist-set! event)
TODO: Docs.
[procedure] (sdl-multi-gesture-event-x event) → float[setter] (set! (sdl-multi-gesture-event-x event) val)
[setter] (sdl-multi-gesture-event-x-set! event)
TODO: Docs.
[procedure] (sdl-multi-gesture-event-y event) → float[setter] (set! (sdl-multi-gesture-event-y event) val)
[setter] (sdl-multi-gesture-event-y-set! event)
TODO: Docs.
[procedure] (sdl-multi-gesture-event-num-fingers event) → fixnum[setter] (set! (sdl-multi-gesture-event-num-fingers event) val)
[setter] (sdl-multi-gesture-event-num-fingers-set! event)
TODO: Docs.
sdl-quit-event
sdl-quit-event is a variant of sdl-event that wraps a pointer to a SDL_QuitEvent.
[procedure] (sdl-quit-event? obj) → booleanReturns #t if obj is a sdl-quit-event.
sdl-sys-wm-event
sdl-sys-wm-event is a variant of sdl-event that wraps a pointer to a SDL_SysWMEvent.
[procedure] (sdl-sys-wm-event? obj) → booleanReturns #t if obj is a sdl-sys-wm-event.
[procedure] (sdl-sys-wm-event-msg event) → sdl-sys-wm-msg[setter] (set! (sdl-sys-wm-event-msg event) val)
[setter] (sdl-sys-wm-event-msg-set! event)
TODO: Docs.
sdl-text-editing-event
sdl-text-editing-event is a variant of sdl-event that wraps a pointer to a SDL_TextEditingEvent.
[procedure] (sdl-text-editing-event? obj) → booleanReturns #t if obj is a sdl-text-editing-event.
[procedure] (sdl-text-editing-event-window-id event) → fixnum[setter] (set! (sdl-text-editing-event-window-id event) val)
[setter] (sdl-text-editing-event-window-id-set! event)
TODO: Docs.
[procedure] (sdl-text-editing-event-text event) → string[setter] (set! (sdl-text-editing-event-text event) val)
[setter] (sdl-text-editing-event-text-set! event)
TODO: Docs.
[procedure] (sdl-text-editing-event-start event) → fixnum[setter] (set! (sdl-text-editing-event-start event) val)
[setter] (sdl-text-editing-event-start-set! event)
TODO: Docs.
[procedure] (sdl-text-editing-event-length event) → fixnum[setter] (set! (sdl-text-editing-event-length event) val)
[setter] (sdl-text-editing-event-length-set! event)
TODO: Docs.
sdl-text-input-event
sdl-text-input-event is a variant of sdl-event that wraps a pointer to a SDL_TextInputEvent.
[procedure] (sdl-text-input-event? obj) → booleanReturns #t if obj is a sdl-text-input-event.
[procedure] (sdl-text-input-event-window-id event) → fixnum[setter] (set! (sdl-text-input-event-window-id event) val)
[setter] (sdl-text-input-event-window-id-set! event)
TODO: Docs.
[procedure] (sdl-text-input-event-text event) → string[setter] (set! (sdl-text-input-event-text event) val)
[setter] (sdl-text-input-event-text-set! event)
TODO: Docs.
sdl-touch-finger-event
sdl-touch-finger-event is a variant of sdl-event that wraps a pointer to a SDL_TouchFingerEvent.
[procedure] (sdl-touch-finger-event? obj) → booleanReturns #t if obj is a sdl-touch-finger-event.
[procedure] (sdl-touch-finger-event-touch-id event) → fixnum[setter] (set! (sdl-touch-finger-event-touch-id event) val)
[setter] (sdl-touch-finger-event-touch-id-set! event)
TODO: Docs.
[procedure] (sdl-touch-finger-event-finger-id event) → fixnum[setter] (set! (sdl-touch-finger-event-finger-id event) val)
[setter] (sdl-touch-finger-event-finger-id-set! event)
TODO: Docs.
[procedure] (sdl-touch-finger-event-x event) → float[setter] (set! (sdl-touch-finger-event-x event) val)
[setter] (sdl-touch-finger-event-x-set! event)
TODO: Docs.
[procedure] (sdl-touch-finger-event-y event) → float[setter] (set! (sdl-touch-finger-event-y event) val)
[setter] (sdl-touch-finger-event-y-set! event)
TODO: Docs.
[procedure] (sdl-touch-finger-event-dx event) → float[setter] (set! (sdl-touch-finger-event-dx event) val)
[setter] (sdl-touch-finger-event-dx-set! event)
TODO: Docs.
[procedure] (sdl-touch-finger-event-dy event) → float[setter] (set! (sdl-touch-finger-event-dy event) val)
[setter] (sdl-touch-finger-event-dy-set! event)
TODO: Docs.
[procedure] (sdl-touch-finger-event-pressure event) → float[setter] (set! (sdl-touch-finger-event-pressure event) val)
[setter] (sdl-touch-finger-event-pressure-set! event)
TODO: Docs.
sdl-user-event
sdl-user-event is a variant of sdl-event that wraps a pointer to a SDL_UserEvent.
[procedure] (sdl-user-event? obj) → booleanReturns #t if obj is a sdl-user-event.
[procedure] (sdl-user-event-window-id event) → fixnum[setter] (set! (sdl-user-event-window-id event) val)
[setter] (sdl-user-event-window-id-set! event)
TODO: Docs.
[procedure] (sdl-user-event-code event) → fixnum[setter] (set! (sdl-user-event-code event) val)
[setter] (sdl-user-event-code-set! event)
TODO: Docs.
[procedure] (sdl-user-event-data1 event) → pointer[setter] (set! (sdl-user-event-data1 event) val)
[setter] (sdl-user-event-data1-set! event)
TODO: Docs.
[procedure] (sdl-user-event-data2 event) → pointer[setter] (set! (sdl-user-event-data2 event) val)
[setter] (sdl-user-event-data2-set! event)
TODO: Docs.
sdl-window-event
sdl-window-event is a variant of sdl-event that wraps a pointer to a SDL_WindowEvent.
[procedure] (sdl-window-event? obj) → booleanReturns #t if obj is a sdl-window-event.
[procedure] (sdl-window-event-window-id event) → fixnum[setter] (set! (sdl-window-event-window-id event) val)
[setter] (sdl-window-event-window-id-set! event)
TODO: Docs.
[procedure] (sdl-window-event-event event) → symbol[setter] (set! (sdl-window-event-event event) val)
[setter] (sdl-window-event-event-set! event)
Returns a window event type indicating what happened to the window.
[procedure] (sdl-window-event-event-raw event) → fixnum[setter] (set! (sdl-window-event-event-raw event) val)
[setter] (sdl-window-event-event-raw-set! event)
Returns an integer indicating what happened to the window. See also sdl-window-event-event.
[procedure] (sdl-window-event-data1 event) → fixnum[setter] (set! (sdl-window-event-data1 event) val)
[setter] (sdl-window-event-data1-set! event)
TODO: Docs.
[procedure] (sdl-window-event-data2 event) → fixnum[setter] (set! (sdl-window-event-data2 event) val)
[setter] (sdl-window-event-data2-set! event)
TODO: Docs.
sdl-finger
sdl-finger is a record type that wraps a pointer to a SDL_Finger struct.
[procedure] (sdl-finger? obj) → booleanReturns #t if obj is a sdl-finger.
[procedure] (sdl-finger-id finger) → fixnumTODO: Docs.
[procedure] (sdl-finger-x finger) → floatTODO: Docs.
[procedure] (sdl-finger-y finger) → floatTODO: Docs.
[procedure] (sdl-finger-pressure finger) → floatTODO: Docs.
sdl-joystick
sdl-joystick is a record type that wraps a pointer to a SDL_Joystick struct.
[procedure] (sdl-joystick? obj) → booleanReturns #t if obj is a sdl-joystick.
sdl-joystick-guid?
sdl-joystick-guid is a record type that wraps a pointer to a SDL_JoystickGUID struct.
[procedure] (sdl-joystick-guid? obj) → booleanReturns #t if obj is a sdl-joystick-guid.
sdl-keysym
sdl-keysym is a record type that wraps a pointer to a SDL_Keysym struct.
[procedure] (sdl-keysym? obj) → booleanReturns #t if obj is a sdl-keysym.
[procedure] (sdl-alloc-keysym) → sdl-keysymAllocate (but do not initialize) a new sdl-keysym instance.
The instance will have a finalizer, so that the underlying struct's memory will automatically be freed when the record instance is garbage collected. It is not necessary to call sdl-free-keysym!, although it is safe (and sometimes useful) to do so.
[procedure] (sdl-alloc-keysym*) → sdl-keysymLike sdl-alloc-keysym, except that the instance will not have a finalizer, so the underlying struct's memory will not be automatically freed when the instance is garbage collected. You must manually call sdl-free-keysym! on the record instance when you are done with it; otherwise, your program will leak memory.
[procedure] (sdl-free-keysym! keysym)Manually free the memory of the given sdl-keysym instance. The instance's pointer will be set to null (see sdl-struct-null?), so you cannot get or set any field of the instance after it has been freed. It is safe to free an instance that has a finalizer. It is safe to free an instance that has already been freed.
[procedure] (sdl-keysym-scancode keysym) → symbol[setter] (set! (sdl-keysym-scancode keysym) val)
[setter] (sdl-keysym-scancode-set! keysym)
TODO: Docs. Returns a keyboard scancode symbol.
[procedure] (sdl-keysym-scancode-raw keysym) → fixnum[setter] (set! (sdl-keysym-scancode-raw keysym) val)
[setter] (sdl-keysym-scancode-raw-set! keysym)
TODO: Docs. See also sdl-keysym-scancode.
[procedure] (sdl-keysym-sym keysym) → symbol[setter] (set! (sdl-keysym-sym keysym) val)
[setter] (sdl-keysym-sym-set! keysym)
TODO: Docs. Returns a keyboard keycode symbol.
[procedure] (sdl-keysym-sym-raw keysym) → fixnum[setter] (set! (sdl-keysym-sym-raw keysym) val)
[setter] (sdl-keysym-sym-raw-set! keysym)
TODO: Docs. See also sdl-keysym-sym.
[procedure] (sdl-keysym-mod keysym) → list of symbols[setter] (set! (sdl-keysym-mod keysym) val)
[setter] (sdl-keysym-mod-set! keysym)
TODO: Docs. Returns a list of zero or more keyboard modifier symbols.
[procedure] (sdl-keysym-mod-raw keysym) → fixnum[setter] (set! (sdl-keysym-mod-raw keysym) val)
[setter] (sdl-keysym-mod-raw-set! keysym)
TODO: Docs. See also sdl-keysym-mod.
sdl-palette
sdl-palette is a record type that wraps a pointer to a SDL_Palette struct.
[procedure] (sdl-palette? obj) → booleanReturns #t if obj is a sdl-palette.
[procedure] (sdl-alloc-palette ncolors)Allocate a new sdl-palette instance with the given number of colors.
The instance will have a finalizer, so that the underlying struct's memory will automatically be freed when the record instance is garbage collected. It is not necessary to call sdl-free-palette!, although it is safe (and sometimes useful) to do so.
[procedure] (sdl-alloc-palette*)Like sdl-alloc-palette, except that the instance will not have a finalizer, so the underlying struct's memory will not be automatically freed when the instance is garbage collected. You must manually call sdl-free-palette! on the record instance when you are done with it; otherwise, your program will leak memory.
[procedure] (sdl-free-palette! palette)Manually free the memory of the given sdl-palette instance. The instance's pointer will be set to null (see sdl-struct-null?), so you cannot get or set any field of the instance after it has been freed. It is safe to free an instance that has a finalizer. It is safe to free an instance that has already been freed.
[procedure] (sdl-palette-ncolors palette) → fixnumReturns the number of colors in the palette. May be as high as 256.
sdl-pixel-format
sdl-pixel-format is a record type that wraps a pointer to a SDL_PixelFormat struct.
[procedure] (sdl-pixel-format? obj) → booleanReturns #t if obj is a sdl-pixel-format.
[procedure] (sdl-alloc-pixel-format pixel-format-enum) → sdl-pixel-formatAllocate a new sdl-pixel-format instance with the given format.
The instance will have a finalizer, so that the underlying struct's memory will automatically be freed when the record instance is garbage collected. It is not necessary to call sdl-free-pixel-format!, although it is safe (and sometimes useful) to do so.
[procedure] (sdl-alloc-pixel-format* pixel-format-enum) → sdl-pixel-formatLike sdl-alloc-pixel-format, except that the instance will not have a finalizer, so the underlying struct's memory will not be automatically freed when the instance is garbage collected. You must manually call sdl-free-pixel-format! on the record instance when you are done with it; otherwise, your program will have a memory leak.
[procedure] (sdl-free-pixel-format! pixel-format)Manually free the memory of the given sdl-pixel-format instance. The instance's pointer will be set to null (see sdl-struct-null?), so you cannot get or set any field of the instance after it has been freed. It is safe to free an instance that has a finalizer. It is safe to free an instance that has already been freed.
[procedure] (sdl-pixel-format-format pixel-format) → symbolTODO: Docs. Returns a pixel format symbol.
[procedure] (sdl-pixel-format-format-raw pixel-format) → fixnumTODO: Docs. See also sdl-pixel-format-format.
[procedure] (sdl-pixel-format-palette pixel-format) → sdl-palette or #f[setter] (set! (sdl-pixel-format-palette pixel-format) val)
[setter] (sdl-pixel-format-palette-set! pixel-format palette)
Returns the pixel format's palette (as a sdl-palette), or #f if it does not have a palette. Only pixel formats with a bits-per-pixel of 8 or less can have a palette.
[procedure] (sdl-pixel-format-bits-per-pixel pixel-format) → fixnumTODO: Docs
[procedure] (sdl-pixel-format-bytes-per-pixel pixel-format) → fixnumTODO: Docs
[procedure] (sdl-pixel-format-rmask pixel-format) → fixnumTODO: Docs
[procedure] (sdl-pixel-format-gmask pixel-format) → fixnumTODO: Docs
[procedure] (sdl-pixel-format-bmask pixel-format) → fixnumTODO: Docs
[procedure] (sdl-pixel-format-amask pixel-format) → fixnumTODO: Docs.
sdl-point
sdl-point is a record type that wraps a pointer to a SDL_Point struct.
[procedure] (sdl-point? obj) → booleanReturns #t if obj is a sdl-point.
[procedure] (sdl-make-point #!optional x y)Allocate and initialize a new sdl-point instance. The instance will have a finalizer, so that the underlying struct's memory will automatically be freed when the record instance is garbage collected. It is not necessary to call sdl-free-point!, although it is safe to do so.
x and y are the x and y fields of the point. They must be integers in the range -2147483648 to 2147483647 (inclusive). They both default to 0.
[procedure] (sdl-alloc-point) → sdl-pointAllocate (but do not initialize) a new sdl-point instance. You probably want to use sdl-make-point instead.
The instance will have a finalizer, so that the underlying struct's memory will automatically be freed when the record instance is garbage collected. It is not necessary to call sdl-free-point!, although it is safe (and sometimes useful) to do so.
[procedure] (sdl-alloc-point*) → sdl-pointLike sdl-alloc-point, except that the instance will not have a finalizer, so the underlying struct's memory will not be automatically freed when the instance is garbage collected. You must manually call sdl-free-point! on the record instance when you are done with it; otherwise, your program will leak memory.
[procedure] (sdl-free-point! point)Manually free the memory of the given sdl-point instance. The instance's pointer will be set to null (see sdl-struct-null?), so you cannot get or set any field of the instance after it has been freed. It is safe to free an instance that has a finalizer. It is safe to free an instance that has already been freed.
[procedure] (sdl-point-x point) → fixnum[setter] (set! (sdl-point-x point) x)
[setter] (sdl-point-x-set! point x)
Get or set the "x" field of the sdl-point, as an integer in the range -2147483648 to 2147483647 (inclusive).
[procedure] (sdl-point-y point) → fixnum[setter] (set! (sdl-point-y point) y)
[setter] (sdl-point-y-set! point y)
Get or set the "y" field of the sdl-point, as an integer in the range -2147483648 to 2147483647 (inclusive).
[procedure] (sdl-point-set! point #!optional x y) → pointSet multiple fields of the sdl-point. If any of the arguments are not #f, that field of the point will be set. Any arguments that are #f will cause no change to that field of the point. Returns point after it is modified.
[procedure] (sdl-point->list point) → list of fixnumsReturns a list (x y) containing the fields of the sdl-point.
sdl-rect
sdl-rect is a record type that wraps a pointer to a SDL_Rect struct.
[procedure] (sdl-rect? obj) → booleanReturns #t if obj is a sdl-rect.
[procedure] (sdl-make-rect #!optional x y w h)Allocate and initialize a new sdl-rect instance. The instance will have a finalizer, so that the underlying struct's memory will automatically be freed when the record instance is garbage collected. It is not necessary to call sdl-free-rect!, although it is safe to do so.
x, y, w, and h are the fields of the rect. They must be integers in the range -2147483648 to 2147483647 (inclusive). They all default to 0.
[procedure] (sdl-alloc-rect)Allocate (but do not initialize) a new sdl-rect instance. You probably want to use sdl-make-rect instead.
The instance will have a finalizer, so that the underlying struct's memory will automatically be freed when the record instance is garbage collected. It is not necessary to call sdl-free-rect!, although it is safe to do so.
[procedure] (sdl-alloc-rect*)Like sdl-alloc-rect, except that the instance will not have a finalizer, so the underlying struct's memory will not be automatically freed when the instance is garbage collected. You must manually call sdl-free-rect! on the record instance when you are done with it; otherwise, your program will leak memory.
[procedure] (sdl-free-rect! rect)Manually free the memory of the given sdl-rect instance. The instance's recter will be set to null (see sdl-struct-null?), so you cannot get or set any field of the instance after it has been freed. It is safe to free an instance that has a finalizer. It is safe to free an instance that has already been freed.
[procedure] (sdl-rect-x rect)[setter] (set! (sdl-rect-x rect) x)
[setter] (sdl-rect-x-set! rect x)
Get or set the "x" field of the sdl-rect, as an integer in the range -2147483648 to 2147483647 (inclusive).
[procedure] (sdl-rect-y rect)[setter] (set! (sdl-rect-y rect) y)
[setter] (sdl-rect-y-set! rect y)
Get or set the "y" field of the sdl-rect, as an integer in the range -2147483648 to 2147483647 (inclusive).
[procedure] (sdl-rect-w rect)[setter] (set! (sdl-rect-w rect) w)
[setter] (sdl-rect-w-set! rect w)
Get or set the "w" (width) field of the sdl-rect, as an integer in the range -2147483648 to 2147483647 (inclusive).
[procedure] (sdl-rect-h rect)[setter] (set! (sdl-rect-h rect) h)
[setter] (sdl-rect-h-set! rect h)
Get or set the "h" (height) field of the sdl-rect, as an integer in the range -2147483648 to 2147483647 (inclusive).
[procedure] (sdl-rect-set! rect #!optional x y w h)Set multiple fields of the sdl-rect. If any of the arguments are not #f, that field of the rect will be set. Any arguments that are #f will cause no change to that field of the rect. Returns rect after it is modified.
[procedure] (sdl-rect->list rect)Returns a list (x y w h) containing the fields of the sdl-rect.
sdl-rwops
sdl-rwops is a record type that wraps a pointer to a SDL_RWops struct.
[procedure] (sdl-rwops? obj) → booleanReturns #t if obj is a sdl-rwops.
[procedure] (sdl-rwops-type rwops) → symbolTODO: Docs
[procedure] (sdl-rwops-type-raw rwops) → fixnumTODO: Docs.
sdl-surface
sdl-surface is a record type that wraps a pointer to a SDL_Surface struct.
[procedure] (sdl-surface? obj) → booleanReturns #t if obj is a sdl-surface.
[procedure] (sdl-free-surface! surface)See SDL_FreeSurface.
Manually free the memory of the given sdl-surface instance. The instance's pointer will be set to null (see sdl-struct-null?), so you cannot get or set any field of the instance after it has been freed. It is safe to free an instance that has a finalizer. It is safe to free an instance that has already been freed.
[procedure] (sdl-surface-format surface) → sdl-pixel-formatTODO: Docs.
[procedure] (sdl-surface-w surface) → fixnumTODO: Docs.
[procedure] (sdl-surface-h surface) → fixnumTODO: Docs.
[procedure] (sdl-surface-pitch surface) → fixnumTODO: Docs.
[procedure] (sdl-surface-refcount surface) → fixnum[setter] (set! (sdl-surface-refcount surface) val)
[setter] (sdl-surface-refcount-set! surface)
TODO: Docs.
sdl-sys-wm-info
sdl-sys-wm-info is a record type that wraps a pointer to a SDL_SysWMinfo struct.
[procedure] (sdl-sys-wm-info? obj) → booleanReturns #t if obj is a sdl-sys-wm-info.
sdl-sys-wm-msg
sdl-sys-wm-msg is a record type that wraps a pointer to a SDL_SysWMmsg struct.
[procedure] (sdl-sys-wm-msg? obj) → booleanReturns #t if obj is a sdl-sys-wm-msg.
sdl-texture
sdl-texture is a record type that wraps a pointer to a SDL_Texture struct.
[procedure] (sdl-texture? obj) → booleanReturns #t if obj is a sdl-texture.
sdl-version
sdl-version is a record type that wraps a pointer to a SDL_version struct.
[procedure] (sdl-version? obj) → booleanReturns #t if obj is a sdl-version.
[procedure] (sdl-make-version #!optional major minor patch)Allocate and initialize a new sdl-version instance. The instance will have a finalizer, so that the underlying struct's memory will automatically be freed when the record instance is garbage collected. It is not necessary to call sdl-free-version!, although it is safe to do so.
major, minor, and patch are the fields of the version. They must be integers in the range 0 to 255 (inclusive). They all default to 0.
[procedure] (sdl-alloc-version)Allocate (but do not initialize) a new sdl-version instance. You probably want to use sdl-make-version instead.
The instance will have a finalizer, so that the underlying struct's memory will automatically be freed when the record instance is garbage collected. It is not necessary to call sdl-free-version!, although it is safe (and sometimes useful) to do so.
[procedure] (sdl-alloc-version*)Like sdl-alloc-version, except that the instance will not have a finalizer, so the underlying struct's memory will not be automatically freed when the instance is garbage collected. You must manually call sdl-free-version! on the record instance when you are done with it; otherwise, your program will leak memory.
[procedure] (sdl-free-version! version)Manually free the memory of the given sdl-version instance. The instance's versioner will be set to null (see sdl-struct-null?), so you cannot get or set any field of the instance after it has been freed. It is safe to free an instance that has a finalizer. It is safe to free an instance that has already been freed.
[procedure] (sdl-version-major version)[setter] (set! (sdl-version-major version) major)
[setter] (sdl-version-major-set! version major)
Get or set the "major" field of the sdl-version, as an integer in the range 0 to 255 (inclusive).
[procedure] (sdl-version-minor version)[setter] (set! (sdl-version-minor version) minor)
[setter] (sdl-version-minor-set! version minor)
Get or set the "minor" field of the sdl-version, as an integer in the range 0 to 255 (inclusive).
[procedure] (sdl-version-patch version)[setter] (set! (sdl-version-patch version) patch)
[setter] (sdl-version-patch-set! version patch)
Get or set the "patch" field of the sdl-version, as an integer in the range 0 to 255 (inclusive).
[procedure] (sdl-version-set! version #!optional major minor patch)Set multiple fields of the sdl-version. If any of the arguments are not #f, that field of the version will be set. Any arguments that are #f will cause no change to that field of the version. Returns version after it is modified.
[procedure] (sdl-version->list version)Returns a list (major minor patch) containing the fields of the sdl-version.
sdl-window
sdl-window is a record type that wraps a pointer to a SDL_Window struct.
[procedure] (sdl-window? obj) → booleanReturns #t if obj is a sdl-window.
Procedures
General / Miscellaneous
[procedure] (sdl-init! flags-list) → fixnumSee SDL_Init. Returns zero if successful.
flags-list must be a list of one or more init flag symbols:
- 'timer
- 'audio
- 'video
- 'joystick
- 'haptic
- 'game-controller
- 'events
- 'everything
See SDL_InitSubSystem. Returns zero if successful.
flags-list must be a list of one or more init flag symbols.
[procedure] (sdl-quit!)See SDL_Quit.
[procedure] (sdl-quit-subsystem! flags-list)See SDL_QuitSubSystem.
flags-list must be a list of one or more init flag symbols.
[procedure] (sdl-was-init flags-list) → list of symbolsSee SDL_WasInit.
flags-list must be a list of one or more init flag symbols.
[procedure] (sdl-set-main-ready!)See SDL_SetMainReady.
[procedure] (sdl-clear-error!)See SDL_ClearError.
[procedure] (sdl-get-error) → stringSee SDL_GetError.
[procedure] (sdl-set-error! message)See SDL_SetError.
Unlike SDL_SetError, this procedure only accepts one argument, a string. You can use sprintf to do string substitution if desired.
[procedure] (sdl-get-platform) → stringSee SDL_GetPlatform.
[procedure] (sdl-disable-screen-saver!)[procedure] (sdl-enable-screen-saver!)
[procedure] (sdl-screen-saver-enabled?) → boolean
[procedure] (sdl-has-clipboard-text?) → boolean
See SDL_HasClipboardText.
[procedure] (sdl-get-clipboard-text) → stringSee SDL_GetClipboardText.
[procedure] (sdl-set-clipboard-text! text) → fixnumSee SDL_SetClipboardText. Returns zero if successful.
[procedure] (sdl-get-version) → sdl-versionSee SDL_GetVersion.
Returns a sdl-version instance containing the version number of SDL that the sdl2 egg is currently using. (This may be different than the version it was compiled with.)
[procedure] (sdl-get-compiled-version) → sdl-versionSee SDL_VERSION.
Returns a sdl-version instance containing the version number of SDL that the sdl2 egg was compiled with. (This may be different than the version it is currently using.)
[procedure] (sdl-version-at-least? major minor patch) → booleanSee SDL_VERSION_ATLEAST.
Returns #t if the sdl2 egg was compiled with a version of SDL at least as high as specified. E.g. (sdl-version-at-least? 2 0 1) returns #t if the sdl2 egg was compiled with SDL 2.0.1 or higher. Some SDL features are only available after a certain version, so you can use this procedure to check whether the feature is available.
Pixel Format / Palette
[procedure] (sdl-map-rgb pixel-format r g b) → fixnumSee SDL_MapRGB.
[procedure] (sdl-map-rgba pixel-format r g b a) → fixnumSee SDL_MapRGBA.
[procedure] (sdl-get-rgb pixel pixel-format) → [r g b]See SDL_GetRGB.
Returns multiple values.
[procedure] (sdl-get-rgba pixel pixel-format) → [r g b a]See SDL_GetRGBA.
Returns multiple values.
[procedure] (sdl-palette-ref palette i) → sdl-colorReturn the sdl-color at the given index of the palette.
[setter] (set! (sdl-palette-ref palette i) color)[setter] (sdl-palette-set! palette i color)
Set the given index of the palette to the given sdl-color.
[procedure] (sdl-palette-colors palette) → vector of sdl-colorsReturn a vector of all the colors in the palette.
[setter] (sdl-palette-colors-set! colors-vec #!optional start) -> fixnumSee SDL_SetPaletteColors.
Replace some or all of the colors in the palette.
Returns zero if successful.
Events
[procedure] (sdl-event-state type) → booleanSee SDL_EventState.
Like calling SDL_EventState with SDL_QUERY. type must be an event type symbol or corresponding integer.
[setter] (set! (sdl-event-state type) state) → boolean[setter] (sdl-event-state-set! type state) → boolean
See SDL_EventState.
Like calling SDL_EventState with SDL_ENABLE or SDL_IGNORE.
Returns the previous state of the given event type.
type must be an event type symbol or corresponding integer.
[procedure] (sdl-flush-event! type)See SDL_FlushEvent.
Note: Contrary to what its name suggests, this procedure will flush ALL events matching the given type, not just a single event.
type must be an event type symbol or corresponding integer.
[procedure] (sdl-flush-events! min-type max-type)See SDL_FlushEvents.
min-type and max-type must be event type symbols or corresponding integers.
[procedure] (sdl-has-event? type) → booleanSee SDL_HasEvent.
type must be an event type symbol or corresponding integer.
[procedure] (sdl-has-events? min-type max-type) → booleanSee SDL_HasEvents.
min-type and max-type must be event type symbols or corresponding integers.
[procedure] (sdl-quit-requested?) → booleanSee SDL_QuitRequested.
[procedure] (sdl-peek-events num #!optional min-type max-type) → list of sdl-eventsSee SDL_PeepEvents.
Like SDL_PeepEvents with SDL_PEEKEVENT
This procedure is similar to sdl-get-events!, except that procedure removes the events from the SDL event queue.
min-type and max-type must be event type symbols or corresponding integers.
[procedure] (sdl-get-events! num #!optional min-type max-type) → list of sdl-eventsSee SDL_PeepEvents.
Like SDL_PeepEvents with SDL_GETEVENT
This procedure is similar to sdl-peek-events, except that procedure does not remove the events from the SDL event queue.
min-type and max-type must be an event type symbol or corresponding integer.
[procedure] (sdl-poll-event! #!optional event) → sdl-eventSee SDL_PollEvent.
If event is omitted, a new sdl-event is allocated and returned. If event is an existing sdl-event instance, it will be modified and returned. (This allows you to allocate a single event and reuse it many times in your event loop, so that your program does not create as much garbage for the garbage collector.)
[procedure] (sdl-pump-events!)See SDL_PumpEvents.
[procedure] (sdl-push-event! event) → fixnumSee SDL_PushEvent.
Returns 1 if successful.
[procedure] (sdl-wait-event! #!optional event) → eventSee SDL_WaitEvent.
If event is omitted, a new sdl-event is allocated and returned. If event is an existing sdl-event instance, it will be modified and returned. (This allows you to allocate a single event and reuse it many times in your event loop, so that your program does not create as much garbage for the garbage collector.)
[procedure] (sdl-wait-event-timeout! timeout #!optional event) → eventSee SDL_WaitEventTimeout.
If event is omitted, a new sdl-event is allocated and returned. If event is an existing sdl-event instance, it will be modified and returned. (This allows you to allocate a single event and reuse it many times in your event loop, so that your program does not create as much garbage for the garbage collector.)
Please note that the argument order is reversed compared to SDL_WaitEventTimeout. This is to allow the event argument to be optional.
[procedure] (sdl-register-events! numevents) → fixnumSee SDL_RegisterEvents.
[procedure] (sdl-get-num-touch-devices) → fixnum[procedure] (sdl-get-num-touch-fingers touch-id) → fixnum
[procedure] (sdl-get-touch-device device-id) → fixnum
See SDL_GetTouchDevice.
[procedure] (sdl-get-touch-finger touch-id index) → sdl-fingerSee SDL_GetTouchFinger.
OpenGL integration
[procedure] (sdl-gl-create-context! window) → sdl-gl-contextSee SDL_GL_CreateContext.
[procedure] (sdl-gl-delete-context! gl-context)See SDL_GL_DeleteContext.
[procedure] (sdl-gl-make-current! window gl-context) → fixnumSee SDL_GL_MakeCurrent.
[procedure] (sdl-gl-get-current-window) → sdl-window[procedure] (sdl-gl-get-current-context) → sdl-gl-context
[procedure] (sdl-gl-get-attribute attr) → value
See SDL_GL_GetAttribute.
attr must be an OpenGL attribute symbol or corresponding integer.
The return type varies depending on attr:
- If attr is 'context-profile-mask, an OpenGL profile symbol will be returned.
- If attr is 'context-flags, a list of zero or more OpenGL context flag symbols will be returned.
- Otherwise, an integer will be returned.
See SDL_GL_SetAttribute. Returns zero if successful.
attr must be an OpenGL attribute symbol or corresponding integer.
value must be one of these types, depending on what attr is:
- If attr is 'context-profile-mask, value must be an OpenGL profile symbol or corresponding integer.
- If attr is 'context-flags, value must be a list of zero or more OpenGL context flag symbols or an integer bitfield.
- Otherwise, value must be an integer.
Requires SDL 2.0.2 or higher. Signals an error if the compiled version of SDL is not high enough. Use (sdl-version-at-least? 2 0 2) to check before calling this procedure.
[procedure] (sdl-gl-get-drawable-size window) → [w h]See SDL_GL_GetDrawableSize. Returns multiple values.
Requires SDL 2.0.1 or higher. Signals an error if the compiled version of SDL is not high enough. Use (sdl-version-at-least? 2 0 1) to check before calling this procedure.
[procedure] (sdl-gl-swap-window!)See SDL_GL_SwapWindow.
[procedure] (sdl-gl-get-swap-interval) → fixnum[procedure] (sdl-gl-set-swap-interval! interval) → fixnum
See SDL_GL_SetSwapInterval. Returns zero if successful
[procedure] (sdl-gl-extension-supported? name-string) → booleanSee SDL_GL_ExtensionSupported.
Joystick
[procedure] (sdl-num-joysticks) → fixnumSee SDL_NumJoysticks.
[procedure] (sdl-joystick-open! index) → sdl-joystickSee SDL_JoystickOpen.
[procedure] (sdl-joystick-close! joystick)See SDL_JoystickClose.
[procedure] (sdl-joystick-update!)See SDL_JoystickUpdate.
[procedure] (sdl-joystick-event-state) → booleanLike SDL_JoystickEventState with SDL_QUERY.
[setter] (set! (sdl-joystick-event-state) state) → boolean[setter] (sdl-joystick-event-state-set! state) → boolean
Like SDL_JoystickEventState with SDL_ENABLE or SDL_IGNORE
[procedure] (sdl-joystick-attached? joystick) → boolean[procedure] (sdl-joystick-num-axes joystick) → fixnum
See SDL_JoystickNumAxes.
[procedure] (sdl-joystick-num-balls joystick) → fixnumSee SDL_JoystickNumBalls.
[procedure] (sdl-joystick-num-buttons joystick) → fixnum[procedure] (sdl-joystick-num-hats joystick) → fixnum
See SDL_JoystickNumHats.
[procedure] (sdl-joystick-get-axis joystick axis-num) → fixnumSee SDL_JoystickGetAxis.
[procedure] (sdl-joystick-get-ball joystick ball-num) → [dx dy]See SDL_JoystickGetBall.
Returns multiple values.
[procedure] (sdl-joystick-get-button joystick button-num) → boolean[procedure] (sdl-joystick-get-hat joystick hat-num) → symbol
See SDL_JoystickGetHat.
[procedure] (sdl-joystick-get-hat-raw joystick hat-num) → fixnumSee SDL_JoystickGetHat. See also sdl-joystick-get-hat.
[procedure] (sdl-joystick-instance-id joystick) → fixnum[procedure] (sdl-joystick-name joystick) → string
See SDL_JoystickName.
[procedure] (sdl-joystick-name-for-index device-index) → string[procedure] (sdl-joystick-get-device-guid device-index) → sdl-joystick-guid
See SDL_JoystickGetDeviceGUID.
[procedure] (sdl-joystick-get-guid joystick) → sdl-joystick-guidSee SDL_JoystickGetGUID.
[procedure] (sdl-joystick-get-guid-from-string str) → sdl-joystick-guidSee SDL_JoystickGetGUIDFromString.
[procedure] (sdl-joystick-get-guid-string guid) → stringSee SDL_JoystickGetGUIDString.
Keyboard
[procedure] (sdl-get-key-from-name name-str) → symbolSee SDL_GetKeyFromName.
Returns a keyboard keycode symbol.
[procedure] (sdl-get-key-from-name-raw name-str) → fixnumSee SDL_GetKeyFromName.
Returns an integer representing a keyboard keycode. See also sdl-get-key-from-name.
[procedure] (sdl-get-key-from-scancode scancode) → symbolscancode must be a keyboard scancode symbol or an integer representing a keyboard scancode.
Returns a keyboard keycode symbol.
[procedure] (sdl-get-key-from-scancode-raw scancode) → fixnumscancode must be a keyboard scancode symbol or an integer representing a keyboard scancode.
Returns an integer representing a keyboard keycode. See also sdl-get-key-from-scancode.
[procedure] (sdl-get-key-name key) → stringSee SDL_GetKeyName.
key must be a keyboard keycode symbol or an integer representing a keyboard keycode.
[procedure] (sdl-get-scancode-from-name name-str) → symbolReturns a keyboard scancode symbol.
[procedure] (sdl-get-scancode-from-name-raw name-str) → fixnumReturns an integer representing a keyboard scancode. See also sdl-get-scancode-from-name.
[procedure] (sdl-get-scancode-from-key key) → symbolkey must be a keyboard keycode symbol or an integer representing a keyboard keycode.
Returns a keyboard scancode symbol.
[procedure] (sdl-get-scancode-from-key-raw key) → fixnumkey must be a keyboard keycode symbol or an integer representing a keyboard keycode.
Returns an integer representing a keyboard scancode. See also sdl-get-scancode-from-key.
[procedure] (sdl-get-scancode-name scancode) → stringSee SDL_GetScancodeName.
scancode must be a keyboard scancode symbol or an integer representing a keyboard scancode.
[procedure] (sdl-get-keyboard-focus) → windowSee SDL_GetKeyboardFocus.
[procedure] (sdl-keyboard-scancode-pressed? scancode) → booleanReturns #t if the specified key is being pressed on the keyboard.
scancode must be either a keyboard scancode symbol or an integer representing the scancode of a keyboard key.
This procedure queries SDL's internal state, which is tied to the event system. Call sdl-pump-events! to update the keyboard state.
This procedure is based on SDL_GetKeyboardState.
[procedure] (sdl-mod-state) → list of symbolsSee SDL_GetModState.
Returns a list of zero or more keyboard modifier symbols.
[procedure] (sdl-mod-state-raw) → fixnumSee SDL_GetModState.
Returns an integer representing a bitfield of keyboard modifiers. See also sdl-mod-state.
[setter] (set! (sdl-mod-state) state)[setter] (sdl-mod-state-set! state)
See SDL_SetModState.
State can be either a list of keyboard modifier symbols or an integer representing a bitfield of keyboard modifiers.
[setter] (sdl-text-input-rect-set! rect)rect can be an sdl-rect or #f.
See SDL_SetTextInputRect.
[procedure] (sdl-start-text-input!)See SDL_StartTextInput.
[procedure] (sdl-stop-text-input!)See SDL_StopTextInput.
[procedure] (sdl-text-input-active?) → boolean[procedure] (sdl-screen-keyboard-support?) → boolean
See SDL_HasScreenKeyboardSupport.
[procedure] (sdl-screen-keyboard-shown? window) → booleanSee SDL_IsScreenKeyboardShown.
Rect / Point
[procedure] (sdl-rect-empty? rect) → booleanSee SDL_RectEmpty.
[procedure] (sdl-rect=? rect1 rect2) → booleanSee SDL_RectEquals.
[procedure] (sdl-enclose-points points #!optional clip result-rect) → [any-enclosed? result-rect]See SDL_EnclosePoints.
points must be a list of sdl-points. clip is either a sdl-rect (to ignore points outside the clip rect) or #f (to consider all points). result-rect is either a sdl-rect (which will be modified and returned) or #f (a new sdl-rect will be returned).
This procedure returns multiple values:
- any-enclosed?
- #t if any points were enclosed, or #f if all points were clipped
- result-rect
- a sdl-rect instance that encloses all matching points. If result-rect arg was given, that rect is modified and returned. Otherwise a newly allocated rect is returned.
See SDL_HasIntersection.
[procedure] (sdl-intersect-rect rect1 rect2 #!optional result-rect) → [intersect? result-rect]See SDL_IntersectRect.
[procedure] (sdl-intersect-rect-and-line rect x1 y1 x2 y2) → [intersect? x1-new y1-new x2-new y2-new]This procedure returns multiple values:
- intersect?
- #t if the given line intersects with the rect
- x1-new
- the x value of the point within rect that is closest to the first point
- y1-new
- the y value ...
- x2-new
- the x value of the point within rect that is closest to the second point
- y2-new
- the y value ...
See SDL_UnionRect.
RWops
[procedure] (sdl-rw-from-file filepath) → sdl-rwopsSee SDL_RWFromFile.
[procedure] (sdl-rw-from-const-mem pointer) → sdl-rwopsSee SDL_RWFromConstMem.
[procedure] (sdl-rw-from-mem pointer) → sdl-rwopsSee SDL_RWFromMem.
[procedure] (sdl-rw-from-blob blob) → sdl-rwopsCreate a new sdl-rwops that accesses the memory of the given CHICKEN Scheme blob.
CAUTION: You must make sure that the blob remains in scope for at least as long as the resulting sdl-rwops is open. If the blob is garbage collected before the sdl-rwops, your program may crash if you try to read or write from the sdl-rwops.
[procedure] (sdl-rw-from-string str) → sdl-rwopsCreate a new sdl-rwops that accesses the memory of the given CHICKEN Scheme string.
CAUTION: You must make sure that the string remains in scope for at least as long as the resulting sdl-rwops is open. If the string is garbage collected before the sdl-rwops, your program may crash if you try to read or write from the sdl-rwops.
[procedure] (sdl-rw-from-u8vector u8v) → sdl-rwopsCreate a new sdl-rwops that accesses the memory of the given SRFI-4 u8vector.
CAUTION: You must make sure that the u8vector remains in scope for at least as long as the resulting sdl-rwops is open. If the u8vector is garbage collected before the sdl-rwops, your program may crash if you try to read or write from the sdl-rwops.
[procedure] (sdl-rw-close! rwops) → fixnumSee SDL_RWclose.
Close and clean up the given sdl-rwops.
Returns zero if successful.
Surface
[procedure] (sdl-make-surface width height depth) → sdl-surface or #fCreate a new surface with the given width, height, and color depth (in bits per pixel). This is a more convenient interface for sdl-create-rgb-surface. The surface's pixel format masks will be chosen automatically based on the requested depth and the current platform's byte order (little endian or big endian). Returns #f if the surface could not be created (e.g. because the color depth is unsupported).
The surface will have a finalizer, so that the underlying struct's memory will automatically be freed when the record instance is garbage collected. It is not necessary to call sdl-free-surface!, although it is safe (and sometimes useful) to do so.
See also sdl-make-surface*, which does not set a finalizer.
[procedure] (sdl-make-surface* width height depth) → sdl-surface or #fSimilar to sdl-make-surface, except that the surface will not have a finalizer. You must call sdl-free-surface! when you are done with the surface.
[procedure] (sdl-create-rgb-surface flags width height depth rmask gmask bmask amask) → sdl-surfaceSee SDL_CreateRGBSurface.
See also sdl-make-surface for a more convenient interface.
[procedure] (sdl-create-rgb-surface-from pixels width height depth pitch rmask gmask bmask amask) → sdl-surface[procedure] (sdl-convert-surface surface pixel-format flags) → sdl-surface
See SDL_ConvertSurface.
[procedure] (sdl-load-bmp path-string) → sdl-surfaceSee SDL_LoadBMP.
The surface will have a finalizer, so that the underlying struct's memory will automatically be freed when the record instance is garbage collected. It is not necessary to call sdl-free-surface!, although it is safe (and sometimes useful) to do so.
[procedure] (sdl-load-bmp* filepath) → sdl-surfaceSimilar to sdl-load-bmp, except that the surface will not have a finalizer. You must call sdl-free-surface! when you are done with the surface.
[procedure] (sdl-load-bmp-rw rwops) → sdl-surfaceSee SDL_LoadBMP_RW.
The surface will have a finalizer, so that the underlying struct's memory will automatically be freed when the record instance is garbage collected. It is not necessary to call sdl-free-surface!, although it is safe (and sometimes useful) to do so.
[procedure] (sdl-load-bmp-rw* rwops) → sdl-surfaceSimilar to sdl-load-bmp-rw, except that the surface will not have a finalizer. You must call sdl-free-surface! when you are done with the surface.
[procedure] (sdl-save-bmp! surface filepath) → fixnumSee SDL_SaveBMP.
Returns zero if successful.
[procedure] (sdl-save-bmp-rw! surface rwops) → fixnumSee SDL_SaveBMP_RW.
Returns zero if successful.
[procedure] (sdl-lock-surface! surface) → fixnumSee SDL_LockSurface.
Returns zero if successful.
[procedure] (sdl-unlock-surface! surface)See SDL_UnlockSurface.
[procedure] (sdl-must-lock? surface) → booleanSee SDL_MUSTLOCK.
[procedure] (sdl-blit-surface! src src-rect dest dest-rect) → fixnumSee SDL_BlitSurface.
Returns zero if successful. May modify dest-rect.
[procedure] (sdl-blit-scaled! src src-rect dest dest-rect) → fixnumSee SDL_BlitScaled.
Returns zero if successful. May modify dest-rect.
[procedure] (sdl-lower-blit! src src-rect dest dest-rect) → fixnumSee SDL_LowerBlit.
Returns zero if successful. May modify dest-rect.
[procedure] (sdl-lower-blit-scaled! src src-rect dest dest-rect) → fixnumSee SDL_LowerBlitScaled.
Returns zero if successful. May modify dest-rect.
[procedure] (sdl-fill-rect! surface rect color) → fixnumSee SDL_FillRect.
rect may be a sdl-rect to fill part of the surface, or #f to fill the entire surface.
color may be an sdl-color or a mapped color (an integer, like returned by sdl-map-rgba).
Returns zero if successful.
[procedure] (sdl-fill-rects! surface rects color) → fixnumSee SDL_FillRects.
rects must be a list of sdl-rects.
color may be an sdl-color or a mapped color (an integer, like returned by sdl-map-rgba).
Returns zero if successful.
[procedure] (sdl-surface-ref surface x y) → sdl-colorReturns the color of the specified pixel on the surface, as an sdl-color. Signals an error if x or y is out of bounds.
[procedure] (sdl-surface-ref-raw surface x y) → fixnumLike sdl-surface-ref, but returns a mapped color (an integer) instead of a sdl-color. You can use sdl-get-rgba to convert the mapped color to color fields.
[setter] (set! (sdl-surface-ref surface x y) color)[setter] (sdl-surface-set! surface x y color)
Set the color of the specified pixel on the surface. Automatically locks and unlocks the surface if needed. Signals an error if x or y is out of bounds. color can be either a sdl-color or a mapped color (an integer). Note: This procedure ignores the surface's clip rect (if any).
[procedure] (sdl-surface-clip-rect surface) → sdl-rectSee SDL_GetClipRect.
Returns a copy of the surface's clip rect.
[setter] (set! (sdl-surface-clip-rect surface) rect) → boolean[setter] (sdl-surface-clip-rect-set! surface rect) → boolean
See SDL_SetClipRect.
Sets the surface's clip rect to a copy of the given rect. Or rect can be #f to disable clipping.
Returns #t if the given rect intersects the surface at all, or #f if the rect is out of bounds (completely clips out the surface).
[procedure] (sdl-surface-color-key surface) → sdl-color or #fSee SDL_GetColorKey.
[procedure] (sdl-surface-color-key-raw surface) → fixnum or #fLike sdl-surface-color-key, but returns a mapped color (an integer) instead of a sdl-color.
[setter] (set! (sdl-surface-color-key surface) color) → boolean[setter] (sdl-surface-color-key-set! surface color) → boolean
See SDL_SetColorKey.
color can be a sdl-color, a mapped color (an integer), or #f to disable color keying.
Returns zero if successful.
[procedure] (sdl-surface-alpha-mod surface) → fixnum[setter] (set! (sdl-surface-alpha-mod surface) mod) → fixnum
[setter] (sdl-surface-alpha-mod-set! surface mod) → fixnum
Returns zero on success.
[procedure] (sdl-surface-blend-mode surface) → symbolReturns a blend mode symbol:
- 'none
- 'blend
- 'add
- 'mod
[setter] (sdl-surface-blend-mode-set! surface mode)
mode must be a blend mode symbol or equivalent integer:
- 'none
- 'blend
- 'add
- 'mod
Returns multiple values.
[setter] (set! (sdl-surface-color-mod surface) rgb)[setter] (sdl-surface-color-mod-set! surface rgb)
rgb can be a list (r g b) of color values, or a sdl-color (the sdl-color's "a" field will be ignored).
[procedure] (sdl-surface-palette surface) → sdl-palette or #fReturns the surface's palette, or #f if it has no palette. This is equivalent to:
(sdl-pixel-format-palette (sdl-surface-format surface))[setter] (set! (sdl-surface-palette surface) palette)
[setter] (sdl-surface-palette-set! surface palette)
[setter] (sdl-surface-rle-set! surface enable)
See SDL_SetSurfaceRLE.
enable is #t to enable RLE acceleration or #f to disable it.
Timer
[procedure] (sdl-delay milliseconds)See SDL_Delay.
[procedure] (sdl-get-ticks) → fixnumSee SDL_GetTicks.
[procedure] (sdl-get-performance-counter) → fixnumSee SDL_GetPerformanceCounter.
[procedure] (sdl-get-performance-frequency) → fixnumSee SDL_GetPerformanceFrequency.
[procedure] (sdl-ticks-passed? ticks-a ticks-b) → booleanSee SDL_TICKS_PASSED.
Requires SDL 2.0.1 or higher. Signals an error if the compiled version of SDL is not high enough. Use (sdl-version-at-least? 2 0 1) to check before calling this procedure.
Window
[procedure] (sdl-create-window! title x y w h #!optional flags) → sdl-windowSee SDL_CreateWindow.
x and y can be integers, the symbol 'centered, or the symbol 'undefined.
flags must be a list of zero or more window flag symbols (or an equivalent integer bitfield):
- 'fullscreen
- 'fullscreen-desktop
- 'opengl
- 'shown
- 'hidden
- 'borderless
- 'resizable
- 'minimized
- 'maximized
- 'input-grabbed
- 'input-focus
- 'mouse-focus
- 'foreign
See SDL_GetWindowFromID.
[procedure] (sdl-destroy-window! window)See SDL_DestroyWindow.
[procedure] (sdl-update-window-surface! window) → fixnumReturns zero if successful.
[procedure] (sdl-update-window-surface-rects! window rects) → fixnumSee SDL_UpdateWindowSurfaceRects.
rects must be a list of sdl-rects.
Returns zero if successful.
[procedure] (sdl-show-window! window)See SDL_ShowWindow.
[procedure] (sdl-hide-window! window)See SDL_HideWindow.
[procedure] (sdl-maximize-window! window)See SDL_MaximizeWindow.
[procedure] (sdl-minimize-window! window)See SDL_MinimizeWindow.
[procedure] (sdl-raise-window! window)See SDL_RaiseWindow.
[procedure] (sdl-restore-window! window)See SDL_RestoreWindow.
[setter] (sdl-window-bordered-set! window bordered)bordered is #t to enable window decoration or #f to disable window decoration.
(There is currently no getter.)
[procedure] (sdl-window-brightness window) → float[setter] (set! (sdl-window-brightness window) brightness) → fixnum
[setter] (sdl-window-brightness-set! window brightness) → fixnum
Returns zero if successful.
[procedure] (sdl-window-display-index window) → fixnumSee SDL_GetWindowDisplayIndex.
[procedure] (sdl-window-display-mode window) → sdl-display-mode[setter] (set! (sdl-window-display-mode surface) mode) → boolean
[setter] (sdl-window-display-mode-set! surface mode) → boolean
TODO: Docs.
[procedure] (sdl-window-flags window) → list of symbolsSee SDL_GetWindowFlags.
Returns a list of window flag symbols.
[setter] (sdl-window-fullscreen-set! window mode)mode can be:
- 'fullscreen or #t
- fullscreen
- 'fullscreen-desktop
- fullscreen desktop
- #f
- not fullscreen
Returns zero if successful.
[procedure] (sdl-window-grab window) → booleanSee SDL_GetWindowGrab.
[setter] (set! (sdl-window-grab window) grab?[setter] (sdl-window-grab-set! window grab?)
See SDL_SetWindowGrab.
[setter] (sdl-window-icon-set! window icon-surface)See SDL_SetWindowIcon.
[procedure] (sdl-window-id window) → fixnumSee SDL_GetWindowID.
[procedure] (sdl-window-maximum-size window) → [width height][setter] (set! (sdl-window-maximum-size window) size)
[setter] (sdl-window-maximum-size-set! window size)
size must be a list of integers (width height).
[procedure] (sdl-window-minimum-size window) → [width height][setter] (set! (sdl-window-minimum-size window) size)
[setter] (sdl-window-minimum-size-set! window size)
size must be a list of integers (width height).
[procedure] (sdl-window-pixel-format window) → sdl-pixel-format[procedure] (sdl-window-position window) → [x y]
[setter] (set! (sdl-window-position window) pos)
[setter] (sdl-window-position-set! window pos)
pos must be a list of integers (x y).
[procedure] (sdl-window-size window) → [width height]See SDL_GetWindowSize.
[setter] (set! (sdl-window-size window) size)[setter] (sdl-window-size-set! window size)
See SDL_SetWindowSize.
size must be a list of integers (width height).
[procedure] (sdl-window-surface window) → sdl-surfaceSee SDL_GetWindowSurface.
[procedure] (sdl-window-title window) → stringSee SDL_GetWindowTitle.
[setter] (set! (sdl-window-title window) title)[setter] (sdl-window-title-set! window title)
See SDL_SetWindowTitle.