Crate fermium

Source
Expand description

Bindings to the SDL2 C library.

By default the crate will dynamically link to the system installed version of SDL2. The crate provides bindings for most of the 2.0.16 APIs, but your system version of SDL2 might be older or newer than that. For example, Debian Bullseye is on 2.0.14, but Debian Bookworm has updated to 2.24.1 (note that in between SDL2 changed their version number policy, so new versions now update the middle value). On Windows MSVC the “system” version will be SDL2’s official pre-built development files that come bundled in the crate.

If you use the static_bundled_build cargo feature then this will build SDL2 using a bundled copy of the source and then statically link to that. Building SDL2 can take a bit during that first build (usually 1 minute or more).

§Crate Features

  • cargo_check: This causes the entire build.rs to exit early. This is useful if you don’t need to make an executable, such as cargo check or cargo doc.

Modules§

audio
Audio playback.
blendmode
Support module for pixel blending.
clipboard
Interact with the system clipboard.
cpuinfo
Get some useful info about the current CPU.
error
SDL uses a thread-local buffer to store the current error string.
events
Module for event handling.
filesystem
Filesystem helper functions.
gamecontroller
The SDL “game controller” API lets you view any joystick as being (approximately) an XBox 360 controller.
gesture
Module for touch gestures.
hints
SDL configuration variables
joystick
Module for SDL joystick event handling.
keyboard
Interactions with the keyboard.
keycode
Logical key mappings (changes by locale).
loadso
Module for loading “shared objects” (aka dynamic libraries / DLLs).
messagebox
Allows the creation of message boxes, for short messages to the user.
mouse
Mouse control and interaction.
pixels
Module for pixel editing.
platform
Platform based functions.
power
Lets you get power info about the system.
prelude
This is a module that re-exports every sub-module of the crate.
quit
Quit stuff.
rect
Operations for SDL’s rectangle type.
renderer
SDL’s portable 2D rendering functions.
rwops
Allows for interaction with things you can read and write from.
scancode
Physical key mappings (ignores locale).
sensor
Lets SDL use various sensors (such as the accelerometer in a phone).
stdinc
The “standard include” which almost every other include tends to use.
surface
Module for SDL’s in-memory bitmap type.
syswm
SDL’s custom system window manager hooks.
timer
Timer related functionality.
touch
Module for touch interface interactions.
version
Lets you get info about the runtime SDL version.
video
Module for interacting with the video subsystem.

Structs§

SDL_InitFlags
SDL2’s initialization flags.

Enums§

c_void
Equivalent to C’s void type when used as a pointer.

Constants§

SDL_INIT_AUDIO
SDL_INIT_EVENTS
SDL_INIT_EVERYTHING
SDL_INIT_GAMECONTROLLER
SDL_INIT_GAMECONTROLLER implies SDL_INIT_JOYSTICK
SDL_INIT_HAPTIC
SDL_INIT_JOYSTICK
SDL_INIT_JOYSTICK implies SDL_INIT_EVENTS
SDL_INIT_NOPARACHUTE
compatibility; this flag is ignored.
SDL_INIT_SENSOR
SDL_INIT_TIMER
SDL_INIT_VIDEO
SDL_INIT_VIDEO implies SDL_INIT_EVENTS

Functions§

SDL_Init
This function initializes the subsystems specified by flags.
SDL_InitSubSystem
This function initializes specific SDL subsystems
SDL_Quit
This function cleans up all initialized subsystems.
SDL_QuitSubSystem
This function cleans up specific SDL subsystems.
SDL_WasInit
This function returns a mask of the specified subsystems which have previously been initialized.

Type Aliases§

c_char
Equivalent to C’s char type.
c_double
Equivalent to C’s double type.
c_float
Equivalent to C’s float type.
c_int
Equivalent to C’s signed int (int) type.
c_long
Equivalent to C’s signed long (long) type.
c_longlong
Equivalent to C’s signed long long (long long) type.
c_schar
Equivalent to C’s signed char type.
c_short
Equivalent to C’s signed short (short) type.
c_uchar
Equivalent to C’s unsigned char type.
c_uint
Equivalent to C’s unsigned int type.
c_ulong
Equivalent to C’s unsigned long type.
c_ulonglong
Equivalent to C’s unsigned long long type.
c_ushort
Equivalent to C’s unsigned short type.