codename-routes/routes-native/src/stateserver.rs

47 lines
841 B
Rust

use gdnative::{export::hint::EnumHint, prelude::*};
use lazy_static::lazy_static;
use std::{string::ToString, vec};
use strum::IntoEnumIterator;
use strum_macros::{Display, EnumIter};
use tokio::sync::RwLock;
lazy_static! {
// static ref STATE: RwLock<Vector3> = RwLock::new(Vector3::new(1.0, 2.0, 3.0));
}
#[derive(Debug, EnumIter, Display, FromVariant, ToVariant)]
enum Terrain {
Earth,
Rock,
Sand,
Water,
Air,
}
#[derive(NativeClass)]
#[inherit(Node)]
pub struct StateServer {
#[property]
a: u8,
}
#[methods]
impl StateServer {
fn new(_owner: &Node) -> Self {
StateServer {
a: 9,
}
}
#[export]
fn _ready(&self, _owner: &Node) {
godot_print!("hello, uwu")
}
#[export]
fn foo(&self, _owner: &Node) {
godot_print!("bar")
}
}