fuck around with native script

This commit is contained in:
zoe 2022-05-01 23:49:48 +02:00
parent 3317db5211
commit 3edf5d0633
3 changed files with 14 additions and 19 deletions

View File

@ -12,5 +12,4 @@ crate-type = ["cdylib"]
gdnative = "0.10"
tokio = {version = "1.18.0", features = ["sync"]}
lazy_static = "1.4.0"
strum = "0.24.0"
strum_macros = "0.24"
pathfinding = "3.0.12"

View File

@ -1,23 +1,13 @@
use gdnative::{export::hint::EnumHint, prelude::*};
use gdnative::prelude::*;
use lazy_static::lazy_static;
use std::{string::ToString, vec};
use strum::IntoEnumIterator;
use strum_macros::{Display, EnumIter};
use tokio::sync::RwLock;
mod terrain;
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 {
@ -28,9 +18,7 @@ pub struct StateServer {
#[methods]
impl StateServer {
fn new(_owner: &Node) -> Self {
StateServer {
a: 9,
}
StateServer { a: 9 }
}
#[export]
@ -38,7 +26,6 @@ impl StateServer {
godot_print!("hello, uwu")
}
#[export]
fn foo(&self, _owner: &Node) {
godot_print!("bar")

View File

@ -0,0 +1,9 @@
use gdnative::prelude::*;
#[derive(Debug, FromVariant, ToVariant)]
enum Terrain {
Earth,
Rock,
Sand,
Water,
Air,
}