rust-sdl2 | SDL2 bindings for Rust | Media library
kandi X-RAY | rust-sdl2 Summary
kandi X-RAY | rust-sdl2 Summary
Rust-SDL2 is a library for talking to the new SDL2.0 libraries from Rust. Low-level C components are wrapped in Rust code to make them more idiomatic and abstract away inappropriate manual memory management. Rust-SDL2 uses the MIT license.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of rust-sdl2
rust-sdl2 Key Features
rust-sdl2 Examples and Code Snippets
Community Discussions
Trending Discussions on rust-sdl2
QUESTION
I'm reading the code of rust-sdl2 and there's this Texture
struct:
ANSWER
Answered 2020-Mar-17 at 12:28If the struct was declared like this, then Rust would be able to automatically ensure memory safety:
QUESTION
I'm using the latest version of sdl2 (0.31.0) but cannot access get_platform
:
ANSWER
Answered 2018-Sep-01 at 01:42The documentation you are reading is is not for the version you are using. Build it yourself (cargo doc --open
) or view it on docs.rs.
That function was added recently and has not been released yet. Perhaps you should file an issue for the authors of the crate to let them know that having documentation that doesn't correspond to any released code is confusing.
In the meantime, you can use a git dependency if you really need it.
QUESTION
I want to start a timer with sdl2-rs
crate for performing draw calls. I wanted to start it by doing something like this:
ANSWER
Answered 2017-Aug-27 at 14:29The cloned sender has the same type as original sender, so it is still not Sync
. add_timer
function wants a closure which is Sync
, so you need to wrap sender in Mutex
which makes your sender safe to share between threads.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install rust-sdl2
Download mingw and msvc development libraries from http://www.libsdl.org/ (SDL2-devel-2.0.x-mingw.tar.gz & SDL2-devel-2.0.x-VC.zip).
Unpack to folders of your choosing (You can delete it afterwards).
Create the following folder structure in the same folder as your Cargo.toml:
Copy the lib and dll files from the source archive to the directories we created in step 3 like so:
Create a build script, if you don't already have one put this in your Cargo.toml under [package]:
Create a file in the same directory as Cargo.toml called build.rs (if you didn't already have a build script) and paste this into it:
On build the build script will copy the needed DLLs into the same directory as your Cargo.toml, you probably don't want to commit these to any Git repositories though so add the following line to your .gitignore file
When you're publish your game make sure to copy the corresponding SDL2.dll to the same directory that your compiled exe is in, otherwise the game won't launch.
If you're using cargo to manage your project, you can download through Crates.io:. Alternatively, pull it from GitHub to obtain the latest version from master. Otherwise, clone this repo and run cargo.
image, ttf, mixer
gfx
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page