omp_gdk/scripting/textdraws/
events.rs

1#![allow(clippy::all)]
2use crate::{events::EventArgs, players::Player, runtime::each_module};
3
4use super::{PlayerTextDraw, TextDraw};
5
6#[repr(C)]
7pub struct OnPlayerCancelTextDrawSelectionArgs {
8    player: *const *const std::ffi::c_void,
9}
10
11#[no_mangle]
12pub unsafe extern "C" fn OMPRS_OnPlayerCancelTextDrawSelection(
13    args: *const EventArgs<OnPlayerCancelTextDrawSelectionArgs>,
14) {
15    each_module(move |mut script| {
16        script.on_player_cancel_text_draw_selection(Player::new(*(*(*args).list).player));
17        None
18    });
19}
20
21#[repr(C)]
22pub struct OnPlayerCancelPlayerTextDrawSelectionArgs {
23    player: *const *const std::ffi::c_void,
24}
25
26#[no_mangle]
27pub unsafe extern "C" fn OMPRS_OnPlayerCancelPlayerTextDrawSelection(
28    args: *const EventArgs<OnPlayerCancelPlayerTextDrawSelectionArgs>,
29) {
30    each_module(move |mut script| {
31        script.on_player_cancel_player_text_draw_selection(Player::new(*(*(*args).list).player));
32        None
33    });
34}
35
36#[repr(C)]
37pub struct OnPlayerClickTextDrawArgs {
38    player: *const *const std::ffi::c_void,
39    textdraw: *const *const std::ffi::c_void,
40}
41
42#[no_mangle]
43pub unsafe extern "C" fn OMPRS_OnPlayerClickTextDraw(
44    args: *const EventArgs<OnPlayerClickTextDrawArgs>,
45) {
46    each_module(move |mut script| {
47        script.on_player_click_text_draw(
48            Player::new(*(*(*args).list).player),
49            TextDraw::new(*(*(*args).list).textdraw),
50        );
51        None
52    });
53}
54
55#[repr(C)]
56pub struct OnPlayerClickPlayerTextDrawArgs {
57    player: *const *const std::ffi::c_void,
58    textdraw: *const *const std::ffi::c_void,
59}
60
61#[no_mangle]
62pub unsafe extern "C" fn OMPRS_OnPlayerClickPlayerTextDraw(
63    args: *const EventArgs<OnPlayerClickPlayerTextDrawArgs>,
64) {
65    each_module(move |mut script| {
66        script.on_player_click_player_text_draw(
67            Player::new(*(*(*args).list).player),
68            PlayerTextDraw::new(
69                *(*(*args).list).textdraw,
70                Player::new(*(*(*args).list).player),
71            ),
72        );
73        None
74    });
75}