11 releases

0.2.0 May 17, 2020
0.1.9 Mar 30, 2020
0.1.8 Mar 18, 2019
0.1.7 Feb 13, 2019

#263 in Video

Download history 39/week @ 2024-09-23

57 downloads per month

MIT license

580KB
12K SLoC

ndless-sdl

Crates.io Docs.rs

Bindings for SDL in Rust

ndless-sdl is a library for talking to SDL from Rust. In addition, it provides optional APIs to a number of common SDL extension libraries. Check out ndless in addition to this crate.

ndless-sdl uses the MIT license.


lib.rs:

SDL bindings for Ndless

Get started with:

ndless_sdl::init(&[ndless_sdl::InitFlag::Video]);
let screen = match ndless_sdl::video::set_video_mode(320, 240, 16,
                                                     &[SurfaceFlag::SWSurface],
                                                     &[VideoFlag::NoFrame]) {
    Ok(screen) => screen,
    Err(err) => panic!("failed to set video mode: {}", err)
};
loop {
    screen.fill_rect(Some(ndless_sdl::Rect {
         x: 0,
         y: 0,
         w: 320,
         h: 240,
    }), ndless_sdl::video::RGB(142, 120, 255));
}
ndless_sdl::quit();

It is not recommended to use the input methods from this crate. Rather, use the ones built into the ndless crate.

Dependencies

~3.5MB
~73K SLoC