1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use gdnative::prelude::*;

#[derive(NativeClass)]
#[inherit(Node)]
pub struct Check;

pub const VERSION: &'static str = env!("CARGO_PKG_VERSION");

#[methods]
impl Check {
    fn new(_owner: &Node) -> Self {
        Check
    }

    #[export]
    fn ping(&self, _owner: &Node) -> GodotString {
        return GodotString::from_str("pong");
    }

    #[export]
    fn version(&self, _owner: &Node) -> GodotString {
        return GodotString::from_str(VERSION);
    }
}