diff --git a/Cargo.toml b/Cargo.toml index 70f2cdd..31bb957 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,7 +22,7 @@ default = [ [dependencies] winit = {version = "0.24.0", features = ["web-sys"]} -bevy = {version = "0.4.0", default-features = false} +bevy = { git = "https://github.com/bevyengine/bevy/", rev="c2a427f1a38db6b1d9798e631a7da7a8507fe18c", default-features=false } regex = "1.4" cfg-if = "1.0.0" js-sys = "0.3.45" @@ -46,8 +46,8 @@ web-sys = {version = "0.3.45", features = [ [dev-dependencies] compile-time-run = "0.2" -rand = "0.7" -getrandom = {version="0.1", features=["wasm-bindgen"]} +rand = "0.8" +getrandom = { version = "0.1", features = ["wasm-bindgen"] } [profile.release] opt-level = 's' @@ -64,7 +64,7 @@ name = "sprite_sheet" path = "examples/2d/sprite_sheet.rs" # disabled as it do not compile on github Actions -# [[example]] +#[[example]] # name = "contributors" # path = "examples/2d/contributors.rs" diff --git a/examples/2d/contributors.rs b/examples/2d/contributors.rs index 88e1d40..061338f 100644 --- a/examples/2d/contributors.rs +++ b/examples/2d/contributors.rs @@ -1,6 +1,10 @@ use bevy::prelude::*; use rand::{prelude::SliceRandom, Rng}; -use std::collections::BTreeSet; +use std::{ + collections::BTreeSet, + io::{BufRead, BufReader}, + process::Stdio, +}; fn main() { App::build() @@ -36,8 +40,8 @@ struct Velocity { const GRAVITY: f32 = -9.821 * 100.0; const SPRITE_SIZE: f32 = 75.0; -const COL_DESELECTED: Color = Color::rgb_linear(0.03, 0.03, 0.03); -const COL_SELECTED: Color = Color::rgb_linear(5.0, 5.0, 5.0); +const COL_DESELECTED: Color = Color::rgba_linear(0.03, 0.03, 0.03, 0.92); +const COL_SELECTED: Color = Color::WHITE; const SHOWCASE_TIMER_SECS: f32 = 3.0; @@ -47,11 +51,12 @@ fn setup( mut materials: ResMut>, ) { let contribs = contributors(); + let texture_handle = asset_server.load("branding/icon.png"); commands - .spawn(Camera2dBundle::default()) - .spawn(CameraUiBundle::default()); + .spawn(OrthographicCameraBundle::new_2d()) + .spawn(UiCameraBundle::default()); let mut sel = ContributorSelection { order: vec![], @@ -61,15 +66,15 @@ fn setup( let mut rnd = rand::thread_rng(); for name in contribs { - let pos = (rnd.gen_range(-400.0, 400.0), rnd.gen_range(0.0, 400.0)); - let dir = rnd.gen_range(-1.0, 1.0); + let pos = (rnd.gen_range(-400.0..400.0), rnd.gen_range(0.0..400.0)); + let dir = rnd.gen_range(-1.0..1.0); let velocity = Vec3::new(dir * 500.0, 0.0, 0.0); let col = gen_color(&mut rnd); // some sprites should be flipped let flipped = rnd.gen_bool(0.5); - let mut transform = Transform::from_translation(Vec3::new(pos.0, pos.1, 0.0)); + let mut transform = Transform::from_xyz(pos.0, pos.1, 0.0); transform.scale.x *= if flipped { -1.0 } else { 1.0 }; commands @@ -108,13 +113,25 @@ fn setup( ..Default::default() }, text: Text { - value: "Contributor showcase".to_string(), - font: asset_server.load("fonts/FiraSans-Bold.ttf"), - style: TextStyle { - font_size: 60.0, - color: Color::WHITE, - ..Default::default() - }, + sections: vec![ + TextSection { + value: "Contributor showcase".to_string(), + style: TextStyle { + font: asset_server.load("fonts/FiraSans-Bold.ttf"), + font_size: 60.0, + color: Color::WHITE, + }, + }, + TextSection { + value: "".to_string(), + style: TextStyle { + font: asset_server.load("fonts/FiraSans-Bold.ttf"), + font_size: 60.0, + color: Color::WHITE, + }, + }, + ], + ..Default::default() }, ..Default::default() }); @@ -127,9 +144,9 @@ fn select_system( mut materials: ResMut>, mut sel: ResMut, mut dq: Query, With>, - time: Res