diff --git a/assets/manifest.json b/assets/manifest.json index f85e117..5915701 100644 --- a/assets/manifest.json +++ b/assets/manifest.json @@ -1,6 +1,6 @@ { "name": "eGUI Circles", - "short_name": "circles", + "short_name": "egui-circles", "icons": [ { "src": "/icon-192.png", diff --git a/assets/sw.js b/assets/sw.js index 7ecd229..ce287b0 100644 --- a/assets/sw.js +++ b/assets/sw.js @@ -1,9 +1,9 @@ -var cacheName = 'egui-template-pwa'; +var cacheName = 'egui-circles'; var filesToCache = [ './', './index.html', - './eframe_template.js', - './eframe_template_bg.wasm', + './egui-circles.js', + './egui-circles_bg.wasm', ]; /* Start the service worker and cache all of the app's content */ diff --git a/docker/make-builder.sh b/docker/make-builder.sh deleted file mode 100755 index cdb8f9f..0000000 --- a/docker/make-builder.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash -set -euxo pipefail - -docker build --tag egui-circles-builder:0.0.1 . \ No newline at end of file diff --git a/docker/serve.sh b/docker/serve.sh deleted file mode 100755 index c3e8530..0000000 --- a/docker/serve.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -PROJECT_NAME=egui-circles - -docker run \ - --volume $(pwd)/..:/$PROJECT_NAME \ - --name vsc-$PROJECT_NAME \ - -p 8080:8080 \ - $PROJECT_NAME-builder:0.0.1 diff --git a/src/app.rs b/src/app.rs index f936714..9575161 100644 --- a/src/app.rs +++ b/src/app.rs @@ -32,6 +32,11 @@ impl eframe::App for Simulation { // Looks better on 4k montior ctx.set_pixels_per_point(1.5); + egui::TopBottomPanel::top("top_panel").show(ctx, |ui| { + // The top panel is often a good place for a menu bar: + egui::widgets::global_dark_light_mode_buttons(ui); + }); + egui::CentralPanel::default().show(ctx, |ui| { if ui.button("halt").clicked() { self.circles.iter_mut().for_each(|c| (*c).v = Vec2{x: 0.0, y: 0.0}); @@ -53,10 +58,10 @@ impl eframe::App for Simulation { self.circles.push(Circle::default()); self.colors.push( egui::Color32::from_rgba_premultiplied( - rand::thread_rng().gen_range(0..255), - rand::thread_rng().gen_range(0..255), - rand::thread_rng().gen_range(0..255), - 64) + rand::thread_rng().gen_range(64..255), + rand::thread_rng().gen_range(64..255), + rand::thread_rng().gen_range(64..255), + 128) ); } } @@ -92,7 +97,7 @@ impl eframe::App for Simulation { self.circles[i].c, self.circles[i].r, self.colors[i] /*Color32::TRANSPARENT*/, - Stroke{width: 2.0, color: Color32::from_rgb(255, 255, 255)} + Stroke{width: 2.0, color: Color32::from_rgb(200, 255, 255)} ); } }); diff --git a/docker/Dockerfile b/wasm32/Dockerfile similarity index 99% rename from docker/Dockerfile rename to wasm32/Dockerfile index b5bc6d7..f10be7b 100644 --- a/docker/Dockerfile +++ b/wasm32/Dockerfile @@ -9,4 +9,3 @@ ENTRYPOINT ["trunk"] CMD ["serve"] WORKDIR /egui-circles - diff --git a/wasm32/build.sh b/wasm32/build.sh new file mode 100755 index 0000000..5abe972 --- /dev/null +++ b/wasm32/build.sh @@ -0,0 +1,40 @@ +#!/usr/bin/env bash +set -euo pipefail + +NAME=egui-circles +BUILDER=djmil/$NAME-builder:0.0.1 +TRAGET=$NAME-wasm32 + +has_docker_image() { + docker manifest inspect $1 +} &> /dev/null + +has_docker_container() { + docker container inspect $1 +} &> /dev/null + +if ! has_docker_image $BUILDER; then + echo "Docker $BUILDER was not found" + + read -p "Would you like to create builder image (y/n)? " + case "$REPLY" in + y|Y ) + docker build --tag $BUILDER . ;; + * ) + exit 1 ;; + esac +fi + +echo "Initiate WASM32 target build.." + +if has_docker_container $TRAGET; then + docker start \ + $TRAGET \ + --attach +else + docker run \ + --volume $(pwd)/..:/$NAME \ + --name $TRAGET \ + $BUILDER \ + build --release +fi