blob: 484391081c2900cd9c0e39d9ad73155504804bf1 (
plain)
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
|
use gdnative::prelude::*;
/// The HelloWorld "class"
#[derive(NativeClass)]
#[inherit(Node)]
pub struct HelloWorld;
#[methods]
impl HelloWorld {
fn new(_owner: &Node) -> Self {
HelloWorld
}
#[export]
fn _ready(&self, _owner: &Node) {
// The `godot_print!` macro works like `println!` but prints to the Godot-editor
// output tab as well.
godot_print!("Hello, world!");
}
}
// Function that registers all exposed classes to Godot
fn init(handle: InitHandle) {
// Register the new `HelloWorld` type we just declared.
handle.add_class::<HelloWorld>();
}
// Macro that creates the entry-points of the dynamic library.
godot_init!(init);
|