use core::ffi::c_void;
use crate::abi::{Header, Status, Str};
#[repr(C)]
#[derive(Clone, Copy, Debug, bytemuck::Zeroable)]
pub struct UiFrame {
pub header: Header,
pub token: u64,
pub screen: u32,
pub reserved: u32,
}
impl_headed!(UiFrame);
impl UiFrame {
pub const MENU: u32 = 0;
pub const LOADING: u32 = 1;
pub const IN_GAME: u32 = 2;
}
pub type UiFrameFn = unsafe extern "system" fn(frame: *const UiFrame, user: *mut c_void);
#[repr(C)]
#[derive(Clone, Copy, Debug, bytemuck::Zeroable)]
pub struct UiWidget {
pub header: Header,
pub kind: u32,
pub flags: u32,
pub style: u32,
pub steps: u32,
pub text: Str,
pub detail: Str,
pub options: *const Str,
pub option_count: u32,
pub index: u32,
pub value: f32,
pub min: f32,
pub max: f32,
pub result: u32,
pub anchor: u32,
pub reserved: u32,
}
impl_headed!(UiWidget);
impl UiWidget {
pub const WINDOW: u32 = 1;
pub const END: u32 = 2;
pub const LABEL: u32 = 3;
pub const BUTTON: u32 = 4;
pub const TOGGLE: u32 = 5;
pub const SLIDER: u32 = 6;
pub const DROPDOWN: u32 = 7;
pub const PROGRESS: u32 = 8;
pub const SOUND: u32 = 9;
pub const READ_ONLY: u32 = 1;
pub const WRAP: u32 = 2;
pub const CENTER: u32 = 4;
pub const STYLE_BODY: u32 = 0;
pub const STYLE_SECONDARY: u32 = 1;
pub const STYLE_H1: u32 = 2;
pub const STYLE_H2: u32 = 3;
pub const STYLE_H3: u32 = 4;
pub const STYLE_WARNING: u32 = 5;
pub const STYLE_POSITIVE: u32 = 6;
pub const STYLE_NEGATIVE: u32 = 7;
pub const SOUND_CLICK: u32 = 0;
pub const SOUND_CONFIRM: u32 = 1;
pub const SOUND_BACK: u32 = 2;
pub const SOUND_ERROR: u32 = 3;
pub const EMPTY: Self = Self {
header: Header::of::<Self>(),
kind: 0,
flags: 0,
style: 0,
steps: 0,
text: Str::EMPTY,
detail: Str::EMPTY,
options: core::ptr::null(),
option_count: 0,
index: 0,
value: 0.0,
min: 0.0,
max: 0.0,
result: 0,
anchor: 0,
reserved: 0,
};
pub const TOP_LEFT: u32 = 0;
pub const TOP_CENTER: u32 = 1;
pub const TOP_RIGHT: u32 = 2;
pub const BOTTOM_LEFT: u32 = 3;
pub const BOTTOM_CENTER: u32 = 4;
pub const BOTTOM_RIGHT: u32 = 5;
}
#[repr(C)]
#[derive(Clone, Copy, Debug, bytemuck::Zeroable)]
pub struct UiMarker {
pub header: Header,
pub position: [i64; 3],
pub label: Str,
pub color: u32,
pub reserved: u32,
}
impl_headed!(UiMarker);
impl UiMarker {
pub const WHITE: u32 = 0;
pub const RED: u32 = 1;
pub const GREEN: u32 = 2;
pub const BLUE: u32 = 3;
pub const YELLOW: u32 = 4;
pub const PURPLE: u32 = 5;
pub const TURQUOISE: u32 = 6;
pub const BLACK: u32 = 7;
}
#[repr(C)]
#[derive(Clone, Copy, Debug, bytemuck::Zeroable)]
pub struct UiDialog {
pub header: Header,
pub title: Str,
pub message: Str,
pub detail: Str,
pub buttons: u32,
pub flags: u32,
}
impl_headed!(UiDialog);
impl UiDialog {
pub const RETRY: u32 = 0;
pub const DISABLE: u32 = 1;
pub const ERASE: u32 = 2;
pub const RESET: u32 = 3;
pub const OVERWRITE: u32 = 5;
pub const CANCEL: u32 = 6;
pub const OK: u32 = 7;
pub const IGNORE: u32 = 8;
pub const BUTTONS: u32 = 0x1ef;
pub const CLOSED: u32 = u32::MAX;
pub const WAITING: u32 = 1;
}
pub type UiAnswerFn = unsafe extern "system" fn(answer: u32, user: *mut c_void);
pub type ConfigCheckFn =
unsafe extern "system" fn(text: Str, why: *mut Str, user: *mut c_void) -> Status;
#[repr(C)]
#[derive(Clone, Copy, Debug, bytemuck::Zeroable)]
pub struct FogInfo {
pub header: Header,
pub width: u32,
pub height: u32,
pub metres_per_pixel: f32,
pub size_z: f32,
pub version: u64,
pub session: u64,
}
impl_headed!(FogInfo);
impl FogInfo {
pub const EMPTY: Self = Self {
header: Header::of::<Self>(),
width: 0,
height: 0,
metres_per_pixel: 0.0,
size_z: 0.0,
version: 0,
session: 0,
};
}