Updated to latest version of Master

This commit is contained in:
Tony Aldridge
2013-11-13 14:16:54 +00:00
parent 7b96829178
commit 3bd045a0d0
18 changed files with 374 additions and 348 deletions
+2 -2
View File
@@ -1,7 +1,7 @@
#[macro_escape];
use std::rt::io::buffered::BufferedWriter;
use std::rt::io::{File, Writer};
use std::io::buffered::BufferedWriter;
use std::io::{File, Writer};
use std::str::CharIterator;
struct ParseBranch {
+4 -4
View File
@@ -1,10 +1,10 @@
#[feature(macro_rules)];
use std::os;
use std::rt::io::buffered::BufferedWriter;
use std::rt::io::{File, Writer};
use std::rt::io;
use std::rt::io::fs::mkdir_recursive;
use std::io::buffered::BufferedWriter;
use std::io::{File, Writer};
use std::io;
use std::io::fs::mkdir_recursive;
pub mod branchify;
pub mod keycode;
pub mod scancode;
+1 -1
View File
@@ -1,5 +1,5 @@
extern mod extra;
use std::rt::io::Writer;
use std::io::Writer;
use super::get_writer;
struct Key {
+1 -1
View File
@@ -1,5 +1,5 @@
extern mod extra;
use std::rt::io::Writer;
use std::io::Writer;
use super::get_writer;
struct ScanCode {
+49 -47
View File
@@ -71,53 +71,55 @@ pub mod ll {
pub static SDL_CONTROLLER_BUTTON_DPAD_RIGHT: SDL_GameControllerButton = 14;
pub static SDL_CONTROLLER_BUTTON_MAX: SDL_GameControllerButton = 15;
externfn!(fn SDL_GameControllerAddMapping(mappingString: *c_schar) -> c_int)
externfn!(fn SDL_GameControllerMappingForGUID(guid: SDL_JoystickGUID) ->
*c_schar)
externfn!(fn SDL_GameControllerMapping(gamecontroller: *SDL_GameController)
-> *c_schar)
externfn!(fn SDL_IsGameController(joystick_index: c_int) -> SDL_bool)
externfn!(fn SDL_GameControllerNameForIndex(joystick_index: c_int) ->
*c_schar)
externfn!(fn SDL_GameControllerOpen(joystick_index: c_int) ->
*SDL_GameController)
externfn!(fn SDL_GameControllerName(gamecontroller: *SDL_GameController) ->
*c_schar)
externfn!(fn SDL_GameControllerGetAttached(gamecontroller:
*SDL_GameController) ->
SDL_bool)
externfn!(fn SDL_GameControllerGetJoystick(gamecontroller:
*SDL_GameController) ->
*SDL_Joystick)
externfn!(fn SDL_GameControllerEventState(state: c_int) -> c_int)
externfn!(fn SDL_GameControllerUpdate())
externfn!(fn SDL_GameControllerGetAxisFromString(pchString: *c_schar) ->
SDL_GameControllerAxis)
externfn!(fn SDL_GameControllerGetStringForAxis(axis:
SDL_GameControllerAxis)
-> *c_schar)
externfn!(fn SDL_GameControllerGetBindForAxis(gamecontroller:
*SDL_GameController,
axis: SDL_GameControllerAxis)
-> SDL_GameControllerButtonBind)
externfn!(fn SDL_GameControllerGetAxis(gamecontroller: *SDL_GameController,
axis: SDL_GameControllerAxis) ->
int16_t)
externfn!(fn SDL_GameControllerGetButtonFromString(pchString: *c_schar) ->
SDL_GameControllerButton)
externfn!(fn SDL_GameControllerGetStringForButton(button:
SDL_GameControllerButton)
-> *c_schar)
externfn!(fn SDL_GameControllerGetBindForButton(gamecontroller:
*SDL_GameController,
button:
SDL_GameControllerButton)
-> SDL_GameControllerButtonBind)
externfn!(fn SDL_GameControllerGetButton(gamecontroller:
*SDL_GameController,
button: SDL_GameControllerButton)
-> uint8_t)
externfn!(fn SDL_GameControllerClose(gamecontroller: *SDL_GameController))
extern "C" {
pub fn SDL_GameControllerAddMapping(mappingString: *c_schar) -> c_int;
pub fn SDL_GameControllerMappingForGUID(guid: SDL_JoystickGUID) ->
*c_schar;
pub fn SDL_GameControllerMapping(gamecontroller: *SDL_GameController)
-> *c_schar;
pub fn SDL_IsGameController(joystick_index: c_int) -> SDL_bool;
pub fn SDL_GameControllerNameForIndex(joystick_index: c_int) ->
*c_schar;
pub fn SDL_GameControllerOpen(joystick_index: c_int) ->
*SDL_GameController;
pub fn SDL_GameControllerName(gamecontroller: *SDL_GameController) ->
*c_schar;
pub fn SDL_GameControllerGetAttached(gamecontroller:
*SDL_GameController) ->
SDL_bool;
pub fn SDL_GameControllerGetJoystick(gamecontroller:
*SDL_GameController) ->
*SDL_Joystick;
pub fn SDL_GameControllerEventState(state: c_int) -> c_int;
pub fn SDL_GameControllerUpdate();
pub fn SDL_GameControllerGetAxisFromString(pchString: *c_schar) ->
SDL_GameControllerAxis;
pub fn SDL_GameControllerGetStringForAxis(axis:
SDL_GameControllerAxis)
-> *c_schar;
pub fn SDL_GameControllerGetBindForAxis(gamecontroller:
*SDL_GameController,
axis: SDL_GameControllerAxis)
-> SDL_GameControllerButtonBind;
pub fn SDL_GameControllerGetAxis(gamecontroller: *SDL_GameController,
axis: SDL_GameControllerAxis) ->
int16_t;
pub fn SDL_GameControllerGetButtonFromString(pchString: *c_schar) ->
SDL_GameControllerButton;
pub fn SDL_GameControllerGetStringForButton(button:
SDL_GameControllerButton)
-> *c_schar;
pub fn SDL_GameControllerGetBindForButton(gamecontroller:
*SDL_GameController,
button:
SDL_GameControllerButton)
-> SDL_GameControllerButtonBind;
pub fn SDL_GameControllerGetButton(gamecontroller:
*SDL_GameController,
button: SDL_GameControllerButton)
-> uint8_t;
pub fn SDL_GameControllerClose(gamecontroller: *SDL_GameController);
}
}
#[deriving(Eq)]
+26 -25
View File
@@ -410,31 +410,32 @@ pub mod ll {
pub type SDL_EventFilter =
extern "C" fn(userdata: *c_void, event: *SDL_Event) -> c_int;
externfn!(fn SDL_free(mem: *c_void))
externfn!(fn SDL_PumpEvents())
/*externfn!(fn SDL_PeepEvents(events: &[SDL_Event], numevents: c_int,
action: SDL_eventaction, minType: uint32_t,
maxType: uint32_t) -> c_int)*/
externfn!(fn SDL_HasEvent(_type: uint32_t) -> SDL_bool)
externfn!(fn SDL_HasEvents(minType: uint32_t, maxType: uint32_t) ->
SDL_bool)
externfn!(fn SDL_FlushEvent(_type: uint32_t))
externfn!(fn SDL_FlushEvents(minType: uint32_t, maxType: uint32_t))
externfn!(fn SDL_PollEvent(event: *SDL_Event) -> c_int)
externfn!(fn SDL_WaitEvent(event: *SDL_Event) -> c_int)
externfn!(fn SDL_WaitEventTimeout(event: *SDL_Event, timeout: c_int) ->
c_int)
/*externfn!(fn SDL_PushEvent(event: *SDL_Event) -> c_int)*/
externfn!(fn SDL_SetEventFilter(filter: SDL_EventFilter,
userdata: *c_void))
/*externfn!(fn SDL_GetEventFilter(filter: *SDL_EventFilter,
userdata: **c_void) -> SDL_bool)*/
externfn!(fn SDL_AddEventWatch(filter: SDL_EventFilter, userdata: *c_void))
externfn!(fn SDL_DelEventWatch(filter: SDL_EventFilter, userdata: *c_void))
externfn!(fn SDL_FilterEvents(filter: SDL_EventFilter, userdata: *c_void))
externfn!(fn SDL_EventState(_type: uint32_t, state: SDL_EventState) ->
SDL_EventState)
/*externfn!(fn SDL_RegisterEvents(numevents: c_int) -> uint32_t)*/
extern "C" {
pub fn SDL_free(mem: *c_void);
pub fn SDL_PumpEvents();
/*pub fn SDL_PeepEvents(events: &[SDL_Event], numevents: c_int,
action: SDL_eventaction, minType: uint32_t,
maxType: uint32_t) -> c_int;*/
pub fn SDL_HasEvent(_type: uint32_t) -> SDL_bool;
pub fn SDL_HasEvents(minType: uint32_t, maxType: uint32_t) ->
SDL_bool;
pub fn SDL_FlushEvent(_type: uint32_t);
pub fn SDL_FlushEvents(minType: uint32_t, maxType: uint32_t);
pub fn SDL_PollEvent(event: *SDL_Event) -> c_int;
pub fn SDL_WaitEvent(event: *SDL_Event) -> c_int;
pub fn SDL_WaitEventTimeout(event: *SDL_Event, timeout: c_int) ->
c_int;
/*pub fn SDL_PushEvent(event: *SDL_Event) -> c_int;*/
pub fn SDL_SetEventFilter(filter: SDL_EventFilter,
userdata: *c_void);
/*pub fn SDL_GetEventFilter(filter: *SDL_EventFilter,
userdata: **c_void) -> SDL_bool;*/
pub fn SDL_AddEventWatch(filter: SDL_EventFilter, userdata: *c_void);
pub fn SDL_DelEventWatch(filter: SDL_EventFilter, userdata: *c_void);
pub fn SDL_FilterEvents(filter: SDL_EventFilter, userdata: *c_void);
pub fn SDL_EventState(_type: uint32_t, state: SDL_EventState) -> SDL_EventState;
/*pub fn SDL_RegisterEvents(numevents: c_int) -> uint32_t;*/
}
}
#[deriving(FromPrimitive)]
+7 -6
View File
@@ -6,11 +6,12 @@ pub mod ll {
pub type SDL_GestureID = int64_t;
externfn!(fn SDL_RecordGesture(touchId: SDL_TouchID) -> c_int)
externfn!(fn SDL_SaveAllDollarTemplates(src: *SDL_RWops) -> c_int)
externfn!(fn SDL_SaveDollarTemplate(gestureId: SDL_GestureID,
src: *SDL_RWops) -> c_int)
externfn!(fn SDL_LoadDollarTemplates(touchId: SDL_TouchID, src: *SDL_RWops)
-> c_int)
extern "C" {
pub fn SDL_RecordGesture(touchId: SDL_TouchID) -> c_int;
pub fn SDL_SaveAllDollarTemplates(src: *SDL_RWops) -> c_int;
pub fn SDL_SaveDollarTemplate(gestureId: SDL_GestureID, src: *SDL_RWops) -> c_int;
pub fn SDL_LoadDollarTemplates(touchId: SDL_TouchID, src: *SDL_RWops) -> c_int;
}
}
+31 -29
View File
@@ -10,35 +10,37 @@ pub mod ll {
data: [uint8_t, ..16u],
}
externfn!(fn SDL_NumJoysticks() -> c_int)
externfn!(fn SDL_JoystickNameForIndex(device_index: c_int) -> *c_schar)
externfn!(fn SDL_JoystickOpen(device_index: c_int) -> *SDL_Joystick)
externfn!(fn SDL_JoystickName(joystick: *SDL_Joystick) -> *c_schar)
externfn!(fn SDL_JoystickGetDeviceGUID(device_index: c_int) ->
SDL_JoystickGUID)
externfn!(fn SDL_JoystickGetGUID(joystick: *SDL_Joystick) ->
SDL_JoystickGUID)
externfn!(fn SDL_JoystickGetGUIDString(guid: SDL_JoystickGUID,
pszGUID: *c_schar, cbGUID: c_int))
externfn!(fn SDL_JoystickGetGUIDFromString(pchGUID: *c_schar) ->
SDL_JoystickGUID)
externfn!(fn SDL_JoystickGetAttached(joystick: *SDL_Joystick) -> SDL_bool)
externfn!(fn SDL_JoystickInstanceID(joystick: *SDL_Joystick) -> int32_t)
externfn!(fn SDL_JoystickNumAxes(joystick: *SDL_Joystick) -> c_int)
externfn!(fn SDL_JoystickNumBalls(joystick: *SDL_Joystick) -> c_int)
externfn!(fn SDL_JoystickNumHats(joystick: *SDL_Joystick) -> c_int)
externfn!(fn SDL_JoystickNumButtons(joystick: *SDL_Joystick) -> c_int)
externfn!(fn SDL_JoystickUpdate())
externfn!(fn SDL_JoystickEventState(state: c_int) -> c_int)
externfn!(fn SDL_JoystickGetAxis(joystick: *SDL_Joystick, axis: c_int) ->
int16_t)
externfn!(fn SDL_JoystickGetHat(joystick: *SDL_Joystick, hat: c_int) ->
int8_t)
externfn!(fn SDL_JoystickGetBall(joystick: *SDL_Joystick, ball: c_int,
dx: *c_int, dy: *c_int) -> c_int)
externfn!(fn SDL_JoystickGetButton(joystick: *SDL_Joystick, button: c_int)
-> uint8_t)
externfn!(fn SDL_JoystickClose(joystick: *SDL_Joystick))
extern "C" {
pub fn SDL_NumJoysticks() -> c_int;
pub fn SDL_JoystickNameForIndex(device_index: c_int) -> *c_schar;
pub fn SDL_JoystickOpen(device_index: c_int) -> *SDL_Joystick;
pub fn SDL_JoystickName(joystick: *SDL_Joystick) -> *c_schar;
pub fn SDL_JoystickGetDeviceGUID(device_index: c_int) ->
SDL_JoystickGUID;
pub fn SDL_JoystickGetGUID(joystick: *SDL_Joystick) ->
SDL_JoystickGUID;
pub fn SDL_JoystickGetGUIDString(guid: SDL_JoystickGUID,
pszGUID: *c_schar, cbGUID: c_int);
pub fn SDL_JoystickGetGUIDFromString(pchGUID: *c_schar) ->
SDL_JoystickGUID;
pub fn SDL_JoystickGetAttached(joystick: *SDL_Joystick) -> SDL_bool;
pub fn SDL_JoystickInstanceID(joystick: *SDL_Joystick) -> int32_t;
pub fn SDL_JoystickNumAxes(joystick: *SDL_Joystick) -> c_int;
pub fn SDL_JoystickNumBalls(joystick: *SDL_Joystick) -> c_int;
pub fn SDL_JoystickNumHats(joystick: *SDL_Joystick) -> c_int;
pub fn SDL_JoystickNumButtons(joystick: *SDL_Joystick) -> c_int;
pub fn SDL_JoystickUpdate();
pub fn SDL_JoystickEventState(state: c_int) -> c_int;
pub fn SDL_JoystickGetAxis(joystick: *SDL_Joystick, axis: c_int) ->
int16_t;
pub fn SDL_JoystickGetHat(joystick: *SDL_Joystick, hat: c_int) ->
int8_t;
pub fn SDL_JoystickGetBall(joystick: *SDL_Joystick, ball: c_int,
dx: *c_int, dy: *c_int) -> c_int;
pub fn SDL_JoystickGetButton(joystick: *SDL_Joystick, button: c_int)
-> uint8_t;
pub fn SDL_JoystickClose(joystick: *SDL_Joystick);
}
}
#[deriving(Eq)]
+18 -16
View File
@@ -29,22 +29,24 @@ pub mod ll {
unused: uint32_t,
}
externfn!(fn SDL_GetKeyboardFocus() -> *SDL_Window)
externfn!(fn SDL_GetKeyboardState(numkeys: *c_int) -> *uint8_t)
externfn!(fn SDL_GetModState() -> SDL_Keymod)
externfn!(fn SDL_SetModState(modstate: SDL_Keymod))
externfn!(fn SDL_GetKeyFromScancode(scancode: SDL_Scancode) -> SDL_Keycode)
externfn!(fn SDL_GetScancodeFromKey(key: SDL_Keycode) -> SDL_Scancode)
externfn!(fn SDL_GetScancodeName(scancode: SDL_Scancode) -> *c_schar)
externfn!(fn SDL_GetScancodeFromName(name: *c_schar) -> SDL_Scancode)
externfn!(fn SDL_GetKeyName(key: SDL_Keycode) -> *c_schar)
externfn!(fn SDL_GetKeyFromName(name: *c_schar) -> SDL_Keycode)
externfn!(fn SDL_StartTextInput())
externfn!(fn SDL_IsTextInputActive() -> SDL_bool)
externfn!(fn SDL_StopTextInput())
externfn!(fn SDL_SetTextInputRect(rect: *SDL_Rect))
externfn!(fn SDL_HasScreenKeyboardSupport() -> SDL_bool)
externfn!(fn SDL_IsScreenKeyboardShown(window: *SDL_Window) -> SDL_bool)
extern "C" {
pub fn SDL_GetKeyboardFocus() -> *SDL_Window;
pub fn SDL_GetKeyboardState(numkeys: *c_int) -> *uint8_t;
pub fn SDL_GetModState() -> SDL_Keymod;
pub fn SDL_SetModState(modstate: SDL_Keymod);
pub fn SDL_GetKeyFromScancode(scancode: SDL_Scancode) -> SDL_Keycode;
pub fn SDL_GetScancodeFromKey(key: SDL_Keycode) -> SDL_Scancode;
pub fn SDL_GetScancodeName(scancode: SDL_Scancode) -> *c_schar;
pub fn SDL_GetScancodeFromName(name: *c_schar) -> SDL_Scancode;
pub fn SDL_GetKeyName(key: SDL_Keycode) -> *c_schar;
pub fn SDL_GetKeyFromName(name: *c_schar) -> SDL_Keycode;
pub fn SDL_StartTextInput();
pub fn SDL_IsTextInputActive() -> SDL_bool;
pub fn SDL_StopTextInput();
pub fn SDL_SetTextInputRect(rect: *SDL_Rect);
pub fn SDL_HasScreenKeyboardSupport() -> SDL_bool;
pub fn SDL_IsScreenKeyboardShown(window: *SDL_Window) -> SDL_bool;
}
}
#[deriving(Eq)]
+19 -17
View File
@@ -33,23 +33,25 @@ pub mod ll {
pub static SDL_ENABLE: SDL_MouseState = 1;
pub static SDL_QUERY: SDL_MouseState = -1;
externfn!(fn SDL_GetMouseFocus() -> *SDL_Window)
externfn!(fn SDL_GetMouseState(x: *c_int, y: *c_int) -> uint32_t)
externfn!(fn SDL_GetRelativeMouseState(x: *c_int, y: *c_int) -> uint32_t)
externfn!(fn SDL_WarpMouseInWindow(window: *SDL_Window, x: c_int, y: c_int))
externfn!(fn SDL_SetRelativeMouseMode(enabled: SDL_bool) -> c_int)
externfn!(fn SDL_GetRelativeMouseMode() -> SDL_bool)
externfn!(fn SDL_CreateCursor(data: *uint8_t, mask: *uint8_t, w: c_int,
h: c_int, hot_x: c_int, hot_y: c_int) ->
*SDL_Cursor)
externfn!(fn SDL_CreateColorCursor(surface: *SDL_Surface, hot_x: c_int,
hot_y: c_int) -> *SDL_Cursor)
externfn!(fn SDL_CreateSystemCursor(id: SDL_SystemCursor) -> *SDL_Cursor)
externfn!(fn SDL_SetCursor(cursor: *SDL_Cursor))
externfn!(fn SDL_GetCursor() -> *SDL_Cursor)
externfn!(fn SDL_GetDefaultCursor() -> *SDL_Cursor)
externfn!(fn SDL_FreeCursor(cursor: *SDL_Cursor))
externfn!(fn SDL_ShowCursor(toggle: SDL_MouseState) -> SDL_MouseState)
extern "C" {
pub fn SDL_GetMouseFocus() -> *SDL_Window;
pub fn SDL_GetMouseState(x: *c_int, y: *c_int) -> uint32_t;
pub fn SDL_GetRelativeMouseState(x: *c_int, y: *c_int) -> uint32_t;
pub fn SDL_WarpMouseInWindow(window: *SDL_Window, x: c_int, y: c_int);
pub fn SDL_SetRelativeMouseMode(enabled: SDL_bool) -> c_int;
pub fn SDL_GetRelativeMouseMode() -> SDL_bool;
pub fn SDL_CreateCursor(data: *uint8_t, mask: *uint8_t, w: c_int,
h: c_int, hot_x: c_int, hot_y: c_int) ->
*SDL_Cursor;
pub fn SDL_CreateColorCursor(surface: *SDL_Surface, hot_x: c_int,
hot_y: c_int) -> *SDL_Cursor;
pub fn SDL_CreateSystemCursor(id: SDL_SystemCursor) -> *SDL_Cursor;
pub fn SDL_SetCursor(cursor: *SDL_Cursor);
pub fn SDL_GetCursor() -> *SDL_Cursor;
pub fn SDL_GetDefaultCursor() -> *SDL_Cursor;
pub fn SDL_FreeCursor(cursor: *SDL_Cursor);
pub fn SDL_ShowCursor(toggle: SDL_MouseState) -> SDL_MouseState;
}
}
#[deriving(Eq)]
+7 -5
View File
@@ -29,11 +29,13 @@ pub mod ll {
pub type SDL_Point = Point;
pub type SDL_bool = c_int;
externfn!(fn SDL_HasIntersection(A: *SDL_Rect, B: *SDL_Rect) -> SDL_bool)
externfn!(fn SDL_IntersectRect(A: *SDL_Rect, B: *SDL_Rect, result: *SDL_Rect) -> SDL_bool)
externfn!(fn SDL_UnionRect(A: *SDL_Rect, B: *SDL_Rect, result: *SDL_Rect))
externfn!(fn SDL_EnclosePoints(points: *SDL_Point, count: c_int, clip: *SDL_Rect, result: *SDL_Rect) -> SDL_bool)
externfn!(fn SDL_IntersectRectAndLine(rect: *SDL_Rect, X1: *c_int, Y1: *c_int, X2: *c_int, Y2: *c_int) -> SDL_bool)
extern "C" {
pub fn SDL_HasIntersection(A: *SDL_Rect, B: *SDL_Rect) -> SDL_bool;
pub fn SDL_IntersectRect(A: *SDL_Rect, B: *SDL_Rect, result: *SDL_Rect) -> SDL_bool;
pub fn SDL_UnionRect(A: *SDL_Rect, B: *SDL_Rect, result: *SDL_Rect);
pub fn SDL_EnclosePoints(points: *SDL_Point, count: c_int, clip: *SDL_Rect, result: *SDL_Rect) -> SDL_bool;
pub fn SDL_IntersectRectAndLine(rect: *SDL_Rect, X1: *c_int, Y1: *c_int, X2: *c_int, Y2: *c_int) -> SDL_bool;
}
}
pub fn Point(x: i32, y: i32) -> Point {
+58 -56
View File
@@ -76,58 +76,60 @@ pub mod ll {
SDL_BLENDMODE_MOD = 0x00000004
}
externfn!(fn SDL_GetNumRenderDrivers() -> c_int)
externfn!(fn SDL_GetRenderDriverInfo(index: c_int, info: *SDL_RendererInfo) -> c_int)
externfn!(fn SDL_CreateWindowAndRenderer(width: c_int, height: c_int, window_flags: uint32_t, window: **SDL_Window, renderer: **SDL_Renderer) -> c_int)
externfn!(fn SDL_CreateRenderer(window: *SDL_Window, index: c_int, flags: uint32_t) -> *SDL_Renderer)
externfn!(fn SDL_CreateSoftwareRenderer(surface: *SDL_Surface) -> *SDL_Renderer)
externfn!(fn SDL_GetRenderer(window: *SDL_Window) -> *SDL_Renderer)
externfn!(fn SDL_GetRendererInfo(renderer: *SDL_Renderer, info: *SDL_RendererInfo) -> c_int)
externfn!(fn SDL_GetRendererOutputSize(renderer: *SDL_Renderer, w: *c_int, h: *c_int) -> c_int)
externfn!(fn SDL_CreateTexture(renderer: *SDL_Renderer, format: uint32_t, access: c_int, w: c_int, h: c_int) -> *SDL_Texture)
externfn!(fn SDL_CreateTextureFromSurface(renderer: *SDL_Renderer, surface: *SDL_Surface) -> *SDL_Texture)
externfn!(fn SDL_QueryTexture(texture: *SDL_Texture, format: *uint32_t, access: *c_int, w: *c_int, h: *c_int) -> c_int)
externfn!(fn SDL_SetTextureColorMod(texture: *SDL_Texture, r: uint8_t, g: uint8_t, b: uint8_t) -> c_int)
externfn!(fn SDL_GetTextureColorMod(texture: *SDL_Texture, r: *uint8_t, g: *uint8_t, b: *uint8_t) -> c_int)
externfn!(fn SDL_SetTextureAlphaMod(texture: *SDL_Texture, alpha: uint8_t) -> c_int)
externfn!(fn SDL_GetTextureAlphaMod(texture: *SDL_Texture, alpha: *uint8_t) -> c_int)
externfn!(fn SDL_SetTextureBlendMode(texture: *SDL_Texture, blendMode: SDL_BlendMode) -> c_int)
externfn!(fn SDL_GetTextureBlendMode(texture: *SDL_Texture, blendMode: *SDL_BlendMode) -> c_int)
externfn!(fn SDL_UpdateTexture(texture: *SDL_Texture, rect: *SDL_Rect, pixels: *c_void, pitch: c_int) -> c_int)
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))
externfn!(fn SDL_RenderTargetSupported(renderer: *SDL_Renderer) -> SDL_bool)
externfn!(fn SDL_SetRenderTarget(renderer: *SDL_Renderer, texture: *SDL_Texture) -> c_int)
externfn!(fn SDL_GetRenderTarget(renderer: *SDL_Renderer) -> *SDL_Texture)
externfn!(fn SDL_RenderSetLogicalSize(renderer: *SDL_Renderer, w: c_int, h: c_int) -> c_int)
externfn!(fn SDL_RenderGetLogicalSize(renderer: *SDL_Renderer, w: *c_int, h: *c_int))
externfn!(fn SDL_RenderSetViewport(renderer: *SDL_Renderer, rect: *SDL_Rect) -> c_int)
externfn!(fn SDL_RenderGetViewport(renderer: *SDL_Renderer, rect: *SDL_Rect))
externfn!(fn SDL_RenderSetClipRect(renderer: *SDL_Renderer, rect: *SDL_Rect) -> c_int)
externfn!(fn SDL_RenderGetClipRect(renderer: *SDL_Renderer, rect: *SDL_Rect))
externfn!(fn SDL_RenderSetScale(renderer: *SDL_Renderer, scaleX: c_float, scaleY: c_float) -> c_int)
externfn!(fn SDL_RenderGetScale(renderer: *SDL_Renderer, scaleX: *c_float, scaleY: *c_float))
externfn!(fn SDL_SetRenderDrawColor(renderer: *SDL_Renderer, r: uint8_t, g: uint8_t, b: uint8_t, a: uint8_t) -> c_int)
externfn!(fn SDL_GetRenderDrawColor(renderer: *SDL_Renderer, r: *uint8_t, g: *uint8_t, b: *uint8_t, a: *uint8_t) -> c_int)
externfn!(fn SDL_SetRenderDrawBlendMode(renderer: *SDL_Renderer, blendMode: SDL_BlendMode) -> c_int)
externfn!(fn SDL_GetRenderDrawBlendMode(renderer: *SDL_Renderer, blendMode: *SDL_BlendMode) -> c_int)
externfn!(fn SDL_RenderClear(renderer: *SDL_Renderer) -> c_int)
externfn!(fn SDL_RenderDrawPoint(renderer: *SDL_Renderer, x: c_int, y: c_int) -> c_int)
externfn!(fn SDL_RenderDrawPoints(renderer: *SDL_Renderer, Points: *SDL_Point, count: c_int) -> c_int)
externfn!(fn SDL_RenderDrawLine(renderer: *SDL_Renderer, x1: c_int, y1: c_int, x2: c_int, y2: c_int) -> c_int)
externfn!(fn SDL_RenderDrawLines(renderer: *SDL_Renderer, Points: *SDL_Point, count: c_int) -> c_int)
externfn!(fn SDL_RenderDrawRect(renderer: *SDL_Renderer, rect: *SDL_Rect) -> c_int)
externfn!(fn SDL_RenderDrawRects(renderer: *SDL_Renderer, rects: *SDL_Rect, count: c_int) -> c_int)
externfn!(fn SDL_RenderFillRect(renderer: *SDL_Renderer, rect: *SDL_Rect) -> c_int)
externfn!(fn SDL_RenderFillRects(renderer: *SDL_Renderer, rects: *SDL_Rect, count: c_int) -> c_int)
externfn!(fn SDL_RenderCopy(renderer: *SDL_Renderer, texture: *SDL_Texture, srcrect: *SDL_Rect, dstrect: *SDL_Rect) -> c_int)
externfn!(fn SDL_RenderCopyEx(renderer: *SDL_Renderer, texture: *SDL_Texture, srcrect: *SDL_Rect, dstrect: *SDL_Rect, angle: c_double, center: *SDL_Point, flip: SDL_RendererFlip) -> c_int)
externfn!(fn SDL_RenderReadPixels(renderer: *SDL_Renderer, rect: *SDL_Rect, format: uint32_t, pixels: *c_void, pitch: c_int) -> c_int)
externfn!(fn SDL_RenderPresent(renderer: *SDL_Renderer))
externfn!(fn SDL_DestroyTexture(texture: *SDL_Texture))
externfn!(fn SDL_DestroyRenderer(renderer: *SDL_Renderer))
externfn!(fn SDL_GL_BindTexture(texture: *SDL_Texture, texw: *c_float, texh: *c_float) -> c_int)
externfn!(fn SDL_GL_UnbindTexture(texture: *SDL_Texture) -> c_int)
extern "C" {
pub fn SDL_GetNumRenderDrivers() -> c_int;
pub fn SDL_GetRenderDriverInfo(index: c_int, info: *SDL_RendererInfo) -> c_int;
pub fn SDL_CreateWindowAndRenderer(width: c_int, height: c_int, window_flags: uint32_t, window: **SDL_Window, renderer: **SDL_Renderer) -> c_int;
pub fn SDL_CreateRenderer(window: *SDL_Window, index: c_int, flags: uint32_t) -> *SDL_Renderer;
pub fn SDL_CreateSoftwareRenderer(surface: *SDL_Surface) -> *SDL_Renderer;
pub fn SDL_GetRenderer(window: *SDL_Window) -> *SDL_Renderer;
pub fn SDL_GetRendererInfo(renderer: *SDL_Renderer, info: *SDL_RendererInfo) -> c_int;
pub fn SDL_GetRendererOutputSize(renderer: *SDL_Renderer, w: *c_int, h: *c_int) -> c_int;
pub fn SDL_CreateTexture(renderer: *SDL_Renderer, format: uint32_t, access: c_int, w: c_int, h: c_int) -> *SDL_Texture;
pub fn SDL_CreateTextureFromSurface(renderer: *SDL_Renderer, surface: *SDL_Surface) -> *SDL_Texture;
pub fn SDL_QueryTexture(texture: *SDL_Texture, format: *uint32_t, access: *c_int, w: *c_int, h: *c_int) -> c_int;
pub fn SDL_SetTextureColorMod(texture: *SDL_Texture, r: uint8_t, g: uint8_t, b: uint8_t) -> c_int;
pub fn SDL_GetTextureColorMod(texture: *SDL_Texture, r: *uint8_t, g: *uint8_t, b: *uint8_t) -> c_int;
pub fn SDL_SetTextureAlphaMod(texture: *SDL_Texture, alpha: uint8_t) -> c_int;
pub fn SDL_GetTextureAlphaMod(texture: *SDL_Texture, alpha: *uint8_t) -> c_int;
pub fn SDL_SetTextureBlendMode(texture: *SDL_Texture, blendMode: SDL_BlendMode) -> c_int;
pub fn SDL_GetTextureBlendMode(texture: *SDL_Texture, blendMode: *SDL_BlendMode) -> c_int;
pub fn SDL_UpdateTexture(texture: *SDL_Texture, rect: *SDL_Rect, pixels: *c_void, pitch: c_int) -> c_int;
pub fn SDL_LockTexture(texture: *SDL_Texture, rect: *SDL_Rect, pixels: **c_void, pitch: *c_int) -> c_int;
pub fn SDL_UnlockTexture(texture: *SDL_Texture);
pub fn SDL_RenderTargetSupported(renderer: *SDL_Renderer) -> SDL_bool;
pub fn SDL_SetRenderTarget(renderer: *SDL_Renderer, texture: *SDL_Texture) -> c_int;
pub fn SDL_GetRenderTarget(renderer: *SDL_Renderer) -> *SDL_Texture;
pub fn SDL_RenderSetLogicalSize(renderer: *SDL_Renderer, w: c_int, h: c_int) -> c_int;
pub fn SDL_RenderGetLogicalSize(renderer: *SDL_Renderer, w: *c_int, h: *c_int);
pub fn SDL_RenderSetViewport(renderer: *SDL_Renderer, rect: *SDL_Rect) -> c_int;
pub fn SDL_RenderGetViewport(renderer: *SDL_Renderer, rect: *SDL_Rect);
pub fn SDL_RenderSetClipRect(renderer: *SDL_Renderer, rect: *SDL_Rect) -> c_int;
pub fn SDL_RenderGetClipRect(renderer: *SDL_Renderer, rect: *SDL_Rect);
pub fn SDL_RenderSetScale(renderer: *SDL_Renderer, scaleX: c_float, scaleY: c_float) -> c_int;
pub fn SDL_RenderGetScale(renderer: *SDL_Renderer, scaleX: *c_float, scaleY: *c_float);
pub fn SDL_SetRenderDrawColor(renderer: *SDL_Renderer, r: uint8_t, g: uint8_t, b: uint8_t, a: uint8_t) -> c_int;
pub fn SDL_GetRenderDrawColor(renderer: *SDL_Renderer, r: *uint8_t, g: *uint8_t, b: *uint8_t, a: *uint8_t) -> c_int;
pub fn SDL_SetRenderDrawBlendMode(renderer: *SDL_Renderer, blendMode: SDL_BlendMode) -> c_int;
pub fn SDL_GetRenderDrawBlendMode(renderer: *SDL_Renderer, blendMode: *SDL_BlendMode) -> c_int;
pub fn SDL_RenderClear(renderer: *SDL_Renderer) -> c_int;
pub fn SDL_RenderDrawPoint(renderer: *SDL_Renderer, x: c_int, y: c_int) -> c_int;
pub fn SDL_RenderDrawPoints(renderer: *SDL_Renderer, Points: *SDL_Point, count: c_int) -> c_int;
pub fn SDL_RenderDrawLine(renderer: *SDL_Renderer, x1: c_int, y1: c_int, x2: c_int, y2: c_int) -> c_int;
pub fn SDL_RenderDrawLines(renderer: *SDL_Renderer, Points: *SDL_Point, count: c_int) -> c_int;
pub fn SDL_RenderDrawRect(renderer: *SDL_Renderer, rect: *SDL_Rect) -> c_int;
pub fn SDL_RenderDrawRects(renderer: *SDL_Renderer, rects: *SDL_Rect, count: c_int) -> c_int;
pub fn SDL_RenderFillRect(renderer: *SDL_Renderer, rect: *SDL_Rect) -> c_int;
pub fn SDL_RenderFillRects(renderer: *SDL_Renderer, rects: *SDL_Rect, count: c_int) -> c_int;
pub fn SDL_RenderCopy(renderer: *SDL_Renderer, texture: *SDL_Texture, srcrect: *SDL_Rect, dstrect: *SDL_Rect) -> c_int;
pub fn SDL_RenderCopyEx(renderer: *SDL_Renderer, texture: *SDL_Texture, srcrect: *SDL_Rect, dstrect: *SDL_Rect, angle: c_double, center: *SDL_Point, flip: SDL_RendererFlip) -> c_int;
pub fn SDL_RenderReadPixels(renderer: *SDL_Renderer, rect: *SDL_Rect, format: uint32_t, pixels: *c_void, pitch: c_int) -> c_int;
pub fn SDL_RenderPresent(renderer: *SDL_Renderer);
pub fn SDL_DestroyTexture(texture: *SDL_Texture);
pub fn SDL_DestroyRenderer(renderer: *SDL_Renderer);
pub fn SDL_GL_BindTexture(texture: *SDL_Texture, texw: *c_float, texh: *c_float) -> c_int;
pub fn SDL_GL_UnbindTexture(texture: *SDL_Texture) -> c_int;
}
}
pub enum RenderDriverIndex {
@@ -502,7 +504,7 @@ impl Renderer {
//TODO: Figure out how big the Pixels array is supposed to be
/*
externfn!(fn SDL_RenderReadPixels(renderer: *SDL_Renderer, rect: *SDL_Rect, format: uint32_t, pixels: *c_void, pitch: c_int) -> c_int)
pub fn SDL_RenderReadPixels(renderer: *SDL_Renderer, rect: *SDL_Rect, format: uint32_t, pixels: *c_void, pitch: c_int) -> c_int;
*/
}
@@ -609,8 +611,8 @@ impl Texture {
//TODO: Figure out how big pixels ends up
/*
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 SDL_LockTexture(texture: *SDL_Texture, rect: *SDL_Rect, pixels: **c_void, pitch: *c_int) -> c_int;
pub fn SDL_UnlockTexture(texture: *SDL_Texture))*/
pub fn gl_bind_texture(&self) -> Result<(f64, f64), ~str> {
let texw: c_float = 0.0;
@@ -672,5 +674,5 @@ pub fn get_render_driver_info(index: int) -> Result<~RendererInfo, ~str> {
/*
//TODO: Figure out how to support this with our current struct format
externfn!(fn SDL_GetRenderer(window: *SDL_Window) -> *SDL_Renderer)
pub fn SDL_GetRenderer(window: *SDL_Window) -> *SDL_Renderer;
*/
+3 -1
View File
@@ -15,5 +15,7 @@ pub mod ll {
hidden: SDL_RWops_Anon
}
externfn!(fn SDL_RWFromFile(file: *c_schar, mode: *c_schar) -> *SDL_RWops)
extern "C" {
pub fn SDL_RWFromFile(file: *c_schar, mode: *c_schar) -> *SDL_RWops;
}
}
+14 -12
View File
@@ -44,20 +44,22 @@ pub mod ll {
pub static SDL_INIT_EVERYTHING: SDL_InitFlag = 0x0000FFFF;
//SDL_error.h
externfn!(fn SDL_ClearError())
externfn!(fn SDL_Error(code: SDL_errorcode) -> c_int)
externfn!(fn SDL_SetError(fmt: *c_schar) -> c_int)
externfn!(fn SDL_GetError() -> *c_schar)
extern "C" {
pub fn SDL_ClearError();
pub fn SDL_Error(code: SDL_errorcode) -> c_int;
pub fn SDL_SetError(fmt: *c_schar) -> c_int;
pub fn SDL_GetError() -> *c_schar;
//SDL.h
externfn!(fn SDL_Init(flags: uint32_t) -> c_int)
externfn!(fn SDL_InitSubSystem(flags: SDL_InitFlag) -> c_int)
externfn!(fn SDL_QuitSubSystem(flags: SDL_InitFlag))
externfn!(fn SDL_WasInit(flags: SDL_InitFlag) -> SDL_InitFlag)
externfn!(fn SDL_Quit())
//SDL.h
pub fn SDL_Init(flags: uint32_t) -> c_int;
pub fn SDL_InitSubSystem(flags: SDL_InitFlag) -> c_int;
pub fn SDL_QuitSubSystem(flags: SDL_InitFlag);
pub fn SDL_WasInit(flags: SDL_InitFlag) -> SDL_InitFlag;
pub fn SDL_Quit();
//SDL_timer.h
externfn!(fn SDL_GetTicks() -> uint32_t)
//SDL_timer.h
pub fn SDL_GetTicks() -> uint32_t;
}
}
#[deriving(Eq)]
+49 -47
View File
@@ -41,35 +41,37 @@ pub mod ll {
refcount: c_int
}
externfn!(fn SDL_CreateRGBSurface(flags: uint32_t, width: c_int, height: c_int, depth: c_int, Rmask: uint32_t, Gmask: uint32_t, Bmask: uint32_t, Amask: uint32_t) -> *SDL_Surface)
externfn!(fn SDL_CreateRGBSurfaceFrom(pixels: *c_void, width: c_int, height: c_int, depth: c_int, pitch: c_int, Rmask: uint32_t, Gmask: uint32_t, Bmask: uint32_t, Amask: uint32_t) -> *SDL_Surface)
externfn!(fn SDL_FreeSurface(surface: *SDL_Surface))
externfn!(fn SDL_SetSurfacePalette(surface: *SDL_Surface, palette: *SDL_Palette) -> c_int)
externfn!(fn SDL_LockSurface(surface: *SDL_Surface) -> c_int)
externfn!(fn SDL_UnlockSurface(surface: *SDL_Surface))
externfn!(fn SDL_LoadBMP_RW(src: *SDL_RWops, freesrc: c_int) -> *SDL_Surface)
externfn!(fn SDL_SaveBMP_RW(surface: *SDL_Surface, dst: *SDL_RWops, freedst: c_int) -> c_int)
externfn!(fn SDL_SetSurfaceRLE(surface: *SDL_Surface, flag: c_int) -> c_int)
externfn!(fn SDL_SetColorKey(surface: *SDL_Surface, flag: c_int, key: uint32_t) -> c_int)
externfn!(fn SDL_GetColorKey(surface: *SDL_Surface, key: *uint32_t) -> c_int)
externfn!(fn SDL_SetSurfaceColorMod(surface: *SDL_Surface, r: uint8_t, g: uint8_t, b: uint8_t) -> c_int)
externfn!(fn SDL_GetSurfaceColorMod(surface: *SDL_Surface, r: *uint8_t, g: *uint8_t, b: *uint8_t ) -> c_int)
externfn!(fn SDL_SetSurfaceAlphaMod(surface: *SDL_Surface, alpha: uint8_t) -> c_int)
externfn!(fn SDL_GetSurfaceAlphaMod(surface: *SDL_Surface, alpha: *uint8_t ) -> c_int)
externfn!(fn SDL_SetSurfaceBlendMode(surface: *SDL_Surface, blendMode: SDL_BlendMode) -> c_int)
externfn!(fn SDL_GetSurfaceBlendMode(surface: *SDL_Surface, blendMode: *SDL_BlendMode) -> c_int)
externfn!(fn SDL_SetClipRect(surface: *SDL_Surface, rect: *SDL_Rect) -> SDL_bool)
externfn!(fn SDL_GetClipRect(surface: *SDL_Surface, rect: *SDL_Rect))
externfn!(fn SDL_ConvertSurface(src: *SDL_Surface, fmt: *SDL_PixelFormat, flags: uint32_t) -> *SDL_Surface)
externfn!(fn SDL_ConvertSurfaceFormat(src: *SDL_Surface, pixel_format: uint32_t, flags: uint32_t) -> *SDL_Surface)
externfn!(fn SDL_ConvertPixels(width: c_int, height: c_int, src_format: uint32_t, src: *c_void, src_pitch: c_int, dst_format: uint32_t, dst: *c_void, dst_pitch: c_int) -> c_int)
externfn!(fn SDL_FillRect(dst: *SDL_Surface, rect: *SDL_Rect, color: uint32_t) -> c_int)
externfn!(fn SDL_FillRects(dst: *SDL_Surface, rects: *SDL_Rect, count: c_int, color: uint32_t) -> c_int)
externfn!(fn SDL_UpperBlit(src: *SDL_Surface, srcrect: *SDL_Rect, dst: *SDL_Surface, dstrect: *SDL_Rect) -> c_int)
externfn!(fn SDL_LowerBlit(src: *SDL_Surface, srcrect: *SDL_Rect, dst: *SDL_Surface, dstrect: *SDL_Rect) -> c_int)
externfn!(fn SDL_SoftStretch(src: *SDL_Surface, srcrect: *SDL_Rect, dst: *SDL_Surface, dstrect: *SDL_Rect) -> c_int)
externfn!(fn SDL_UpperBlitScaled(src: *SDL_Surface, srcrect: *SDL_Rect, dst: *SDL_Surface, dstrect: *SDL_Rect) -> c_int)
externfn!(fn SDL_LowerBlitScaled(src: *SDL_Surface, srcrect: *SDL_Rect, dst: *SDL_Surface, dstrect: *SDL_Rect) -> c_int)
extern "C" {
pub fn SDL_CreateRGBSurface(flags: uint32_t, width: c_int, height: c_int, depth: c_int, Rmask: uint32_t, Gmask: uint32_t, Bmask: uint32_t, Amask: uint32_t) -> *SDL_Surface;
pub fn SDL_CreateRGBSurfaceFrom(pixels: *c_void, width: c_int, height: c_int, depth: c_int, pitch: c_int, Rmask: uint32_t, Gmask: uint32_t, Bmask: uint32_t, Amask: uint32_t) -> *SDL_Surface;
pub fn SDL_FreeSurface(surface: *SDL_Surface);
pub fn SDL_SetSurfacePalette(surface: *SDL_Surface, palette: *SDL_Palette) -> c_int;
pub fn SDL_LockSurface(surface: *SDL_Surface) -> c_int;
pub fn SDL_UnlockSurface(surface: *SDL_Surface);
pub fn SDL_LoadBMP_RW(src: *SDL_RWops, freesrc: c_int) -> *SDL_Surface;
pub fn SDL_SaveBMP_RW(surface: *SDL_Surface, dst: *SDL_RWops, freedst: c_int) -> c_int;
pub fn SDL_SetSurfaceRLE(surface: *SDL_Surface, flag: c_int) -> c_int;
pub fn SDL_SetColorKey(surface: *SDL_Surface, flag: c_int, key: uint32_t) -> c_int;
pub fn SDL_GetColorKey(surface: *SDL_Surface, key: *uint32_t) -> c_int;
pub fn SDL_SetSurfaceColorMod(surface: *SDL_Surface, r: uint8_t, g: uint8_t, b: uint8_t) -> c_int;
pub fn SDL_GetSurfaceColorMod(surface: *SDL_Surface, r: *uint8_t, g: *uint8_t, b: *uint8_t ) -> c_int;
pub fn SDL_SetSurfaceAlphaMod(surface: *SDL_Surface, alpha: uint8_t) -> c_int;
pub fn SDL_GetSurfaceAlphaMod(surface: *SDL_Surface, alpha: *uint8_t ) -> c_int;
pub fn SDL_SetSurfaceBlendMode(surface: *SDL_Surface, blendMode: SDL_BlendMode) -> c_int;
pub fn SDL_GetSurfaceBlendMode(surface: *SDL_Surface, blendMode: *SDL_BlendMode) -> c_int;
pub fn SDL_SetClipRect(surface: *SDL_Surface, rect: *SDL_Rect) -> SDL_bool;
pub fn SDL_GetClipRect(surface: *SDL_Surface, rect: *SDL_Rect);
pub fn SDL_ConvertSurface(src: *SDL_Surface, fmt: *SDL_PixelFormat, flags: uint32_t) -> *SDL_Surface;
pub fn SDL_ConvertSurfaceFormat(src: *SDL_Surface, pixel_format: uint32_t, flags: uint32_t) -> *SDL_Surface;
pub fn SDL_ConvertPixels(width: c_int, height: c_int, src_format: uint32_t, src: *c_void, src_pitch: c_int, dst_format: uint32_t, dst: *c_void, dst_pitch: c_int) -> c_int;
pub fn SDL_FillRect(dst: *SDL_Surface, rect: *SDL_Rect, color: uint32_t) -> c_int;
pub fn SDL_FillRects(dst: *SDL_Surface, rects: *SDL_Rect, count: c_int, color: uint32_t) -> c_int;
pub fn SDL_UpperBlit(src: *SDL_Surface, srcrect: *SDL_Rect, dst: *SDL_Surface, dstrect: *SDL_Rect) -> c_int;
pub fn SDL_LowerBlit(src: *SDL_Surface, srcrect: *SDL_Rect, dst: *SDL_Surface, dstrect: *SDL_Rect) -> c_int;
pub fn SDL_SoftStretch(src: *SDL_Surface, srcrect: *SDL_Rect, dst: *SDL_Surface, dstrect: *SDL_Rect) -> c_int;
pub fn SDL_UpperBlitScaled(src: *SDL_Surface, srcrect: *SDL_Rect, dst: *SDL_Surface, dstrect: *SDL_Rect) -> c_int;
pub fn SDL_LowerBlitScaled(src: *SDL_Surface, srcrect: *SDL_Rect, dst: *SDL_Surface, dstrect: *SDL_Rect) -> c_int;
}
}
#[deriving(Eq)]
@@ -190,8 +192,8 @@ impl Surface {
}
/* //TODO: Figure out how to safely turn Color(RGB) into the pixel using the right format
externfn!(fn SDL_SetColorKey(surface: *SDL_Surface, flag: c_int, key: uint32_t) -> c_int)
externfn!(fn SDL_GetColorKey(surface: *SDL_Surface, key: *uint32_t) -> c_int)
pub fn SDL_SetColorKey(surface: *SDL_Surface, flag: c_int, key: uint32_t) -> c_int;
pub fn SDL_GetColorKey(surface: *SDL_Surface, key: *uint32_t) -> c_int;
*/
pub fn set_color_mod(&self, color: pixels::Color) -> bool {
@@ -221,20 +223,20 @@ impl Surface {
}
}
/*
externfn!(fn SDL_SetSurfaceAlphaMod(surface: *SDL_Surface, alpha: uint8_t) -> c_int)
externfn!(fn SDL_GetSurfaceAlphaMod(surface: *SDL_Surface, alpha: *uint8_t ) -> c_int)
externfn!(fn SDL_SetSurfaceBlendMode(surface: *SDL_Surface, blendMode: SDL_BlendMode) -> c_int)
externfn!(fn SDL_GetSurfaceBlendMode(surface: *SDL_Surface, blendMode: *SDL_BlendMode) -> c_int)
externfn!(fn SDL_SetClipRect(surface: *SDL_Surface, rect: *SDL_Rect) -> SDL_bool)
externfn!(fn SDL_GetClipRect(surface: *SDL_Surface, rect: *SDL_Rect))
externfn!(fn SDL_ConvertSurface(src: *SDL_Surface, fmt: *SDL_PixelFormat, flags: uint32_t) -> *SDL_Surface)
externfn!(fn SDL_ConvertSurfaceFormat(src: *SDL_Surface, pixel_format: uint32_t, flags: uint32_t) -> *SDL_Surface)
externfn!(fn SDL_ConvertPixels(width: c_int, height: c_int, src_format: uint32_t, src: *c_void, src_pitch: c_int, dst_format: uint32_t, dst: *c_void, dst_pitch: c_int) -> c_int)
externfn!(fn SDL_FillRect(dst: *SDL_Surface, rect: *SDL_Rect, color: uint32_t) -> c_int)
externfn!(fn SDL_FillRects(dst: *SDL_Surface, rects: *SDL_Rect, count: c_int, color: uint32_t) -> c_int)
externfn!(fn SDL_UpperBlit(src: *SDL_Surface, srcrect: *SDL_Rect, dst: *SDL_Surface, dstrect: *SDL_Rect) -> c_int)
externfn!(fn SDL_LowerBlit(src: *SDL_Surface, srcrect: *SDL_Rect, dst: *SDL_Surface, dstrect: *SDL_Rect) -> c_int)
externfn!(fn SDL_SoftStretch(src: *SDL_Surface, srcrect: *SDL_Rect, dst: *SDL_Surface, dstrect: *SDL_Rect) -> c_int)
externfn!(fn SDL_UpperBlitScaled(src: *SDL_Surface, srcrect: *SDL_Rect, dst: *SDL_Surface, dstrect: *SDL_Rect) -> c_int)
externfn!(fn SDL_LowerBlitScaled(src: *SDL_Surface, srcrect: *SDL_Rect, dst: *SDL_Surface, dstrect: *SDL_Rect) -> c_int)*/
pub fn SDL_SetSurfaceAlphaMod(surface: *SDL_Surface, alpha: uint8_t) -> c_int;
pub fn SDL_GetSurfaceAlphaMod(surface: *SDL_Surface, alpha: *uint8_t ) -> c_int;
pub fn SDL_SetSurfaceBlendMode(surface: *SDL_Surface, blendMode: SDL_BlendMode) -> c_int;
pub fn SDL_GetSurfaceBlendMode(surface: *SDL_Surface, blendMode: *SDL_BlendMode) -> c_int;
pub fn SDL_SetClipRect(surface: *SDL_Surface, rect: *SDL_Rect) -> SDL_bool;
pub fn SDL_GetClipRect(surface: *SDL_Surface, rect: *SDL_Rect);
pub fn SDL_ConvertSurface(src: *SDL_Surface, fmt: *SDL_PixelFormat, flags: uint32_t) -> *SDL_Surface;
pub fn SDL_ConvertSurfaceFormat(src: *SDL_Surface, pixel_format: uint32_t, flags: uint32_t) -> *SDL_Surface;
pub fn SDL_ConvertPixels(width: c_int, height: c_int, src_format: uint32_t, src: *c_void, src_pitch: c_int, dst_format: uint32_t, dst: *c_void, dst_pitch: c_int) -> c_int;
pub fn SDL_FillRect(dst: *SDL_Surface, rect: *SDL_Rect, color: uint32_t) -> c_int;
pub fn SDL_FillRects(dst: *SDL_Surface, rects: *SDL_Rect, count: c_int, color: uint32_t) -> c_int;
pub fn SDL_UpperBlit(src: *SDL_Surface, srcrect: *SDL_Rect, dst: *SDL_Surface, dstrect: *SDL_Rect) -> c_int;
pub fn SDL_LowerBlit(src: *SDL_Surface, srcrect: *SDL_Rect, dst: *SDL_Surface, dstrect: *SDL_Rect) -> c_int;
pub fn SDL_SoftStretch(src: *SDL_Surface, srcrect: *SDL_Rect, dst: *SDL_Surface, dstrect: *SDL_Rect) -> c_int;
pub fn SDL_UpperBlitScaled(src: *SDL_Surface, srcrect: *SDL_Rect, dst: *SDL_Surface, dstrect: *SDL_Rect) -> c_int;
pub fn SDL_LowerBlitScaled(src: *SDL_Surface, srcrect: *SDL_Rect, dst: *SDL_Surface, dstrect: *SDL_Rect) -> c_int)*/
}
+6 -4
View File
@@ -3,10 +3,12 @@ pub mod ll {
use std::libc::{uint32_t, uint64_t};
//SDL_timer.h
externfn!(fn SDL_GetTicks() -> uint32_t)
externfn!(fn SDL_GetPerformanceCounter() -> uint64_t)
externfn!(fn SDL_GetPerformanceFrequency() -> uint64_t)
externfn!(fn SDL_Delay(ms: uint32_t))
extern "C" {
pub fn SDL_GetTicks() -> uint32_t;
pub fn SDL_GetPerformanceCounter() -> uint64_t;
pub fn SDL_GetPerformanceFrequency() -> uint64_t;
pub fn SDL_Delay(ms: uint32_t);
}
//TODO: Figure out what to do with the timer callback functions
}
+7 -5
View File
@@ -18,11 +18,13 @@ pub mod ll {
pub type SDL_FingerID = int64_t;
pub type SDL_Finger = Finger;
externfn!(fn SDL_GetNumTouchDevices() -> c_int)
externfn!(fn SDL_GetTouchDevice(index: c_int) -> SDL_TouchID)
externfn!(fn SDL_GetNumTouchFingers(touchID: SDL_TouchID) -> c_int)
externfn!(fn SDL_GetTouchFinger(touchID: SDL_TouchID, index: c_int) ->
*SDL_Finger)
extern "C" {
pub fn SDL_GetNumTouchDevices() -> c_int;
pub fn SDL_GetTouchDevice(index: c_int) -> SDL_TouchID;
pub fn SDL_GetNumTouchFingers(touchID: SDL_TouchID) -> c_int;
pub fn SDL_GetTouchFinger(touchID: SDL_TouchID, index: c_int) ->
*SDL_Finger;
}
}
pub fn get_num_touch_devices() -> int {
+72 -70
View File
@@ -106,76 +106,78 @@ pub mod ll {
}
//SDL_video.h
externfn!(fn SDL_GetNumVideoDrivers() -> c_int)
externfn!(fn SDL_GetVideoDriver(index: c_int) -> *c_char)
externfn!(fn SDL_VideoInit(driver_name: *c_char) -> c_int)
externfn!(fn SDL_VideoQuit())
externfn!(fn SDL_GetCurrentVideoDriver() -> *c_char)
externfn!(fn SDL_GetNumVideoDisplays() -> c_int)
externfn!(fn SDL_GetDisplayName(displayIndex: c_int) -> *c_char)
externfn!(fn SDL_GetDisplayBounds(displayIndex: c_int, rect: *SDL_Rect) -> c_int)
externfn!(fn SDL_GetNumDisplayModes(displayIndex: c_int) -> c_int)
externfn!(fn SDL_GetDisplayMode(displayIndex: c_int, modeIndex: c_int, mode: *SDL_DisplayMode) -> c_int)
externfn!(fn SDL_GetDesktopDisplayMode(displayIndex: c_int, mode: *SDL_DisplayMode) -> c_int)
externfn!(fn SDL_GetCurrentDisplayMode(displayIndex: c_int, mode: *SDL_DisplayMode) -> c_int)
externfn!(fn SDL_GetClosestDisplayMode(displayIndex: c_int, mode: *SDL_DisplayMode, closest: *SDL_DisplayMode) -> *SDL_DisplayMode)
externfn!(fn SDL_GetWindowDisplayIndex(window: *SDL_Window) -> c_int)
externfn!(fn SDL_SetWindowDisplayMode(window: *SDL_Window, mode: *SDL_DisplayMode) -> c_int)
externfn!(fn SDL_GetWindowDisplayMode(window: *SDL_Window, mode: *SDL_DisplayMode) -> c_int)
externfn!(fn SDL_GetWindowPixelFormat(window: *SDL_Window) -> uint32_t)
externfn!(fn SDL_CreateWindow(title: *c_char, x: c_int, y: c_int, w: c_int, h: c_int, flags: uint32_t) -> *SDL_Window)
externfn!(fn SDL_CreateWindowFrom(data: *c_void) -> *SDL_Window)
externfn!(fn SDL_GetWindowID(window: *SDL_Window) -> uint32_t)
externfn!(fn SDL_GetWindowFromID(id: uint32_t) -> *SDL_Window)
externfn!(fn SDL_GetWindowFlags(window: *SDL_Window) -> uint32_t)
externfn!(fn SDL_SetWindowTitle(window: *SDL_Window, title: *c_char))
externfn!(fn SDL_GetWindowTitle(window: *SDL_Window) -> *c_char)
externfn!(fn SDL_SetWindowIcon(window: *SDL_Window, icon: *SDL_Surface))
externfn!(fn SDL_SetWindowData(window: *SDL_Window, name: *c_char, userdata: *c_void) -> *c_void)
externfn!(fn SDL_GetWindowData(window: *SDL_Window, name: *c_char) -> *c_void)
externfn!(fn SDL_SetWindowPosition(window: *SDL_Window, x: c_int, y: c_int))
externfn!(fn SDL_GetWindowPosition(window: *SDL_Window, x: *c_int, y: *c_int))
externfn!(fn SDL_SetWindowSize(window: *SDL_Window, w: c_int, h: c_int))
externfn!(fn SDL_GetWindowSize(window: *SDL_Window, w: *c_int, h: *c_int))
externfn!(fn SDL_SetWindowMinimumSize(window: *SDL_Window, min_w: c_int, min_h: c_int))
externfn!(fn SDL_GetWindowMinimumSize(window: *SDL_Window, w: *c_int, h: *c_int))
externfn!(fn SDL_SetWindowMaximumSize(window: *SDL_Window, max_w: c_int, max_h: c_int))
externfn!(fn SDL_GetWindowMaximumSize(window: *SDL_Window, w: *c_int, h: *c_int))
externfn!(fn SDL_SetWindowBordered(window: *SDL_Window, bordered: SDL_bool))
externfn!(fn SDL_ShowWindow(window: *SDL_Window))
externfn!(fn SDL_HideWindow(window: *SDL_Window))
externfn!(fn SDL_RaiseWindow(window: *SDL_Window))
externfn!(fn SDL_MaximizeWindow(window: *SDL_Window))
externfn!(fn SDL_MinimizeWindow(window: *SDL_Window))
externfn!(fn SDL_RestoreWindow(window: *SDL_Window))
externfn!(fn SDL_SetWindowFullscreen(window: *SDL_Window, flags: uint32_t) -> c_int)
externfn!(fn SDL_GetWindowSurface(window: *SDL_Window) -> *SDL_Surface)
externfn!(fn SDL_UpdateWindowSurface(window: *SDL_Window) -> c_int)
externfn!(fn SDL_UpdateWindowSurfaceRects(window: *SDL_Window, rects: *SDL_Rect, numrects: c_int) -> c_int)
externfn!(fn SDL_SetWindowGrab(window: *SDL_Window, grabbed: SDL_bool))
externfn!(fn SDL_GetWindowGrab(window: *SDL_Window) -> SDL_bool)
externfn!(fn SDL_SetWindowBrightness(window: *SDL_Window, brightness: c_float) -> c_int)
externfn!(fn SDL_GetWindowBrightness(window: *SDL_Window) -> c_float)
externfn!(fn SDL_SetWindowGammaRamp(window: *SDL_Window, red: *uint16_t, green: *uint16_t, blue: *uint16_t) -> c_int)
externfn!(fn SDL_GetWindowGammaRamp(window: *SDL_Window, red: *uint16_t, green: *uint16_t, blue: *uint16_t) -> c_int)
externfn!(fn SDL_DestroyWindow(window: *SDL_Window))
externfn!(fn SDL_IsScreenSaverEnabled() -> SDL_bool)
externfn!(fn SDL_EnableScreenSaver())
externfn!(fn SDL_DisableScreenSaver())
externfn!(fn SDL_GL_LoadLibrary(path: *c_char) -> c_int)
//externfn!(fn SDL_GL_GetProcAddress(proc: *c_char) -> Option<extern "C" fn()>) //FIXME: What should the return type of this be?
externfn!(fn SDL_GL_UnloadLibrary())
externfn!(fn SDL_GL_ExtensionSupported(extension: *c_char) -> SDL_bool)
externfn!(fn SDL_GL_SetAttribute(attr: SDL_GLattr, value: c_int) -> c_int)
externfn!(fn SDL_GL_GetAttribute(attr: SDL_GLattr, value: *c_int) -> c_int)
externfn!(fn SDL_GL_CreateContext(window: *SDL_Window) -> SDL_GLContext)
externfn!(fn SDL_GL_MakeCurrent(window: *SDL_Window, context: SDL_GLContext) -> c_int)
externfn!(fn SDL_GL_GetCurrentWindow() -> *SDL_Window)
externfn!(fn SDL_GL_GetCurrentContext() -> SDL_GLContext)
externfn!(fn SDL_GL_SetSwapInterval(interval: c_int) -> c_int)
externfn!(fn SDL_GL_GetSwapInterval() -> c_int)
externfn!(fn SDL_GL_SwapWindow(window: *SDL_Window))
externfn!(fn SDL_GL_DeleteContext(context: SDL_GLContext))
extern "C" {
pub fn SDL_GetNumVideoDrivers() -> c_int;
pub fn SDL_GetVideoDriver(index: c_int) -> *c_char;
pub fn SDL_VideoInit(driver_name: *c_char) -> c_int;
pub fn SDL_VideoQuit();
pub fn SDL_GetCurrentVideoDriver() -> *c_char;
pub fn SDL_GetNumVideoDisplays() -> c_int;
pub fn SDL_GetDisplayName(displayIndex: c_int) -> *c_char;
pub fn SDL_GetDisplayBounds(displayIndex: c_int, rect: *SDL_Rect) -> c_int;
pub fn SDL_GetNumDisplayModes(displayIndex: c_int) -> c_int;
pub fn SDL_GetDisplayMode(displayIndex: c_int, modeIndex: c_int, mode: *SDL_DisplayMode) -> c_int;
pub fn SDL_GetDesktopDisplayMode(displayIndex: c_int, mode: *SDL_DisplayMode) -> c_int;
pub fn SDL_GetCurrentDisplayMode(displayIndex: c_int, mode: *SDL_DisplayMode) -> c_int;
pub fn SDL_GetClosestDisplayMode(displayIndex: c_int, mode: *SDL_DisplayMode, closest: *SDL_DisplayMode) -> *SDL_DisplayMode;
pub fn SDL_GetWindowDisplayIndex(window: *SDL_Window) -> c_int;
pub fn SDL_SetWindowDisplayMode(window: *SDL_Window, mode: *SDL_DisplayMode) -> c_int;
pub fn SDL_GetWindowDisplayMode(window: *SDL_Window, mode: *SDL_DisplayMode) -> c_int;
pub fn SDL_GetWindowPixelFormat(window: *SDL_Window) -> uint32_t;
pub fn SDL_CreateWindow(title: *c_char, x: c_int, y: c_int, w: c_int, h: c_int, flags: uint32_t) -> *SDL_Window;
pub fn SDL_CreateWindowFrom(data: *c_void) -> *SDL_Window;
pub fn SDL_GetWindowID(window: *SDL_Window) -> uint32_t;
pub fn SDL_GetWindowFromID(id: uint32_t) -> *SDL_Window;
pub fn SDL_GetWindowFlags(window: *SDL_Window) -> uint32_t;
pub fn SDL_SetWindowTitle(window: *SDL_Window, title: *c_char);
pub fn SDL_GetWindowTitle(window: *SDL_Window) -> *c_char;
pub fn SDL_SetWindowIcon(window: *SDL_Window, icon: *SDL_Surface);
pub fn SDL_SetWindowData(window: *SDL_Window, name: *c_char, userdata: *c_void) -> *c_void;
pub fn SDL_GetWindowData(window: *SDL_Window, name: *c_char) -> *c_void;
pub fn SDL_SetWindowPosition(window: *SDL_Window, x: c_int, y: c_int);
pub fn SDL_GetWindowPosition(window: *SDL_Window, x: *c_int, y: *c_int);
pub fn SDL_SetWindowSize(window: *SDL_Window, w: c_int, h: c_int);
pub fn SDL_GetWindowSize(window: *SDL_Window, w: *c_int, h: *c_int);
pub fn SDL_SetWindowMinimumSize(window: *SDL_Window, min_w: c_int, min_h: c_int);
pub fn SDL_GetWindowMinimumSize(window: *SDL_Window, w: *c_int, h: *c_int);
pub fn SDL_SetWindowMaximumSize(window: *SDL_Window, max_w: c_int, max_h: c_int);
pub fn SDL_GetWindowMaximumSize(window: *SDL_Window, w: *c_int, h: *c_int);
pub fn SDL_SetWindowBordered(window: *SDL_Window, bordered: SDL_bool);
pub fn SDL_ShowWindow(window: *SDL_Window);
pub fn SDL_HideWindow(window: *SDL_Window);
pub fn SDL_RaiseWindow(window: *SDL_Window);
pub fn SDL_MaximizeWindow(window: *SDL_Window);
pub fn SDL_MinimizeWindow(window: *SDL_Window);
pub fn SDL_RestoreWindow(window: *SDL_Window);
pub fn SDL_SetWindowFullscreen(window: *SDL_Window, flags: uint32_t) -> c_int;
pub fn SDL_GetWindowSurface(window: *SDL_Window) -> *SDL_Surface;
pub fn SDL_UpdateWindowSurface(window: *SDL_Window) -> c_int;
pub fn SDL_UpdateWindowSurfaceRects(window: *SDL_Window, rects: *SDL_Rect, numrects: c_int) -> c_int;
pub fn SDL_SetWindowGrab(window: *SDL_Window, grabbed: SDL_bool);
pub fn SDL_GetWindowGrab(window: *SDL_Window) -> SDL_bool;
pub fn SDL_SetWindowBrightness(window: *SDL_Window, brightness: c_float) -> c_int;
pub fn SDL_GetWindowBrightness(window: *SDL_Window) -> c_float;
pub fn SDL_SetWindowGammaRamp(window: *SDL_Window, red: *uint16_t, green: *uint16_t, blue: *uint16_t) -> c_int;
pub fn SDL_GetWindowGammaRamp(window: *SDL_Window, red: *uint16_t, green: *uint16_t, blue: *uint16_t) -> c_int;
pub fn SDL_DestroyWindow(window: *SDL_Window);
pub fn SDL_IsScreenSaverEnabled() -> SDL_bool;
pub fn SDL_EnableScreenSaver();
pub fn SDL_DisableScreenSaver();
pub fn SDL_GL_LoadLibrary(path: *c_char) -> c_int;
//pub fn SDL_GL_GetProcAddress(proc: *c_char) -> Option<extern "C" fn()> //FIXME: What should the return type of this be
pub fn SDL_GL_UnloadLibrary();
pub fn SDL_GL_ExtensionSupported(extension: *c_char) -> SDL_bool;
pub fn SDL_GL_SetAttribute(attr: SDL_GLattr, value: c_int) -> c_int;
pub fn SDL_GL_GetAttribute(attr: SDL_GLattr, value: *c_int) -> c_int;
pub fn SDL_GL_CreateContext(window: *SDL_Window) -> SDL_GLContext;
pub fn SDL_GL_MakeCurrent(window: *SDL_Window, context: SDL_GLContext) -> c_int;
pub fn SDL_GL_GetCurrentWindow() -> *SDL_Window;
pub fn SDL_GL_GetCurrentContext() -> SDL_GLContext;
pub fn SDL_GL_SetSwapInterval(interval: c_int) -> c_int;
pub fn SDL_GL_GetSwapInterval() -> c_int;
pub fn SDL_GL_SwapWindow(window: *SDL_Window);
pub fn SDL_GL_DeleteContext(context: SDL_GLContext);
}
}
#[deriving(Eq)]