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
pub mod api;
pub mod component;
pub mod components;
pub mod entity;
pub mod graph_interpreter;
mod hash;
pub mod log;
pub mod registry;
pub mod the_truth;

pub use hash::hash;
pub use tm_sys::ffi;

pub use tm_sys::ffi::tm_vec2_t as Vec2;
pub use tm_sys::ffi::tm_vec3_t as Vec3;
pub use tm_sys::ffi::tm_vec4_t as Vec4;

#[doc(hidden)]
pub use paste;

#[macro_export]
macro_rules! tm_plugin {
    (|$reg:ident: &mut RegistryApi| $body:block) => {
        #[no_mangle]
        #[allow(clippy::missing_safety_doc)]
        pub unsafe extern "C" fn tm_load_plugin(
            reg: *mut $crate::ffi::tm_api_registry_api,
            load: bool,
        ) {
            let $reg = &mut $crate::registry::RegistryApi::new(reg, load);

            api::register::<EntityApi>($reg);
            api::register::<TheTruthApi>($reg);

            $body
        }
    };
}