use libc::*;
use sdl2_sys::*;
use crate::types::*;
extern "C" {
pub fn LEXSDL_Init(flags: u32) -> c_int;
pub fn LEXSDL_InitIMG(flags: c_int) -> c_int;
pub fn LEXSDL_Terminate();
pub fn LEXSDL_Quit();
}
#[allow(dead_code)]
#[allow(non_snake_case)]
#[repr(C)]
pub struct LexSdlData {
pub window: *mut SDL_Window,
pub renderer: *mut SDL_Renderer,
pub bgColor: [u8;4],
pub drColor: [u8;4],
pub textures: *mut *mut SDL_Texture,
sprites: *mut LEXSDL_Sprite,
pub texturesQuantity: TextureID,
pub spritesQuantity: SpriteID,
pub eventQuit: u8 ,
pub keyboardState: *const u8,
pub mouseState: LEXSDL_Mouse,
pub deltaTicksLast: u32,
pub deltaTicksCurrent: u32,
pub delta: u32,
pub deltaFloat: c_float,
}
#[allow(dead_code)]
#[allow(non_snake_case)]
#[repr(C)]
struct LEXSDL_Sprite {
frames: u32,
delta: u32,
currentFrame: u32,
fps: u32,
textureID: c_int,
frameDimensions: SDL_Rect,
freed: u8,
}
extern "C" {
#[allow(dead_code)]
pub static LEXSDLDATA: LexSdlData;
}
extern "C" {
pub fn LEXSDL_SetupEvents() -> c_int;
pub fn LEXSDL_HandleEvents();
pub fn LEXSDL_EventKey(scancode: u16) -> u8;
pub fn LEXSDL_EventQuit() -> u8;
pub fn LEXSDL_EventDoQuit();
pub fn LEXSDL_EventCancelQuit();
}
#[repr(C)]
pub struct LEXSDL_Mouse {
x: c_int,
y: c_int,
left: u8,
right: u8,
middle: u8,
x1: u8,
x2: u8,
}
extern "C" {
pub fn LEXSDL_GetMouse() -> *const LEXSDL_Mouse;
pub fn LEXSDL_MouseUpdate();
pub fn LEXSDL_MousePos(x: *mut c_int, y: *mut c_int);
pub fn LEXSDL_MousePosX() -> c_int;
pub fn LEXSDL_MousePosY() -> c_int;
pub fn LEXSDL_MouseLeft() -> u8;
pub fn LEXSDL_MouseRight() -> u8;
pub fn LEXSDL_MouseMiddle() -> u8;
pub fn LEXSDL_MouseX1() -> u8;
pub fn LEXSDL_MouseX2() -> u8;
}
extern "C" {
pub fn LEXSDL_CreateRenderer(flags: u32) -> *mut SDL_Renderer;
pub fn LEXSDL_GetBackgroundColor(r: *mut u8, g: *mut u8, b: *mut u8, a: *mut u8);
pub fn LEXSDL_GetDrawColor(r: *mut u8, g: *mut u8, b: *mut u8, a: *mut u8);
pub fn LEXSDL_GetRenderer() -> *mut SDL_Renderer;
pub fn LEXSDL_SetRenderer(renderer: *mut SDL_Renderer);
pub fn LEXSDL_SetBackgroundColor(r: u8, g: u8, b: u8, a: u8);
pub fn LEXSDL_SetDrawColor(r: u8, g: u8, b: u8, a: u8);
pub fn LEXSDL_NewFrame() -> c_int;
pub fn LEXSDL_ShowFrame();
}
extern "C" {
pub fn LEXSDL_TextureAdd(texture: *mut SDL_Texture) -> c_int;
pub fn LEXSDL_TextureLoad(file: *const c_char) -> c_int;
pub fn LEXSDL_TextureLoadBytes(data: *const u8, len: c_int) -> c_int;
pub fn LEXSDL_TextureGet(id: c_int) -> *mut SDL_Texture;
pub fn LEXSDL_TextureChange(id: c_int, r: u8, g: u8, b: u8);
pub fn LEXSDL_TextureChangeAlpha(id: c_int, a: u8);
pub fn LEXSDL_TextureDestroy(id: c_int);
pub fn LEXSDL_TextureDraw(id: c_int, srcrect: *const SDL_Rect, dstrect: *const SDL_Rect);
pub fn LEXSDL_TextureDrawAt(id: c_int, x: c_int, y: c_int, w: c_int, h: c_int);
pub fn LEXSDL_TextureDrawFill(id: c_int);
pub fn LEXSDL_TextureDrawRot(id: c_int, srcrect: *const SDL_Rect, dstrect: *const SDL_Rect, rot: c_double);
pub fn LEXSDL_TextureDrawRotAt(id: c_int, x: c_int, y: c_int, w: c_int, h: c_int, rot: c_double);
pub fn LEXSDL_TextureDrawRotCenterAt(id: c_int, x: c_int, y: c_int, w: c_int, h: c_int, rot: c_double, cx: c_int, cy: c_int);
}
extern "C" {
pub fn LEXSDL_CreateSprite(textureID: c_int, frames: u32, fps: u32, frameDimensions: SDL_Rect) -> c_int;
pub fn LEXSDL_SpriteGetCurrentFrame(id: c_int) -> u32;
pub fn LEXSDL_SpriteGetFrameDimensions(id: c_int) -> SDL_Rect;
pub fn LEXSDL_SpriteGetFrames(id: c_int) -> u32;
pub fn LEXSDL_SpriteGetFps(id: c_int) -> u32;
pub fn LEXSDL_SpriteGetTexture(id: c_int) -> *mut SDL_Texture;
pub fn LEXSDL_SpriteGetTextureId(id: c_int) -> c_int;
pub fn LEXSDL_SpriteSetTextureId(id: c_int, textureID: c_int) -> c_int;
pub fn LEXSDL_SpriteClone(id: c_int) -> c_int;
pub fn LEXSDL_SpriteSkipFrames(id: c_int, frames: u32);
pub fn LEXSDL_SpriteSetFrame(id: c_int, frame: u32);
pub fn LEXSDL_SpriteStep(id: c_int);
pub fn LEXSDL_SpriteUpdate(id: c_int);
pub fn LEXSDL_SpriteDraw(id: c_int, x: c_int, y: c_int, w: c_int, h: c_int);
pub fn LEXSDL_SpriteDrawFlip(id: c_int, x: c_int, y: c_int, w: c_int, h: c_int);
pub fn LEXSDL_SpriteDrawFlipRot(id: c_int, x: c_int, y: c_int, w: c_int, h: c_int, rot: c_double);
pub fn LEXSDL_SpriteDrawRot(id: c_int, x: c_int, y: c_int, w: c_int, h: c_int, rot: c_double);
pub fn LEXSDL_SpritePlay(id: c_int, x: c_int, y: c_int, w: c_int, h: c_int);
pub fn LEXSDL_SpritePlayBackground(id: c_int);
pub fn LEXSDL_SpritePlayFlip(id: c_int, x: c_int, y: c_int, w: c_int, h: c_int);
pub fn LEXSDL_SpritePlayFlipRot(id: c_int, x: c_int, y: c_int, w: c_int, h: c_int, rot: c_double);
pub fn LEXSDL_SpritePlayRot(id: c_int, x: c_int, y: c_int, w: c_int, h: c_int, rot: c_double);
}
extern "C" {
pub fn LEXSDL_DeltaUpdate();
pub fn LEXSDL_DeltaTime() -> u32;
pub fn LEXSDL_DeltaTimeFloat() -> c_float;
}
extern "C" {
pub fn LEXSDL_GetWindow() -> *mut SDL_Window;
pub fn LEXSDL_SetWindow(window: *mut SDL_Window);
pub fn LEXSDL_CreateWindow(title: *const c_char, flags: u32) -> *mut SDL_Window;
pub fn LEXSDL_CreateWindowSized(title: *const c_char, width: c_int, height: c_int, flags: u32) -> *mut SDL_Window;
}