1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
//! `ITextLabel` — generated by `cargo xtask gen-omp` from `Server/Components/TextLabels/textlabels.hpp`.
//! Implemented by `TextLabel` in the server's `TextLabels`.
//!
//! Do not edit: change `xtask/omp-wrappers.toml` or the generator and
//! regenerate. Slots are clang's layout of the header for each ABI, checked
//! against the official binaries by `cargo xtask check-abi --generated`.
#![allow(unused_imports)]
use crate::omp::containers::{FlatSet, HybridString, Pair, Span};
use crate::omp::types::{
Colour, GTAQuat, Hours, Microseconds, Milliseconds, Minutes, Seconds, StringView, TimePoint,
UID, Vector2, Vector3, Vector4, WorldTimePoint,
};
use crate::omp::vtable::{call_vtable_small_struct, opaque, slots, virtual_fns};
use crate::omp::*;
slots! {
/// `void ITextLabelBase::setText(StringView)`
SLOT_SET_TEXT: usize = 6, 5;
/// `StringView ITextLabelBase::getText()`
SLOT_GET_TEXT: usize = 7, 6;
/// `void ITextLabelBase::setColour(Colour)`
SLOT_SET_COLOUR: usize = 8, 7;
/// `Colour ITextLabelBase::getColour()`
SLOT_GET_COLOUR: usize = 9, 8;
/// `void ITextLabelBase::setDrawDistance(float)`
SLOT_SET_DRAW_DISTANCE: usize = 10, 9;
/// `float ITextLabelBase::getDrawDistance()`
SLOT_GET_DRAW_DISTANCE: usize = 11, 10;
/// `void ITextLabelBase::attachToPlayer(IPlayer &, Vector3)`
SLOT_ATTACH_TO_PLAYER: usize = 12, 11;
/// `void ITextLabelBase::attachToVehicle(IVehicle &, Vector3)`
SLOT_ATTACH_TO_VEHICLE: usize = 13, 12;
/// `const TextLabelAttachmentData & ITextLabelBase::getAttachmentData()`
SLOT_GET_ATTACHMENT_DATA: usize = 14, 13;
/// `void ITextLabelBase::detachFromPlayer(Vector3)`
SLOT_DETACH_FROM_PLAYER: usize = 15, 14;
/// `void ITextLabelBase::detachFromVehicle(Vector3)`
SLOT_DETACH_FROM_VEHICLE: usize = 16, 15;
/// `void ITextLabelBase::setTestLOS(bool)`
SLOT_SET_TEST_LOS: usize = 17, 16;
/// `bool ITextLabelBase::getTestLOS()`
SLOT_GET_TEST_LOS: usize = 18, 17;
/// `void ITextLabelBase::setColourAndText(Colour, StringView)`
SLOT_SET_COLOUR_AND_TEXT: usize = 19, 18;
/// `bool ITextLabel::isStreamedInForPlayer(const IPlayer &)`
SLOT_IS_STREAMED_IN_FOR_PLAYER: usize = 20, 19;
/// `void ITextLabel::streamInForPlayer(IPlayer &)`
SLOT_STREAM_IN_FOR_PLAYER: usize = 21, 20;
/// `void ITextLabel::streamOutForPlayer(IPlayer &)`
SLOT_STREAM_OUT_FOR_PLAYER: usize = 22, 21;
}
virtual_fns! {
/// `void ITextLabelBase::setText(StringView)`.
///
/// # Safety
/// `textlabel` must be a live `ITextLabel`.
pub fn textlabel_set_text(textlabel: ITextLabel, text: StringView) = [0, SLOT_SET_TEXT];
/// `void ITextLabelBase::setColour(Colour)`.
///
/// # Safety
/// `textlabel` must be a live `ITextLabel`.
pub fn textlabel_set_colour(textlabel: ITextLabel, colour: Colour) = [0, SLOT_SET_COLOUR];
/// `void ITextLabelBase::setDrawDistance(float)`.
///
/// # Safety
/// `textlabel` must be a live `ITextLabel`.
pub fn textlabel_set_draw_distance(
textlabel: ITextLabel,
dist: f32,
) = [0, SLOT_SET_DRAW_DISTANCE];
/// `float ITextLabelBase::getDrawDistance()`.
///
/// # Safety
/// `textlabel` must be a live `ITextLabel`.
#[must_use]
pub fn textlabel_draw_distance(
textlabel: ITextLabel,
) -> f32 = [0, SLOT_GET_DRAW_DISTANCE] or 0.0;
/// `void ITextLabelBase::attachToPlayer(IPlayer &, Vector3)`.
///
/// # Safety
/// `textlabel` must be a live `ITextLabel`.
pub fn textlabel_attach_to_player(
textlabel: ITextLabel,
player: *mut IPlayer,
offset: Vector3,
) = [0, SLOT_ATTACH_TO_PLAYER];
/// `void ITextLabelBase::attachToVehicle(IVehicle &, Vector3)`.
///
/// # Safety
/// `textlabel` must be a live `ITextLabel`.
pub fn textlabel_attach_to_vehicle(
textlabel: ITextLabel,
vehicle: *mut IVehicle,
offset: Vector3,
) = [0, SLOT_ATTACH_TO_VEHICLE];
/// `const TextLabelAttachmentData & ITextLabelBase::getAttachmentData()`.
///
/// # Safety
/// `textlabel` must be a live `ITextLabel`.
#[must_use]
pub fn textlabel_attachment_data(
textlabel: ITextLabel,
) -> *const TextLabelAttachmentData = [0, SLOT_GET_ATTACHMENT_DATA] or std::ptr::null();
/// `void ITextLabelBase::detachFromPlayer(Vector3)`.
///
/// # Safety
/// `textlabel` must be a live `ITextLabel`.
pub fn textlabel_detach_from_player(
textlabel: ITextLabel,
position: Vector3,
) = [0, SLOT_DETACH_FROM_PLAYER];
/// `void ITextLabelBase::detachFromVehicle(Vector3)`.
///
/// # Safety
/// `textlabel` must be a live `ITextLabel`.
pub fn textlabel_detach_from_vehicle(
textlabel: ITextLabel,
position: Vector3,
) = [0, SLOT_DETACH_FROM_VEHICLE];
/// `void ITextLabelBase::setTestLOS(bool)`.
///
/// # Safety
/// `textlabel` must be a live `ITextLabel`.
pub fn textlabel_set_test_los(textlabel: ITextLabel, status: bool) = [0, SLOT_SET_TEST_LOS];
/// `bool ITextLabelBase::getTestLOS()`.
///
/// # Safety
/// `textlabel` must be a live `ITextLabel`.
#[must_use]
pub fn textlabel_test_los(textlabel: ITextLabel) -> bool = [0, SLOT_GET_TEST_LOS] or false;
/// `void ITextLabelBase::setColourAndText(Colour, StringView)`.
///
/// # Safety
/// `textlabel` must be a live `ITextLabel`.
pub fn textlabel_set_colour_and_text(
textlabel: ITextLabel,
colour: Colour,
text: StringView,
) = [0, SLOT_SET_COLOUR_AND_TEXT];
/// `bool ITextLabel::isStreamedInForPlayer(const IPlayer &)`.
///
/// # Safety
/// `textlabel` must be a live `ITextLabel`.
#[must_use]
pub fn textlabel_is_streamed_in_for_player(
textlabel: ITextLabel,
player: *mut IPlayer,
) -> bool = [0, SLOT_IS_STREAMED_IN_FOR_PLAYER] or false;
/// `void ITextLabel::streamInForPlayer(IPlayer &)`.
///
/// # Safety
/// `textlabel` must be a live `ITextLabel`.
pub fn textlabel_stream_in_for_player(
textlabel: ITextLabel,
player: *mut IPlayer,
) = [0, SLOT_STREAM_IN_FOR_PLAYER];
/// `void ITextLabel::streamOutForPlayer(IPlayer &)`.
///
/// # Safety
/// `textlabel` must be a live `ITextLabel`.
pub fn textlabel_stream_out_for_player(
textlabel: ITextLabel,
player: *mut IPlayer,
) = [0, SLOT_STREAM_OUT_FOR_PLAYER];
}
/// `StringView ITextLabelBase::getText()`.
///
/// # Safety
/// `textlabel` must be a live `ITextLabel`.
#[must_use]
pub unsafe fn textlabel_text(textlabel: *mut ITextLabel) -> Option<String> {
let view = call_vtable_small_struct!(
textlabel.cast::<u8>(),
0,
SLOT_GET_TEXT,
StringView,
StringView::EMPTY
)?;
unsafe { view.to_owned_string() }
}
/// `Colour ITextLabelBase::getColour()`.
///
/// # Safety
/// `textlabel` must be a live `ITextLabel`.
#[must_use]
pub unsafe fn textlabel_colour(textlabel: *mut ITextLabel) -> Option<Colour> {
call_vtable_small_struct!(
textlabel.cast::<u8>(),
0,
SLOT_GET_COLOUR,
Colour,
Colour::default()
)
}