Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update versions and remove deprecated Rust idioms #31

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changes

## Version 0.16 (2020-12-14)
- Changed glium dependency to version `0.28`
- Changed SDL2 dependency to version `0.34`
- Update deprecated Rust idioms to remove warnings

## Version 0.15 (2017-10-19)
- Changed glium dependency to version `0.18`

Expand Down
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "glium_sdl2"
version = "0.15.0"
version = "0.16.0"
authors = ["Danny Spencer <[email protected]>"]
license = "MIT/Apache-2.0"
keywords = ["graphics", "gamedev", "glium", "sdl", "opengl"]
Expand All @@ -9,10 +9,10 @@ repository = "https://github.com/nukep/glium-sdl2/"
description = "An SDL2 backend for Glium - a high-level OpenGL wrapper for the Rust language."

[dependencies]
sdl2 = "0.30"
sdl2 = "0.34"

[dependencies.glium]
version = "0.18"
version = "0.28"
# Do not enable any features by default, as to not bring in unwanted dependencies
# (Cargo seems to apply a "union" of requested features across projects for any given dependency).
# Instead, Let the library user define which features they want.
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ are in heavy development and are subject to change.

```toml
[dependencies]
glium_sdl2 = "0.15"
sdl2 = "0.30"
glium = "0.18"
glium_sdl2 = "0.16"
sdl2 = "0.34"
glium = "0.28"

features = []
default-features = false
Expand Down
2 changes: 1 addition & 1 deletion examples/support/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,5 @@ pub fn load_wavefront(display: &Display, data: &[u8]) -> VertexBufferAny {
}
}

glium::vertex::VertexBuffer::new(display, &vertex_data).unwrap().into_vertex_buffer_any()
glium::vertex::VertexBuffer::new(display, &vertex_data).unwrap().into()
}
24 changes: 9 additions & 15 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,17 +93,11 @@ impl From<IncompatibleOpenGl> for GliumSdl2Error {
}
}

impl std::error::Error for GliumSdl2Error {
fn description(&self) -> &str {
return match *self {
GliumSdl2Error::WindowBuildError(ref err) => err.description(),
GliumSdl2Error::ContextCreationError(ref s) => s
}
}

fn cause(&self) -> Option<&std::error::Error> {
impl std::error::Error for GliumSdl2Error {
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
match *self {
GliumSdl2Error::WindowBuildError(ref err) => err.cause(),
GliumSdl2Error::WindowBuildError(ref err) => err.source(),
GliumSdl2Error::ContextCreationError(_) => None
}
}
Expand Down Expand Up @@ -210,8 +204,8 @@ impl<'a> DisplayBuild for &'a mut sdl2::video::WindowBuilder {
type Err = GliumSdl2Error;

fn build_glium_debug(self, debug: debug::DebugCallbackBehavior) -> Result<SDL2Facade, GliumSdl2Error> {
let backend = Rc::new(try!(SDL2WindowBackend::new(self)));
let context = try!(unsafe { Context::new(backend.clone(), true, debug) });
let backend = Rc::new(SDL2WindowBackend::new(self)?);
let context = unsafe { Context::new(backend.clone(), true, debug)? };

let display = SDL2Facade {
context: context,
Expand All @@ -222,8 +216,8 @@ impl<'a> DisplayBuild for &'a mut sdl2::video::WindowBuilder {
}

unsafe fn build_glium_unchecked_debug(self, debug: debug::DebugCallbackBehavior) -> Result<SDL2Facade, GliumSdl2Error> {
let backend = Rc::new(try!(SDL2WindowBackend::new(self)));
let context = try!(Context::new(backend.clone(), false, debug));
let backend = Rc::new(SDL2WindowBackend::new(self)?);
let context = Context::new(backend.clone(), false, debug)?;

let display = SDL2Facade {
context: context,
Expand Down Expand Up @@ -259,8 +253,8 @@ impl SDL2WindowBackend {
}

pub fn new(window_builder: &mut sdl2::video::WindowBuilder) -> Result<SDL2WindowBackend, GliumSdl2Error> {
let window = try!(window_builder.opengl().build());
let context = try!(window.gl_create_context());
let window = window_builder.opengl().build()?;
let context = window.gl_create_context()?;

Ok(SDL2WindowBackend {
window: UnsafeCell::new(window),
Expand Down