mirror of
https://github.com/encounter/rust-sdl2.git
synced 2026-07-10 21:18:41 -07:00
Updated to latest version of Rust
This commit is contained in:
+22
-22
@@ -548,12 +548,12 @@ pub enum Event {
|
||||
ControllerDeviceRemovedEvent(uint, int),
|
||||
ControllerDeviceRemappedEvent(uint, int),
|
||||
|
||||
FingerDownEvent(uint, i64, i64, float, float, float, float, float),
|
||||
FingerUpEvent(uint, i64, i64, float, float, float, float, float),
|
||||
FingerMotionEvent(uint, i64, i64, float, float, float, float, float),
|
||||
DollarGestureEvent(uint, i64, i64, uint, float, float, float),
|
||||
DollarRecordEvent(uint, i64, i64, uint, float, float, float),
|
||||
MultiGestureEvent(uint, i64, float, float, float, float, uint),
|
||||
FingerDownEvent(uint, i64, i64, f64, f64, f64, f64, f64),
|
||||
FingerUpEvent(uint, i64, i64, f64, f64, f64, f64, f64),
|
||||
FingerMotionEvent(uint, i64, i64, f64, f64, f64, f64, f64),
|
||||
DollarGestureEvent(uint, i64, i64, uint, f64, f64, f64),
|
||||
DollarRecordEvent(uint, i64, i64, uint, f64, f64, f64),
|
||||
MultiGestureEvent(uint, i64, f64, f64, f64, f64, uint),
|
||||
|
||||
ClipboardUpdateEvent(uint),
|
||||
DropFileEvent(uint, ~str),
|
||||
@@ -886,9 +886,9 @@ fn wrap_event(raw: ll::SDL_Event) -> Event {
|
||||
else { *event };
|
||||
|
||||
FingerDownEvent(event.timestamp as uint, event.touchId as i64,
|
||||
event.fingerId as i64, event.x as float,
|
||||
event.y as float, event.dx as float,
|
||||
event.dy as float, event.pressure as float)
|
||||
event.fingerId as i64, event.x as f64,
|
||||
event.y as f64, event.dx as f64,
|
||||
event.dy as f64, event.pressure as f64)
|
||||
}
|
||||
FingerUpEventType => {
|
||||
let event = raw.tfinger();
|
||||
@@ -896,9 +896,9 @@ fn wrap_event(raw: ll::SDL_Event) -> Event {
|
||||
else { *event };
|
||||
|
||||
FingerUpEvent(event.timestamp as uint, event.touchId as i64,
|
||||
event.fingerId as i64, event.x as float,
|
||||
event.y as float, event.dx as float,
|
||||
event.dy as float, event.pressure as float)
|
||||
event.fingerId as i64, event.x as f64,
|
||||
event.y as f64, event.dx as f64,
|
||||
event.dy as f64, event.pressure as f64)
|
||||
}
|
||||
FingerMotionEventType => {
|
||||
let event = raw.tfinger();
|
||||
@@ -907,9 +907,9 @@ fn wrap_event(raw: ll::SDL_Event) -> Event {
|
||||
|
||||
FingerMotionEvent(event.timestamp as uint,
|
||||
event.touchId as i64, event.fingerId as i64,
|
||||
event.x as float, event.y as float,
|
||||
event.dx as float, event.dy as float,
|
||||
event.pressure as float)
|
||||
event.x as f64, event.y as f64,
|
||||
event.dx as f64, event.dy as f64,
|
||||
event.pressure as f64)
|
||||
}
|
||||
DollarGestureEventType => {
|
||||
let event = raw.dgesture();
|
||||
@@ -920,8 +920,8 @@ fn wrap_event(raw: ll::SDL_Event) -> Event {
|
||||
event.touchId as i64,
|
||||
event.gestureId as i64,
|
||||
event.numFingers as uint,
|
||||
event.error as float, event.x as float,
|
||||
event.y as float)
|
||||
event.error as f64, event.x as f64,
|
||||
event.y as f64)
|
||||
}
|
||||
DollarRecordEventType => {
|
||||
let event = raw.dgesture();
|
||||
@@ -931,8 +931,8 @@ fn wrap_event(raw: ll::SDL_Event) -> Event {
|
||||
DollarRecordEvent(event.timestamp as uint,
|
||||
event.touchId as i64, event.gestureId as i64,
|
||||
event.numFingers as uint,
|
||||
event.error as float, event.x as float,
|
||||
event.y as float)
|
||||
event.error as f64, event.x as f64,
|
||||
event.y as f64)
|
||||
}
|
||||
MultiGestureEventType => {
|
||||
let event = raw.mgesture();
|
||||
@@ -940,9 +940,9 @@ fn wrap_event(raw: ll::SDL_Event) -> Event {
|
||||
else { *event };
|
||||
|
||||
MultiGestureEvent(event.timestamp as uint,
|
||||
event.touchId as i64, event.dTheta as float,
|
||||
event.dDist as float, event.x as float,
|
||||
event.y as float, event.numFingers as uint)
|
||||
event.touchId as i64, event.dTheta as f64,
|
||||
event.dDist as f64, event.x as f64,
|
||||
event.y as f64, event.numFingers as uint)
|
||||
}
|
||||
|
||||
ClipboardUpdateEventType => {
|
||||
|
||||
+7
-7
@@ -403,15 +403,15 @@ impl Renderer {
|
||||
rect
|
||||
}
|
||||
|
||||
pub fn set_scale(&self, scale_x: float, scale_y: float) -> bool {
|
||||
pub fn set_scale(&self, scale_x: f64, scale_y: f64) -> bool {
|
||||
unsafe { ll::SDL_RenderSetScale(self.raw, scale_x as c_float, scale_y as c_float) == 0 }
|
||||
}
|
||||
|
||||
pub fn get_scale(&self) -> (float, float) {
|
||||
pub fn get_scale(&self) -> (f64, f64) {
|
||||
let scale_x: c_float = 0.0;
|
||||
let scale_y: c_float = 0.0;
|
||||
unsafe { ll::SDL_RenderGetScale(self.raw, &scale_x, &scale_y) };
|
||||
(scale_x as float, scale_y as float)
|
||||
(scale_x as f64, scale_y as f64)
|
||||
}
|
||||
|
||||
pub fn draw_point(&self, point: Point) -> bool {
|
||||
@@ -611,7 +611,7 @@ impl Texture {
|
||||
externfn!(fn SDL_LockTexture(texture: *SDL_Texture, rect: *SDL_Rect, pixels: **c_void, pitch: *c_int) -> c_int)
|
||||
externfn!(fn SDL_UnlockTexture(texture: *SDL_Texture))*/
|
||||
|
||||
pub fn gl_bind_texture(&self) -> Result<(float, float), ~str> {
|
||||
pub fn gl_bind_texture(&self) -> Result<(f64, f64), ~str> {
|
||||
let texw: c_float = 0.0;
|
||||
let texh: c_float = 0.0;
|
||||
|
||||
@@ -620,7 +620,7 @@ impl Texture {
|
||||
};
|
||||
|
||||
if result {
|
||||
Ok((texw as float, texh as float))
|
||||
Ok((texw as f64, texh as f64))
|
||||
} else {
|
||||
Err(~"Operation not supported")
|
||||
}
|
||||
@@ -630,12 +630,12 @@ impl Texture {
|
||||
unsafe { ll::SDL_GL_UnbindTexture(self.raw) == 0 }
|
||||
}
|
||||
|
||||
pub fn gl_with_bind<R>(&self, f: &fn(tex_w: float, tex_h: float) -> R) -> R {
|
||||
pub fn gl_with_bind<R>(&self, f: &fn(tex_w: f64, tex_h: f64) -> R) -> R {
|
||||
unsafe {
|
||||
let texw: c_float = 0.0;
|
||||
let texh: c_float = 0.0;
|
||||
if ll::SDL_GL_BindTexture(self.raw, &texw, &texh) != 0 { fail!(~"could not bind texture"); }
|
||||
let rv = f(texw as float, texh as float);
|
||||
let rv = f(texw as f64, texh as f64);
|
||||
ll::SDL_GL_UnbindTexture(self.raw);
|
||||
rv
|
||||
}
|
||||
|
||||
+3
-3
@@ -556,12 +556,12 @@ impl Window {
|
||||
unsafe { ll::SDL_GetWindowGrab(self.raw) == 1 }
|
||||
}
|
||||
|
||||
pub fn set_brightness(&self, brightness: float) -> bool {
|
||||
pub fn set_brightness(&self, brightness: f64) -> bool {
|
||||
unsafe { ll::SDL_SetWindowBrightness(self.raw, brightness as c_float) == 0 }
|
||||
}
|
||||
|
||||
pub fn get_brightness(&self) -> float {
|
||||
unsafe { ll::SDL_GetWindowBrightness(self.raw) as float }
|
||||
pub fn get_brightness(&self) -> f64 {
|
||||
unsafe { ll::SDL_GetWindowBrightness(self.raw) as f64 }
|
||||
}
|
||||
|
||||
pub fn set_gamma_ramp(&self, red: Option<&[u16, ..256]>, green: Option<&[u16, ..256]>, blue: Option<&[u16, ..256]>) -> bool {
|
||||
|
||||
Reference in New Issue
Block a user