mirror of
https://github.com/lightsoutgames/godot-tts
synced 2024-11-22 16:25:57 +00:00
Bump to 0.9.0 preview API for godot-rust.
This commit is contained in:
parent
00aadde492
commit
6bbddcc6dd
|
@ -9,8 +9,8 @@ crate-type = ["staticlib", "cdylib"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
env_logger = "0.7"
|
env_logger = "0.7"
|
||||||
gdnative = "0.8"
|
gdnative = "0.9.0-preview.0"
|
||||||
tts = "0.6"
|
tts = { version = "0.6", path = "tts-rs" }
|
||||||
|
|
||||||
[target.'cfg(windows)'.dependencies]
|
[target.'cfg(windows)'.dependencies]
|
||||||
tolk = "0.2"
|
tolk = "0.2"
|
||||||
|
|
13
src/lib.rs
13
src/lib.rs
|
@ -1,5 +1,4 @@
|
||||||
use gdnative::init::*;
|
use gdnative::prelude::*;
|
||||||
use gdnative::*;
|
|
||||||
use tts::{Features, TTS as Tts};
|
use tts::{Features, TTS as Tts};
|
||||||
|
|
||||||
#[derive(NativeClass)]
|
#[derive(NativeClass)]
|
||||||
|
@ -9,7 +8,7 @@ struct TTS(Tts);
|
||||||
|
|
||||||
#[methods]
|
#[methods]
|
||||||
impl TTS {
|
impl TTS {
|
||||||
fn _init(_owner: gdnative::Node) -> Self {
|
fn new(_owner: &Node) -> Self {
|
||||||
let tts = Tts::default().unwrap();
|
let tts = Tts::default().unwrap();
|
||||||
Self(tts)
|
Self(tts)
|
||||||
}
|
}
|
||||||
|
@ -122,18 +121,18 @@ impl TTS {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[export]
|
#[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();
|
let message = message.to_string();
|
||||||
self.0.speak(message, interrupt).unwrap();
|
self.0.speak(message, interrupt).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[export]
|
#[export]
|
||||||
fn stop(&mut self, _owner: Node) {
|
fn stop(&mut self, _owner: &Node) {
|
||||||
self.0.stop().unwrap();
|
self.0.stop().unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[export]
|
#[export]
|
||||||
fn is_rate_supported(&mut self, _owner: Node) -> bool {
|
fn is_rate_supported(&mut self, _owner: &Node) -> bool {
|
||||||
let Features {
|
let Features {
|
||||||
rate: rate_supported,
|
rate: rate_supported,
|
||||||
..
|
..
|
||||||
|
@ -142,7 +141,7 @@ impl TTS {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn init(handle: gdnative::init::InitHandle) {
|
fn init(handle: InitHandle) {
|
||||||
env_logger::init();
|
env_logger::init();
|
||||||
handle.add_class::<TTS>();
|
handle.add_class::<TTS>();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user