omp_gdk/scripting/menus/
functions.rs1use omp_codegen::native;
2use std::ffi::c_void;
3
4use crate::players::Player;
5
6use super::Menu;
7
8native!(Menu_Create, title: str, columns: u32, x: f32, y: f32, column1Width: f32, column2Width: f32, id: mut i32, -> struct Menu);
9native!(Menu_Destroy, menu: struct Menu, -> bool);
10native!(Menu_FromID, menuid: i32, -> struct Menu);
11native!(Menu_GetID, menu: struct Menu, -> i32);
12native!(Menu_AddItem, menu: struct Menu, column: u8, text: str, -> i32);
13native!(Menu_SetColumnHeader, menu: struct Menu, column: u8, headerTitle: str, -> bool);
14native!(Menu_ShowForPlayer, menu: struct Menu, player: struct Player, -> bool);
15native!(Menu_HideForPlayer, menu: struct Menu, player: struct Player, -> bool);
16native!(Menu_Disable, menu: struct Menu, -> bool);
17native!(Menu_DisableRow, menu: struct Menu, row: u8, -> bool);
18native!(Menu_IsValid, menu: struct Menu, -> bool);
19native!(Menu_IsDisabled, menu: struct Menu, -> bool);
20native!(Menu_IsRowDisabled, menu: struct Menu, row: i32, -> bool);
21native!(Menu_GetColumns, menu: struct Menu, -> i32);
22native!(Menu_GetItems, menu: struct Menu, column: i32, -> i32);
23native!(Menu_GetPos, menu: struct Menu, x: mut f32, y: mut f32, -> bool);
24native!(Menu_GetColumnWidth, menu: struct Menu, column1Width: mut f32, column2Width: mut f32, -> bool);
25native!(Menu_GetColumnHeader, menu: struct Menu, column: i32, header: mut str, header_len: usize, -> bool);
26native!(Menu_GetItem, menu: struct Menu, column: i32, row: i32, item: mut str, item_len: usize, -> bool);
27
28#[doc(hidden)]
29pub fn load_functions() {
30 load_function!(Menu_Create);
31 load_function!(Menu_Destroy);
32 load_function!(Menu_FromID);
33 load_function!(Menu_GetID);
34 load_function!(Menu_AddItem);
35 load_function!(Menu_SetColumnHeader);
36 load_function!(Menu_ShowForPlayer);
37 load_function!(Menu_HideForPlayer);
38 load_function!(Menu_Disable);
39 load_function!(Menu_DisableRow);
40 load_function!(Menu_IsValid);
41 load_function!(Menu_IsDisabled);
42 load_function!(Menu_IsRowDisabled);
43 load_function!(Menu_GetColumns);
44 load_function!(Menu_GetItems);
45 load_function!(Menu_GetPos);
46 load_function!(Menu_GetColumnWidth);
47 load_function!(Menu_GetColumnHeader);
48 load_function!(Menu_GetItem);
49}