Registry / Framework

framework · v0.1.2
Scene Stream
Load a destination game scene before detaching the current scene and discard stale load callbacks.
Use Scene Stream
use vendor::scene_stream::scene_stream;
Run the example
nest demo scene_stream@0.1.2
blyxc native-run scene_stream-demo/main.blyx
Example source and expected output
use std::cli;
use std::text;
use vendor::scene_stream::scene_stream;
fn main() {
let arguments = cli_args();
if args_len(arguments) > 0 {
if args_len(arguments) % 2 != 0 {
stderr_line("Expected event and value pairs");
process_exit(2);
}
let mut live = scene_stream_start();
let mut i = 0;
while i < args_len(arguments) {
let input = args_at(arguments, i + 1);
if !text_is_number(input) {
stderr_line("Expected a whole numeric event value");
process_exit(2);
}
live = scene_stream_step(live, args_at(arguments, i), text_number(input));
let command = scene_stream_command(live);
println!(command);
if command == "reject" { process_exit(1); }
i += 2;
}
return;
}
let mut state = scene_stream_start();
state = scene_stream_step(state, "go", 5.0);
println!(scene_stream_command(state));
state = scene_stream_step(state, "go", 6.0);
println!(scene_stream_command(state));
state = scene_stream_step(state, "loaded", 5.0);
println!(scene_stream_command(state));
state = scene_stream_step(state, "loaded", 6.0);
println!(scene_stream_command(state));
state = scene_stream_step(state, "active", 6.0);
println!(scene_stream_command(state));
}
Expected output
load_scene
replace_request
reject
attach_scene
detach_previous
Published versions
| Version | Package | Source commit | SHA-256 |
|---|---|---|---|
| 0.1.2 | Download ZIP · Browse files | cbf683ed50 | e327c96fea6343adc1325a16f25768998f4a976386abab4015597bf7f9bf28c7 |
| 0.1.1 | Download ZIP · Browse files | 07c98cfb49 | f26653773a480ea969af857da4b1fb3b344106ac481ac56263b6581f5ed93597 |
| 0.1.0 | Download ZIP · Browse files | 6349f23784 | ed567df6a57aadca1c9480d732f69c6c843e22ae9ed756b607c93935e5cfa643 |