Web build script

This commit is contained in:
Pascal Engélibert 2022-08-28 00:10:41 +02:00
parent b70396ab72
commit 0ee61d808e
Signed by: tuxmain
GPG key ID: 3504BC6D362F7DCA
10 changed files with 82 additions and 26 deletions

7
Cargo.lock generated
View file

@ -1313,7 +1313,6 @@ dependencies = [
"parking_lot 0.12.1",
"stdweb",
"thiserror",
"wasm-bindgen",
"web-sys",
"windows",
]
@ -3760,7 +3759,7 @@ dependencies = [
"js-sys",
"log",
"naga",
"parking_lot 0.11.2",
"parking_lot 0.12.1",
"raw-window-handle 0.4.3",
"smallvec",
"wasm-bindgen",
@ -3785,7 +3784,7 @@ dependencies = [
"fxhash",
"log",
"naga",
"parking_lot 0.11.2",
"parking_lot 0.12.1",
"profiling",
"raw-window-handle 0.4.3",
"smallvec",
@ -3821,7 +3820,7 @@ dependencies = [
"metal",
"naga",
"objc",
"parking_lot 0.11.2",
"parking_lot 0.12.1",
"profiling",
"range-alloc",
"raw-window-handle 0.4.3",

View file

@ -24,7 +24,7 @@ serde_json = "1.0.85"
ticktock = "0.8.0"
[target."cfg(target_arch = \"wasm32\")".dependencies]
cpal = { version = "0.14.0", features = ["wasm-bindgen"] }
#cpal = { version = "0.14.0", features = ["wasm-bindgen"] }
[profile.dev.package."*"]
opt-level = 3

View file

@ -1,11 +1,15 @@
# Lux synthesĕ
[Play in browser](https://txmn.tk/projects/lux-synthese/)
## Controls
* **Move**: arrows
* **Switch character**: Tab
* **Level up**: Enter (when character is white)
* **Reset**: R
* **Fullscreen**: F11
* **Exit**: Escape
## TODO

Binary file not shown.

Binary file not shown.

View file

@ -59,10 +59,10 @@
{
"pos": [
0.0,
0.0
64.0
],
"font_size": 32.0,
"text": "Combine the colors to synthetize a white light.\nUse arrows to move."
"text": "Combine the colors\nto synthetize a white light.\nUse arrows to move."
}
]
},
@ -374,11 +374,11 @@
"texts": [
{
"pos": [
0.0,
-304.0,
-64.0
],
"font_size": 32.0,
"text": "Too much light\ncause some platforms to melt."
"text": "Too much light\ncauses some platforms to melt."
}
]
},

View file

@ -7,6 +7,7 @@ cp assets/* target/itchio/wasm/assets/
cp index.html target/itchio/wasm/
cp target/lux-synthese.js target/itchio/wasm/target/
cp target/lux-synthese_bg.wasm target/itchio/wasm/target/
jq -c < assets/game.levels.json > target/itchio/wasm/assets/game.levels.json
cd target/itchio/wasm
zip -r ../wasm.zip .

View file

@ -3,13 +3,61 @@
<head>
<meta charset="UTF-8"/>
<title>Lux synthesĕ</title>
<style type="text/css">
@font-face {
font-family: UacariLegacy;
font-weight: normal;
src: url("assets/UacariLegacy-Regular.ttf");
}
@font-face {
font-family: UacariLegacy;
font-weight: bold;
src: url("assets/UacariLegacy-Bold.ttf");
}
@font-face {
font-family: UacariLegacy-Thin;
src: url("assets/UacariLegacy-Thin.ttf");
}
html, body {
font-family: UacariLegacy;
margin: 0;
padding: 0;
background-color: #222;
}
body {
display: flex;
flex-flow: column;
color: white;
}
h1, h2 {
font-family: UacariLegacy-Thin;
font-weight: normal;
}
canvas {
order: 1;
max-width: 100vw;
max-height: 100vh;
margin: auto;
}
#readme {
order: 2;
width: 640px;
max-width: 100vw;
padding: 8px;
margin: auto;
}
a, a:visited {
color: #f80;
}
</style>
</head>
<body>
<script type="module">
import init from './target/bevyjam.js'
import init from './target/lux-synthese.js'
init()
</script>
<div>
<div id="readme">
<h1>Lux synthesĕ</h1>
<p>
<strong>Note</strong>: audio does not work in the WASM build.
@ -27,9 +75,9 @@ init()
</p>
<p>
GNU AGPL v3: CopyLeft 2022 Pascal Engélibert, Nixon Cheng<br/>
<em>Lux synthesĕ</em> is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, version 3 of the License.<br/>
<em>Lux synthesĕ</em> is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.<br/>
You should have received a copy of the GNU Affero General Public License along with <em>Lux synthesĕ</em>. If not, see <a href="https://www.gnu.org/licenses/">https://www.gnu.org/licenses/</a>.
Lux synthesĕ is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, version 3 of the License.<br/>
Lux synthesĕ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.<br/>
You should have received a copy of the GNU Affero General Public License along with Lux synthesĕ. If not, see <a href="https://www.gnu.org/licenses/">https://www.gnu.org/licenses/</a>.
</p>
</div>
</body>

View file

@ -300,11 +300,7 @@ fn char_char_collision_event_system(
mut commands: Commands,
mut collision_events: EventReader<CollisionEvent>,
character_query: Query<(
&CharacterColor,
&Transform,
Option<&Player>,
)>,
character_query: Query<(&CharacterColor, &Transform, Option<&Player>)>,
mut character_list: ResMut<CharacterList>,
mut app_state: ResMut<State<AppState>>,

View file

@ -13,7 +13,7 @@ mod particle_effect;
use bevy::{
asset::{Asset, HandleId, LoadState},
prelude::*,
window::{WindowId, WindowMode},
window::{WindowMode, WindowResizeConstraints},
};
use bevy_common_assets::json::JsonAssetPlugin;
use bevy_rapier2d::prelude::*;
@ -58,6 +58,19 @@ fn main() {
let mut app = App::new();
app.insert_resource(Msaa { samples: 4 })
.insert_resource(WindowDescriptor {
width: 640.0,
height: 480.0,
resize_constraints: WindowResizeConstraints {
min_width: 256.,
min_height: 256.,
max_width: f32::INFINITY,
max_height: f32::INFINITY,
},
resizable: true,
title: "Lux synthesĕ".into(),
..Default::default()
})
.insert_resource(audio_event_sender)
.insert_resource(UseEditor(use_editor))
.add_state(AppState::Loading)
@ -88,12 +101,7 @@ fn main() {
.run();
}
fn setup(mut commands: Commands, mut windows: ResMut<Windows>, asset_server: Res<AssetServer>) {
windows
.get_mut(WindowId::primary())
.unwrap()
.set_title(String::from("Bevyjam"));
fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
let mut assets = LoadingAssets(Vec::new());
commands.insert_resource(
assets.add(asset_server.load::<levels::StoredLevels, _>("game.levels.json")),