classicube_helpers\events/
texture.rs

1#![allow(clippy::not_unsafe_ptr_arg_deref)]
2
3use classicube_sys::{cc_string, Stream};
4
5use crate::make_event_handler;
6
7make_event_handler!(
8    /// Terrain atlas (terrain.png) is changed
9    Texture,
10    AtlasChanged,
11    Void,
12    ()
13);
14
15make_event_handler!(
16    /// Texture pack is changed
17    Texture,
18    PackChanged,
19    Void,
20    ()
21);
22
23make_event_handler!(
24    /// File in a texture pack is changed (terrain.png, rain.png)
25    Texture,
26    FileChanged,
27    Entry,
28    (
29        {
30            name: stream,
31            rust_type: *mut Stream,
32            c_type: *mut Stream,
33            to_rust: |a| a,
34        },
35        {
36            name: name,
37            rust_type: String,
38            c_type: *const cc_string,
39            to_rust: |name: *const cc_string| {
40                unsafe { name.as_ref().unwrap() }.to_string()
41            },
42        },
43    )
44);