wasm32 build target #10
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "eGUI Circles",
|
||||
"short_name": "circles",
|
||||
"short_name": "egui-circles",
|
||||
"icons": [
|
||||
{
|
||||
"src": "/icon-192.png",
|
||||
|
@ -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 */
|
||||
|
@ -1,4 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euxo pipefail
|
||||
|
||||
docker build --tag egui-circles-builder:0.0.1 .
|
@ -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
|
15
src/app.rs
15
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)}
|
||||
);
|
||||
}
|
||||
});
|
||||
|
@ -9,4 +9,3 @@ ENTRYPOINT ["trunk"]
|
||||
CMD ["serve"]
|
||||
|
||||
WORKDIR /egui-circles
|
||||
|
40
wasm32/build.sh
Executable file
40
wasm32/build.sh
Executable file
@ -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
|
Loading…
Reference in New Issue
Block a user