Skip to main content

samp_sdk/omp/generated/
player_textdraws.rs

1//! `IPlayerTextDrawData` — generated by `cargo xtask gen-omp` from `Server/Components/TextDraws/textdraws.hpp`.
2//! Implemented by `PlayerTextDrawData` in the server's `TextDraws`.
3//!
4//! Do not edit: change `xtask/omp-wrappers.toml` or the generator and
5//! regenerate. Slots are clang's layout of the header for each ABI, checked
6//! against the official binaries by `cargo xtask check-abi --generated`.
7
8#![allow(unused_imports)]
9
10use crate::omp::containers::{FlatSet, HybridString, Pair, Span};
11use crate::omp::types::{
12    Colour, GTAQuat, Hours, Microseconds, Milliseconds, Minutes, Seconds, StringView, TimePoint,
13    UID, Vector2, Vector3, Vector4, WorldTimePoint,
14};
15use crate::omp::vtable::{call_vtable_small_struct, opaque, slots, virtual_fns};
16use crate::omp::*;
17
18opaque! {
19    /// Opaque handle for `IPlayerTextDrawData*`.
20    pub IPlayerTextDrawData;
21}
22
23/// `PlayerTextDrawData_UID` in `Server/Components/TextDraws/textdraws.hpp`.
24pub const PLAYER_TEXTDRAWS_UID: UID = 0xbf08495682312400;
25
26/// The player's `IPlayerTextDrawData`, or null when the component providing it is not loaded.
27///
28/// Found by walking the player's extension map for `PLAYER_TEXTDRAWS_UID` — the
29/// virtual `getExtension` does not consult that map. `IExtension`
30/// is `IPlayerTextDrawData`'s first base, so the extension pointer is the interface pointer.
31///
32/// # Safety
33/// `player` must be a live `IPlayer`.
34#[must_use]
35pub unsafe fn player_textdraws(player: *mut IPlayer) -> *mut IPlayerTextDrawData {
36    unsafe { extension(player.cast::<u8>(), PLAYER_TEXTDRAWS_UID) }.cast::<IPlayerTextDrawData>()
37}
38
39slots! {
40    /// `void IPlayerTextDrawData::beginSelection(Colour)`
41    SLOT_BEGIN_SELECTION: usize = 3, 3;
42    /// `bool IPlayerTextDrawData::isSelecting()`
43    SLOT_IS_SELECTING: usize = 4, 4;
44    /// `void IPlayerTextDrawData::endSelection()`
45    SLOT_END_SELECTION: usize = 5, 5;
46    /// `IPlayerTextDraw * IPlayerTextDrawData::create(Vector2, StringView)`
47    SLOT_CREATE: usize = 6, 7;
48    /// `IPlayerTextDraw * IPlayerTextDrawData::create(Vector2, int)`
49    SLOT_CREATE_PREVIEW: usize = 7, 6;
50}
51
52virtual_fns! {
53    /// `void IPlayerTextDrawData::beginSelection(Colour)`.
54    ///
55    /// # Safety
56    /// `data` must be a live `IPlayerTextDrawData`.
57    pub fn player_textdraws_begin_selection(
58        data: IPlayerTextDrawData,
59        highlight: Colour,
60    ) = [0, SLOT_BEGIN_SELECTION];
61
62    /// `bool IPlayerTextDrawData::isSelecting()`.
63    ///
64    /// # Safety
65    /// `data` must be a live `IPlayerTextDrawData`.
66    #[must_use]
67    pub fn player_textdraws_is_selecting(
68        data: IPlayerTextDrawData,
69    ) -> bool = [0, SLOT_IS_SELECTING] or false;
70
71    /// `void IPlayerTextDrawData::endSelection()`.
72    ///
73    /// # Safety
74    /// `data` must be a live `IPlayerTextDrawData`.
75    pub fn player_textdraws_end_selection(data: IPlayerTextDrawData) = [0, SLOT_END_SELECTION];
76
77    /// `IPlayerTextDraw * IPlayerTextDrawData::create(Vector2, StringView)`.
78    ///
79    /// # Safety
80    /// `data` must be a live `IPlayerTextDrawData`.
81    #[must_use]
82    pub fn player_textdraws_create(
83        data: IPlayerTextDrawData,
84        position: Vector2,
85        text: StringView,
86    ) -> *mut IPlayerTextDraw = [0, SLOT_CREATE] or std::ptr::null_mut();
87
88    /// `IPlayerTextDraw * IPlayerTextDrawData::create(Vector2, int)`.
89    ///
90    /// # Safety
91    /// `data` must be a live `IPlayerTextDrawData`.
92    #[must_use]
93    pub fn player_textdraws_create_preview(
94        data: IPlayerTextDrawData,
95        position: Vector2,
96        model: i32,
97    ) -> *mut IPlayerTextDraw = [0, SLOT_CREATE_PREVIEW] or std::ptr::null_mut();
98}