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
define_api_id!(0xbb0f_0dfe_ff53_2a59, "applet-v4");

pub use super::applet_v3::*;

pub type PlayerIdRepr = u64;

#[ark_api_macros::ark_bindgen(imports = "ark-applet-v4")]
mod applet {
    use super::PlayerIdRepr;

    #[repr(u32)]
    #[derive(Copy, Clone, Debug, Hash, Eq, PartialEq)]
    #[cfg_attr(feature = "with_serde", derive(serde::Serialize, serde::Deserialize))]
    #[cfg_attr(feature = "with_speedy", derive(speedy::Writable, speedy::Readable))]
    #[cfg_attr(feature = "with_arbitrary", derive(arbitrary::Arbitrary))]
    pub enum CursorShape {
        /// The platform-dependent default cursor.
        Default = 0,
        /// A simple crosshair.
        Crosshair = 1,
        /// A hand (often used to indicate links in web browsers).
        Hand = 2,
        /// Self explanatory.
        Arrow = 3,
        /// Indicates something is to be moved.
        Move = 4,
        /// Indicates text that may be selected or edited.
        Text = 5,
        /// Program busy indicator.
        Wait = 6,
        /// Help indicator (often rendered as a "?")
        Help = 7,
        /// Progress indicator. Shows that processing is being done. But in contrast
        /// with "Wait" the user may still interact with the program. Often rendered
        /// as a spinning beach ball, or an arrow with a watch or hourglass.
        Progress = 8,

        /// Cursor showing that something cannot be done.
        NotAllowed = 9,
        ContextMenu = 10,
        Cell = 11,
        VerticalText = 12,
        Alias = 13,
        Copy = 14,
        NoDrop = 15,
        /// Indicates something can be grabbed.
        Grab = 16,
        /// Indicates something is grabbed.
        Grabbing = 17,
        AllScroll = 18,
        ZoomIn = 19,
        ZoomOut = 20,

        /// Indicate that some edge is to be moved. For example, the 'SeResize' cursor
        /// is used when the movement starts from the south-east corner of the box.
        EResize = 21,
        NResize = 22,
        NEResize = 23,
        NWResize = 24,
        SResize = 25,
        SEResize = 26,
        SWResize = 27,
        WResize = 28,
        EWResize = 29,
        NSResize = 30,
        NESWResize = 31,
        NWSEResize = 32,
        ColResize = 33,
        RowResize = 34,
    }

    extern "C" {
        /// Describes the appearance of the mouse cursor.
        #[deprecated_infallible]
        pub fn set_cursor_shape(shape: CursorShape);

        /// Retrieves module launch argument string
        ///
        /// This is an arbitrary string argument that can be passed in to the module from an Ark module link
        ///
        /// note: This should really been called `launch_argument_string` (without the `get_`) prefix, should fix for a future breaking version
        #[deprecated_infallible]
        pub fn get_launch_argument_string(out_string: &mut [u8]) -> u32;

        /// Launch another applet module given an valid Ark module URL
        #[deprecated_infallible]
        pub fn launch_applet_with_url(url: &str);

        /// Requests that the applet is terminated gracefully.
        ///
        /// The module will not quit immediately but will continue running its current update loop.
        ///
        /// The host is free to ignore this request, delay it, or ask the user for confirmation.
        #[deprecated_infallible]
        fn request_quit();

        /// The size of the allocation in bytes for the a given [`crate::applet_v0::EventType`] of a specific player.
        ///
        /// `ty`: The [`crate::applet_v0::EventType`] of the event
        /// `id`: Which player you want the event size from
        #[deprecated_infallible]
        pub fn event_size(ty: u32, id: PlayerIdRepr) -> u32;

        /// Writes all events for a given [`crate::applet_v0::EventType`] into `out_events` for a specific player.
        ///
        /// `ty`: The [`crate::applet_v0::EventType`] of the event
        /// `id`: Which player you want the events from
        /// `out_events`: The ptr where the events are written to
        #[deprecated_infallible]
        pub fn retrieve_events(ty: u32, id: PlayerIdRepr, out_events: &mut [u8]);
    }
}

pub use applet::safe as safe_v4;
pub use applet::CursorShape;
#[cfg(not(target_arch = "wasm32"))]
pub use applet::HostShim as HostShim_v4;