saving place

main
Elijah Voigt 1 year ago
parent f65d2eea63
commit f8bed3111f

@ -1,11 +1,12 @@
# [unstable] [unstable]
# codegen-backend = true codegen-backend = true
# [profile.dev] [profile.quick]
# codegen-backend = "cranelift" inherits = "dev"
codegen-backend = "cranelift"
# [profile.dev.package."*"] [profile.quick.package."*"]
# codegen-backend = "llvm" codegen-backend = "llvm"
# for Linux # for Linux
[target.x86_64-unknown-linux-gnu] [target.x86_64-unknown-linux-gnu]

@ -1,35 +1,72 @@
ifeq ($(PROFILE),release) ###
RELEASE = --release target/x86_64-unknown-linux-gnu/release/set: src/*
PROFILE = release cargo build --target x86_64-unknown-linux-gnu --features bevy/dynamic_linking --release
else
PROFILE = debug
endif
target/x86_64-unknown-linux-gnu/$(PROFILE)/set: src/* target/x86_64-unknown-linux-gnu/quick/set: src/*
cargo build --target x86_64-unknown-linux-gnu --features bevy/dynamic_linking $(RELEASE) cargo build --target x86_64-unknown-linux-gnu --features bevy/dynamic_linking --profile quick
###
target/wasm32-unknown-unknown/$(PROFILE)/set.wasm: src/* ###
cargo build --target wasm32-unknown-unknown $(RELEASE) target/wasm32-unknown-unknown/debug/set.wasm: src/*
cargo build --target wasm32-unknown-unknown
out/$(PROFILE)/set.js: target/wasm32-unknown-unknown/$(PROFILE)/set.wasm target/wasm32-unknown-unknown/release/set.wasm: src/*
wasm-bindgen --no-typescript --target web --out-dir "./out/$(PROFILE)" ./target/wasm32-unknown-unknown/$(PROFILE)/set.wasm cargo build --target wasm32-unknown-unknown --release
###
out/$(PROFILE)/assets: ###
rm -rf ./out/$(PROFILE)/assets out/debug/set.js: target/wasm32-unknown-unknown/debug/set.wasm
cp -r ./assets ./out/$(PROFILE)/ wasm-bindgen --no-typescript --target web --out-dir "./out/debug" ./target/wasm32-unknown-unknown/debug/set.wasm
out/$(PROFILE)/index.html: out/release/set.js: target/wasm32-unknown-unknown/release/set.wasm
cp index.html ./out/$(PROFILE)/index.html wasm-bindgen --no-typescript --target web --out-dir "./out/release" ./target/wasm32-unknown-unknown/release/set.wasm
###
native/build: target/x86_64-unknown-linux-gnu/$(PROFILE)/set ###
out/debug/assets:
rm -rf ./out/debug/assets
cp -r ./assets ./out/debug/
native/run: native/build out/release/assets:
cargo run --target x86_64-unknown-linux-gnu --features bevy/dynamic_linking $(RELEASE) rm -rf ./out/release/assets
cp -r ./assets ./out/release/
###
web/build: out/$(PROFILE)/set.js out/$(PROFILE)/assets out/$(PROFILE)/index.html ###
out/debug/index.html:
cp index.html ./out/debug/index.html
web/serve: web/build out/release/index.html:
cd ./out/$(PROFILE)/; simple-http-server cp index.html ./out/release/index.html
###
###
native/debug/build: target/x86_64-unknown-linux-gnu/quick/set
native/release/build: target/x86_64-unknown-linux-gnu/release/set
###
###
native/debug/run: native/debug/build
cargo run --target x86_64-unknown-linux-gnu --features bevy/dynamic_linking --profile quick
native/release/run: native/release/build
cargo run --target x86_64-unknown-linux-gnu --features bevy/dynamic_linking --release
###
###
web/debug/build: out/debug/set.js out/debug/assets out/debug/index.html
web/release/build: out/release/set.js out/release/assets out/release/index.html
###
###
web/debug/serve: web/debug/build
cd ./out/debug/; simple-http-server
web/release/serve: web/release/build
cd ./out/release/; simple-http-server
###
clean: clean:
rm ./target/*/*/set* rm ./target/*/*/set*

@ -28,10 +28,10 @@
]; ];
nativeBuildInputs = with pkgs; [ nativeBuildInputs = with pkgs; [
libxkbcommon libxkbcommon
(rust-bin.stable.latest.default.override { (rust-bin.selectLatestNightlyWith (toolchain: toolchain.default.override {
extensions = [ "rust-src" "clippy" ]; extensions = [ "rust-src" "clippy" "rustc-codegen-cranelift-preview" ];
targets = [ "x86_64-unknown-linux-gnu" "wasm32-unknown-unknown" ]; targets = [ "x86_64-unknown-linux-gnu" "wasm32-unknown-unknown" ];
}) }))
]; ];
all_deps = with pkgs; [ all_deps = with pkgs; [
cargo-flamegraph cargo-flamegraph

@ -165,6 +165,9 @@ fn setup_how_to_play(mut commands: Commands, deck: Res<Deck>) {
position_type: PositionType::Absolute, position_type: PositionType::Absolute,
width: Val::Percent(100.0), width: Val::Percent(100.0),
height: Val::Percent(100.0), height: Val::Percent(100.0),
align_items: AlignItems::Center,
justify_content: JustifyContent::Center,
flex_direction: FlexDirection::Column,
..default() ..default()
}, },
)) ))
@ -182,13 +185,14 @@ fn setup_how_to_play(mut commands: Commands, deck: Res<Deck>) {
.observe(button_set_state(ViewState::Menu)); .observe(button_set_state(ViewState::Menu));
parent.spawn((Node { parent.spawn((Node {
align_items: AlignItems::Center, align_items: AlignItems::Center,
justify_content: JustifyContent::Center, justify_content: JustifyContent::Center,
flex_direction: FlexDirection::Column, flex_direction: FlexDirection::Column,
..default() ..default()
}, },
BackgroundColor(BLACK.with_alpha(0.9).into()), BackgroundColor(BLACK.with_alpha(0.9).into()),
)).with_children(|parent| { )).with_children(|parent| {
parent.spawn((Text("How to Play".into()), TextFont::default().with_font_size(30.0)));
let most_matching = ( let most_matching = (
Card { Card {
color: ItemColor::Red, color: ItemColor::Red,
@ -255,7 +259,7 @@ fn setup_how_to_play(mut commands: Commands, deck: Res<Deck>) {
("For example all agree on Color, Shading, and Shape but not Number...", Some(most_matching)), ("For example all agree on Color, Shading, and Shape but not Number...", Some(most_matching)),
("...or all agree on Number but not Color, Number, Shading, and Shape...", Some(most_not_matching)), ("...or all agree on Number but not Color, Number, Shading, and Shape...", Some(most_not_matching)),
("...but never partial agreement on a trait...", Some(not_valid)), ("...but never partial agreement on a trait...", Some(not_valid)),
("When in doubt, click the 'Help!' button to get an assist", None), ("When in doubt, click the 'Help!' button to get an assist.", None),
] ]
.iter() .iter()
.for_each(|(t, example)| { .for_each(|(t, example)| {

Loading…
Cancel
Save