-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: 🐛 uniffi-bindgen-cpp doesn't support WithForeign (#63)
- Loading branch information
Showing
5 changed files
with
113 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
namespace dotlottie_player { | ||
}; | ||
|
||
[Trait] | ||
interface Observer { | ||
void on_load(); | ||
void on_play(); | ||
void on_pause(); | ||
void on_stop(); | ||
void on_frame(f32 frame_no); | ||
void on_render(f32 frame_no); | ||
void on_loop(u32 loop_count); | ||
void on_complete(); | ||
}; | ||
|
||
enum Mode { | ||
"Forward", | ||
"Reverse", | ||
"Bounce", | ||
"ReverseBounce" | ||
}; | ||
|
||
dictionary Config { | ||
boolean autoplay; | ||
boolean loop_animation; | ||
Mode mode; | ||
f32 speed; | ||
boolean use_frame_interpolation; | ||
sequence<f32> segments; | ||
u32 background_color; | ||
}; | ||
|
||
dictionary ManifestTheme { | ||
string id; | ||
sequence<string> values; | ||
}; | ||
|
||
dictionary ManifestThemes { | ||
sequence<ManifestTheme>? value; | ||
}; | ||
|
||
dictionary ManifestAnimation { | ||
boolean? autoplay; | ||
string? defaultTheme; | ||
i8? direction; | ||
boolean? hover; | ||
string id; | ||
u32? intermission; | ||
boolean? loop; | ||
u32? loop_count; | ||
string? playMode; | ||
u32? speed; | ||
string? themeColor; | ||
}; | ||
|
||
dictionary Manifest { | ||
string? active_animation_id; | ||
sequence<ManifestAnimation> animations; | ||
string? author; | ||
string? description; | ||
string? generator; | ||
string? keywords; | ||
u32? revision; | ||
ManifestThemes? themes; | ||
sequence<string>? states; | ||
string? version; | ||
}; | ||
|
||
interface DotLottiePlayer { | ||
constructor(Config config); | ||
boolean load_animation_data([ByRef] string animation_data, u32 width, u32 height); | ||
boolean load_animation_path([ByRef] string animation_path, u32 width, u32 height); | ||
boolean load_dotlottie_data([ByRef] bytes file_data, u32 width, u32 height); | ||
boolean load_animation([ByRef] string animation_id, u32 width, u32 height); | ||
Manifest? manifest(); | ||
string manifest_string(); | ||
u64 buffer_ptr(); | ||
u64 buffer_len(); | ||
void set_config(Config config); | ||
Config config(); | ||
f32 total_frames(); | ||
f32 duration(); | ||
f32 current_frame(); | ||
u32 loop_count(); | ||
boolean is_loaded(); | ||
boolean is_playing(); | ||
boolean is_paused(); | ||
boolean is_stopped(); | ||
boolean play(); | ||
boolean pause(); | ||
boolean stop(); | ||
f32 request_frame(); | ||
boolean set_frame(f32 no); | ||
boolean render(); | ||
boolean resize(u32 width, u32 height); | ||
void clear(); | ||
void subscribe(Observer observer); | ||
boolean is_complete(); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,10 @@ | ||
pub use dotlottie_fms::*; | ||
pub use dotlottie_player_core::*; | ||
|
||
uniffi::include_scaffolding!("dotlottie_player"); | ||
cfg_if::cfg_if! { | ||
if #[cfg(target_arch = "wasm32")] { | ||
uniffi::include_scaffolding!("dotlottie_player_cpp"); | ||
} else { | ||
uniffi::include_scaffolding!("dotlottie_player"); | ||
} | ||
} |