rust-samp-sdk 3.6.0

Low-level FFI bindings for the SA-MP AMX virtual machine and open.mp native component ABI. Used internally by `rust-samp`; depend on it directly only if you need raw access without the higher-level macros and lifecycle.
Documentation
//! `IPlayerTextDrawData` — generated by `cargo xtask gen-omp` from `Server/Components/TextDraws/textdraws.hpp`.
//! Implemented by `PlayerTextDrawData` in the server's `TextDraws`.
//!
//! 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::*;

opaque! {
    /// Opaque handle for `IPlayerTextDrawData*`.
    pub IPlayerTextDrawData;
}

/// `PlayerTextDrawData_UID` in `Server/Components/TextDraws/textdraws.hpp`.
pub const PLAYER_TEXTDRAWS_UID: UID = 0xbf08495682312400;

/// The player's `IPlayerTextDrawData`, or null when the component providing it is not loaded.
///
/// Found by walking the player's extension map for `PLAYER_TEXTDRAWS_UID` — the
/// virtual `getExtension` does not consult that map. `IExtension`
/// is `IPlayerTextDrawData`'s first base, so the extension pointer is the interface pointer.
///
/// # Safety
/// `player` must be a live `IPlayer`.
#[must_use]
pub unsafe fn player_textdraws(player: *mut IPlayer) -> *mut IPlayerTextDrawData {
    unsafe { extension(player.cast::<u8>(), PLAYER_TEXTDRAWS_UID) }.cast::<IPlayerTextDrawData>()
}

slots! {
    /// `void IPlayerTextDrawData::beginSelection(Colour)`
    SLOT_BEGIN_SELECTION: usize = 3, 3;
    /// `bool IPlayerTextDrawData::isSelecting()`
    SLOT_IS_SELECTING: usize = 4, 4;
    /// `void IPlayerTextDrawData::endSelection()`
    SLOT_END_SELECTION: usize = 5, 5;
    /// `IPlayerTextDraw * IPlayerTextDrawData::create(Vector2, StringView)`
    SLOT_CREATE: usize = 6, 7;
    /// `IPlayerTextDraw * IPlayerTextDrawData::create(Vector2, int)`
    SLOT_CREATE_PREVIEW: usize = 7, 6;
}

virtual_fns! {
    /// `void IPlayerTextDrawData::beginSelection(Colour)`.
    ///
    /// # Safety
    /// `data` must be a live `IPlayerTextDrawData`.
    pub fn player_textdraws_begin_selection(
        data: IPlayerTextDrawData,
        highlight: Colour,
    ) = [0, SLOT_BEGIN_SELECTION];

    /// `bool IPlayerTextDrawData::isSelecting()`.
    ///
    /// # Safety
    /// `data` must be a live `IPlayerTextDrawData`.
    #[must_use]
    pub fn player_textdraws_is_selecting(
        data: IPlayerTextDrawData,
    ) -> bool = [0, SLOT_IS_SELECTING] or false;

    /// `void IPlayerTextDrawData::endSelection()`.
    ///
    /// # Safety
    /// `data` must be a live `IPlayerTextDrawData`.
    pub fn player_textdraws_end_selection(data: IPlayerTextDrawData) = [0, SLOT_END_SELECTION];

    /// `IPlayerTextDraw * IPlayerTextDrawData::create(Vector2, StringView)`.
    ///
    /// # Safety
    /// `data` must be a live `IPlayerTextDrawData`.
    #[must_use]
    pub fn player_textdraws_create(
        data: IPlayerTextDrawData,
        position: Vector2,
        text: StringView,
    ) -> *mut IPlayerTextDraw = [0, SLOT_CREATE] or std::ptr::null_mut();

    /// `IPlayerTextDraw * IPlayerTextDrawData::create(Vector2, int)`.
    ///
    /// # Safety
    /// `data` must be a live `IPlayerTextDrawData`.
    #[must_use]
    pub fn player_textdraws_create_preview(
        data: IPlayerTextDrawData,
        position: Vector2,
        model: i32,
    ) -> *mut IPlayerTextDraw = [0, SLOT_CREATE_PREVIEW] or std::ptr::null_mut();
}