mirror of
https://github.com/encounter/rust-sdl2.git
synced 2026-07-10 21:18:41 -07:00
Sync with master
This commit is contained in:
@@ -86,7 +86,7 @@ mod game_of_life {
|
||||
|
||||
pub fn update(&mut self) {
|
||||
let mut new_playground = self.playground;
|
||||
for (u, mut square) in new_playground.iter_mut().enumerate() {
|
||||
for (u, square) in new_playground.iter_mut().enumerate() {
|
||||
let u = u as u32;
|
||||
let x = u % PLAYGROUND_WIDTH;
|
||||
let y = u / PLAYGROUND_WIDTH;
|
||||
@@ -252,7 +252,7 @@ pub fn main() {
|
||||
let x = (x as u32) / SQUARE_SIZE;
|
||||
let y = (y as u32) / SQUARE_SIZE;
|
||||
match game.get_mut(x as i32, y as i32) {
|
||||
Some(mut square) => {*square = !(*square);},
|
||||
Some(square) => {*square = !(*square);},
|
||||
None => {panic!()}
|
||||
};
|
||||
},
|
||||
|
||||
@@ -115,7 +115,7 @@ mod game_of_life {
|
||||
}
|
||||
}
|
||||
|
||||
fn dummy_texture<'a>(canvas: &mut Canvas<Window>, texture_creator: &'a TextureCreator<WindowContext>) -> (Texture<'a>, Texture<'a>) {
|
||||
fn dummy_texture<'a>(canvas: &mut Canvas<Window>, texture_creator: &'a TextureCreator<WindowContext>) -> (Texture, Texture) {
|
||||
enum TextureColor {
|
||||
Yellow,
|
||||
White,
|
||||
|
||||
@@ -70,7 +70,7 @@ fn main() {
|
||||
}
|
||||
}
|
||||
|
||||
type TextureManager<'l, T> = ResourceManager<'l, String, Texture<'l>, TextureCreator<T>>;
|
||||
type TextureManager<'l, T> = ResourceManager<'l, String, Texture, TextureCreator<T>>;
|
||||
type FontManager<'l> = ResourceManager<'l, FontDetails, Font<'l, 'static>, Sdl2TtfContext>;
|
||||
|
||||
// Generic struct to cache any resource loaded by a ResourceLoader
|
||||
@@ -113,7 +113,7 @@ impl<'l, K, R, L> ResourceManager<'l, K, R, L>
|
||||
}
|
||||
|
||||
// TextureCreator knows how to load Textures
|
||||
impl<'l, T> ResourceLoader<'l, Texture<'l>> for TextureCreator<T> {
|
||||
impl<'l, T> ResourceLoader<'l, Texture> for TextureCreator<T> {
|
||||
type Args = str;
|
||||
fn load(&'l self, path: &str) -> Result<Texture, String> {
|
||||
println!("LOADED A TEXTURE");
|
||||
|
||||
@@ -27,10 +27,12 @@ use std::ffi::{CString, CStr};
|
||||
use std::str::from_utf8;
|
||||
use std::borrow::ToOwned;
|
||||
use std::path::Path;
|
||||
use libc::{c_int, uint16_t, c_double, c_uint, c_void};
|
||||
use std::os::raw::c_void;
|
||||
use libc::{c_int, uint16_t, c_double, c_uint};
|
||||
use ::get_error;
|
||||
use ::rwops::RWops;
|
||||
use ::version::Version;
|
||||
use sys;
|
||||
|
||||
// Setup linking for all targets.
|
||||
#[cfg(target_os="macos")]
|
||||
@@ -793,7 +795,7 @@ impl<'a> Music<'a> {
|
||||
/// Load music from a static byte buffer.
|
||||
pub fn from_static_bytes(buf: &'static [u8]) -> Result<Music<'static>, String> {
|
||||
let rw = unsafe {
|
||||
::sys::rwops::SDL_RWFromConstMem(buf.as_ptr() as *const c_void, buf.len() as c_int)
|
||||
sys::SDL_RWFromConstMem(buf.as_ptr() as *const c_void, buf.len() as c_int)
|
||||
};
|
||||
|
||||
if rw.is_null() {
|
||||
|
||||
Reference in New Issue
Block a user