mirror of
https://github.com/encounter/rust-sdl2.git
synced 2026-07-10 21:18:41 -07:00
load_with switched to take Rust void rather than the c_void
This commit is contained in:
+1
-1
@@ -4,7 +4,7 @@ name = "sdl2"
|
||||
description = "SDL2 bindings for Rust"
|
||||
repository = "https://github.com/AngryLawyer/rust-sdl2"
|
||||
documentation = "http://angrylawyer.github.io/rust-sdl2/sdl2/"
|
||||
version = "0.10.0"
|
||||
version = "0.11.0"
|
||||
license = "MIT"
|
||||
authors = [ "Tony Aldridge <tony@angry-lawyer.com>" ]
|
||||
keywords = ["SDL", "windowing", "graphics"]
|
||||
|
||||
@@ -95,7 +95,7 @@ download through Crates.io:
|
||||
|
||||
```toml
|
||||
[dependencies]
|
||||
sdl2 = "0.10"
|
||||
sdl2 = "0.11"
|
||||
```
|
||||
|
||||
Alternatively, pull it from GitHub
|
||||
@@ -138,7 +138,7 @@ bindings:
|
||||
let sdl_context = sdl2::init().unwrap();
|
||||
let video_subsystem = sdl_context.video().unwrap();
|
||||
|
||||
gl::load_with(|name| video_subsystem.gl_get_proc_address(name) as *const _);
|
||||
gl::load_with(|name| video_subsystem.gl_get_proc_address(name));
|
||||
```
|
||||
|
||||
Note that these bindings are very raw, and many of the calls will require
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ path = "src/lib.rs"
|
||||
|
||||
[dependencies]
|
||||
num = "0.1"
|
||||
libc = "0.2.1"
|
||||
libc = "0.2"
|
||||
|
||||
[build-dependencies.pkg-config]
|
||||
version = "0.3"
|
||||
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
use libc::{c_void, c_int, c_float, uint32_t};
|
||||
use libc::{c_int, c_float, uint32_t};
|
||||
use std::ffi::{CStr, CString};
|
||||
use std::mem;
|
||||
use std::ops::{Deref, DerefMut};
|
||||
@@ -620,9 +620,9 @@ impl VideoSubsystem {
|
||||
/// Gets the pointer to the named OpenGL function.
|
||||
///
|
||||
/// This is useful for OpenGL wrappers such as [`gl-rs`](https://github.com/bjz/gl-rs).
|
||||
pub fn gl_get_proc_address(&self, procname: &str) -> *const c_void {
|
||||
pub fn gl_get_proc_address(&self, procname: &str) -> *const () {
|
||||
match CString::new(procname) {
|
||||
Ok(procname) => unsafe { ll::SDL_GL_GetProcAddress(procname.as_ptr()) },
|
||||
Ok(procname) => unsafe { ll::SDL_GL_GetProcAddress(procname.as_ptr()) as *const () },
|
||||
// string contains a nul byte - it won't match anything.
|
||||
Err(_) => ptr::null()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user