diff --git a/Cargo.toml b/Cargo.toml index cd22c31..6c88a49 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,5 +8,5 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -gdnative = { git = "https://github.com/ndarilek/godot-rust/" } +gdnative = { git = "https://github.com/GodotNativeTools/godot-rust/" } tts = "0.2" diff --git a/appveyor.yml b/appveyor.yml index 0ac3a8d..e5c56cb 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -17,17 +17,14 @@ build: false test_script: - cargo build --release - # - cmd: mkdir -p staging\godot-tts\target\release - - cmd: copy target\release\*.dll staging\godot-tts\target\release - # - cmd: cd staging - # - cmd: 7z a ../windows.zip * - - sh: cp godot-tts.gdns staging/godot-tts - - sh: cp godot-tts.gdnlib.release staging/godot-tts/godot-tts.gdnlib - - sh: cp target/release/*.so target/godot-tts/target/release - - sh: cd target + - cmd: mkdir -p godot-tts\target\release + - cmd: copy target\release\*.dll godot-tts\target\release + - cmd: 7z a godot-tts-windows.zip godot-tts + - sh: cp godot-tts.gdns godot-tts + - sh: cp godot-tts.gdnlib.release godot-tts/godot-tts.gdnlib + - sh: cp target/release/*.so godot-tts/target/release - sh: zip -r9 godot-tts.zip godot-tts/ - sh: appveyor PushArtifact godot-tts.zip cache: - target - - staging diff --git a/src/lib.rs b/src/lib.rs index bea407f..3c2570f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,11 +1,43 @@ use gdnative::*; +use gdnative::init::*; use tts::{TTS as Tts}; -#[derive(gdnative::NativeClass)] -#[inherit(gdnative::Node)] struct TTS(Tts); +impl NativeClass for TTS { + type Base = Node; + type UserData = user_data::MutexData; + + fn class_name() -> &'static str { + "TTS" + } + + fn init(owner: Self::Base) -> Self { + Self::_init(owner) + } + + fn register_properties(builder: &ClassBuilder) { + builder.add_property(Property { + name: "rate", + default: 128, + hint: PropertyHint::Range { + range: 0.0..255.0, + step: 1., + slider: true, + }, + getter: |this: &TTS| { + let rate = this.0.get_rate().unwrap(); + rate + }, + setter: |this: &mut TTS, v: u8| { + this.0.set_rate(v).unwrap(); + }, + usage: PropertyUsage::DEFAULT, + }); + } +} + #[methods] impl TTS { fn _init(_owner: gdnative::Node) -> Self {