#sdl #graphics #gamedev

lexsdl

A wrapper for SDL2 to abstract away annoying parts

3 releases (breaking)

0.3.0 Feb 6, 2023
0.2.0 Feb 1, 2023
0.1.0 Jan 27, 2023

#1040 in Graphics APIs

MIT license

44KB
783 lines

LEXSDL


A SDL2 wrapper (under development) for C and Rust.

Once SDL3 is stable it will be used.

The documentation can be found as a download in the releases page here.

Some functions are implemented in rust but there is no need for a rust compiler as in the releases page are compiled libs available for Linux 32/64 bits and Windows 32/64 bits.

The .a might be big but it doesn't affect the final binary size.

For linux a install script is available.

It is still necessary to have SDL installed and a C compiler even on Rust.

On Rust a safe wrapper is in progress, use of unsafe still necessary.

It can be used in existing projects without beeing disruptive. (in the documentation is more info and full examples)

// the easiest is to set the window and the renderer

SDL_Window *yourSdlWindow = SDL_CreateWindow(..);
SDL_Renderer *yourSdlRenderer = SDL_CreateRenderer(..);

LEXSDL_SetWindow(yourSdlWindow);
LEXSDL_SetRenderer(youtSdlRenderer);

// now it can be used with the rest of the lib
LEXSDL_NewFrame();
/* draw textures and stuff */
LEXSDL_ShowFrame();

Dependencies

~16MB
~342K SLoC