omp_gdk/scripting/textlabels/
functions.rs

1use omp_codegen::native;
2
3use std::ffi::c_void;
4
5use crate::{players::Player, vehicles::Vehicle};
6
7use super::{PlayerTextLabel, TextLabel};
8
9native!(TextLabel_Create, text: str, color: u32, x: f32, y: f32, z: f32, drawDistance: f32, virtualWorld: i32, los: bool, id: mut i32, -> struct TextLabel);
10native!(TextLabel_Destroy, textlabel: struct TextLabel, -> bool);
11native!(TextLabel_FromID, textlabelid: i32, -> struct TextLabel);
12native!(TextLabel_GetID, textlabel: struct TextLabel, -> i32);
13native!(TextLabel_AttachToPlayer, textlabel: struct TextLabel, player: struct Player, offsetX: f32, offsetY: f32, offsetZ: f32, -> bool);
14native!(TextLabel_AttachToVehicle, textlabel: struct TextLabel, vehicle: struct Vehicle, offsetX: f32, offsetY: f32, offsetZ: f32, -> bool);
15native!(TextLabel_UpdateText, textlabel: struct TextLabel, color: u32, text: str, -> bool);
16native!(TextLabel_IsValid, textlabel: struct TextLabel, -> bool);
17native!(TextLabel_IsStreamedIn, player: struct Player, textlabel: struct TextLabel, -> bool);
18native!(TextLabel_GetText, textlabel: struct TextLabel, output: mut str, output_len: usize, -> bool);
19native!(TextLabel_GetColor, textlabel: struct TextLabel, -> u32);
20native!(TextLabel_GetPos, textlabel: struct TextLabel, x: mut f32, y: mut f32, z: mut f32, -> bool);
21native!(TextLabel_SetDrawDistance, textlabel: struct TextLabel, distance: f32, -> bool);
22native!(TextLabel_GetDrawDistance, textlabel: struct TextLabel, -> f32);
23native!(TextLabel_GetLOS, textlabel: struct TextLabel, -> bool);
24native!(TextLabel_SetLOS, textlabel: struct TextLabel, status: bool, -> bool);
25native!(TextLabel_GetVirtualWorld, textlabel: struct TextLabel, -> i32);
26native!(TextLabel_SetVirtualWorld, textlabel: struct TextLabel, world: i32, -> bool);
27native!(TextLabel_GetAttachedData, textlabel: struct TextLabel, attached_player: mut i32, attached_vehicle: mut i32, -> bool);
28
29// Player TextLabels
30
31native!(PlayerTextLabel_Create, player: struct Player, text: str, color: u32, x: f32, y: f32, z: f32, drawDistance: f32, attachedPlayer: struct Player, attachedVehicle: struct Vehicle, los: bool, id: mut i32, -> struct PlayerTextLabel);
32native!(PlayerTextLabel_Destroy, player: struct Player, textlabel: struct PlayerTextLabel, -> bool);
33native!(PlayerTextLabel_FromID, player: struct Player, textlabelid: i32, -> struct PlayerTextLabel);
34native!(PlayerTextLabel_GetID, player: struct Player, textlabel: struct PlayerTextLabel, -> i32);
35native!(PlayerTextLabel_UpdateText, player: struct Player, textlabel: struct PlayerTextLabel, color: u32, text: str, -> bool);
36native!(PlayerTextLabel_IsValid, player: struct Player, textlabel: struct PlayerTextLabel, valid: mut bool, -> bool);
37native!(PlayerTextLabel_GetText, player: struct Player, textlabel: struct PlayerTextLabel, output: mut str, output_len: usize, -> bool);
38native!(PlayerTextLabel_GetColor, player: struct Player, textlabel: struct PlayerTextLabel, color: mut u32, -> bool);
39native!(PlayerTextLabel_GetPos, player: struct Player, textlabel: struct PlayerTextLabel, x: mut f32, y: mut f32, z: mut f32, -> bool);
40native!(PlayerTextLabel_SetDrawDistance, player: struct Player, textlabel: struct PlayerTextLabel, distance: f32, -> bool);
41native!(PlayerTextLabel_GetDrawDistance, player: struct Player, textlabel: struct PlayerTextLabel, -> f32);
42native!(PlayerTextLabel_GetLOS, player: struct Player, textlabel: struct PlayerTextLabel, -> bool);
43native!(PlayerTextLabel_SetLOS, player: struct Player, textlabel: struct PlayerTextLabel, status: bool, -> bool);
44native!(PlayerTextLabel_GetVirtualWorld, player: struct Player, -> i32);
45native!(PlayerTextLabel_GetAttachedData, player: struct Player, textlabel: struct PlayerTextLabel, attached_player: mut i32, attached_vehicle: mut i32, -> bool);
46
47#[doc(hidden)]
48pub fn load_functions() {
49    load_function!(TextLabel_Create);
50    load_function!(TextLabel_Destroy);
51    load_function!(TextLabel_FromID);
52    load_function!(TextLabel_GetID);
53    load_function!(TextLabel_AttachToPlayer);
54    load_function!(TextLabel_AttachToVehicle);
55    load_function!(TextLabel_UpdateText);
56    load_function!(TextLabel_IsValid);
57    load_function!(TextLabel_IsStreamedIn);
58    load_function!(TextLabel_GetText);
59    load_function!(TextLabel_GetColor);
60    load_function!(TextLabel_GetPos);
61    load_function!(TextLabel_SetDrawDistance);
62    load_function!(TextLabel_GetDrawDistance);
63    load_function!(TextLabel_GetLOS);
64    load_function!(TextLabel_SetLOS);
65    load_function!(TextLabel_GetVirtualWorld);
66    load_function!(TextLabel_SetVirtualWorld);
67    load_function!(TextLabel_GetAttachedData);
68
69    // Player TextLabels
70
71    load_function!(PlayerTextLabel_Create);
72    load_function!(PlayerTextLabel_Destroy);
73    load_function!(PlayerTextLabel_FromID);
74    load_function!(PlayerTextLabel_GetID);
75    load_function!(PlayerTextLabel_UpdateText);
76    load_function!(PlayerTextLabel_IsValid);
77    load_function!(PlayerTextLabel_GetText);
78    load_function!(PlayerTextLabel_GetColor);
79    load_function!(PlayerTextLabel_GetPos);
80    load_function!(PlayerTextLabel_SetDrawDistance);
81    load_function!(PlayerTextLabel_GetDrawDistance);
82    load_function!(PlayerTextLabel_GetLOS);
83    load_function!(PlayerTextLabel_SetLOS);
84    load_function!(PlayerTextLabel_GetVirtualWorld);
85    load_function!(PlayerTextLabel_GetAttachedData);
86}