From fdbba87b346c6020d7349d0c2cb3793fcdab25f3 Mon Sep 17 00:00:00 2001 From: cel Date: Sat, 16 Jul 2022 22:42:19 +0100 Subject: add menu and switch die code from rust to gdscript --- rust/src/game.rs | 44 -------------------------------------------- 1 file changed, 44 deletions(-) delete mode 100644 rust/src/game.rs (limited to 'rust/src/game.rs') diff --git a/rust/src/game.rs b/rust/src/game.rs deleted file mode 100644 index 61b23ed..0000000 --- a/rust/src/game.rs +++ /dev/null @@ -1,44 +0,0 @@ -use gdnative::api::*; -use gdnative::prelude::*; - -/// The Game "class" -#[derive(NativeClass)] -#[inherit(Spatial)] -#[register_with(Self::register_builder)] -pub struct Game { - name: String, -} - -// __One__ `impl` block can have the `#[methods]` attribute, which will generate -// code to automatically bind any exported methods to Godot. -#[methods] -impl Game { - // Register the builder for methods, properties and/or signals. - fn register_builder(_builder: &ClassBuilder) { - godot_print!("Game builder is registered!"); - } - - /// The "constructor" of the class. - fn new(_owner: &Spatial) -> Self { - godot_print!("Game is created!"); - Game { - name: "".to_string(), - } - } - - // In order to make a method known to Godot, the #[export] attribute has to be used. - // In Godot script-classes do not actually inherit the parent class. - // Instead they are "attached" to the parent object, called the "owner". - // The owner is passed to every single exposed method. - #[export] - unsafe fn _ready(&mut self, _owner: &Spatial) { - // The `godot_print!` macro works like `println!` but prints to the Godot-editor - // output tab as well. - self.name = "Game".to_string(); - godot_print!("{} is ready!", self.name); - } - - // This function will be called in every frame - #[export] - unsafe fn _process(&self, _owner: &Spatial, _delta: f64) { } -} -- cgit