mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2025-01-22 18:06:33 +11:00
Update for Rustc
This commit is contained in:
parent
25b261975c
commit
dbdb43f077
8 changed files with 18 additions and 31 deletions
|
@ -1,7 +1,5 @@
|
|||
#![feature(phase)]
|
||||
|
||||
#[cfg(target_os = "android")]
|
||||
#[phase(plugin, link)]
|
||||
#[macro_use]
|
||||
extern crate android_glue;
|
||||
|
||||
extern crate glutin;
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
#![feature(phase)]
|
||||
|
||||
#[cfg(target_os = "android")]
|
||||
#[phase(plugin, link)]
|
||||
#[macro_use]
|
||||
extern crate android_glue;
|
||||
|
||||
extern crate glutin;
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
#![cfg(feature = "window")]
|
||||
|
||||
#[phase(plugin)]
|
||||
extern crate gl_generator;
|
||||
|
||||
use glutin;
|
||||
|
||||
#[cfg(not(target_os = "android"))]
|
||||
|
@ -23,12 +20,12 @@ pub struct Context {
|
|||
pub fn load(window: &glutin::Window) -> Context {
|
||||
let gl = gl::Gl::load(window);
|
||||
|
||||
let version = {
|
||||
use std::c_str::CString;
|
||||
unsafe { CString::new(gl.GetString(gl::VERSION) as *const i8, false) }
|
||||
let version = unsafe {
|
||||
use std::ffi;
|
||||
ffi::c_str_to_bytes(&(gl.GetString(gl::VERSION) as *const i8)).to_string()
|
||||
};
|
||||
|
||||
println!("OpenGL version {}", version.as_str().unwrap());
|
||||
println!("OpenGL version {}", version);
|
||||
|
||||
Context { gl: gl }
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
#![feature(phase)]
|
||||
|
||||
#[cfg(target_os = "android")]
|
||||
#[phase(plugin, link)]
|
||||
#[macro_use]
|
||||
extern crate android_glue;
|
||||
|
||||
extern crate glutin;
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
#![feature(unsafe_destructor)]
|
||||
#![feature(globs)]
|
||||
#![feature(phase)]
|
||||
#![unstable]
|
||||
#![feature(associated_types)]
|
||||
|
||||
//! The purpose of this library is to provide an OpenGL context on as many
|
||||
//! platforms as possible.
|
||||
|
|
|
@ -6,6 +6,7 @@ use {CreationError, Event};
|
|||
use CreationError::OsError;
|
||||
|
||||
use std::cell::RefCell;
|
||||
use std::ffi::CString;
|
||||
use std::rc::Rc;
|
||||
use std::sync::mpsc::{Sender, Receiver, channel};
|
||||
|
||||
|
@ -224,11 +225,12 @@ pub fn new_window(builder_dimensions: Option<(uint, uint)>, builder_title: Strin
|
|||
// loading the extra WGL functions
|
||||
let extra_functions = gl::wgl_extra::Wgl::load_with(|addr| {
|
||||
use libc;
|
||||
use std::c_str::ToCStr;
|
||||
|
||||
let addr = CString::from_slice(addr.as_bytes());
|
||||
let addr = addr.as_slice_with_nul().as_ptr();
|
||||
|
||||
unsafe {
|
||||
let addr = addr.to_c_str();
|
||||
gl::wgl::GetProcAddress(addr.as_ptr()) as *const libc::c_void
|
||||
gl::wgl::GetProcAddress(addr) as *const libc::c_void
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use std::sync::atomic::AtomicBool;
|
||||
use std::ptr;
|
||||
use std::ffi::CString;
|
||||
use std::collections::RingBuf;
|
||||
use std::sync::mpsc::Receiver;
|
||||
use libc;
|
||||
|
@ -256,14 +257,13 @@ impl Window {
|
|||
|
||||
/// See the docs in the crate root file.
|
||||
pub fn get_proc_address(&self, addr: &str) -> *const () {
|
||||
use std::c_str::ToCStr;
|
||||
let addr = CString::from_slice(addr.as_bytes());
|
||||
let addr = addr.as_slice_with_nul().as_ptr();
|
||||
|
||||
unsafe {
|
||||
addr.with_c_str(|s| {
|
||||
let p = gl::wgl::GetProcAddress(s) as *const ();
|
||||
let p = gl::wgl::GetProcAddress(addr) as *const ();
|
||||
if !p.is_null() { return p; }
|
||||
winapi::GetProcAddress(self.gl_library, s) as *const ()
|
||||
})
|
||||
winapi::GetProcAddress(self.gl_library, addr) as *const ()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
#![feature(phase)]
|
||||
|
||||
#[phase(plugin)]
|
||||
extern crate gl_generator;
|
||||
extern crate glutin;
|
||||
extern crate libc;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue