From a039ef94d1875352b9b9e8432da726d43794c880 Mon Sep 17 00:00:00 2001 From: raphael Date: Wed, 27 Nov 2024 12:25:53 +0100 Subject: [PATCH 1/9] refactor: update CSS and images files path to include them in a static file - Include static file serving in server.js - Inlucde new musuem path in build.sh --- build.sh | 6 +- index.html.template | 56 ++------------- server.js | 10 ++- static/css/.gitkeep | 0 static/css/base.css | 64 ++++++++++++++++++ static/css/rainbow.css | 42 ++++++++++++ {museum => static/museum}/18Plusger.png | Bin {museum => static/museum}/Adelieger.png | Bin {museum => static/museum}/Baldger.png | Bin {museum => static/museum}/Blenger.png | Bin {museum => static/museum}/BlueWolologer.png | Bin {museum => static/museum}/Camelger.png | Bin {museum => static/museum}/Camellow.png | Bin {museum => static/museum}/Capger.png | Bin .../museum}/CapgerSaysTransRights.png | Bin {museum => static/museum}/CephonPenger.png | Bin {museum => static/museum}/Clipenger.png | Bin {museum => static/museum}/Clownger.png | Bin {museum => static/museum}/Coffeeger.png | Bin {museum => static/museum}/Cookger.png | Bin {museum => static/museum}/Copeger.png | Bin {museum => static/museum}/Criminalger.png | Bin {museum => static/museum}/Cryger.png | Bin {museum => static/museum}/CrygerBlood.png | Bin {museum => static/museum}/CrygerChernobyl.png | Bin {museum => static/museum}/Cyberger.png | Bin {museum => static/museum}/DarthPenger.png | Bin {museum => static/museum}/Deadger.png | Bin {museum => static/museum}/Demureger.png | Bin {museum => static/museum}/Disger.png | Bin {museum => static/museum}/DoctorPenger.png | Bin {museum => static/museum}/Doomger.png | Bin {museum => static/museum}/EvilCyberger.png | Bin {museum => static/museum}/Factoryger.png | Bin {museum => static/museum}/Fatger.png | Bin {museum => static/museum}/Ferrisger.png | Bin {museum => static/museum}/Fesh.png | Bin {museum => static/museum}/Feshger.png | Bin {museum => static/museum}/Frankenpenger.png | Bin {museum => static/museum}/FullCookger.png | Bin {museum => static/museum}/GNUPenger.png | Bin {museum => static/museum}/Geniusger.png | Bin {museum => static/museum}/Ghostger.png | Bin {museum => static/museum}/Ghostyger.png | Bin {museum => static/museum}/Githubger.png | Bin {museum => static/museum}/Goldger.png | Bin {museum => static/museum}/Gonger.png | Bin {museum => static/museum}/Gopnikger.png | Bin {museum => static/museum}/Grubenger.png | Bin {museum => static/museum}/Gunger.png | Bin {museum => static/museum}/HDPenger.png | Bin {museum => static/museum}/Hackger.png | Bin {museum => static/museum}/Heisenberger.png | Bin {museum => static/museum}/HolyCPenger.png | Bin {museum => static/museum}/Holyger.png | Bin {museum => static/museum}/Hoodger.png | Bin {museum => static/museum}/Howdyger.png | Bin {museum => static/museum}/Ideager.png | Bin {museum => static/museum}/JPenger.png | Bin {museum => static/museum}/Jonkger.png | Bin {museum => static/museum}/Kidger.png | Bin {museum => static/museum}/Knightger.png | Bin {museum => static/museum}/Laptopger.png | Bin {museum => static/museum}/Luigiger.png | Bin {museum => static/museum}/Macger.png | Bin {museum => static/museum}/Madger.png | Bin {museum => static/museum}/Malger.png | Bin {museum => static/museum}/Marioger.png | Bin {museum => static/museum}/Michaelger.png | Bin {museum => static/museum}/Millhouseger.png | Bin {museum => static/museum}/Mineger.png | Bin {museum => static/museum}/Momger.png | Bin {museum => static/museum}/MonkeyGer.png | Bin {museum => static/museum}/Moustacheger.png | Bin {museum => static/museum}/Nerdger.png | Bin {museum => static/museum}/NinjaPenger.png | Bin {museum => static/museum}/Oldger.png | Bin {museum => static/museum}/Paintger.png | Bin {museum => static/museum}/Partyger.png | Bin {museum => static/museum}/Peng.png | Bin {museum => static/museum}/PengKisser.png | Bin {museum => static/museum}/Pengachu.png | Bin {museum => static/museum}/Penganger.png | Bin {museum => static/museum}/Pengcoder.png | Bin {museum => static/museum}/Penger.png | Bin {museum => static/museum}/PengerClose.png | Bin {museum => static/museum}/PengerFront.png | Bin {museum => static/museum}/PengerGiga.png | Bin {museum => static/museum}/PengerH.png | Bin {museum => static/museum}/PengerHeart.png | Bin {museum => static/museum}/PengerNote.png | Bin {museum => static/museum}/PengerNumberOne.png | Bin .../museum}/PengerRidingCamellow.png | Bin {museum => static/museum}/PengerSeller.png | Bin .../museum}/PengerSilverfoot.png | Bin {museum => static/museum}/PengerStatue.png | Bin {museum => static/museum}/PengerStream.png | Bin {museum => static/museum}/PengerTPose.png | Bin {museum => static/museum}/PengerThumbsUp.png | Bin {museum => static/museum}/Pengerberry.png | Bin {museum => static/museum}/Penghost.png | Bin {museum => static/museum}/Penglup.png | Bin {museum => static/museum}/Pinker.png | Bin {museum => static/museum}/Pipimiger.png | Bin {museum => static/museum}/Policeger.png | Bin .../museum}/PongarTheBarbarian.png | Bin {museum => static/museum}/Ponger.png | Bin {museum => static/museum}/PongerWizard.png | Bin {museum => static/museum}/Poopenger.png | Bin {museum => static/museum}/Popukoger.png | Bin {museum => static/museum}/PowerPenger.png | Bin {museum => static/museum}/Presentger.png | Bin .../museum}/PrincessPeachger.png | Bin {museum => static/museum}/Queenger.png | Bin {museum => static/museum}/RedWolologer.png | Bin {museum => static/museum}/Redger.png | Bin {museum => static/museum}/Richger.png | Bin {museum => static/museum}/Rockhopger.png | Bin {museum => static/museum}/Rubyger.png | Bin {museum => static/museum}/SailorMoonger.png | Bin {museum => static/museum}/Saluteger.png | Bin {museum => static/museum}/Samiger.png | Bin {museum => static/museum}/ScientistPenger.png | Bin .../museum}/ScientistPengerFlask.png | Bin {museum => static/museum}/Seniorger.png | Bin {museum => static/museum}/Skeleger.png | Bin {museum => static/museum}/SkiFreeger.png | Bin {museum => static/museum}/Sleepger.png | Bin {museum => static/museum}/Sonarqubeger.png | Bin {museum => static/museum}/Soupger.png | Bin {museum => static/museum}/Spainger.png | Bin {museum => static/museum}/Spillger.png | Bin {museum => static/museum}/Sponger.png | Bin {museum => static/museum}/Startleger.png | Bin {museum => static/museum}/Stronger.png | Bin {museum => static/museum}/Suitger.png | Bin {museum => static/museum}/SuperPenger.png | Bin {museum => static/museum}/Surfger.png | Bin {museum => static/museum}/Susger.png | Bin {museum => static/museum}/Swagger.png | Bin {museum => static/museum}/Swenger.png | Bin .../museum}/TakeoutCoffeeger.png | Bin {museum => static/museum}/Toadger.png | Bin .../museum}/Transparencenger.png | Bin {museum => static/museum}/Tuxger.png | Bin {museum => static/museum}/TwitchPenger.png | Bin {museum => static/museum}/USAger.png | Bin {museum => static/museum}/Urinalger.png | Bin {museum => static/museum}/Waitinger.png | Bin {museum => static/museum}/Weezger.png | Bin {museum => static/museum}/Wrightger.png | Bin {museum => static/museum}/Younger.png | Bin {museum => static/museum}/Zombieger.png | Bin 153 files changed, 124 insertions(+), 54 deletions(-) create mode 100644 static/css/.gitkeep create mode 100644 static/css/base.css create mode 100644 static/css/rainbow.css rename {museum => static/museum}/18Plusger.png (100%) rename {museum => static/museum}/Adelieger.png (100%) rename {museum => static/museum}/Baldger.png (100%) rename {museum => static/museum}/Blenger.png (100%) rename {museum => static/museum}/BlueWolologer.png (100%) rename {museum => static/museum}/Camelger.png (100%) rename {museum => static/museum}/Camellow.png (100%) rename {museum => static/museum}/Capger.png (100%) rename {museum => static/museum}/CapgerSaysTransRights.png (100%) rename {museum => static/museum}/CephonPenger.png (100%) rename {museum => static/museum}/Clipenger.png (100%) rename {museum => static/museum}/Clownger.png (100%) rename {museum => static/museum}/Coffeeger.png (100%) rename {museum => static/museum}/Cookger.png (100%) rename {museum => static/museum}/Copeger.png (100%) rename {museum => static/museum}/Criminalger.png (100%) rename {museum => static/museum}/Cryger.png (100%) rename {museum => static/museum}/CrygerBlood.png (100%) rename {museum => static/museum}/CrygerChernobyl.png (100%) rename {museum => static/museum}/Cyberger.png (100%) rename {museum => static/museum}/DarthPenger.png (100%) rename {museum => static/museum}/Deadger.png (100%) rename {museum => static/museum}/Demureger.png (100%) rename {museum => static/museum}/Disger.png (100%) rename {museum => static/museum}/DoctorPenger.png (100%) rename {museum => static/museum}/Doomger.png (100%) rename {museum => static/museum}/EvilCyberger.png (100%) rename {museum => static/museum}/Factoryger.png (100%) rename {museum => static/museum}/Fatger.png (100%) rename {museum => static/museum}/Ferrisger.png (100%) rename {museum => static/museum}/Fesh.png (100%) rename {museum => static/museum}/Feshger.png (100%) rename {museum => static/museum}/Frankenpenger.png (100%) rename {museum => static/museum}/FullCookger.png (100%) rename {museum => static/museum}/GNUPenger.png (100%) rename {museum => static/museum}/Geniusger.png (100%) rename {museum => static/museum}/Ghostger.png (100%) rename {museum => static/museum}/Ghostyger.png (100%) rename {museum => static/museum}/Githubger.png (100%) rename {museum => static/museum}/Goldger.png (100%) rename {museum => static/museum}/Gonger.png (100%) rename {museum => static/museum}/Gopnikger.png (100%) rename {museum => static/museum}/Grubenger.png (100%) rename {museum => static/museum}/Gunger.png (100%) rename {museum => static/museum}/HDPenger.png (100%) rename {museum => static/museum}/Hackger.png (100%) rename {museum => static/museum}/Heisenberger.png (100%) rename {museum => static/museum}/HolyCPenger.png (100%) rename {museum => static/museum}/Holyger.png (100%) rename {museum => static/museum}/Hoodger.png (100%) rename {museum => static/museum}/Howdyger.png (100%) rename {museum => static/museum}/Ideager.png (100%) rename {museum => static/museum}/JPenger.png (100%) rename {museum => static/museum}/Jonkger.png (100%) rename {museum => static/museum}/Kidger.png (100%) rename {museum => static/museum}/Knightger.png (100%) rename {museum => static/museum}/Laptopger.png (100%) rename {museum => static/museum}/Luigiger.png (100%) rename {museum => static/museum}/Macger.png (100%) rename {museum => static/museum}/Madger.png (100%) rename {museum => static/museum}/Malger.png (100%) rename {museum => static/museum}/Marioger.png (100%) rename {museum => static/museum}/Michaelger.png (100%) rename {museum => static/museum}/Millhouseger.png (100%) rename {museum => static/museum}/Mineger.png (100%) rename {museum => static/museum}/Momger.png (100%) rename {museum => static/museum}/MonkeyGer.png (100%) rename {museum => static/museum}/Moustacheger.png (100%) rename {museum => static/museum}/Nerdger.png (100%) rename {museum => static/museum}/NinjaPenger.png (100%) rename {museum => static/museum}/Oldger.png (100%) rename {museum => static/museum}/Paintger.png (100%) rename {museum => static/museum}/Partyger.png (100%) rename {museum => static/museum}/Peng.png (100%) rename {museum => static/museum}/PengKisser.png (100%) rename {museum => static/museum}/Pengachu.png (100%) rename {museum => static/museum}/Penganger.png (100%) rename {museum => static/museum}/Pengcoder.png (100%) rename {museum => static/museum}/Penger.png (100%) rename {museum => static/museum}/PengerClose.png (100%) rename {museum => static/museum}/PengerFront.png (100%) rename {museum => static/museum}/PengerGiga.png (100%) rename {museum => static/museum}/PengerH.png (100%) rename {museum => static/museum}/PengerHeart.png (100%) rename {museum => static/museum}/PengerNote.png (100%) rename {museum => static/museum}/PengerNumberOne.png (100%) rename {museum => static/museum}/PengerRidingCamellow.png (100%) rename {museum => static/museum}/PengerSeller.png (100%) rename {museum => static/museum}/PengerSilverfoot.png (100%) rename {museum => static/museum}/PengerStatue.png (100%) rename {museum => static/museum}/PengerStream.png (100%) rename {museum => static/museum}/PengerTPose.png (100%) rename {museum => static/museum}/PengerThumbsUp.png (100%) rename {museum => static/museum}/Pengerberry.png (100%) rename {museum => static/museum}/Penghost.png (100%) rename {museum => static/museum}/Penglup.png (100%) rename {museum => static/museum}/Pinker.png (100%) rename {museum => static/museum}/Pipimiger.png (100%) rename {museum => static/museum}/Policeger.png (100%) rename {museum => static/museum}/PongarTheBarbarian.png (100%) rename {museum => static/museum}/Ponger.png (100%) rename {museum => static/museum}/PongerWizard.png (100%) rename {museum => static/museum}/Poopenger.png (100%) rename {museum => static/museum}/Popukoger.png (100%) rename {museum => static/museum}/PowerPenger.png (100%) rename {museum => static/museum}/Presentger.png (100%) rename {museum => static/museum}/PrincessPeachger.png (100%) rename {museum => static/museum}/Queenger.png (100%) rename {museum => static/museum}/RedWolologer.png (100%) rename {museum => static/museum}/Redger.png (100%) rename {museum => static/museum}/Richger.png (100%) rename {museum => static/museum}/Rockhopger.png (100%) rename {museum => static/museum}/Rubyger.png (100%) rename {museum => static/museum}/SailorMoonger.png (100%) rename {museum => static/museum}/Saluteger.png (100%) rename {museum => static/museum}/Samiger.png (100%) rename {museum => static/museum}/ScientistPenger.png (100%) rename {museum => static/museum}/ScientistPengerFlask.png (100%) rename {museum => static/museum}/Seniorger.png (100%) rename {museum => static/museum}/Skeleger.png (100%) rename {museum => static/museum}/SkiFreeger.png (100%) rename {museum => static/museum}/Sleepger.png (100%) rename {museum => static/museum}/Sonarqubeger.png (100%) rename {museum => static/museum}/Soupger.png (100%) rename {museum => static/museum}/Spainger.png (100%) rename {museum => static/museum}/Spillger.png (100%) rename {museum => static/museum}/Sponger.png (100%) rename {museum => static/museum}/Startleger.png (100%) rename {museum => static/museum}/Stronger.png (100%) rename {museum => static/museum}/Suitger.png (100%) rename {museum => static/museum}/SuperPenger.png (100%) rename {museum => static/museum}/Surfger.png (100%) rename {museum => static/museum}/Susger.png (100%) rename {museum => static/museum}/Swagger.png (100%) rename {museum => static/museum}/Swenger.png (100%) rename {museum => static/museum}/TakeoutCoffeeger.png (100%) rename {museum => static/museum}/Toadger.png (100%) rename {museum => static/museum}/Transparencenger.png (100%) rename {museum => static/museum}/Tuxger.png (100%) rename {museum => static/museum}/TwitchPenger.png (100%) rename {museum => static/museum}/USAger.png (100%) rename {museum => static/museum}/Urinalger.png (100%) rename {museum => static/museum}/Waitinger.png (100%) rename {museum => static/museum}/Weezger.png (100%) rename {museum => static/museum}/Wrightger.png (100%) rename {museum => static/museum}/Younger.png (100%) rename {museum => static/museum}/Zombieger.png (100%) diff --git a/build.sh b/build.sh index a911b33..d525fd8 100755 --- a/build.sh +++ b/build.sh @@ -28,10 +28,10 @@ rm -f museum.c/* pengers_html=$'\n' pengers_include=$'\n' id=0 -for p in $(ls museum); do +for p in $(ls static/museum/); do file=$(echo $p | sed "s/\.png$//g") - ./png2c "museum/"$p $id > museum.c/$file.c - pengers_html+=$' \n' + ./png2c "static/museum/"$p $id > museum.c/$file.c + pengers_html+=$' \n' pengers_include+='#include "museum.c/'$file$'.c"\n' ((id=id+1)) done diff --git a/index.html.template b/index.html.template index 0511899..cff04fd 100644 --- a/index.html.template +++ b/index.html.template @@ -3,57 +3,11 @@ Penger Party - + + -

Penger Party

+

Penger Party

@@ -93,9 +47,11 @@

Choose your penger:

+
+
-

Made by a Penger Entousiast

+

Made by a Penger Entousiast

diff --git a/server.js b/server.js index b6ebc23..c47ef0f 100644 --- a/server.js +++ b/server.js @@ -76,12 +76,20 @@ const requestListener = function (req, res) { return; } - if (url.startsWith("/museum/")) { + if (url.startsWith("/static/museum/")) { res.setHeader("Content-Type", "image/png"); res.writeHead(200); res.end(fs.readFileSync("." + url)); return; } + + if (url.startsWith("/static/css/")) { + res.setHeader("Content-Type", "text/css"); + res.writeHead(200); + res.end(fs.readFileSync("." + url)); + return; + } + if (url == "/create-map") { res.setHeader("Content-Type", "text/html"); res.writeHead(200); diff --git a/static/css/.gitkeep b/static/css/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/static/css/base.css b/static/css/base.css new file mode 100644 index 0000000..95ec757 --- /dev/null +++ b/static/css/base.css @@ -0,0 +1,64 @@ +body{ + background-color: pink; +} +#demo-canvas { + border-radius: 30px; + filter: drop-shadow(0 0 0.75rem black); +} +#demo-canvas:hover { + cursor: none +} +.penger-img { + width: 64px; + image-rendering: pixelated; + border-radius: 5px; + border: solid 1px white; + height: 64px; + object-fit: contain; + transition: transform 0.2s; +} +.penger-img:hover { + cursor: pointer; + transform: scale(1.1); +} +.players-img { + margin-right: 10px; +} +h1 { + text-align: center; + font-size: 3.5em; + margin: 0px; + margin-bottom: 20px; + font-family: "Comic Sans MS", "Comic Sans", cursive; +} +h3 { + margin-top: 7px; +} +.info { + display: flex; + flex-wrap: wrap; + justify-content: space-between; +} +.info > * { + margin-right: 1rem; +} +#chat { + width: 69%; +} +@media screen and (min-width: calc(800px + calc(64px * 4))) { + #css-bullshit { + content: ""; + display: table; + clear: both; + } + #left { + float: left; + width: 50%; + } + #right { + float: right; + width: calc(100% - 800px - 25px); + position: absolute; + right: 0px; + } +} \ No newline at end of file diff --git a/static/css/rainbow.css b/static/css/rainbow.css new file mode 100644 index 0000000..01b1794 --- /dev/null +++ b/static/css/rainbow.css @@ -0,0 +1,42 @@ +.rainbow{ + animation: rainbow 2.5s linear; + animation-iteration-count: infinite; +} +@keyframes rainbow{ + 100%,0%{ + color: rgb(255,0,0); + } + 8%{ + color: rgb(255,127,0); + } + 16%{ + color: rgb(255,255,0); + } + 25%{ + color: rgb(127,255,0); + } + 33%{ + color: rgb(0,255,0); + } + 41%{ + color: rgb(0,255,127); + } + 50%{ + color: rgb(0,255,255); + } + 58%{ + color: rgb(0,127,255); + } + 66%{ + color: rgb(0,0,255); + } + 75%{ + color: rgb(127,0,255); + } + 83%{ + color: rgb(255,0,255); + } + 91%{ + color: rgb(255,0,127); + } +} \ No newline at end of file diff --git a/museum/18Plusger.png b/static/museum/18Plusger.png similarity index 100% rename from museum/18Plusger.png rename to static/museum/18Plusger.png diff --git a/museum/Adelieger.png b/static/museum/Adelieger.png similarity index 100% rename from museum/Adelieger.png rename to static/museum/Adelieger.png diff --git a/museum/Baldger.png b/static/museum/Baldger.png similarity index 100% rename from museum/Baldger.png rename to static/museum/Baldger.png diff --git a/museum/Blenger.png b/static/museum/Blenger.png similarity index 100% rename from museum/Blenger.png rename to static/museum/Blenger.png diff --git a/museum/BlueWolologer.png b/static/museum/BlueWolologer.png similarity index 100% rename from museum/BlueWolologer.png rename to static/museum/BlueWolologer.png diff --git a/museum/Camelger.png b/static/museum/Camelger.png similarity index 100% rename from museum/Camelger.png rename to static/museum/Camelger.png diff --git a/museum/Camellow.png b/static/museum/Camellow.png similarity index 100% rename from museum/Camellow.png rename to static/museum/Camellow.png diff --git a/museum/Capger.png b/static/museum/Capger.png similarity index 100% rename from museum/Capger.png rename to static/museum/Capger.png diff --git a/museum/CapgerSaysTransRights.png b/static/museum/CapgerSaysTransRights.png similarity index 100% rename from museum/CapgerSaysTransRights.png rename to static/museum/CapgerSaysTransRights.png diff --git a/museum/CephonPenger.png b/static/museum/CephonPenger.png similarity index 100% rename from museum/CephonPenger.png rename to static/museum/CephonPenger.png diff --git a/museum/Clipenger.png b/static/museum/Clipenger.png similarity index 100% rename from museum/Clipenger.png rename to static/museum/Clipenger.png diff --git a/museum/Clownger.png b/static/museum/Clownger.png similarity index 100% rename from museum/Clownger.png rename to static/museum/Clownger.png diff --git a/museum/Coffeeger.png b/static/museum/Coffeeger.png similarity index 100% rename from museum/Coffeeger.png rename to static/museum/Coffeeger.png diff --git a/museum/Cookger.png b/static/museum/Cookger.png similarity index 100% rename from museum/Cookger.png rename to static/museum/Cookger.png diff --git a/museum/Copeger.png b/static/museum/Copeger.png similarity index 100% rename from museum/Copeger.png rename to static/museum/Copeger.png diff --git a/museum/Criminalger.png b/static/museum/Criminalger.png similarity index 100% rename from museum/Criminalger.png rename to static/museum/Criminalger.png diff --git a/museum/Cryger.png b/static/museum/Cryger.png similarity index 100% rename from museum/Cryger.png rename to static/museum/Cryger.png diff --git a/museum/CrygerBlood.png b/static/museum/CrygerBlood.png similarity index 100% rename from museum/CrygerBlood.png rename to static/museum/CrygerBlood.png diff --git a/museum/CrygerChernobyl.png b/static/museum/CrygerChernobyl.png similarity index 100% rename from museum/CrygerChernobyl.png rename to static/museum/CrygerChernobyl.png diff --git a/museum/Cyberger.png b/static/museum/Cyberger.png similarity index 100% rename from museum/Cyberger.png rename to static/museum/Cyberger.png diff --git a/museum/DarthPenger.png b/static/museum/DarthPenger.png similarity index 100% rename from museum/DarthPenger.png rename to static/museum/DarthPenger.png diff --git a/museum/Deadger.png b/static/museum/Deadger.png similarity index 100% rename from museum/Deadger.png rename to static/museum/Deadger.png diff --git a/museum/Demureger.png b/static/museum/Demureger.png similarity index 100% rename from museum/Demureger.png rename to static/museum/Demureger.png diff --git a/museum/Disger.png b/static/museum/Disger.png similarity index 100% rename from museum/Disger.png rename to static/museum/Disger.png diff --git a/museum/DoctorPenger.png b/static/museum/DoctorPenger.png similarity index 100% rename from museum/DoctorPenger.png rename to static/museum/DoctorPenger.png diff --git a/museum/Doomger.png b/static/museum/Doomger.png similarity index 100% rename from museum/Doomger.png rename to static/museum/Doomger.png diff --git a/museum/EvilCyberger.png b/static/museum/EvilCyberger.png similarity index 100% rename from museum/EvilCyberger.png rename to static/museum/EvilCyberger.png diff --git a/museum/Factoryger.png b/static/museum/Factoryger.png similarity index 100% rename from museum/Factoryger.png rename to static/museum/Factoryger.png diff --git a/museum/Fatger.png b/static/museum/Fatger.png similarity index 100% rename from museum/Fatger.png rename to static/museum/Fatger.png diff --git a/museum/Ferrisger.png b/static/museum/Ferrisger.png similarity index 100% rename from museum/Ferrisger.png rename to static/museum/Ferrisger.png diff --git a/museum/Fesh.png b/static/museum/Fesh.png similarity index 100% rename from museum/Fesh.png rename to static/museum/Fesh.png diff --git a/museum/Feshger.png b/static/museum/Feshger.png similarity index 100% rename from museum/Feshger.png rename to static/museum/Feshger.png diff --git a/museum/Frankenpenger.png b/static/museum/Frankenpenger.png similarity index 100% rename from museum/Frankenpenger.png rename to static/museum/Frankenpenger.png diff --git a/museum/FullCookger.png b/static/museum/FullCookger.png similarity index 100% rename from museum/FullCookger.png rename to static/museum/FullCookger.png diff --git a/museum/GNUPenger.png b/static/museum/GNUPenger.png similarity index 100% rename from museum/GNUPenger.png rename to static/museum/GNUPenger.png diff --git a/museum/Geniusger.png b/static/museum/Geniusger.png similarity index 100% rename from museum/Geniusger.png rename to static/museum/Geniusger.png diff --git a/museum/Ghostger.png b/static/museum/Ghostger.png similarity index 100% rename from museum/Ghostger.png rename to static/museum/Ghostger.png diff --git a/museum/Ghostyger.png b/static/museum/Ghostyger.png similarity index 100% rename from museum/Ghostyger.png rename to static/museum/Ghostyger.png diff --git a/museum/Githubger.png b/static/museum/Githubger.png similarity index 100% rename from museum/Githubger.png rename to static/museum/Githubger.png diff --git a/museum/Goldger.png b/static/museum/Goldger.png similarity index 100% rename from museum/Goldger.png rename to static/museum/Goldger.png diff --git a/museum/Gonger.png b/static/museum/Gonger.png similarity index 100% rename from museum/Gonger.png rename to static/museum/Gonger.png diff --git a/museum/Gopnikger.png b/static/museum/Gopnikger.png similarity index 100% rename from museum/Gopnikger.png rename to static/museum/Gopnikger.png diff --git a/museum/Grubenger.png b/static/museum/Grubenger.png similarity index 100% rename from museum/Grubenger.png rename to static/museum/Grubenger.png diff --git a/museum/Gunger.png b/static/museum/Gunger.png similarity index 100% rename from museum/Gunger.png rename to static/museum/Gunger.png diff --git a/museum/HDPenger.png b/static/museum/HDPenger.png similarity index 100% rename from museum/HDPenger.png rename to static/museum/HDPenger.png diff --git a/museum/Hackger.png b/static/museum/Hackger.png similarity index 100% rename from museum/Hackger.png rename to static/museum/Hackger.png diff --git a/museum/Heisenberger.png b/static/museum/Heisenberger.png similarity index 100% rename from museum/Heisenberger.png rename to static/museum/Heisenberger.png diff --git a/museum/HolyCPenger.png b/static/museum/HolyCPenger.png similarity index 100% rename from museum/HolyCPenger.png rename to static/museum/HolyCPenger.png diff --git a/museum/Holyger.png b/static/museum/Holyger.png similarity index 100% rename from museum/Holyger.png rename to static/museum/Holyger.png diff --git a/museum/Hoodger.png b/static/museum/Hoodger.png similarity index 100% rename from museum/Hoodger.png rename to static/museum/Hoodger.png diff --git a/museum/Howdyger.png b/static/museum/Howdyger.png similarity index 100% rename from museum/Howdyger.png rename to static/museum/Howdyger.png diff --git a/museum/Ideager.png b/static/museum/Ideager.png similarity index 100% rename from museum/Ideager.png rename to static/museum/Ideager.png diff --git a/museum/JPenger.png b/static/museum/JPenger.png similarity index 100% rename from museum/JPenger.png rename to static/museum/JPenger.png diff --git a/museum/Jonkger.png b/static/museum/Jonkger.png similarity index 100% rename from museum/Jonkger.png rename to static/museum/Jonkger.png diff --git a/museum/Kidger.png b/static/museum/Kidger.png similarity index 100% rename from museum/Kidger.png rename to static/museum/Kidger.png diff --git a/museum/Knightger.png b/static/museum/Knightger.png similarity index 100% rename from museum/Knightger.png rename to static/museum/Knightger.png diff --git a/museum/Laptopger.png b/static/museum/Laptopger.png similarity index 100% rename from museum/Laptopger.png rename to static/museum/Laptopger.png diff --git a/museum/Luigiger.png b/static/museum/Luigiger.png similarity index 100% rename from museum/Luigiger.png rename to static/museum/Luigiger.png diff --git a/museum/Macger.png b/static/museum/Macger.png similarity index 100% rename from museum/Macger.png rename to static/museum/Macger.png diff --git a/museum/Madger.png b/static/museum/Madger.png similarity index 100% rename from museum/Madger.png rename to static/museum/Madger.png diff --git a/museum/Malger.png b/static/museum/Malger.png similarity index 100% rename from museum/Malger.png rename to static/museum/Malger.png diff --git a/museum/Marioger.png b/static/museum/Marioger.png similarity index 100% rename from museum/Marioger.png rename to static/museum/Marioger.png diff --git a/museum/Michaelger.png b/static/museum/Michaelger.png similarity index 100% rename from museum/Michaelger.png rename to static/museum/Michaelger.png diff --git a/museum/Millhouseger.png b/static/museum/Millhouseger.png similarity index 100% rename from museum/Millhouseger.png rename to static/museum/Millhouseger.png diff --git a/museum/Mineger.png b/static/museum/Mineger.png similarity index 100% rename from museum/Mineger.png rename to static/museum/Mineger.png diff --git a/museum/Momger.png b/static/museum/Momger.png similarity index 100% rename from museum/Momger.png rename to static/museum/Momger.png diff --git a/museum/MonkeyGer.png b/static/museum/MonkeyGer.png similarity index 100% rename from museum/MonkeyGer.png rename to static/museum/MonkeyGer.png diff --git a/museum/Moustacheger.png b/static/museum/Moustacheger.png similarity index 100% rename from museum/Moustacheger.png rename to static/museum/Moustacheger.png diff --git a/museum/Nerdger.png b/static/museum/Nerdger.png similarity index 100% rename from museum/Nerdger.png rename to static/museum/Nerdger.png diff --git a/museum/NinjaPenger.png b/static/museum/NinjaPenger.png similarity index 100% rename from museum/NinjaPenger.png rename to static/museum/NinjaPenger.png diff --git a/museum/Oldger.png b/static/museum/Oldger.png similarity index 100% rename from museum/Oldger.png rename to static/museum/Oldger.png diff --git a/museum/Paintger.png b/static/museum/Paintger.png similarity index 100% rename from museum/Paintger.png rename to static/museum/Paintger.png diff --git a/museum/Partyger.png b/static/museum/Partyger.png similarity index 100% rename from museum/Partyger.png rename to static/museum/Partyger.png diff --git a/museum/Peng.png b/static/museum/Peng.png similarity index 100% rename from museum/Peng.png rename to static/museum/Peng.png diff --git a/museum/PengKisser.png b/static/museum/PengKisser.png similarity index 100% rename from museum/PengKisser.png rename to static/museum/PengKisser.png diff --git a/museum/Pengachu.png b/static/museum/Pengachu.png similarity index 100% rename from museum/Pengachu.png rename to static/museum/Pengachu.png diff --git a/museum/Penganger.png b/static/museum/Penganger.png similarity index 100% rename from museum/Penganger.png rename to static/museum/Penganger.png diff --git a/museum/Pengcoder.png b/static/museum/Pengcoder.png similarity index 100% rename from museum/Pengcoder.png rename to static/museum/Pengcoder.png diff --git a/museum/Penger.png b/static/museum/Penger.png similarity index 100% rename from museum/Penger.png rename to static/museum/Penger.png diff --git a/museum/PengerClose.png b/static/museum/PengerClose.png similarity index 100% rename from museum/PengerClose.png rename to static/museum/PengerClose.png diff --git a/museum/PengerFront.png b/static/museum/PengerFront.png similarity index 100% rename from museum/PengerFront.png rename to static/museum/PengerFront.png diff --git a/museum/PengerGiga.png b/static/museum/PengerGiga.png similarity index 100% rename from museum/PengerGiga.png rename to static/museum/PengerGiga.png diff --git a/museum/PengerH.png b/static/museum/PengerH.png similarity index 100% rename from museum/PengerH.png rename to static/museum/PengerH.png diff --git a/museum/PengerHeart.png b/static/museum/PengerHeart.png similarity index 100% rename from museum/PengerHeart.png rename to static/museum/PengerHeart.png diff --git a/museum/PengerNote.png b/static/museum/PengerNote.png similarity index 100% rename from museum/PengerNote.png rename to static/museum/PengerNote.png diff --git a/museum/PengerNumberOne.png b/static/museum/PengerNumberOne.png similarity index 100% rename from museum/PengerNumberOne.png rename to static/museum/PengerNumberOne.png diff --git a/museum/PengerRidingCamellow.png b/static/museum/PengerRidingCamellow.png similarity index 100% rename from museum/PengerRidingCamellow.png rename to static/museum/PengerRidingCamellow.png diff --git a/museum/PengerSeller.png b/static/museum/PengerSeller.png similarity index 100% rename from museum/PengerSeller.png rename to static/museum/PengerSeller.png diff --git a/museum/PengerSilverfoot.png b/static/museum/PengerSilverfoot.png similarity index 100% rename from museum/PengerSilverfoot.png rename to static/museum/PengerSilverfoot.png diff --git a/museum/PengerStatue.png b/static/museum/PengerStatue.png similarity index 100% rename from museum/PengerStatue.png rename to static/museum/PengerStatue.png diff --git a/museum/PengerStream.png b/static/museum/PengerStream.png similarity index 100% rename from museum/PengerStream.png rename to static/museum/PengerStream.png diff --git a/museum/PengerTPose.png b/static/museum/PengerTPose.png similarity index 100% rename from museum/PengerTPose.png rename to static/museum/PengerTPose.png diff --git a/museum/PengerThumbsUp.png b/static/museum/PengerThumbsUp.png similarity index 100% rename from museum/PengerThumbsUp.png rename to static/museum/PengerThumbsUp.png diff --git a/museum/Pengerberry.png b/static/museum/Pengerberry.png similarity index 100% rename from museum/Pengerberry.png rename to static/museum/Pengerberry.png diff --git a/museum/Penghost.png b/static/museum/Penghost.png similarity index 100% rename from museum/Penghost.png rename to static/museum/Penghost.png diff --git a/museum/Penglup.png b/static/museum/Penglup.png similarity index 100% rename from museum/Penglup.png rename to static/museum/Penglup.png diff --git a/museum/Pinker.png b/static/museum/Pinker.png similarity index 100% rename from museum/Pinker.png rename to static/museum/Pinker.png diff --git a/museum/Pipimiger.png b/static/museum/Pipimiger.png similarity index 100% rename from museum/Pipimiger.png rename to static/museum/Pipimiger.png diff --git a/museum/Policeger.png b/static/museum/Policeger.png similarity index 100% rename from museum/Policeger.png rename to static/museum/Policeger.png diff --git a/museum/PongarTheBarbarian.png b/static/museum/PongarTheBarbarian.png similarity index 100% rename from museum/PongarTheBarbarian.png rename to static/museum/PongarTheBarbarian.png diff --git a/museum/Ponger.png b/static/museum/Ponger.png similarity index 100% rename from museum/Ponger.png rename to static/museum/Ponger.png diff --git a/museum/PongerWizard.png b/static/museum/PongerWizard.png similarity index 100% rename from museum/PongerWizard.png rename to static/museum/PongerWizard.png diff --git a/museum/Poopenger.png b/static/museum/Poopenger.png similarity index 100% rename from museum/Poopenger.png rename to static/museum/Poopenger.png diff --git a/museum/Popukoger.png b/static/museum/Popukoger.png similarity index 100% rename from museum/Popukoger.png rename to static/museum/Popukoger.png diff --git a/museum/PowerPenger.png b/static/museum/PowerPenger.png similarity index 100% rename from museum/PowerPenger.png rename to static/museum/PowerPenger.png diff --git a/museum/Presentger.png b/static/museum/Presentger.png similarity index 100% rename from museum/Presentger.png rename to static/museum/Presentger.png diff --git a/museum/PrincessPeachger.png b/static/museum/PrincessPeachger.png similarity index 100% rename from museum/PrincessPeachger.png rename to static/museum/PrincessPeachger.png diff --git a/museum/Queenger.png b/static/museum/Queenger.png similarity index 100% rename from museum/Queenger.png rename to static/museum/Queenger.png diff --git a/museum/RedWolologer.png b/static/museum/RedWolologer.png similarity index 100% rename from museum/RedWolologer.png rename to static/museum/RedWolologer.png diff --git a/museum/Redger.png b/static/museum/Redger.png similarity index 100% rename from museum/Redger.png rename to static/museum/Redger.png diff --git a/museum/Richger.png b/static/museum/Richger.png similarity index 100% rename from museum/Richger.png rename to static/museum/Richger.png diff --git a/museum/Rockhopger.png b/static/museum/Rockhopger.png similarity index 100% rename from museum/Rockhopger.png rename to static/museum/Rockhopger.png diff --git a/museum/Rubyger.png b/static/museum/Rubyger.png similarity index 100% rename from museum/Rubyger.png rename to static/museum/Rubyger.png diff --git a/museum/SailorMoonger.png b/static/museum/SailorMoonger.png similarity index 100% rename from museum/SailorMoonger.png rename to static/museum/SailorMoonger.png diff --git a/museum/Saluteger.png b/static/museum/Saluteger.png similarity index 100% rename from museum/Saluteger.png rename to static/museum/Saluteger.png diff --git a/museum/Samiger.png b/static/museum/Samiger.png similarity index 100% rename from museum/Samiger.png rename to static/museum/Samiger.png diff --git a/museum/ScientistPenger.png b/static/museum/ScientistPenger.png similarity index 100% rename from museum/ScientistPenger.png rename to static/museum/ScientistPenger.png diff --git a/museum/ScientistPengerFlask.png b/static/museum/ScientistPengerFlask.png similarity index 100% rename from museum/ScientistPengerFlask.png rename to static/museum/ScientistPengerFlask.png diff --git a/museum/Seniorger.png b/static/museum/Seniorger.png similarity index 100% rename from museum/Seniorger.png rename to static/museum/Seniorger.png diff --git a/museum/Skeleger.png b/static/museum/Skeleger.png similarity index 100% rename from museum/Skeleger.png rename to static/museum/Skeleger.png diff --git a/museum/SkiFreeger.png b/static/museum/SkiFreeger.png similarity index 100% rename from museum/SkiFreeger.png rename to static/museum/SkiFreeger.png diff --git a/museum/Sleepger.png b/static/museum/Sleepger.png similarity index 100% rename from museum/Sleepger.png rename to static/museum/Sleepger.png diff --git a/museum/Sonarqubeger.png b/static/museum/Sonarqubeger.png similarity index 100% rename from museum/Sonarqubeger.png rename to static/museum/Sonarqubeger.png diff --git a/museum/Soupger.png b/static/museum/Soupger.png similarity index 100% rename from museum/Soupger.png rename to static/museum/Soupger.png diff --git a/museum/Spainger.png b/static/museum/Spainger.png similarity index 100% rename from museum/Spainger.png rename to static/museum/Spainger.png diff --git a/museum/Spillger.png b/static/museum/Spillger.png similarity index 100% rename from museum/Spillger.png rename to static/museum/Spillger.png diff --git a/museum/Sponger.png b/static/museum/Sponger.png similarity index 100% rename from museum/Sponger.png rename to static/museum/Sponger.png diff --git a/museum/Startleger.png b/static/museum/Startleger.png similarity index 100% rename from museum/Startleger.png rename to static/museum/Startleger.png diff --git a/museum/Stronger.png b/static/museum/Stronger.png similarity index 100% rename from museum/Stronger.png rename to static/museum/Stronger.png diff --git a/museum/Suitger.png b/static/museum/Suitger.png similarity index 100% rename from museum/Suitger.png rename to static/museum/Suitger.png diff --git a/museum/SuperPenger.png b/static/museum/SuperPenger.png similarity index 100% rename from museum/SuperPenger.png rename to static/museum/SuperPenger.png diff --git a/museum/Surfger.png b/static/museum/Surfger.png similarity index 100% rename from museum/Surfger.png rename to static/museum/Surfger.png diff --git a/museum/Susger.png b/static/museum/Susger.png similarity index 100% rename from museum/Susger.png rename to static/museum/Susger.png diff --git a/museum/Swagger.png b/static/museum/Swagger.png similarity index 100% rename from museum/Swagger.png rename to static/museum/Swagger.png diff --git a/museum/Swenger.png b/static/museum/Swenger.png similarity index 100% rename from museum/Swenger.png rename to static/museum/Swenger.png diff --git a/museum/TakeoutCoffeeger.png b/static/museum/TakeoutCoffeeger.png similarity index 100% rename from museum/TakeoutCoffeeger.png rename to static/museum/TakeoutCoffeeger.png diff --git a/museum/Toadger.png b/static/museum/Toadger.png similarity index 100% rename from museum/Toadger.png rename to static/museum/Toadger.png diff --git a/museum/Transparencenger.png b/static/museum/Transparencenger.png similarity index 100% rename from museum/Transparencenger.png rename to static/museum/Transparencenger.png diff --git a/museum/Tuxger.png b/static/museum/Tuxger.png similarity index 100% rename from museum/Tuxger.png rename to static/museum/Tuxger.png diff --git a/museum/TwitchPenger.png b/static/museum/TwitchPenger.png similarity index 100% rename from museum/TwitchPenger.png rename to static/museum/TwitchPenger.png diff --git a/museum/USAger.png b/static/museum/USAger.png similarity index 100% rename from museum/USAger.png rename to static/museum/USAger.png diff --git a/museum/Urinalger.png b/static/museum/Urinalger.png similarity index 100% rename from museum/Urinalger.png rename to static/museum/Urinalger.png diff --git a/museum/Waitinger.png b/static/museum/Waitinger.png similarity index 100% rename from museum/Waitinger.png rename to static/museum/Waitinger.png diff --git a/museum/Weezger.png b/static/museum/Weezger.png similarity index 100% rename from museum/Weezger.png rename to static/museum/Weezger.png diff --git a/museum/Wrightger.png b/static/museum/Wrightger.png similarity index 100% rename from museum/Wrightger.png rename to static/museum/Wrightger.png diff --git a/museum/Younger.png b/static/museum/Younger.png similarity index 100% rename from museum/Younger.png rename to static/museum/Younger.png diff --git a/museum/Zombieger.png b/static/museum/Zombieger.png similarity index 100% rename from museum/Zombieger.png rename to static/museum/Zombieger.png From d6ab4e402201a438348cd637b7ac585c2ea87e57 Mon Sep 17 00:00:00 2001 From: raphael Date: Wed, 27 Nov 2024 13:51:46 +0100 Subject: [PATCH 2/9] chore: remove version declaration from docker-compose.yml as it's deprecated --- docker-compose.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index cbe21a6..edb3864 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,3 @@ -version: "3" - services: penger-party: container_name: "penger-party" From b17657884a8b3c6e19ab562966110efe5d249089 Mon Sep 17 00:00:00 2001 From: raphael Date: Wed, 27 Nov 2024 13:56:31 +0100 Subject: [PATCH 3/9] chore: move coin and hand to statics and modify c compilation --- build.sh | 4 ++-- png2c.c | 20 ++++++++++++++++---- coin.png => static/assets/coin.png | Bin hand.png => static/assets/hand.png | Bin 4 files changed, 18 insertions(+), 6 deletions(-) rename coin.png => static/assets/coin.png (100%) rename hand.png => static/assets/hand.png (100%) diff --git a/build.sh b/build.sh index d525fd8..0183252 100755 --- a/build.sh +++ b/build.sh @@ -51,8 +51,8 @@ echo -e "$pengers_html" > pengers_image.html.temp sed -e '//rpengers_image.html.temp' index.html.template > index.html rm pengers_image.html.temp -./png2c "hand.png" > hand.c -./png2c "coin.png" > coin.c +./out/png2c "static/assets/hand.png" > out/hand.c +./out/png2c "static/assets/coin.png" > out/coin.c clang -O3 --target=wasm32 -fno-builtin -nostdlib --no-standard-libraries -Wl,--no-entry $export_cmd -Wl,--allow-undefined -o $f.wasm $a diff --git a/png2c.c b/png2c.c index fa9dbdb..4ed4f19 100644 --- a/png2c.c +++ b/png2c.c @@ -20,11 +20,23 @@ int main(int argc, const char *argv[]) } if (argc < 3) { // no id provided - int file_name_len = strlen(img_path) - strlen(".png"); + char *last_slash = strrchr(img_path, '/'); + char extracted[50]; - printf("int %.*s_height = %d;\n", file_name_len, img_path, height); - printf("int %.*s_width = %d;\n", file_name_len, img_path, width); - printf("unsigned int %.*s_img[%d][%d] = {\n", file_name_len, img_path, height, width); + if (last_slash != NULL) { + // Extract the part after the last '/' + strcpy(extracted, last_slash + 1); + + // Remove the '.png' extension + char *dot = strrchr(extracted, '.'); + if (dot != NULL) { + *dot = '\0'; // Null-terminate the string at the '.' + } + } + + printf("int %s_height = %d;\n", extracted, height); + printf("int %s_width = %d;\n", extracted, width); + printf("unsigned int %s_img[%d][%d] = {\n", extracted, height, width); for (int y = 0; y < height; y++) { printf(" "); diff --git a/coin.png b/static/assets/coin.png similarity index 100% rename from coin.png rename to static/assets/coin.png diff --git a/hand.png b/static/assets/hand.png similarity index 100% rename from hand.png rename to static/assets/hand.png From efe681ffa986ecfc488f25ff94b38f89bc3461a5 Mon Sep 17 00:00:00 2001 From: raphael Date: Wed, 27 Nov 2024 14:01:14 +0100 Subject: [PATCH 4/9] chore: update .gitignore to exclude output directory and keep .gitkeep --- .gitignore | 11 ++--------- out/.gitkeep | 0 2 files changed, 2 insertions(+), 9 deletions(-) create mode 100644 out/.gitkeep diff --git a/.gitignore b/.gitignore index 4456f41..422a1d3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,10 +1,3 @@ -app.wasm -app.wat -png2c -penger.c -hand.c -index.html -museum.c -pengers.h node_modules/ -coin.c +out/* +!out/.gitkeep \ No newline at end of file diff --git a/out/.gitkeep b/out/.gitkeep new file mode 100644 index 0000000..e69de29 From ac5a285ed42859d70c7b84a7b6861b6cb826d6ad Mon Sep 17 00:00:00 2001 From: raphael Date: Wed, 27 Nov 2024 14:01:39 +0100 Subject: [PATCH 5/9] feat: add HTML and JSON template --- index.html.template => templates/index.html.template | 0 leaderboard.json => templates/leaderboard.json.template | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename index.html.template => templates/index.html.template (100%) rename leaderboard.json => templates/leaderboard.json.template (100%) diff --git a/index.html.template b/templates/index.html.template similarity index 100% rename from index.html.template rename to templates/index.html.template diff --git a/leaderboard.json b/templates/leaderboard.json.template similarity index 100% rename from leaderboard.json rename to templates/leaderboard.json.template From 3c7792eba9f6b4e7950bf1675fd8a0e75385b9a0 Mon Sep 17 00:00:00 2001 From: raphael Date: Wed, 27 Nov 2024 14:02:45 +0100 Subject: [PATCH 6/9] chore: refactors files path --- app.c | 6 +++--- build.sh | 33 ++++++++++++++++++--------------- load.js | 2 +- reset-leaderboard.js | 4 ++-- server.js | 11 ++++++----- 5 files changed, 30 insertions(+), 26 deletions(-) diff --git a/app.c b/app.c index c56558c..3f6689d 100644 --- a/app.c +++ b/app.c @@ -1,6 +1,6 @@ -#include "pengers.h" -#include "hand.c" -#include "coin.c" +#include "out/pengers.h" +#include "out/hand.c" +#include "out/coin.c" #define GREEN 0xff00ff00 #define RED 0xff0000ff diff --git a/build.sh b/build.sh index 0183252..89b7fc0 100755 --- a/build.sh +++ b/build.sh @@ -1,7 +1,8 @@ #!/bin/bash if [[ "$1" == "clear" ]]; then - rm -vfr museum.c pengers.h hand.c app.wasm png2c app.wat index.html + rm -vfr out/* + touch out/.gitkeep exit fi; @@ -21,39 +22,41 @@ fi #set -xe -clang png2c.c -o png2c -lm -mkdir -p museum.c -rm -f museum.c/* +clang png2c.c -o out/png2c -lm +mkdir -p out/museum.c +rm -f out/museum.c/* pengers_html=$'\n' pengers_include=$'\n' id=0 for p in $(ls static/museum/); do file=$(echo $p | sed "s/\.png$//g") - ./png2c "static/museum/"$p $id > museum.c/$file.c + ./out/png2c "static/museum/"$p $id > out/museum.c/$file.c pengers_html+=$' \n' pengers_include+='#include "museum.c/'$file$'.c"\n' ((id=id+1)) done -echo "int pengers_height[$id];" > pengers.h -echo "int pengers_width[$id];" >> pengers.h -echo "unsigned int *pengers_img[$id];" >> pengers.h -echo "$pengers_include" >> pengers.h -echo "void pengers_init(void) {" >> pengers.h +echo "int pengers_height[$id];" > out/pengers.h +echo "int pengers_width[$id];" >> out/pengers.h +echo "unsigned int *pengers_img[$id];" >> out/pengers.h +echo "$pengers_include" >> out/pengers.h +echo "void pengers_init(void) {" >> out/pengers.h ((id=id-1)) for i in $(seq 0 $id); do - echo " penger_init_$i();" >> pengers.h; + echo " penger_init_$i();" >> out/pengers.h; done -echo "}" >> pengers.h +echo "}" >> out/pengers.h echo -e "$pengers_html" > pengers_image.html.temp -sed -e '//rpengers_image.html.temp' index.html.template > index.html +sed -e '//rpengers_image.html.temp' templates/index.html.template > out/index.html rm pengers_image.html.temp ./out/png2c "static/assets/hand.png" > out/hand.c ./out/png2c "static/assets/coin.png" > out/coin.c -clang -O3 --target=wasm32 -fno-builtin -nostdlib --no-standard-libraries -Wl,--no-entry $export_cmd -Wl,--allow-undefined -o $f.wasm $a +clang -O3 --target=wasm32 -fno-builtin -nostdlib --no-standard-libraries -Wl,--no-entry $export_cmd -Wl,--allow-undefined -o out/$f.wasm $a -wasm2wat $f.wasm > $f.wat +wasm2wat out/$f.wasm > out/$f.wat + +cp templates/leaderboard.json.template out/leaderboard.json \ No newline at end of file diff --git a/load.js b/load.js index 96c3ecf..60cb23d 100644 --- a/load.js +++ b/load.js @@ -175,7 +175,7 @@ function make_environment(...envs) { }); } -const { instance } = await WebAssembly.instantiateStreaming(fetch("./app.wasm"), { +const { instance } = await WebAssembly.instantiateStreaming(fetch("./out/app.wasm"), { "env": make_environment({ // importer les fonctions dans le wasm 'random': Math.random, diff --git a/reset-leaderboard.js b/reset-leaderboard.js index 3894d91..8fe1908 100644 --- a/reset-leaderboard.js +++ b/reset-leaderboard.js @@ -1,6 +1,6 @@ const fs = require('fs'); -var leaderboard = JSON.parse(fs.readFileSync("leaderboard.json")); +var leaderboard = JSON.parse(fs.readFileSync("out/leaderboard.json")); leaderboard.today = [ {name: 'none', value: '0'}, {name: 'none', value: '0'}, @@ -8,4 +8,4 @@ leaderboard.today = [ {name: 'none', value: '0'}, {name: 'none', value: '0'} ]; -fs.writeFile('leaderboard.json', JSON.stringify(leaderboard), ()=>{}); +fs.writeFile('out/leaderboard.json', JSON.stringify(leaderboard), ()=>{}); diff --git a/server.js b/server.js index c47ef0f..265769c 100644 --- a/server.js +++ b/server.js @@ -46,6 +46,7 @@ function send_new_map() }); setTimeout(send_new_map, map_every_ms); } + setTimeout(send_new_map, map_every_ms); function send_map(socket) { @@ -55,14 +56,14 @@ function send_map(socket) const requestListener = function (req, res) { var url = req.url; - if (url == "/" || url == "/index.html") { + if (url == "/") { res.setHeader("Content-Type", "text/html"); res.writeHead(200); - res.end(fs.readFileSync("./index.html")); + res.end(fs.readFileSync("./out/index.html")); return; } - if (url == "/app.wasm") { + if (url == "/out/app.wasm") { res.setHeader("Content-Type", "application/wasm"); res.writeHead(200); res.end(fs.readFileSync("." + url)); @@ -108,7 +109,7 @@ http_server.listen(HTTP_PORT, () => { }); var maps = JSON.parse(fs.readFileSync("maps.json")); -var leaderboard = JSON.parse(fs.readFileSync("leaderboard.json")); +var leaderboard = JSON.parse(fs.readFileSync("out/leaderboard.json")); const ws_server = new ws.Server({ port: WS_PORT }); @@ -172,7 +173,7 @@ ws_server.on('connection', (socket) => { leaderboard.total.pop(); } if (update_leaderboard) { - fs.writeFile('leaderboard.json', JSON.stringify(leaderboard), ()=>{}); + fs.writeFile('out/leaderboard.json', JSON.stringify(leaderboard), ()=>{}); sockets.forEach((s) => { s.send('{"name": "leaderboard", "value": '+JSON.stringify(leaderboard)+'}'); }); From f4e6521279521701bd58ba541f56f8dfba68b39a Mon Sep 17 00:00:00 2001 From: raphael Date: Wed, 27 Nov 2024 14:17:00 +0100 Subject: [PATCH 7/9] style: modify css as it is not suitable for production --- static/css/base.css | 11 +---------- static/css/rainbow.css | 6 +++++- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/static/css/base.css b/static/css/base.css index 95ec757..89e5b43 100644 --- a/static/css/base.css +++ b/static/css/base.css @@ -1,19 +1,10 @@ -body{ - background-color: pink; -} -#demo-canvas { - border-radius: 30px; - filter: drop-shadow(0 0 0.75rem black); -} #demo-canvas:hover { cursor: none } .penger-img { width: 64px; - image-rendering: pixelated; - border-radius: 5px; - border: solid 1px white; height: 64px; + image-rendering: pixelated; object-fit: contain; transition: transform 0.2s; } diff --git a/static/css/rainbow.css b/static/css/rainbow.css index 01b1794..3b7a4d6 100644 --- a/static/css/rainbow.css +++ b/static/css/rainbow.css @@ -39,4 +39,8 @@ 91%{ color: rgb(255,0,127); } -} \ No newline at end of file +} + + + + From b103a073118032a44e096fe66b319921e73be925 Mon Sep 17 00:00:00 2001 From: raphael Date: Wed, 27 Nov 2024 14:42:22 +0100 Subject: [PATCH 8/9] ops: Remove juicy link --- templates/index.html.template | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/index.html.template b/templates/index.html.template index cff04fd..50d4ef7 100644 --- a/templates/index.html.template +++ b/templates/index.html.template @@ -52,6 +52,6 @@ -

Made by a Penger Entousiast

+

Made by a Penger Entousiast

From 4a1d6502b66cb5223c961315bf4c5b9d7e5dd168 Mon Sep 17 00:00:00 2001 From: raphael Date: Wed, 27 Nov 2024 14:44:49 +0100 Subject: [PATCH 9/9] refactor: Remove leaderboard from templates --- build.sh | 2 -- templates/leaderboard.json.template => leaderboard.json | 0 reset-leaderboard.js | 4 ++-- server.js | 4 ++-- 4 files changed, 4 insertions(+), 6 deletions(-) rename templates/leaderboard.json.template => leaderboard.json (100%) diff --git a/build.sh b/build.sh index 89b7fc0..0429e9a 100755 --- a/build.sh +++ b/build.sh @@ -58,5 +58,3 @@ rm pengers_image.html.temp clang -O3 --target=wasm32 -fno-builtin -nostdlib --no-standard-libraries -Wl,--no-entry $export_cmd -Wl,--allow-undefined -o out/$f.wasm $a wasm2wat out/$f.wasm > out/$f.wat - -cp templates/leaderboard.json.template out/leaderboard.json \ No newline at end of file diff --git a/templates/leaderboard.json.template b/leaderboard.json similarity index 100% rename from templates/leaderboard.json.template rename to leaderboard.json diff --git a/reset-leaderboard.js b/reset-leaderboard.js index 8fe1908..3894d91 100644 --- a/reset-leaderboard.js +++ b/reset-leaderboard.js @@ -1,6 +1,6 @@ const fs = require('fs'); -var leaderboard = JSON.parse(fs.readFileSync("out/leaderboard.json")); +var leaderboard = JSON.parse(fs.readFileSync("leaderboard.json")); leaderboard.today = [ {name: 'none', value: '0'}, {name: 'none', value: '0'}, @@ -8,4 +8,4 @@ leaderboard.today = [ {name: 'none', value: '0'}, {name: 'none', value: '0'} ]; -fs.writeFile('out/leaderboard.json', JSON.stringify(leaderboard), ()=>{}); +fs.writeFile('leaderboard.json', JSON.stringify(leaderboard), ()=>{}); diff --git a/server.js b/server.js index 265769c..6865e0e 100644 --- a/server.js +++ b/server.js @@ -109,7 +109,7 @@ http_server.listen(HTTP_PORT, () => { }); var maps = JSON.parse(fs.readFileSync("maps.json")); -var leaderboard = JSON.parse(fs.readFileSync("out/leaderboard.json")); +var leaderboard = JSON.parse(fs.readFileSync("leaderboard.json")); const ws_server = new ws.Server({ port: WS_PORT }); @@ -173,7 +173,7 @@ ws_server.on('connection', (socket) => { leaderboard.total.pop(); } if (update_leaderboard) { - fs.writeFile('out/leaderboard.json', JSON.stringify(leaderboard), ()=>{}); + fs.writeFile('leaderboard.json', JSON.stringify(leaderboard), ()=>{}); sockets.forEach((s) => { s.send('{"name": "leaderboard", "value": '+JSON.stringify(leaderboard)+'}'); });