brushed up
This commit is contained in:
parent
a92f19180e
commit
8f8a860dbb
6 changed files with 163 additions and 129 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -5,3 +5,4 @@ node_modules
|
||||||
dist
|
dist
|
||||||
.cache
|
.cache
|
||||||
.idea/
|
.idea/
|
||||||
|
.DS_Store
|
||||||
|
|
|
||||||
17
Dockerfile
Normal file
17
Dockerfile
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
FROM node:22-alpine AS build
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY package*.json ./
|
||||||
|
RUN npm ci
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
FROM nginx:alpine
|
||||||
|
|
||||||
|
COPY --from=build /app/dist /usr/share/nginx/html
|
||||||
|
|
||||||
|
EXPOSE 80
|
||||||
|
|
||||||
|
CMD ["nginx", "-g", "daemon off;"]
|
||||||
|
|
@ -1,14 +1,27 @@
|
||||||
html {
|
html {
|
||||||
|
color: #222;
|
||||||
background: rgb(249,235,213);
|
background: rgb(249,235,213);
|
||||||
font-size: 1em;
|
font-size: 1em;
|
||||||
line-height: 1.4;
|
line-height: 1.4;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
canvas {
|
||||||
|
color: black;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
font: 13px monospace, sans-serif;
|
||||||
|
color: black;
|
||||||
|
position: fixed;
|
||||||
|
left: 10px;
|
||||||
|
bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
#console {
|
#console {
|
||||||
font: 13px monospace, sans-serif;
|
font: 13px monospace, sans-serif;
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
color: black;
|
color: #222;
|
||||||
background: rgb(255,241,219);
|
background: rgb(255,241,219);
|
||||||
position: fixed;
|
position: fixed;
|
||||||
right: 1px;
|
right: 1px;
|
||||||
|
|
@ -18,6 +31,7 @@ html {
|
||||||
border: 2px solid darkgray;
|
border: 2px solid darkgray;
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
z-index: 0;
|
z-index: 0;
|
||||||
|
overflow: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
#help{
|
#help{
|
||||||
|
|
@ -45,7 +59,7 @@ html {
|
||||||
#log{
|
#log{
|
||||||
font: 13px monospace, sans-serif;
|
font: 13px monospace, sans-serif;
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
color: black;
|
color: #222;
|
||||||
background: rgb(255,241,219);
|
background: rgb(255,241,219);
|
||||||
position: fixed;
|
position: fixed;
|
||||||
right: 1px;
|
right: 1px;
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ moving_pillars(5, 10,1, false);
|
||||||
</textarea>
|
</textarea>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
<a href="https://git.sanderhautvast.nl/sander/szpakowski-lang">https://git.sanderhautvast.nl/sander/szpakowski-lang</a>
|
||||||
|
|
||||||
<span id="help" style="visibility: hidden"></span>
|
<span id="help" style="visibility: hidden"></span>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,7 @@ import {interpret} from "./interpreter.js";
|
||||||
canvas.clearRect(0, 0, width, height);
|
canvas.clearRect(0, 0, width, height);
|
||||||
canvas.lineWidth = 2;
|
canvas.lineWidth = 2;
|
||||||
canvas.globalAlpha = 1;
|
canvas.globalAlpha = 1;
|
||||||
canvas.strokeStyle = 'black';
|
canvas.strokeStyle = '#000';
|
||||||
canvas.fillStyle = 'black';
|
|
||||||
canvas_element.width = width;
|
canvas_element.width = width;
|
||||||
canvas_element.height = height;
|
canvas_element.height = height;
|
||||||
|
|
||||||
|
|
@ -71,10 +70,14 @@ import {interpret} from "./interpreter.js";
|
||||||
}
|
}
|
||||||
|
|
||||||
function refresh() {
|
function refresh() {
|
||||||
|
canvas.beginPath();
|
||||||
|
canvas.lineWidth = 1.8;
|
||||||
|
canvas.moveTo(0, 0);
|
||||||
script = command_input_element.value;
|
script = command_input_element.value;
|
||||||
try {
|
try {
|
||||||
canvas.clearRect(0, 0, width, height);
|
canvas.clearRect(0, 0, width, height);
|
||||||
interpret({canvas: canvas, x: tx, y: ty, angle: tangle, unit: 10, width: width, height: height}, script);
|
interpret({canvas: canvas, x: tx, y: ty, angle: tangle, unit: 10, width: width, height: height}, script);
|
||||||
|
canvas.stroke();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
document.getElementById('log').innerHTML = e;
|
document.getElementById('log').innerHTML = e;
|
||||||
}
|
}
|
||||||
|
|
@ -142,6 +145,6 @@ import {interpret} from "./interpreter.js";
|
||||||
}
|
}
|
||||||
//main
|
//main
|
||||||
refresh();
|
refresh();
|
||||||
})
|
})
|
||||||
();
|
();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -133,7 +133,6 @@ export function interpret(init_env, code) {
|
||||||
tx = x * unit;
|
tx = x * unit;
|
||||||
ty = y * unit;
|
ty = y * unit;
|
||||||
tangle = 0;
|
tangle = 0;
|
||||||
canvas.beginPath();
|
|
||||||
canvas.moveTo(x0 + tx, y0 + ty);
|
canvas.moveTo(x0 + tx, y0 + ty);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -141,7 +140,6 @@ export function interpret(init_env, code) {
|
||||||
tx += distance * unit * Math.cos(tangle);
|
tx += distance * unit * Math.cos(tangle);
|
||||||
ty += distance * unit * Math.sin(tangle);
|
ty += distance * unit * Math.sin(tangle);
|
||||||
canvas.lineTo(x0 + tx, y0 + ty);
|
canvas.lineTo(x0 + tx, y0 + ty);
|
||||||
canvas.stroke();
|
|
||||||
},
|
},
|
||||||
|
|
||||||
turn: (degrees) => {
|
turn: (degrees) => {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue