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

Structs

Enums

Constants

Functions

  • This function initializes the subsystems specified by flags.
  • This function initializes specific SDL subsystems
  • This function cleans up all initialized subsystems.
  • This function cleans up specific SDL subsystems.
  • This function returns a mask of the specified subsystems which have previously been initialized.

Type Definitions

  • Equivalent to C’s char type.
  • Equivalent to C’s double type.
  • Equivalent to C’s float type.
  • Equivalent to C’s signed int (int) type.
  • Equivalent to C’s signed long (long) type.
  • Equivalent to C’s signed long long (long long) type.
  • Equivalent to C’s signed char type.
  • Equivalent to C’s signed short (short) type.
  • Equivalent to C’s unsigned char type.
  • Equivalent to C’s unsigned int type.
  • Equivalent to C’s unsigned long type.
  • Equivalent to C’s unsigned long long type.
  • Equivalent to C’s unsigned short type.