mirror of
https://github.com/lightsoutgames/godot-tts
synced 2024-12-22 11:25:57 +00:00
Add rate
property.
This commit is contained in:
parent
bc46bbad60
commit
ca79ca99bd
|
@ -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"
|
||||
|
|
15
appveyor.yml
15
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
|
||||
|
|
36
src/lib.rs
36
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<TTS>;
|
||||
|
||||
fn class_name() -> &'static str {
|
||||
"TTS"
|
||||
}
|
||||
|
||||
fn init(owner: Self::Base) -> Self {
|
||||
Self::_init(owner)
|
||||
}
|
||||
|
||||
fn register_properties(builder: &ClassBuilder<Self>) {
|
||||
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 {
|
||||
|
|
Loading…
Reference in New Issue
Block a user