#[allow(non_camel_case_types)]
pub type c_char = i8;
#[allow(non_camel_case_types)]
pub type c_float = f32;
#[allow(non_camel_case_types)]
pub type c_void = std::ffi::c_void;
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
#[allow(non_camel_case_types)]
#[allow(dead_code)]
pub enum RCode {
FAIL,
NO_FILE,
OK
}
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
#[allow(non_camel_case_types)]
pub enum PixelMode {
NORMAL,
MASK,
ALPHA,
CUSTOM
}
#[repr(C)]
#[derive(Clone, Copy, Debug, Default, PartialEq)]
pub struct V2d<T> {
pub x: T,
pub y: T
}
pub type Vi2d = V2d<i32>;
pub type Vf2d = V2d<c_float>;
#[repr(C)]
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub struct Pixel {
pub r: u8,
pub g: u8,
pub b: u8,
pub a: u8
}
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct HWButton {
pub pressed: bool,
pub released: bool,
pub held: bool
}
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
#[allow(non_camel_case_types)]
pub enum Key {
NONE,
A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z,
K0, K1, K2, K3, K4, K5, K6, K7, K8, K9,
F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12,
UP, DOWN, LEFT, RIGHT,
SPACE, TAB, SHIFT, CTRL, INS, DEL, HOME, END, PGUP, PGDN,
BACK, ESCAPE, RETURN, ENTER, PAUSE, SCROLL,
NP0, NP1, NP2, NP3, NP4, NP5, NP6, NP7, NP8, NP9,
NP_MUL, NP_DIV, NP_ADD, NP_SUB, NP_DECIMAL, PERIOD
}
#[repr(C)]
#[derive(Debug, PartialEq)]
pub struct Sprite {
olc_sprite: *const c_void
}
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
#[allow(non_camel_case_types)]
pub enum SpriteMode {
NORMAL,
PERIODIC
}
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
#[allow(non_camel_case_types)]
pub enum SpriteFlip {
NONE,
HORIZ,
VERT
}
#[repr(C)]
#[derive(Debug, PartialEq)]
pub struct Decal {
olc_decal: *const c_void
}
#[link(name="olcRustBindingApp", kind="static")]
extern "C" {
pub fn c_rand() -> i32;
pub fn start(name: *const c_char, binding: *mut c_void, screen_w: i32, screen_h: i32, pixel_w: i32, pixel_h: i32, full_screen: bool, vsync: bool) -> RCode;
pub fn SpriteNullConstructor() -> Sprite;
pub fn SpriteConstructor(w: i32, h: i32) -> Sprite;
pub fn SpriteDestructor(s: &Sprite);
pub fn SpriteLoadFromFile(s: &Sprite, image_file: *const c_char) -> RCode;
pub fn SpriteWidth(s: &Sprite) -> i32;
pub fn SpriteHeight(s: &Sprite) -> i32;
pub fn SpriteHasData(s: &Sprite) -> bool;
pub fn SpriteSetSampleMode(s: &Sprite, mode: SpriteMode);
pub fn SpriteGetSampleMode(s: &Sprite) -> SpriteMode;
pub fn SpriteGetPixel(s: &Sprite, x: i32, y: i32) -> Pixel;
pub fn SpriteSetPixel(s: &Sprite, x: i32, y: i32, p: Pixel) -> bool;
pub fn SpriteSample(s: &Sprite, x: c_float, y: c_float) -> Pixel;
pub fn SpriteSampleBL(s: &Sprite, u: c_float, v: c_float) -> Pixel;
pub fn DecalConstructor(s: &Sprite) -> Decal;
pub fn DecalId(d: &Decal) -> i32;
pub fn DecalScale(d: &Decal) -> Vf2d;
pub fn DecalDestructor(d: &Decal);
pub fn IsFocused() -> bool;
pub fn GetKey(k: Key) -> HWButton;
pub fn GetMouse(b: u32) -> HWButton;
pub fn GetMouseX() -> i32;
pub fn GetMouseY() -> i32;
pub fn GetMouseWheel() -> i32;
pub fn ScreenWidth() -> i32;
pub fn ScreenHeight() -> i32;
pub fn GetDrawTargetWidth() -> i32;
pub fn GetDrawTargetHeight() -> i32;
pub fn SetScreenSize(w: i32, h: i32);
pub fn GetFPS() -> u32;
pub fn SetDrawTarget(layer: u8);
pub fn EnableLayer(layer: u8, b: bool);
pub fn SetLayerOffset(layer: u8, x: c_float, y: c_float);
pub fn SetLayerScale(layer: u8, x: c_float, y: c_float);
pub fn SetLayerTint(layer: u8, tint: Pixel);
pub fn CreateLayer() -> u32;
pub fn SetPixelMode(m: PixelMode);
pub fn GetPixelMode() -> PixelMode;
pub fn SetPixelBlend(fBlend: c_float);
pub fn Draw(x: i32, y: i32, p: Pixel) -> bool;
pub fn DrawLine(x1: i32, y1: i32, x2: i32, y2: i32, p: Pixel, pattern: u32);
pub fn DrawCircle(x: i32, y: i32, radius: i32, p: Pixel, mask: u8);
pub fn FillCircle(x: i32, y: i32, radius: i32, p: Pixel);
pub fn DrawRect(x: i32, y: i32, w: i32, h: i32, p: Pixel);
pub fn FillRect(x: i32, y: i32, w: i32, h: i32, p: Pixel);
pub fn DrawTriangle(x1: i32, y1: i32, x2: i32, y2: i32, x3: i32, y3: i32, p: Pixel);
pub fn FillTriangle(x1: i32, y1: i32, x2: i32, y2: i32, x3: i32, y3: i32, p: Pixel);
pub fn DrawSprite(x: i32, y: i32, sprite: &Sprite, scale: u32, flip: SpriteFlip);
pub fn DrawPartialSprite(x: i32, y: i32, sprite: &Sprite, ox: i32, oy: i32, w: i32, h: i32, scale: u32, flip: SpriteFlip);
pub fn DrawDecal(pos: &Vf2d, decal: &Decal, scale: &Vf2d, tint: &Pixel);
pub fn DrawPartialDecal(pos: &Vf2d, decal: &Decal, source_pos: &Vf2d, source_size: &Vf2d, scale: &Vf2d, tint: &Pixel);
pub fn DrawWarpedDecal(decal: &Decal, pos: *const Vf2d, tint: &Pixel);
pub fn DrawPartialWarpedDecal(decal: &Decal, pos: *const Vf2d, source_pos: &Vf2d, source_size: &Vf2d, tint: &Pixel);
pub fn DrawRotatedDecal(pos: &Vf2d, decal: &Decal, angle: c_float, center: &Vf2d, scale: &Vf2d, tint: &Pixel);
pub fn DrawPartialRotatedDecal(pos: &Vf2d, decal: &Decal, angle: c_float, center: &Vf2d, source_pos: &Vf2d, source_size: &Vf2d, scale: &Vf2d, tint: &Pixel);
pub fn DrawStringDecal(pos: &Vf2d, sText: *const c_char, col: Pixel, scale: &Vf2d);
pub fn DrawString(x: i32, y: i32, sText: *const c_char, col: Pixel, scale: u32);
pub fn Clear(p: Pixel);
pub fn ClearBuffer(p: Pixel, bDepth: bool);
}