diff --git a/Cargo.toml b/Cargo.toml index 71dad95..a119e9d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,8 +9,8 @@ crate-type = ["staticlib", "cdylib"] [dependencies] env_logger = "0.7" -gdnative = "0.8" -tts = "0.6" +gdnative = "0.9.0-preview.0" +tts = { version = "0.6", path = "tts-rs" } [target.'cfg(windows)'.dependencies] tolk = "0.2" diff --git a/src/lib.rs b/src/lib.rs index 47f111b..9f172fe 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,5 +1,4 @@ -use gdnative::init::*; -use gdnative::*; +use gdnative::prelude::*; use tts::{Features, TTS as Tts}; #[derive(NativeClass)] @@ -9,7 +8,7 @@ struct TTS(Tts); #[methods] impl TTS { - fn _init(_owner: gdnative::Node) -> Self { + fn new(_owner: &Node) -> Self { let tts = Tts::default().unwrap(); Self(tts) } @@ -122,18 +121,18 @@ impl TTS { } #[export] - fn speak(&mut self, _owner: Node, message: GodotString, interrupt: bool) { + fn speak(&mut self, _owner: &Node, message: GodotString, interrupt: bool) { let message = message.to_string(); self.0.speak(message, interrupt).unwrap(); } #[export] - fn stop(&mut self, _owner: Node) { + fn stop(&mut self, _owner: &Node) { self.0.stop().unwrap(); } #[export] - fn is_rate_supported(&mut self, _owner: Node) -> bool { + fn is_rate_supported(&mut self, _owner: &Node) -> bool { let Features { rate: rate_supported, .. @@ -142,7 +141,7 @@ impl TTS { } } -fn init(handle: gdnative::init::InitHandle) { +fn init(handle: InitHandle) { env_logger::init(); handle.add_class::(); }