mirror of
https://git.kittycat.homes/zoe/codename-routes.git
synced 2024-08-15 03:18:26 +00:00
fuck around with native script
This commit is contained in:
parent
3317db5211
commit
3edf5d0633
3 changed files with 14 additions and 19 deletions
|
@ -12,5 +12,4 @@ crate-type = ["cdylib"]
|
||||||
gdnative = "0.10"
|
gdnative = "0.10"
|
||||||
tokio = {version = "1.18.0", features = ["sync"]}
|
tokio = {version = "1.18.0", features = ["sync"]}
|
||||||
lazy_static = "1.4.0"
|
lazy_static = "1.4.0"
|
||||||
strum = "0.24.0"
|
pathfinding = "3.0.12"
|
||||||
strum_macros = "0.24"
|
|
||||||
|
|
|
@ -1,23 +1,13 @@
|
||||||
use gdnative::{export::hint::EnumHint, prelude::*};
|
use gdnative::prelude::*;
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
use std::{string::ToString, vec};
|
|
||||||
use strum::IntoEnumIterator;
|
|
||||||
use strum_macros::{Display, EnumIter};
|
|
||||||
use tokio::sync::RwLock;
|
use tokio::sync::RwLock;
|
||||||
|
|
||||||
|
mod terrain;
|
||||||
|
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
// static ref STATE: RwLock<Vector3> = RwLock::new(Vector3::new(1.0, 2.0, 3.0));
|
// 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)]
|
#[derive(NativeClass)]
|
||||||
#[inherit(Node)]
|
#[inherit(Node)]
|
||||||
pub struct StateServer {
|
pub struct StateServer {
|
||||||
|
@ -28,9 +18,7 @@ pub struct StateServer {
|
||||||
#[methods]
|
#[methods]
|
||||||
impl StateServer {
|
impl StateServer {
|
||||||
fn new(_owner: &Node) -> Self {
|
fn new(_owner: &Node) -> Self {
|
||||||
StateServer {
|
StateServer { a: 9 }
|
||||||
a: 9,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[export]
|
#[export]
|
||||||
|
@ -38,7 +26,6 @@ impl StateServer {
|
||||||
godot_print!("hello, uwu")
|
godot_print!("hello, uwu")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[export]
|
#[export]
|
||||||
fn foo(&self, _owner: &Node) {
|
fn foo(&self, _owner: &Node) {
|
||||||
godot_print!("bar")
|
godot_print!("bar")
|
||||||
|
|
9
routes-native/src/stateserver/terrain.rs
Normal file
9
routes-native/src/stateserver/terrain.rs
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
use gdnative::prelude::*;
|
||||||
|
#[derive(Debug, FromVariant, ToVariant)]
|
||||||
|
enum Terrain {
|
||||||
|
Earth,
|
||||||
|
Rock,
|
||||||
|
Sand,
|
||||||
|
Water,
|
||||||
|
Air,
|
||||||
|
}
|
Loading…
Reference in a new issue