Skip to content

Free games for graphing calculators: NumWorks, TI-Nspire CX, Casio fx-CG50 and soon TI-84 Plus CE. Balatro, Celeste, Hollow Knight, Minecraft and more.

NumPlay Studio: the intro, previews, moving games, your own icon and name, languages

Mason3636790b1dffdc1
diff --git a/README.md b/README.md
index 893a622a..80df1faa 100644
--- a/README.md
+++ b/README.md
@@ -20,6 +20,12 @@
<a href="https://mason363.github.io/NumPlay/customize/"><img src="https://img.shields.io/badge/Pick_your_games-NumPlay_Studio-3A3A3C?style=for-the-badge" alt="Pick your games in NumPlay Studio"></a>
</p>
+<p align="center">
+ <a href="https://mason363.github.io/NumPlay/customize/"><img src="docs/media/studio.png" width="640" alt="NumPlay Studio: pick your games, add Game Boy, NES and Sega games, and install in one click"></a>
+ <br>
+ <a href="https://mason363.github.io/NumPlay/customize/"><b>Make your own NumPlay in NumPlay Studio</b></a>
+</p>
+
<p align="center">
<a href="#how-to-install"><b>How to install</b></a> &nbsp;·&nbsp; <a href="docs/play.md"><b>How to play</b></a> &nbsp;·&nbsp; <a href="https://github.com/Mason363/NumPlay/releases/latest"><b>All downloads</b></a> &nbsp;·&nbsp; <a href="#roadmap"><b>Roadmap</b></a> &nbsp;·&nbsp; <a href="docs/make-a-game.md"><b>Make a game</b></a>
</p>
@@ -288,6 +294,7 @@ NumPlay is a fan project, made out of love for these games and for the NumWorks
- **[Gabriel](https://github.com/tomcalif9-stack)**, who made the home screen's moving backgrounds, translated NumPlay into French first, and tests it on Upsilon and an N0115.
- **[LanoCodes17](https://github.com/LanoCodes17)**, whose idea the Konami code is: one of the secret ways into NumPlay from Matrices.
- **[Retro-Go](https://github.com/ducalex/retro-go)** by ducalex inspired NumPlay's Retro-Go, whose launcher, menus and frame skipping are written again for NumPlay with no code copied from it. Its emulators are **[gnuboy](https://github.com/rofl0r/gnuboy)** by Laguna and Gilgamesh (GNU GPL v2 or later) for the Game Boy and **nofrendo** by Matthew Conte (GNU LGPL v2, used under the GPL) for the NES; the Master System and Game Gear are NumPlay's own, around **[superzazu's z80](https://github.com/superzazu/z80)** by Nicolas Allemand (MIT License). Its tests use Blargg's test ROMs, Matt Currie's dmg-acid2 and cgb-acid2, kevtris's nestest and Frank Cringle's zexdoc and zexall. Not affiliated with them.
+- **NumPlay Studio** builds your NumPlay right in the browser with **GNU ld and objcopy** from [binutils](https://www.gnu.org/software/binutils/) (GNU GPL v3), compiled to WebAssembly with [emscripten](https://emscripten.org).
- Everyone who reported a bug: **NEE** ([reversallava63](https://github.com/reversallava63)), **Gabriel**, **[briac134](https://github.com/briac134)**, **[Raphanobie](https://github.com/Raphanobie)**, **[zbigzo](https://github.com/zbigzo)**, **Yacine**, **PelicanMan75**, **[Spykube](https://github.com/Spykube)** and **[axio-m](https://github.com/axio-m)**. Thank you!
## License
diff --git a/customize/app.css b/customize/app.css
index 53586129..2433a583 100644
--- a/customize/app.css
+++ b/customize/app.css
@@ -7,11 +7,12 @@
--btn: #1d1d1f;
--btn-ink: #ffffff;
--line: #a3a8af;
+ --blue: #0a84ff;
--shadow: 0 8px 18px rgba(0, 0, 0, 0.16);
--ease: cubic-bezier(0.2, 0.9, 0.25, 1);
--spring: cubic-bezier(0.3, 1.5, 0.5, 1);
--t: 210ms;
- --cw: clamp(240px, min(27vw, calc((100vh - 150px) * 0.509)), 380px);
+ --cw: clamp(240px, min(27vw, calc((100vh - 170px) * 0.509)), 380px);
}
* { box-sizing: border-box; }
@@ -24,25 +25,45 @@ body {
-webkit-font-smoothing: antialiased;
overflow-x: hidden;
}
-button { font: inherit; color: inherit; }
+button, input, select { font: inherit; color: inherit; }
a { color: inherit; }
-:focus-visible { outline: 3px solid #0a84ff; outline-offset: 3px; border-radius: 12px; }
+:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; border-radius: 12px; }
+.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
+[hidden] { display: none !important; }
-.brand {
- position: absolute; left: 36px; top: 28px; z-index: 2;
- display: flex; align-items: center; gap: 11px;
- text-decoration: none; color: var(--ink);
-}
-.brand img { width: 38px; height: 38px; filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.15)); transition: transform var(--t) var(--spring); }
-.brand:hover img { transform: rotate(-6deg) scale(1.06); }
-.brand span { font-size: 23px; font-weight: 750; letter-spacing: -0.6px; }
+/* ---- the top: NumPlay on calculator keys, and GitHub */
+.top { position: absolute; left: 0; right: 0; top: 0; z-index: 3; display: flex; justify-content: space-between; align-items: center; padding: 24px 32px 0; pointer-events: none; }
+.top > * { pointer-events: auto; }
+.logo { display: flex; align-items: center; gap: 12px; border: 0; background: none; padding: 0; cursor: pointer; }
+.logo-icon { width: 40px; height: 40px; border-radius: 18%; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.16); transition: transform 300ms var(--spring); }
+.logo:hover .logo-icon { transform: rotate(-8deg) scale(1.06); }
+.keys { display: flex; gap: 3px; }
+.keys i {
+ font-style: normal; font-weight: 700; font-size: 17px; line-height: 1;
+ width: 25px; height: 29px; display: flex; align-items: center; justify-content: center;
+ border-radius: 8px; color: #2a2a2c;
+ background: linear-gradient(#ffffff, #ececee);
+ box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.1), 0 1px 0 #c5c7cb, 0 2px 4px rgba(0, 0, 0, 0.12);
+ transition: transform 90ms var(--ease), box-shadow 90ms var(--ease);
+}
+.keys i.y { background: linear-gradient(#ffd25f, #f5b83a); color: #ffffff; text-shadow: 0 1px 1px rgba(150, 90, 0, 0.35); box-shadow: inset 0 -2px 0 rgba(150, 90, 0, 0.18), 0 1px 0 #d39a24, 0 2px 4px rgba(0, 0, 0, 0.14); }
+.keys i.down { transform: translateY(2px); box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.18), 0 0 0 #c5c7cb; }
+.star {
+ display: flex; align-items: center; gap: 10px; text-decoration: none;
+ background: var(--btn); color: var(--btn-ink); padding: 12px 18px 12px 16px; border-radius: 999px;
+ font-size: 15px; font-weight: 650; box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
+ transition: transform var(--t) var(--spring);
+}
+.star:hover { transform: translateY(-2px) scale(1.03); }
+.star .count { background: rgba(255, 255, 255, 0.16); padding: 3px 9px; border-radius: 999px; font-size: 13px; display: flex; align-items: center; gap: 4px; }
+.star .count::before { content: "★"; color: #f5b70a; }
main {
position: relative;
display: flex; flex-wrap: wrap; justify-content: center; align-items: center;
gap: 32px 64px;
min-height: 100vh;
- padding: 34px 40px 30px;
+ padding: 92px 40px 50px;
}
/* ---- the game grids */
@@ -55,33 +76,54 @@ main {
.app {
position: relative; border: 0; background: transparent; padding: 0; cursor: pointer;
-webkit-tap-highlight-color: transparent;
- transition: transform var(--t) var(--spring), filter var(--t) var(--ease), opacity var(--t) var(--ease);
+ transition: transform var(--t) var(--spring), opacity var(--t) var(--ease), translate 220ms var(--ease);
}
+.app.placeholder { opacity: 0.18 !important; }
+.app.held { outline: 2.5px solid var(--blue); outline-offset: 4px; border-radius: 18%; animation: wiggle 500ms ease-in-out infinite; }
+@keyframes wiggle { 0%, 100% { rotate: -2deg; } 50% { rotate: 2deg; } }
+.app.ghost img { box-shadow: 0 16px 30px rgba(0, 0, 0, 0.28); filter: none; }
+.app.ghost .badge { transform: scale(1); }
+body.dragging-icon, body.dragging-icon * { cursor: grabbing !important; user-select: none; }
.app img {
- display: block; width: 100%; aspect-ratio: 55 / 56; border-radius: 12px;
+ display: block; width: 100%; aspect-ratio: 55 / 56; border-radius: 18%;
transition: box-shadow var(--t) var(--ease), filter var(--t) var(--ease);
pointer-events: none; user-select: none;
}
-.grid.big .app img { border-radius: 14px; }
+.app .badge {
+ position: absolute; right: -5px; top: -5px; width: 22px; height: 22px; border-radius: 11px;
+ display: flex; align-items: center; justify-content: center;
+ background: var(--blue); color: #ffffff; box-shadow: 0 0 0 2.5px var(--bg), 0 2px 4px rgba(0, 0, 0, 0.2);
+ transform: scale(0); transition: transform 180ms var(--spring), background 120ms var(--ease);
+}
+.app .badge svg { width: 12px; height: 12px; }
+.app .badge .plus { display: none; }
+/* in: in colour, lifted, a blue tick */
.app.on img { box-shadow: var(--shadow); }
-.app.off { transform: scale(0.92); opacity: 0.62; filter: saturate(0.62); }
-.app.nofit { transform: scale(0.88); opacity: 0.26; filter: saturate(0.25); }
-.app:hover { transform: translateY(-2px) scale(1.03); }
-.app.off:hover { transform: scale(0.97); opacity: 0.9; }
-.app:active { transform: scale(0.9); transition-duration: 80ms; }
-.app.pop { animation: pop 260ms var(--spring); }
+.app.on .badge { transform: scale(1); }
+/* out: grey and small; hovering shows a + but keeps it grey, so taking one out always shows */
+.app.off { transform: scale(0.9); opacity: 0.5; }
+.app.off img { filter: grayscale(0.85) contrast(0.9); }
+.app.off:hover { opacity: 0.78; transform: scale(0.93); }
+.app.off:hover .badge { transform: scale(1); background: #8e939a; }
+.app.off .badge .tick, .app.nofit .badge .tick { display: none; }
+.app.off .badge .plus { display: block; }
+.app.nofit { transform: scale(0.86); opacity: 0.22; }
+.app.nofit img { filter: grayscale(1); }
+.app.on:hover { transform: translateY(-2px); }
+.app:active { transform: scale(0.88); transition-duration: 80ms; }
+.app.bounce { animation: bounce 280ms var(--spring); }
.app.shake { animation: shake 300ms var(--ease); }
-@keyframes pop { 0% { transform: scale(0.86); } 55% { transform: scale(1.08); } 100% { transform: scale(1); } }
+@keyframes bounce { 0% { transform: scale(0.84); } 55% { transform: scale(1.08); } 100% { transform: scale(1); } }
@keyframes shake {
- 0%, 100% { transform: translateX(0) scale(0.88); }
- 25% { transform: translateX(-5px) scale(0.88); }
- 50% { transform: translateX(4px) scale(0.88); }
- 75% { transform: translateX(-2px) scale(0.88); }
+ 0%, 100% { transform: translateX(0) scale(0.86); }
+ 25% { transform: translateX(-5px) scale(0.86); }
+ 50% { transform: translateX(4px) scale(0.86); }
+ 75% { transform: translateX(-2px) scale(0.86); }
}
/* ---- the calculator, its space bar and the buttons */
.device { display: flex; align-items: flex-start; gap: 24px; }
-.side-by { display: flex; flex-direction: column; align-items: center; gap: 20px; }
+.side-by { display: flex; flex-direction: column; align-items: center; gap: 22px; }
.meter { display: flex; flex-direction: column; align-items: center; gap: 10px; padding-top: calc(var(--cw) * 0.16); }
.used { font-size: 22px; font-weight: 750; letter-spacing: -0.5px; font-variant-numeric: tabular-nums; line-height: 1; }
.bar {
@@ -92,11 +134,7 @@ main {
transition: box-shadow var(--t) var(--ease);
}
.bar.over { box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.12), 0 0 0 3px rgba(255, 69, 58, 0.45); }
-.seg {
- display: block; width: 14px; flex-shrink: 0; height: 0;
- box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.25);
- transition: height var(--t) var(--ease);
-}
+.seg { display: block; width: 14px; flex-shrink: 0; height: 0; box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.25); transition: height var(--t) var(--ease); }
.cap { display: flex; flex-direction: column; gap: 4px; }
.cap button {
border: 0; background: transparent; padding: 3px 7px; border-radius: 999px; cursor: pointer;
@@ -106,11 +144,12 @@ main {
.cap button[aria-checked="true"] { background: var(--btn); color: var(--btn-ink); }
.calc { position: relative; width: var(--cw); aspect-ratio: 1018 / 2000; }
-.calc-img { position: absolute; inset: 0; width: 100%; height: 100%; user-select: none; }
-.calc::after {
- content: ""; position: absolute; left: 50%; bottom: -34px; width: 136%; height: 64px; transform: translateX(-50%);
- border-radius: 50%; background: radial-gradient(closest-side, rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0)); z-index: -1;
-}
+.calc-img { position: absolute; inset: 0; width: 100%; height: 100%; user-select: none; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.1)) drop-shadow(0 18px 26px rgba(0, 0, 0, 0.12)); }
+/* the shadow on the table: a soft wide one, and a darker one where it touches */
+.calc .shadow { position: absolute; left: 6%; right: 6%; bottom: -2.2%; height: 6%; pointer-events: none; }
+.calc .shadow::before, .calc .shadow::after { content: ""; position: absolute; border-radius: 50%; }
+.calc .shadow::before { inset: -40% -12%; background: radial-gradient(closest-side, rgba(30, 34, 44, 0.22), rgba(30, 34, 44, 0)); filter: blur(10px); }
+.calc .shadow::after { left: 8%; right: 8%; top: 28%; height: 34%; background: radial-gradient(closest-side, rgba(20, 22, 30, 0.38), rgba(20, 22, 30, 0)); filter: blur(4px); }
.screen {
position: absolute; left: 14.538%; top: 7.7%; width: 70.923%; height: 27.1%;
background: #0c0d10; overflow: hidden; container-type: size;
@@ -119,11 +158,11 @@ main {
position: absolute; left: 0; top: 0; right: 0; height: 7.5%;
background: #ffb734; color: #ffffff;
display: flex; align-items: center; justify-content: space-between; padding: 0 2.2cqw;
- font-size: 4.6cqh; font-weight: 700; letter-spacing: 0.02em; z-index: 3;
+ font-size: 4.6cqh; font-weight: 700; letter-spacing: 0.02em; z-index: 3; white-space: nowrap;
transition: background var(--t) var(--ease);
}
.over .status { background: #ff453a; }
-.battery { width: 5.6cqw; height: 3.6cqh; border: max(1px, 0.4cqh) solid #ffffff; border-radius: 1px; position: relative; display: block; }
+.battery { width: 5.6cqw; height: 3.6cqh; border: max(1px, 0.4cqh) solid #ffffff; border-radius: 1px; position: relative; display: block; flex-shrink: 0; }
.battery i { position: absolute; left: 1px; top: 1px; bottom: 1px; width: 50%; background: #ffffff; display: block; transition: width var(--t) var(--ease); }
.map { position: absolute; left: 0; right: 0; top: 7.5%; bottom: 0; }
.tile {
@@ -134,13 +173,12 @@ main {
}
.tile.enter { opacity: 0; transform: scale(0.82); }
.tile.leave { opacity: 0; transform: scale(0.82); pointer-events: none; }
-.tile img {
- display: block; height: auto; aspect-ratio: 55 / 56; border-radius: 9%;
- box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
- transition: width var(--t) var(--ease), opacity var(--t) var(--ease);
-}
+.tile img { display: block; height: auto; aspect-ratio: 55 / 56; border-radius: 18%; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4); transition: width var(--t) var(--ease), opacity var(--t) var(--ease); }
.tile b { color: #ffffff; font-size: 4.4cqh; font-weight: 800; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5); }
.tile.free { background: repeating-linear-gradient(135deg, #15171c 0 4px, #1b1e24 4px 8px); border-color: rgba(0, 0, 0, 0.6); }
+.preview { position: absolute; left: 0; right: 0; top: 7.5%; bottom: 0; z-index: 2; background: #000000; opacity: 0; transition: opacity 140ms var(--ease); pointer-events: none; }
+.preview img { width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; display: block; }
+.preview.show { opacity: 1; }
.drop-hint {
position: absolute; inset: 7.5% 0 0 0; z-index: 4; display: flex; align-items: center; justify-content: center;
color: #ffffff; background: rgba(10, 132, 255, 0.42); outline: 2px dashed rgba(255, 255, 255, 0.8); outline-offset: -6px;
@@ -148,15 +186,17 @@ main {
}
body.dragging .drop-hint { opacity: 1; }
-.actions { display: flex; align-items: center; gap: 12px; }
-.variants { display: flex; gap: 6px; margin-right: 4px; }
-.variants button {
- width: 30px; height: 30px; padding: 0; border: 0; border-radius: 8px; background: transparent; cursor: pointer;
- opacity: 0.45; transition: opacity var(--t) var(--ease), transform var(--t) var(--spring);
-}
-.variants button img { width: 100%; height: 100%; display: block; border-radius: 7px; outline: 1px solid rgba(0, 0, 0, 0.1); outline-offset: -1px; }
-.variants button[aria-checked="true"] { opacity: 1; transform: scale(1.08); }
-.variants button:hover { opacity: 0.85; }
+.actions { display: flex; align-items: center; gap: 10px; }
+.chip {
+ height: 46px; padding: 0 10px 0 9px; border: 0; border-radius: 23px; background: var(--card); cursor: pointer;
+ display: flex; align-items: center; gap: 6px; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
+ transition: transform var(--t) var(--spring);
+}
+.chip img { width: 28px; height: 28px; border-radius: 18%; outline: 1px solid rgba(0, 0, 0, 0.08); outline-offset: -1px; display: block; }
+.chip.lang span { font-size: 13px; font-weight: 750; min-width: 22px; text-align: center; }
+.chip .caret { color: var(--mute); transition: transform var(--t) var(--ease); }
+.chip[aria-expanded="true"] .caret { transform: rotate(180deg); }
+.chip:hover { transform: translateY(-2px); }
.install {
position: relative; border: 0; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center;
background: var(--btn); color: var(--btn-ink); padding: 13px 30px; border-radius: 999px; font-size: 15px; font-weight: 600;
@@ -181,20 +221,77 @@ body.dragging .drop-hint { opacity: 1; }
.round.busy svg { animation: drop 700ms var(--ease) infinite; }
@keyframes drop { 0% { transform: translateY(-3px); opacity: 0.4; } 60% { transform: translateY(2px); opacity: 1; } 100% { transform: translateY(2px); opacity: 0.4; } }
-/* ---- Retro-Go's cartridges */
-.carts[hidden] { display: none; }
-.carts { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
-.carts input { position: absolute; left: -9999px; }
+/* ---- the app's own settings: two small panels over the chips */
+.pop {
+ position: fixed; z-index: 25; width: 330px; background: var(--card); border-radius: 18px; padding: 16px;
+ box-shadow: 0 18px 50px rgba(0, 0, 0, 0.22), 0 0 0 1px rgba(0, 0, 0, 0.04);
+ display: flex; flex-direction: column; gap: 14px; animation: rise 200ms var(--spring);
+}
+.pop.narrow { width: 170px; padding: 8px; }
+.pop-row { display: flex; align-items: center; gap: 10px; }
+.pop-label { width: 66px; flex-shrink: 0; font-size: 12px; font-weight: 650; color: var(--mute); }
+.icon-pick { display: flex; gap: 8px; }
+.icon-pick button { width: 44px; height: 44px; padding: 0; border: 0; border-radius: 12px; background: transparent; cursor: pointer; position: relative; transition: transform var(--t) var(--spring); }
+.icon-pick button img { width: 100%; height: 100%; border-radius: 18%; display: block; outline: 1px solid rgba(0, 0, 0, 0.1); outline-offset: -1px; }
+.icon-pick button[aria-checked="true"] { box-shadow: 0 0 0 2.5px var(--card), 0 0 0 4.5px var(--blue); }
+.icon-pick button:hover { transform: translateY(-2px); }
+.icon-pick .upload { border: 2px dashed var(--line); color: var(--mute); display: flex; align-items: center; justify-content: center; }
+.field { flex: 1; min-width: 0; height: 36px; border: 1px solid #d5d8dc; border-radius: 10px; padding: 0 10px; background: #f6f7f8; font-size: 14px; }
+.field:focus { outline: 2px solid var(--blue); outline-offset: -1px; background: #ffffff; }
+.segctl { display: flex; background: #eceef1; border-radius: 10px; padding: 3px; gap: 3px; }
+.segctl button { border: 0; background: transparent; border-radius: 8px; padding: 7px 12px; font-size: 13px; font-weight: 650; color: var(--mute); cursor: pointer; transition: background var(--t) var(--ease), color var(--t) var(--ease); }
+.segctl button[aria-checked="true"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }
+.segctl.col { flex-direction: column; background: transparent; padding: 0; }
+.segctl.col button { text-align: left; padding: 10px 12px; font-size: 14px; color: var(--ink); }
+.segctl.col button[aria-checked="true"] { background: #eceef1; box-shadow: none; }
+.tick { display: flex; align-items: center; gap: 5px; font-size: 13px; color: var(--mute); white-space: nowrap; }
+
+#xl-pop { width: 360px; gap: 10px; }
+.xl-title { font-size: 16px; }
+.xl-text, .xl-warn { margin: 0; font-size: 13px; line-height: 1.45; color: #3a3d42; }
+.xl-warn { color: #a05a00; background: #fff4e0; border-radius: 10px; padding: 8px 10px; }
+.xl-steps { margin: 0; padding-left: 20px; font-size: 13px; line-height: 1.6; color: #3a3d42; }
+.xl-buttons { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; }
+.xl-guide { font-size: 13px; font-weight: 650; color: var(--blue); text-decoration: none; }
+.xl-ok { padding: 10px 20px; font-size: 14px; }
+
+/* ---- Retro-Go: drop your games, they come in as cartridges */
+.retro { display: flex; flex-direction: column; gap: 12px; }
+.retro-head { display: flex; align-items: center; gap: 10px; }
+.retro-head img { width: 34px; height: 34px; border-radius: 18%; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15); }
+.retro-head b { display: block; font-size: 15px; }
+.retro-head .systems { display: block; font-size: 12px; color: var(--mute); font-weight: 600; }
+.drop {
+ position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer;
+ border: 2px dashed var(--line); border-radius: 16px; padding: 18px 12px 14px; text-align: center;
+ transition: border-color var(--t) var(--ease), background var(--t) var(--ease), transform var(--t) var(--spring);
+}
+.drop:hover, body.dragging .drop { border-color: var(--blue); background: rgba(10, 132, 255, 0.06); }
+.drop:active { transform: scale(0.98); }
+.drop-art { position: relative; width: 74px; height: 46px; margin-bottom: 4px; }
+.drop-art i { position: absolute; bottom: 0; width: 30px; height: 36px; border-radius: 3px 8px 3px 3px; box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.12); transition: transform 260ms var(--spring); }
+.drop-art i::after { content: ""; position: absolute; left: 4px; right: 4px; bottom: 7px; height: 14px; border-radius: 2px; }
+.drop-art .c1 { left: 0; background: #c9c9cf; transform: rotate(-12deg); }
+.drop-art .c1::after { background: #6d8a0c; }
+.drop-art .c2 { left: 22px; background: #d9d9de; z-index: 1; }
+.drop-art .c2::after { background: #c43a2f; }
+.drop-art .c3 { right: 0; background: #cfd6e4; transform: rotate(12deg); }
+.drop-art .c3::after { background: #2f62c4; }
+.drop:hover .c1, body.dragging .c1 { transform: rotate(-18deg) translateY(-4px); }
+.drop:hover .c2, body.dragging .c2 { transform: translateY(-8px); }
+.drop:hover .c3, body.dragging .c3 { transform: rotate(18deg) translateY(-4px); }
+.drop-text { font-size: 15px; font-weight: 700; }
+.drop-sub { font-size: 12px; color: var(--mute); font-weight: 600; letter-spacing: 0.02em; }
+.retro input[type=file] { position: absolute; left: -9999px; }
+.carts { display: flex; flex-wrap: wrap; gap: 10px; }
+.carts:empty { display: none; }
.cart {
- position: relative; width: 56px; height: 66px; border: 0; padding: 0; cursor: pointer;
+ position: relative; width: 52px; height: 62px; border: 0; padding: 0; cursor: pointer;
border-radius: 5px 13px 5px 5px; display: flex; flex-direction: column; justify-content: flex-end;
box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.12);
transition: transform var(--t) var(--spring), opacity var(--t) var(--ease);
}
-.cart .label {
- margin: 0 7px 11px; height: 28px; border-radius: 3px; color: #ffffff; font-size: 11px; font-weight: 800;
- display: flex; align-items: center; justify-content: center;
-}
+.cart .label { margin: 0 6px 10px; height: 26px; border-radius: 3px; color: #ffffff; font-size: 11px; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.cart .x {
position: absolute; right: -6px; top: -6px; width: 20px; height: 20px; border-radius: 10px;
background: var(--btn); color: var(--btn-ink); display: flex; align-items: center; justify-content: center;
@@ -203,21 +300,33 @@ body.dragging .drop-hint { opacity: 1; }
.cart:hover .x, .cart:focus-visible .x { opacity: 1; transform: scale(1); }
.cart:hover { transform: translateY(-3px) rotate(-2deg); }
.cart:active { transform: scale(0.92); transition-duration: 80ms; }
-.cart.enter { animation: slot 300ms var(--spring); }
+.cart.enter { animation: slot 320ms var(--spring); }
@keyframes slot { 0% { transform: translateY(-18px) scale(0.8); opacity: 0; } 100% { transform: none; opacity: 1; } }
-.cart.add {
- border: 2px dashed var(--line); background: transparent; box-shadow: none; color: var(--mute);
- align-items: center; justify-content: center;
-}
-.cart.add:hover { color: var(--ink); border-color: var(--ink); }
-.foot { position: absolute; right: 36px; bottom: 22px; font-size: 12px; }
-.foot a { color: var(--mute); text-decoration: none; }
-.foot a:hover { color: var(--ink); }
+/* ---- the intro: a few words, the calculator filling up, then the studio */
+.caption {
+ position: fixed; left: 50%; top: 22px; z-index: 30; transform: translate(-50%, 8px); pointer-events: none;
+ font-size: clamp(24px, 3vw, 40px); font-weight: 800; letter-spacing: -1px; text-align: center; white-space: nowrap;
+ opacity: 0; transition: opacity 320ms var(--ease), transform 420ms var(--ease);
+}
+.caption.show { opacity: 1; transform: translate(-50%, 0); }
+.intro-skip {
+ position: fixed; left: 50%; bottom: 28px; z-index: 30; transform: translateX(-50%); border: 0; cursor: pointer;
+ background: rgba(29, 29, 31, 0.08); color: var(--mute); font-size: 13px; font-weight: 650; padding: 8px 16px; border-radius: 999px;
+}
+body.intro .grid.small, body.intro .side, body.intro .meter, body.intro .actions, body.intro .top, body.intro .foot { transition: opacity 500ms var(--ease), transform 600ms var(--ease); }
+body.intro.s0 .grid.small, body.intro.s0 .side, body.intro.s0 .meter, body.intro.s0 .actions, body.intro.s0 .top, body.intro.s0 .foot,
+body.intro.s1 .side, body.intro.s1 .meter, body.intro.s1 .actions, body.intro.s1 .top, body.intro.s1 .foot,
+body.intro.s2 .actions, body.intro.s2 .top, body.intro.s2 .foot { opacity: 0; transform: translateY(10px); pointer-events: none; }
+body.intro .calc { transition: transform 700ms var(--ease), opacity 500ms var(--ease); }
+body.intro.s0 .calc { transform: translateY(24px) scale(0.97); }
+body.intro.s0.start .calc { opacity: 0; }
+body.intro.s3 .install { animation: beat 900ms var(--ease) 2; }
+@keyframes beat { 0%, 100% { transform: scale(1); } 40% { transform: scale(1.08); } }
/* ---- tooltip, toast and the install sheet */
.tip {
- position: fixed; left: 0; top: 0; z-index: 20; pointer-events: none;
+ position: fixed; left: 0; top: 0; z-index: 40; pointer-events: none;
background: rgba(29, 29, 31, 0.92); color: #ffffff; font-size: 12px; font-weight: 600; white-space: nowrap;
padding: 6px 10px; border-radius: 8px; opacity: 0; transform: translateY(4px);
transition: opacity 110ms var(--ease), transform 110ms var(--ease);
@@ -225,50 +334,61 @@ body.dragging .drop-hint { opacity: 1; }
.tip.show { opacity: 1; transform: none; }
.tip small { font-weight: 500; opacity: 0.7; margin-left: 6px; }
.toast {
- position: fixed; left: 50%; bottom: 28px; z-index: 30; transform: translate(-50%, 20px);
+ position: fixed; left: 50%; bottom: 28px; z-index: 45; transform: translate(-50%, 20px);
background: var(--btn); color: var(--btn-ink); font-size: 14px; font-weight: 600; padding: 11px 18px; border-radius: 999px;
opacity: 0; pointer-events: none; transition: opacity 160ms var(--ease), transform 220ms var(--spring);
max-width: calc(100vw - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
-
.sheet {
- position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; padding: 16px;
+ position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px;
background: rgba(0, 0, 0, 0.32); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
animation: fade 160ms var(--ease);
}
-.sheet[hidden] { display: none; }
.sheet-card {
- position: relative; width: min(380px, 100%); background: var(--card); color: var(--ink); border-radius: 22px; padding: 26px 26px 22px;
+ position: relative; width: min(390px, 100%); background: var(--card); color: var(--ink); border-radius: 22px; padding: 26px 26px 18px;
box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3); animation: rise 260ms var(--spring);
}
.sheet-card h2 { margin: 0 0 18px; font-size: 19px; letter-spacing: -0.3px; }
.sheet-close { position: absolute; right: 14px; top: 14px; width: 30px; height: 30px; border: 0; border-radius: 15px; background: var(--track); cursor: pointer; display: flex; align-items: center; justify-content: center; }
-.steps { list-style: none; margin: 0 0 22px; padding: 0; display: flex; flex-direction: column; gap: 14px; counter-reset: s; }
+.steps { list-style: none; margin: 0 0 22px; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.steps li { display: flex; align-items: center; gap: 14px; font-size: 15px; font-weight: 550; }
-.steps li[hidden] { display: none; }
.step-icon { width: 42px; height: 42px; border-radius: 12px; background: var(--track); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.install.wide { width: 100%; }
+.star-ask { display: flex; align-items: center; gap: 10px; margin-top: 14px; padding: 12px 14px; border-radius: 14px; background: #fff7e0; text-decoration: none; font-size: 14px; font-weight: 600; transition: transform var(--t) var(--spring); }
+.star-ask:hover { transform: translateY(-1px); }
@keyframes fade { from { opacity: 0; } }
-@keyframes rise { from { transform: translateY(24px) scale(0.97); opacity: 0; } }
+@keyframes rise { from { transform: translateY(14px) scale(0.97); opacity: 0; } }
+
+.foot { position: absolute; right: 32px; bottom: 18px; font-size: 12px; color: var(--mute); display: flex; gap: 8px; }
+.foot a { color: var(--mute); text-decoration: none; }
+.foot a:hover { color: var(--ink); }
+.noscript { text-align: center; padding: 0 16px; }
/* ---- narrow screens: the calculator first, the games below */
@media (max-width: 980px) {
:root { --cw: min(300px, 62vw); }
+ .top { padding: 16px 16px 0; }
+ .star span { display: none; }
+ .star { padding: 10px 14px; }
main { padding: 84px 16px 32px; gap: 28px; }
.device { order: -1; gap: 16px; }
.grid.small, .side { flex-basis: 100%; max-width: 560px; }
.grid.small { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.grid.big { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
- .brand { left: 16px; top: 20px; }
- .foot { position: static; text-align: center; padding: 0 16px 24px; }
+ .foot { position: static; justify-content: center; padding: 0 16px 24px; }
+ .caption { top: 18px; white-space: normal; width: calc(100vw - 32px); }
}
@media (max-width: 420px) {
+ .keys i { width: 21px; height: 26px; font-size: 15px; }
+ .logo-icon { width: 34px; height: 34px; }
.grid.small { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.grid.big { grid-template-columns: repeat(4, minmax(0, 1fr)); }
- .variants { display: none; }
+ .actions { gap: 8px; }
+ .chip { padding: 0 8px 0 7px; }
+ .pop { width: calc(100vw - 32px); }
}
@media (prefers-reduced-motion: reduce) {
:root { --t: 1ms; }
- .app.pop, .app.shake, .cart.enter, .sheet, .sheet-card { animation: none; }
+ .app.bounce, .app.shake, .cart.enter, .sheet, .sheet-card, .pop { animation: none; }
}
diff --git a/customize/app.js b/customize/app.js
index 1a2cd7e4..03ccf7c7 100644
--- a/customize/app.js
+++ b/customize/app.js
@@ -1,13 +1,16 @@
/* NumPlay Studio: pick games, add Retro-Go games, and link a NumPlay.nwa of your own in the
- * browser. The kit (kit/, made by `make kit`, tools/kit.py) holds the objects the Makefile links
- * NumPlay.nwa from; GNU ld and objcopy, built as WebAssembly (ld/), link them here the same way. */
+ * browser. The kit (kit/, made by `make kit` and `make kit-langs`, tools/kit.py) holds the objects
+ * the Makefile links NumPlay.nwa from; GNU ld and objcopy, built as WebAssembly (ld/), link them
+ * here the same way. */
'use strict';
(() => {
const KIT = 'kit/';
+ const PREVIEWS = '../docs/media/gallery/';
const MiB = 1048576;
// Enlarged Extra Apps (nwagyu's Nwagra): it moves the end of the app area from the end of
// Epsilon's slot to the end of the 8 MB flash, so apps go from 0x90200000 to 0x90800000
const XL_SPACE = 6 * MiB;
+ const NWAGRA = 'https://nwagyu.org/guide/help/enlarge-your-memory.html';
const SYS = {
1: { tag: 'GB', name: 'Game Boy', color: '#6d8a0c', shell: '#c9c9cf' },
2: { tag: 'GBC', name: 'Game Boy Color', color: '#6a3fb5', shell: '#b9a6d8' },
@@ -17,7 +20,10 @@
};
const EXT = { gb: 1, gbc: 2, nes: 3, sms: 4, gg: 5 };
const ROM_ENTRY = 52, ROM_HEAD = 12;
- const VARIANT_NAMES = { 'NumPlay': 'NumPlay', 'NumPlay-Invisible': 'Invisible', 'NumPlay-Matrices': 'Matrices' };
+ const PRESETS = { 'NumPlay': ['NumPlay', 'NumPlay'], 'NumPlay-Invisible': ['Invisible', ' '], 'NumPlay-Matrices': ['Matrices', 'Matrices'] };
+ const LANGS = { en: ['EN', 'English'], fr: ['FR', 'Français'], zh: ['中文', '中文'] };
+ // launcher/src/settings.c's secrets, in order (NP_SECRET_*)
+ const SECRETS = ['x,n,t key', 'var key', 'Toolbox key', 'π key', '√ key', 'Menu: Examples', 'Konami code'];
const W = 320, H = 222; // the screen below its status bar, in the calculator's pixels
const $ = (s) => document.querySelector(s);
@@ -34,21 +40,34 @@
return 'rgb(' + c.map((v) => Math.round(t > 0 ? v + (255 - v) * t : v * (1 + t))).join(',') + ')';
};
const size = (b) => b >= MiB ? (b / MiB).toFixed(2) + ' MB' : Math.max(1, Math.round(b / 1024)) + ' KB';
+ const wait = (ms) => new Promise((r) => setTimeout(r, ms));
+ const store = (k, v) => { try { if (v === undefined) return localStorage.getItem(k); localStorage.setItem(k, v); } catch (e) { return null; } return null; };
let kit = null, rg = null;
- const st = { picked: new Set(), roms: [], cap: 'std', variant: 'NumPlay' };
+ const kits = {}; // the kit of each language, loaded when picked
+ const byId = {};
+ const st = {
+ picked: new Set(), order: [], roms: [], cap: 'std', lang: 'en',
+ app: { icon: 'NumPlay', name: 'NumPlay', open: 'numplay', secret: 0, hint: true },
+ };
+ let custom = null; // an icon of your own: { url, obj }
let romKey = 0;
// ------------------------------------------------------------------ sizes
const capacity = () => st.cap === 'xl' ? XL_SPACE : kit.appSpace;
+ const langKit = () => kits[st.lang] || kit;
+ const flash = (id) => ((langKit().byId || {})[id] || byId[id]).flash;
const romBytes = (r) => ROM_ENTRY + align4(r.bytes.length);
+ const iconUrl = () => st.app.icon === 'custom' && custom ? custom.url : KIT + 'variants/' + st.app.icon + '.png';
+ const ordered = () => st.order.filter((id) => st.picked.has(id));
function items() {
- const out = [{ key: '_core', name: 'NumPlay', bytes: kit.base, color: '#3a3a3c', icon: KIT + 'variants/' + st.variant + '.png' }];
- for (const g of kit.games)
- if (st.picked.has(g.id) && g !== rg)
- out.push({ key: g.id, id: g.id, name: g.title, bytes: g.flash, color: hex(g.top), icon: g.icon ? KIT + 'icons/' + g.id + '.png' : null });
+ const out = [{ key: '_core', name: st.app.name.trim() || 'NumPlay', bytes: langKit().base, color: '#3a3a3c', icon: iconUrl() }];
+ for (const id of ordered()) {
+ const g = byId[id];
+ out.push({ key: id, id, name: g.title, bytes: flash(id), color: hex(g.top), icon: g.icon ? KIT + 'icons/' + id + '.png' : null });
+ }
if (rg && st.roms.length) {
- out.push({ key: rg.id, id: rg.id, name: rg.title, bytes: rg.flash + ROM_HEAD, color: hex(rg.top), icon: rg.icon ? KIT + 'icons/' + rg.id + '.png' : null });
+ out.push({ key: rg.id, id: rg.id, name: rg.title, bytes: flash(rg.id) + ROM_HEAD, color: hex(rg.top), icon: rg.icon ? KIT + 'icons/' + rg.id + '.png' : null });
for (const r of st.roms)
out.push({ key: 'rom' + r.key, rom: r, name: r.name, bytes: romBytes(r), color: SYS[r.sys].color, tag: SYS[r.sys].tag });
}
@@ -91,7 +110,7 @@
// ------------------------------------------------------------------ drawing
const tiles = new Map(), segs = new Map(), buttons = new Map();
- let shownUsed = 0, tween = 0;
+ let shownUsed = 0, tween = 0, previewing = null;
function render() {
const list = items(), cap = capacity();
@@ -126,12 +145,13 @@
const s = Math.min(t.w, t.h);
const img = e.querySelector('img');
if (img) {
+ if (t.key === '_core' && img.getAttribute('src') !== t.icon) img.src = t.icon;
img.style.width = (100 * Math.min(44, s * 0.62) / Math.max(t.w, 1)) + '%';
img.style.opacity = s >= 13 ? 1 : 0;
}
const b = e.querySelector('b');
if (b) b.style.opacity = s >= 14 ? 1 : 0;
- e.dataset.tip = t.free ? 'Free|' + size(t.bytes) : t.name + '|' + size(t.bytes);
+ e.dataset.tip = (t.free ? 'Free' : t.name) + '|' + size(t.bytes);
if (fresh) {
if (first) { // (the first time, the blocks come in one after another, the biggest first)
e.style.transitionDelay = (18 * i) + 'ms';
@@ -143,7 +163,7 @@
});
for (const [k, e] of tiles) if (!seen.has(k)) { e.classList.add('leave'); tiles.delete(k); setTimeout(() => e.remove(), 260); }
- // the bar beside it: the same blocks, stacked
+ // the bar beside it: the same blocks, stacked in the launcher's order
const bar = $('#bar'), keys = new Set();
list.forEach((it, i) => {
let e = segs.get(it.key);
@@ -161,6 +181,10 @@
keys.add(it.key);
});
for (const [k, e] of segs) if (!keys.has(k)) { e.style.height = '0'; segs.delete(k); setTimeout(() => e.remove(), 260); }
+ // (the order of the blocks follows the games' order)
+ const want = list.map((it) => segs.get(it.key));
+ const live = [...bar.children].filter((c) => want.includes(c));
+ if (live.some((c, i) => c !== want[i])) for (const c of want) bar.appendChild(c);
bar.classList.toggle('over', over);
$('#screen').classList.toggle('over', over);
bar.setAttribute('aria-label', 'Space used: ' + size(used) + ' of ' + size(cap));
@@ -173,31 +197,34 @@
const k = Math.min(1, Math.max(0, (now - t0) / 220)), e = 1 - Math.pow(1 - k, 3); // (a frame's time can be before t0)
shownUsed = from + (used - from) * e;
$('#used').textContent = (shownUsed / MiB).toFixed(2);
- $('#status-line').textContent = (shownUsed / MiB).toFixed(2) + ' OF ' + +(cap / MiB).toFixed(2) + ' MB';
+ if (!previewing) $('#status-line').textContent = (shownUsed / MiB).toFixed(2) + ' OF ' + +(cap / MiB).toFixed(2) + ' MB';
$('#battery').style.width = 'calc(' + Math.min(100, 100 * shownUsed / cap) + '% - 2px)';
if (k < 1) requestAnimationFrame(step);
};
step(t0);
- // the icons
+ // the icons, in the order they go in the launcher
for (const [id, b] of buttons) {
- const g = kit.games.find((x) => x.id === id), on = st.picked.has(id);
+ const g = byId[id], on = st.picked.has(id), fits = used + flash(id) <= cap;
b.classList.toggle('on', on);
- b.classList.toggle('off', !on && used + g.flash <= cap);
- b.classList.toggle('nofit', !on && used + g.flash > cap);
+ b.classList.toggle('off', !on && fits);
+ b.classList.toggle('nofit', !on && !fits);
b.setAttribute('aria-pressed', on);
- b.dataset.tip = g.title + '|' + size(g.flash);
+ b.dataset.tip = g.title + '|' + size(flash(id)) + ' · drag to move';
+ }
+ for (const box of [$('#small'), $('#big')]) {
+ const want2 = st.order.map((id) => buttons.get(id)).filter((b) => b && b.parentNode === box);
+ if ([...box.children].some((c, i) => c !== want2[i])) for (const b of want2) box.appendChild(b);
}
for (const b of document.querySelectorAll('.cap button')) b.setAttribute('aria-checked', b.dataset.cap === st.cap);
- for (const b of document.querySelectorAll('.variants button')) b.setAttribute('aria-checked', b.dataset.v === st.variant);
- $('#brand-icon').src = KIT + 'variants/' + st.variant + '.png';
+ $('#app-chip-icon').src = iconUrl();
+ $('#lang-chip-label').textContent = LANGS[st.lang][0];
renderCarts();
save();
}
function renderCarts() {
- const box = $('#carts'), add = $('#add-rom');
- if (!rg) { box.hidden = true; return; }
+ const box = $('#carts');
const have = new Set();
for (const r of st.roms) {
have.add('c' + r.key);
@@ -213,33 +240,56 @@
'<svg viewBox="0 0 24 24" width="10" height="10" fill="none" stroke="currentColor" stroke-width="3.4" stroke-linecap="round"><path d="M6 6l12 12M18 6L6 18"/></svg>';
c.addEventListener('click', () => removeRom(r));
c.addEventListener('animationend', () => c.classList.remove('enter'));
- box.insertBefore(c, add);
+ box.appendChild(c);
}
for (const c of box.querySelectorAll('.cart[data-k]')) if (!have.has(c.dataset.k)) c.remove();
}
+ // ------------------------------------------------------------------ the game on the screen
+ let previewTimer = 0;
+ function showPreview(id) {
+ const g = byId[id];
+ if (!g || !g.preview || dragging) return;
+ clearTimeout(previewTimer);
+ previewing = id;
+ const p = $('#preview'), img = p.querySelector('img');
+ const src = PREVIEWS + id + '.gif';
+ if (img.getAttribute('src') !== src) img.src = src;
+ p.classList.add('show');
+ $('#status-line').textContent = g.title.toUpperCase();
+ }
+ function hidePreview(later) {
+ clearTimeout(previewTimer);
+ const go = () => {
+ previewing = null;
+ $('#preview').classList.remove('show');
+ $('#status-line').textContent = (shownUsed / MiB).toFixed(2) + ' OF ' + +(capacity() / MiB).toFixed(2) + ' MB';
+ };
+ if (later) previewTimer = setTimeout(go, later); else go();
+ }
+
// ------------------------------------------------------------------ picking
function bump(e, cls) {
- e.classList.remove('pop', 'shake');
+ if (!e) return;
+ e.classList.remove('bounce', 'shake');
void e.offsetWidth;
e.classList.add(cls);
setTimeout(() => e.classList.remove(cls), 320);
}
function overflow(bytes) {
- toast("That doesn't fit: " + size(bytes) + ' too much');
- const bar = $('#bar');
- bar.classList.add('over');
+ toast("That doesn't fit: " + size(bytes) + ' too much' + (st.cap === 'std' ? '. 6 MB can take more' : ''));
+ $('#bar').classList.add('over');
setTimeout(() => render(), 500);
}
- function toggle(id) {
- const g = kit.games.find((x) => x.id === id), b = buttons.get(id);
+ function toggle(id, quiet) {
+ const b = buttons.get(id);
if (st.picked.has(id)) st.picked.delete(id);
else {
- const over = usedBytes() + g.flash - capacity();
- if (over > 0) { if (b) bump(b, 'shake'); overflow(over); return; }
+ const over = usedBytes() + flash(id) - capacity();
+ if (over > 0) { bump(b, 'shake'); if (!quiet) overflow(over); return; }
st.picked.add(id);
- if (b) bump(b, 'pop');
- fetchObj('games/' + id + '.o'); // (ready by the time you install)
+ bump(b, 'bounce');
+ if (!quiet) fetchObj(objPath(id)).catch(() => {}); // (ready by the time you install)
}
render();
}
@@ -254,11 +304,11 @@
}
const bytes = new Uint8Array(await f.arrayBuffer());
const r = { key: ++romKey, sys, bytes, name: romName(f.name) };
- const extra = (st.roms.length ? 0 : rg.flash + ROM_HEAD) + romBytes(r);
+ const extra = (st.roms.length ? 0 : flash(rg.id) + ROM_HEAD) + romBytes(r);
const over = usedBytes() + extra - capacity();
- if (over > 0) { bump($('#add-rom'), 'shake'); overflow(over); continue; }
+ if (over > 0) { bump($('#drop'), 'shake'); overflow(over); continue; }
st.roms.push(r);
- fetchObj('games/' + rg.id + '.o');
+ fetchObj(objPath(rg.id)).catch(() => {});
}
render();
}
@@ -276,26 +326,124 @@
render();
}
+ // ------------------------------------------------------------------ moving games around
+ // Drag an icon to change where its game sits in the launcher; a click still picks it. On a
+ // phone, hold an icon, then tap where it goes.
+ let dragging = null, justDragged = false, holding = null;
+ function flip(box, change) {
+ const kids = [...box.children], before = new Map(kids.map((k) => [k, k.getBoundingClientRect()]));
+ change();
+ for (const k of kids) {
+ const a = before.get(k), b = k.getBoundingClientRect();
+ const dx = a.left - b.left, dy = a.top - b.top;
+ if (!dx && !dy) continue;
+ k.style.transition = 'none';
+ k.style.translate = dx + 'px ' + dy + 'px';
+ requestAnimationFrame(() => { k.style.transition = ''; k.style.translate = ''; });
+ }
+ }
+ function commitOrder() {
+ const small = [...$('#small').children].map((b) => b.dataset.id), big = [...$('#big').children].map((b) => b.dataset.id);
+ st.order = small.concat(big, st.order.filter((id) => !small.includes(id) && !big.includes(id)));
+ render();
+ }
+ function sortable(box) {
+ box.addEventListener('pointerdown', (e) => {
+ const b = e.target.closest('.app');
+ if (!b || e.button || intro.on) return;
+ if (e.pointerType === 'touch') {
+ if (holding === b) { b.classList.remove('held'); holding = null; justDragged = true; return; }
+ if (holding && holding !== b) { // (a phone: the held icon goes where you tap)
+ const from = holding;
+ holding.classList.remove('held'); holding = null; justDragged = true;
+ if (from.parentNode === box) flip(box, () => box.insertBefore(from, [...box.children].indexOf(from) < [...box.children].indexOf(b) ? b.nextSibling : b));
+ commitOrder();
+ return;
+ }
+ const t = setTimeout(() => { holding = b; b.classList.add('held'); justDragged = true; toast('Now tap where it goes'); }, 450);
+ const stop = () => { clearTimeout(t); removeEventListener('pointerup', stop); removeEventListener('pointercancel', stop); };
+ addEventListener('pointerup', stop); addEventListener('pointercancel', stop);
+ return;
+ }
+ dragging = { b, box, x: e.clientX, y: e.clientY, on: false, ghost: null };
+ });
+ addEventListener('pointermove', (e) => {
+ const d = dragging;
+ if (!d || d.box !== box) return;
+ if (!d.on) {
+ if (Math.hypot(e.clientX - d.x, e.clientY - d.y) < 7) return;
+ d.on = true;
+ hidePreview();
+ const r = d.b.getBoundingClientRect();
+ d.dx = d.x - r.left; d.dy = d.y - r.top;
+ d.ghost = d.b.cloneNode(true);
+ d.ghost.className = 'app on ghost';
+ Object.assign(d.ghost.style, { position: 'fixed', left: '0', top: '0', width: r.width + 'px', zIndex: 60, pointerEvents: 'none', margin: 0 });
+ document.body.appendChild(d.ghost);
+ d.b.classList.add('placeholder');
+ document.body.classList.add('dragging-icon');
+ }
+ d.ghost.style.transform = 'translate(' + (e.clientX - d.dx) + 'px,' + (e.clientY - d.dy) + 'px) scale(1.08) rotate(-3deg)';
+ const over = document.elementFromPoint(e.clientX, e.clientY);
+ const t = over && over.closest('.app');
+ if (t && t !== d.b && t.parentNode === box) {
+ const kids = [...box.children], i = kids.indexOf(d.b), j = kids.indexOf(t);
+ flip(box, () => box.insertBefore(d.b, i < j ? t.nextSibling : t));
+ }
+ });
+ const end = () => {
+ const d = dragging;
+ if (!d || d.box !== box) return;
+ dragging = null;
+ if (!d.on) return;
+ justDragged = true;
+ setTimeout(() => { justDragged = false; }, 0);
+ d.b.classList.remove('placeholder');
+ document.body.classList.remove('dragging-icon');
+ d.ghost.remove();
+ commitOrder();
+ };
+ addEventListener('pointerup', end);
+ addEventListener('pointercancel', end);
+ }
+
// ------------------------------------------------------------------ remembering a pick
function save() {
- const h = 'games=' + kit.games.filter((g) => st.picked.has(g.id)).map((g) => g.id).join(',') +
- (st.cap === 'xl' ? '&space=xl' : '') + (st.variant !== 'NumPlay' ? '&icon=' + st.variant : '');
+ if (intro.on) return; // (the intro empties the calculator for a moment: not a pick to keep)
+ const a = st.app, p = new URLSearchParams();
+ p.set('games', ordered().join(','));
+ if (st.cap === 'xl') p.set('space', 'xl');
+ if (st.lang !== 'en') p.set('lang', st.lang);
+ if (a.icon !== 'NumPlay') p.set('icon', a.icon);
+ if (a.name !== (PRESETS[a.icon] || [0, 'NumPlay'])[1]) p.set('name', a.name);
+ if (a.open === 'matrices') p.set('open', 'matrices' + (a.secret ? '-' + a.secret : '') + (a.hint ? '' : '-nohint'));
+ const h = p.toString();
try { history.replaceState(null, '', '#' + h); } catch (e) { /* (a file:// page) */ }
- try { localStorage.setItem('numplay-studio', h); } catch (e) { /* (private browsing) */ }
+ store('numplay-studio', h);
+ store('numplay-order', st.order.join(','));
}
function restore() {
let h = location.hash.slice(1);
- if (!h) try { h = localStorage.getItem('numplay-studio') || ''; } catch (e) { h = ''; }
+ if (!h) h = store('numplay-studio') || '';
const p = new URLSearchParams(h);
- if (p.has('games')) {
- const ids = new Set(p.get('games').split(',').filter(Boolean));
- for (const g of kit.games) if (ids.has(g.id) && g !== rg) st.picked.add(g.id);
- } else for (const g of kit.games) if (g.default) st.picked.add(g.id);
- if (p.get('space') === 'xl') st.cap = 'xl';
- if (kit.variants.includes(p.get('icon'))) st.variant = p.get('icon');
+ const known = kit.games.filter((g) => g !== rg).map((g) => g.id);
+ const saved = (store('numplay-order') || '').split(',').filter((id) => known.includes(id));
+ const linked = p.has('games') ? p.get('games').split(',').filter((id) => known.includes(id)) : null;
+ // the order: the link's picks first, in its order, then the rest as last time, then the kit's
+ st.order = [...new Set([...(linked || []), ...saved, ...known])];
+ st.picked = new Set(linked || kit.games.filter((g) => g.default).map((g) => g.id));
+ st.cap = p.get('space') === 'xl' ? 'xl' : 'std';
+ st.lang = LANGS[p.get('lang')] && kit.langs.includes(p.get('lang')) ? p.get('lang') : 'en';
+ const icon = p.get('icon');
+ st.app.icon = PRESETS[icon] ? icon : icon === 'custom' && custom ? 'custom' : 'NumPlay';
+ st.app.name = p.has('name') ? p.get('name').slice(0, 20) : (PRESETS[st.app.icon] || [0, 'NumPlay'])[1];
+ const open = (p.get('open') || '').split('-');
+ st.app.open = open[0] === 'matrices' ? 'matrices' : 'numplay';
+ st.app.secret = Math.min(SECRETS.length - 1, Math.max(0, parseInt(open[1], 10) || 0));
+ st.app.hint = !open.includes('nohint');
// a pick that no longer fits the calculator (the kit grew): drop the biggest games until it does
- const order = kit.games.filter((g) => st.picked.has(g.id)).sort((a, b) => a.flash - b.flash);
- while (usedBytes() > capacity() && order.length) st.picked.delete(order.pop().id);
+ const big = ordered().sort((a, b) => flash(a) - flash(b));
+ while (usedBytes() > capacity() && big.length) st.picked.delete(big.pop());
}
// ------------------------------------------------------------------ the kit
@@ -312,6 +460,14 @@
return p;
}
const fetchObj = (rel) => fetchBytes(KIT + rel + '.gz');
+ // a game's object in the app's language, or English when that language's kit hasn't got it
+ const objPath = (id) => (st.lang !== 'en' && kits[st.lang] && kits[st.lang].byId[id] ? st.lang + '/' : '') + 'games/' + id + '.o';
+ async function loadKit(lang) {
+ if (lang === 'en' || kits[lang]) return;
+ const k = await fetch(KIT + lang + '/kit.json').then((r) => { if (!r.ok) throw new Error(r.status); return r.json(); });
+ k.byId = Object.fromEntries(k.games.map((g) => [g.id, g]));
+ kits[lang] = k;
+ }
let tools = null;
function script(src) {
@@ -342,8 +498,45 @@
return { m, code, log };
}
- // The ROM table Retro-Go reads (np_roms, in its own section): "NPRM", version 1, the count,
- // then 52 bytes per game (offset, size, system, 3 spare bytes, its name in 40), then the games.
+ // A relocatable ARM object (e_flags 0, like nwlink's): one section and one global symbol for
+ // each of `secs` ({ name, data, sym, flags, type }).
+ function elfObject(secs) {
+ const enc = new TextEncoder();
+ const shstr = '\0' + secs.map((s) => s.name).join('\0') + '\0.symtab\0.strtab\0.shstrtab\0';
+ const str = '\0' + secs.map((s) => s.sym).join('\0') + '\0';
+ const shs = enc.encode(shstr), sts = enc.encode(str);
+ let at = 52;
+ const offs = secs.map((s) => { const o = at; at = align4(at + s.data.length); return o; });
+ const symOff = at, nsym = secs.length + 1, strOff = symOff + 16 * nsym;
+ const shsOff = strOff + sts.length, shOff = align4(shsOff + shs.length), nsh = secs.length + 4;
+ const b = new Uint8Array(shOff + 40 * nsh), v = new DataView(b.buffer);
+ b.set([0x7f, 0x45, 0x4c, 0x46, 1, 1, 1], 0);
+ v.setUint16(16, 1, true); v.setUint16(18, 40, true); v.setUint32(20, 1, true);
+ v.setUint32(32, shOff, true);
+ v.setUint16(40, 52, true); v.setUint16(46, 40, true); v.setUint16(48, nsh, true); v.setUint16(50, nsh - 1, true);
+ secs.forEach((s, i) => b.set(s.data, offs[i]));
+ let sn = 1;
+ secs.forEach((s, i) => {
+ const o = symOff + 16 * (i + 1);
+ v.setUint32(o, sn, true); sn += enc.encode(s.sym).length + 1;
+ v.setUint32(o + 8, s.data.length, true); v.setUint8(o + 12, 0x10 | (s.type === undefined ? 1 : s.type)); v.setUint16(o + 14, i + 1, true);
+ });
+ b.set(sts, strOff); b.set(shs, shsOff);
+ const sh = (i, name, type, flags, off, sz, link, info, al, es) => {
+ const o = shOff + 40 * i;
+ [name, type, flags, 0, off, sz, link, info, al, es].forEach((x, k) => v.setUint32(o + 4 * k, x, true));
+ };
+ let nameAt = 1;
+ secs.forEach((s, i) => { sh(i + 1, nameAt, 1, s.flags || 2, offs[i], s.data.length, 0, 0, s.align || 1, 0); nameAt += enc.encode(s.name).length + 1; });
+ const n = secs.length;
+ sh(n + 1, shstr.indexOf('.symtab'), 2, 0, symOff, 16 * nsym, n + 2, 1, 4, 16);
+ sh(n + 2, shstr.indexOf('.strtab'), 3, 0, strOff, sts.length, 0, 0, 1, 0);
+ sh(n + 3, shstr.indexOf('.shstrtab'), 3, 0, shsOff, shs.length, 0, 0, 1, 0);
+ return b;
+ }
+
+ // The ROM table Retro-Go reads (np_roms, as tools/romtable.py makes it): "NPRM", version 1, the
+ // count, then 52 bytes per game (offset, size, system, 3 spare bytes, its name in 40), then the games.
function romTable(roms) {
let at = align4(ROM_HEAD + ROM_ENTRY * roms.length);
const offs = roms.map((r) => { const o = at; at = align4(at + r.bytes.length); return o; });
@@ -357,33 +550,59 @@
});
return d;
}
- // ...as a relocatable ARM object: one section, .rodata.np_roms, and the symbol np_roms (as
- // tools/romtable.py makes it, e_flags 0 like nwlink's icon objects)
- function romObject(table) {
- const shstr = '\0.rodata.np_roms\0.symtab\0.strtab\0.shstrtab\0', str = '\0np_roms\0';
- const enc = new TextEncoder(), shs = enc.encode(shstr), sts = enc.encode(str);
- const dataOff = 52, symOff = align4(dataOff + table.length), strOff = symOff + 48;
- const shsOff = strOff + sts.length, shOff = align4(shsOff + shs.length), total = shOff + 40 * 5;
- const b = new Uint8Array(total), v = new DataView(b.buffer);
- b.set([0x7f, 0x45, 0x4c, 0x46, 1, 1, 1], 0);
- v.setUint16(16, 1, true); v.setUint16(18, 40, true); v.setUint32(20, 1, true);
- v.setUint32(32, shOff, true);
- v.setUint16(40, 52, true); v.setUint16(46, 40, true); v.setUint16(48, 5, true); v.setUint16(50, 4, true);
- b.set(table, dataOff);
- // symbols: none, the section, np_roms (global object)
- v.setUint8(symOff + 16 + 12, 3); v.setUint16(symOff + 16 + 14, 1, true);
- v.setUint32(symOff + 32, 1, true); v.setUint32(symOff + 32 + 8, table.length, true);
- v.setUint8(symOff + 32 + 12, 0x11); v.setUint16(symOff + 32 + 14, 1, true);
- b.set(sts, strOff); b.set(shs, shsOff);
- const sh = (i, name, type, flags, off, sz, link, info, al, es) => {
- const o = shOff + 40 * i;
- [name, type, flags, 0, off, sz, link, info, al, es].forEach((x, k) => v.setUint32(o + 4 * k, x, true));
- };
- sh(1, shstr.indexOf('.rodata.np_roms'), 1, 2, dataOff, table.length, 0, 0, 4, 0);
- sh(2, shstr.indexOf('.symtab'), 2, 0, symOff, 48, 3, 2, 4, 16);
- sh(3, shstr.indexOf('.strtab'), 3, 0, strOff, sts.length, 0, 0, 1, 0);
- sh(4, shstr.indexOf('.shstrtab'), 3, 0, shsOff, shs.length, 0, 0, 1, 0);
- return b;
+ const romObject = (table) => elfObject([{ name: '.rodata.np_roms', sym: 'np_roms', data: table, align: 4 }]);
+ // The app's name, and how it starts (launcher/app_name.c): 'D', 1, flags (1 Matrices, 2 no hint), the secret
+ function appObject() {
+ const a = st.app, name = new TextEncoder().encode((a.name || ' ').slice(0, 20));
+ const nz = new Uint8Array(name.length + 1); nz.set(name);
+ const flags = (a.open === 'matrices' ? 1 : 0) | (a.hint ? 0 : 2);
+ return elfObject([{ name: '.rodata.eadk_app_name', sym: 'eadk_app_name', data: nz },
+ { name: '.rodata.np_defaults', sym: 'np_defaults', data: new Uint8Array([0x44, 1, flags, a.secret]) }]);
+ }
+
+ // An icon of your own: 55x56 pixels in RGB565, LZ4 compressed, as nwlink's png-icon-o makes them
+ function lz4(src) {
+ const n = src.length, out = [], hash = new Int32Array(4096).fill(-1);
+ const len = (l) => { while (l >= 255) { out.push(255); l -= 255; } out.push(l); };
+ let anchor = 0, i = 0;
+ while (i + 12 <= n) { // (a match starts 12 bytes before the end at the latest, and ends 5 before)
+ const k = Math.imul(src[i] | src[i + 1] << 8 | src[i + 2] << 16 | src[i + 3] << 24, 2654435761) >>> 20, ref = hash[k];
+ hash[k] = i;
+ if (ref >= 0 && i - ref < 65536 && src[ref] === src[i] && src[ref + 1] === src[i + 1] && src[ref + 2] === src[i + 2] && src[ref + 3] === src[i + 3]) {
+ let m = 4;
+ while (i + m < n - 5 && src[ref + m] === src[i + m]) m++;
+ const lit = i - anchor;
+ out.push((Math.min(lit, 15) << 4) | Math.min(m - 4, 15));
+ if (lit >= 15) len(lit - 15);
+ for (let j = anchor; j < i; j++) out.push(src[j]);
+ out.push((i - ref) & 255, (i - ref) >> 8);
+ if (m - 4 >= 15) len(m - 4 - 15);
+ i += m; anchor = i;
+ } else i++;
+ }
+ const lit = n - anchor;
+ out.push(Math.min(lit, 15) << 4);
+ if (lit >= 15) len(lit - 15);
+ for (let j = anchor; j < n; j++) out.push(src[j]);
+ return new Uint8Array(out);
+ }
+ async function iconFrom(file) {
+ const img = await createImageBitmap(file);
+ const c = document.createElement('canvas');
+ c.width = 55; c.height = 56;
+ const g = c.getContext('2d');
+ g.fillStyle = '#ffffff'; // (the calculator's home screen is white: see-through parts become white)
+ g.fillRect(0, 0, 55, 56);
+ const s = Math.max(55 / img.width, 56 / img.height);
+ g.imageSmoothingQuality = 'high';
+ g.drawImage(img, (55 - img.width * s) / 2, (56 - img.height * s) / 2, img.width * s, img.height * s);
+ const px = g.getImageData(0, 0, 55, 56).data, raw = new Uint8Array(55 * 56 * 2);
+ for (let p = 0, q = 0; p < px.length; p += 4, q += 2) {
+ const v = ((px[p] >> 3) << 11) | ((px[p + 1] >> 2) << 5) | (px[p + 2] >> 3);
+ raw[q] = v & 255; raw[q + 1] = v >> 8;
+ }
+ const obj = elfObject([{ name: '.rodata.eadk_app_icon', sym: 'eadk_app_icon', data: lz4(raw), flags: 3, type: 0 }]);
+ return { url: c.toDataURL('image/png'), obj };
}
// Bytes the installer writes for an .nwa (tools/kit.py's installed_size), less its own start code.
@@ -407,25 +626,33 @@
}
async function build() {
- const sel = kit.games.filter((g) => st.picked.has(g.id) && g !== rg).map((g) => g.id);
+ await loadKit(st.lang);
+ const k = langKit();
+ const sel = ordered();
const roms = rg && st.roms.length;
if (roms) sel.push(rg.id);
- const need = ['base.o', 'arena.o', 'variants/' + st.variant + '-name.o', 'variants/' + st.variant + '-icon.o'].concat(sel.map((id) => 'games/' + id + '.o'));
- const [t, ...objs] = await Promise.all([loadTools()].concat(need.map(fetchObj)));
- const files = { 'base.o': objs[0], 'arena.o': objs[1], 'name.o': objs[2], 'icon.o': objs[3] };
- sel.forEach((id, i) => { files[id + '.o'] = objs[4 + i]; });
- const args = kit.link.concat(['-T', 'numplay.ld', 'base.o', 'arena.o', 'name.o', 'icon.o'], sel.map((id) => id + '.o'));
+ const lang = st.lang === 'en' ? '' : st.lang + '/';
+ const iconObj = st.app.icon === 'custom' && custom ? Promise.resolve(custom.obj) : fetchObj('variants/' + st.app.icon + '-icon.o');
+ const [t, base, arena, icon, ...objs] = await Promise.all([loadTools(), fetchObj(lang + 'base.o'), fetchObj(lang + 'arena.o'), iconObj]
+ .concat(sel.map((id) => fetchObj(objPath(id)))));
+ const files = { 'base.o': base, 'arena.o': arena, 'app.o': appObject(), 'icon.o': icon };
+ sel.forEach((id, i) => { files[id + '.o'] = objs[i]; });
+ const args = k.link.concat(['-T', 'numplay.ld', 'base.o', 'arena.o', 'app.o', 'icon.o'], sel.map((id) => id + '.o'));
if (roms) {
files['roms.o'] = romObject(romTable(st.roms));
args.push('roms.o');
}
- files['numplay.ld'] = kit.script.head + sel.map((id) => kit.script.blocks[id]).join('') + kit.script.tail;
+ // the launcher shows the games in the order of their entries: yours, not the kit's
+ const entries = sel.map((id) => 'KEEP(*(.rodata.np_games.' + String((k.byId[id] || byId[id]).index).padStart(2, '0') + '))').join('\n ');
+ const head = k.script.head.replace('KEEP(*(SORT_BY_NAME(.rodata.np_games.*)))', entries);
+ const block = (id) => k.script.blocks[id] || kit.script.blocks[id];
+ files['numplay.ld'] = head + sel.map(block).join('') + k.script.tail;
const l = await run(t.ld, args.concat(['-o', 'out.nwa']), files);
if (l.code) throw new Error(l.log || 'ld ' + l.code);
const s = await run(t.oc, ['--strip-unneeded', 'in.nwa', 'out.nwa'], { 'in.nwa': l.m.FS.readFile('out.nwa') });
if (s.code) throw new Error(s.log || 'objcopy ' + s.code);
const nwa = s.m.FS.readFile('out.nwa');
- const n = installedSize(nwa) + kit.runtime;
+ const n = installedSize(nwa) + k.runtime;
if (n > capacity()) throw new Error("That's " + size(n - capacity()) + ' more than the calculator holds');
return nwa;
}
@@ -451,9 +678,190 @@
}
function prefetch() {
loadTools().catch(() => {});
- for (const p of ['base.o', 'arena.o', 'variants/' + st.variant + '-name.o', 'variants/' + st.variant + '-icon.o']) fetchObj(p).catch(() => {});
- for (const id of st.picked) fetchObj('games/' + id + '.o').catch(() => {});
- if (st.roms.length) fetchObj('games/' + rg.id + '.o').catch(() => {});
+ loadKit(st.lang).then(() => {
+ const lang = st.lang === 'en' ? '' : st.lang + '/';
+ for (const p of [lang + 'base.o', lang + 'arena.o', 'variants/' + (PRESETS[st.app.icon] ? st.app.icon : 'NumPlay') + '-icon.o']) fetchObj(p).catch(() => {});
+ for (const id of st.picked) fetchObj(objPath(id)).catch(() => {});
+ if (st.roms.length) fetchObj(objPath(rg.id)).catch(() => {});
+ }).catch(() => {});
+ }
+
+ // ------------------------------------------------------------------ the app's own settings
+ let popOpen = null;
+ function openPop(pop, chip, side) {
+ if (popOpen === pop) return closePops();
+ closePops();
+ pop.hidden = false;
+ popOpen = pop;
+ chip.setAttribute('aria-expanded', 'true');
+ const r = chip.getBoundingClientRect(), w = pop.offsetWidth, h = pop.offsetHeight;
+ if (side && r.right + 16 + w < innerWidth - 12) { // (beside it, over the calculator, not over the games)
+ pop.style.left = (r.right + 16) + 'px';
+ pop.style.top = Math.max(12, Math.min(innerHeight - h - 12, r.bottom - h)) + 'px';
+ return;
+ }
+ pop.style.left = Math.max(12, Math.min(innerWidth - w - 12, r.left + r.width / 2 - w / 2)) + 'px';
+ pop.style.top = (r.top - h - 12 < 12 ? r.bottom + 12 : r.top - h - 12) + 'px';
+ }
+ function closePops() {
+ for (const p of document.querySelectorAll('.pop')) p.hidden = true;
+ for (const c of document.querySelectorAll('.chip, .cap button')) c.setAttribute('aria-expanded', 'false');
+ popOpen = null;
+ }
+ function renderApp() {
+ const box = $('#icons');
+ box.textContent = '';
+ for (const v of kit.variants) {
+ const b = el('button', '', { type: 'button', role: 'radio', 'aria-checked': st.app.icon === v, 'aria-label': PRESETS[v][0], 'data-tip': PRESETS[v][0] });
+ b.appendChild(el('img', '', { src: KIT + 'variants/' + v + '.png', alt: '' }));
+ b.addEventListener('click', () => {
+ st.app.icon = v;
+ st.app.name = PRESETS[v][1];
+ if (v === 'NumPlay-Matrices') st.app.open = 'matrices';
+ renderApp(); render();
+ });
+ box.appendChild(b);
+ }
+ if (custom) {
+ const b = el('button', '', { type: 'button', role: 'radio', 'aria-checked': st.app.icon === 'custom', 'aria-label': 'Your icon', 'data-tip': 'Your icon' });
+ b.appendChild(el('img', '', { src: custom.url, alt: '' }));
+ b.addEventListener('click', () => { st.app.icon = 'custom'; renderApp(); render(); });
+ box.appendChild(b);
+ }
+ const up = el('button', 'upload', { type: 'button', 'aria-label': 'Your own picture', 'data-tip': 'Your own picture' });
+ up.innerHTML = '<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round"><path d="M12 5v14"/><path d="M5 12h14"/></svg>';
+ up.addEventListener('click', () => $('#icon-file').click());
+ box.appendChild(up);
+ $('#app-name').value = st.app.name;
+ for (const b of document.querySelectorAll('[data-open]')) b.setAttribute('aria-checked', b.dataset.open === st.app.open);
+ $('#secret-row').hidden = st.app.open !== 'matrices';
+ $('#secret').value = String(st.app.secret);
+ $('#hint').checked = st.app.hint;
+ const langs = $('#langs');
+ langs.textContent = '';
+ for (const l of kit.langs) {
+ const b = el('button', '', { type: 'button', role: 'radio', 'aria-checked': st.lang === l });
+ b.textContent = LANGS[l][1];
+ b.addEventListener('click', async () => {
+ try { await loadKit(l); } catch (e) { toast("That language didn't load, try again"); return; }
+ st.lang = l;
+ closePops(); renderApp(); render();
+ });
+ langs.appendChild(b);
+ }
+ }
+
+ // the 6 MB of Enlarged Extra Apps: what it is and how, before switching to it
+ function askXL(btn) {
+ let pop = $('#xl-pop');
+ if (!pop) {
+ pop = el('div', 'pop', { id: 'xl-pop', role: 'dialog', 'aria-label': 'Enlarged Extra Apps' });
+ pop.innerHTML = '<b class="xl-title">6 MB with Enlarged Extra Apps</b>' +
+ '<p class="xl-text">The calculator\'s installer gives apps 1.94 MB. nwagyu\'s <b>Nwagra</b> bookmark makes it use the rest of the flash, 6 MB in all, so several big games fit in one NumPlay.</p>' +
+ '<ol class="xl-steps"><li>Add the Nwagra bookmark from nwagyu\'s guide</li><li>Update your calculator twice on my.numworks.com</li><li>On the installer page, click the bookmark, then drop NumPlay.nwa</li></ol>' +
+ '<p class="xl-warn">It only works on older calculator software. On the newest, the calculator shows exam mode.</p>' +
+ '<div class="xl-buttons"><a class="xl-guide" href="' + NWAGRA + '" target="_blank" rel="noopener">nwagyu\'s guide</a><button type="button" class="install xl-ok">Use 6 MB</button></div>';
+ document.body.appendChild(pop);
+ pop.querySelector('.xl-ok').addEventListener('click', () => { st.cap = 'xl'; store('numplay-xl-seen', '1'); closePops(); render(); });
+ }
+ openPop(pop, btn, true);
+ }
+
+ // ------------------------------------------------------------------ the intro
+ // A few words while the calculator fills up, the first time and when the logo is clicked
+ const intro = { on: false, run: 0 };
+ function caption(text) {
+ const c = $('#caption');
+ c.classList.remove('show');
+ setTimeout(() => { c.textContent = text; if (text) c.classList.add('show'); }, text ? 180 : 0);
+ }
+ async function playIntro() {
+ if (intro.on) return;
+ if (matchMedia('(prefers-reduced-motion: reduce)').matches) return;
+ intro.on = true;
+ const run = ++intro.run, alive = () => intro.run === run;
+ closePops(); hidePreview();
+ const target = ordered(), roms = st.roms;
+ const body = document.body;
+ const skip = el('button', 'intro-skip', { type: 'button' });
+ skip.textContent = 'Skip';
+ skip.addEventListener('click', endIntro);
+ body.appendChild(skip);
+ st.picked = new Set(); st.roms = [];
+ body.classList.add('intro', 's0', 'start');
+ render();
+ intro.restore = () => { st.picked = new Set(target); st.roms = roms; };
+ await wait(60);
+ if (!alive()) return;
+ body.classList.remove('start');
+ caption('Free games for your NumWorks');
+ await wait(1500);
+ if (!alive()) return;
+ body.classList.replace('s0', 's1');
+ caption('Pick the ones you want');
+ await wait(500);
+ for (const id of target) {
+ if (!alive()) return;
+ st.picked.add(id);
+ bump(buttons.get(id), 'bounce');
+ render();
+ await wait(target.length > 16 ? 45 : 80);
+ }
+ await wait(700);
+ if (!alive()) return;
+ body.classList.replace('s1', 's2');
+ if (rg) {
+ caption('Add Game Boy, NES and Sega games');
+ await wait(1600);
+ if (!alive()) return;
+ }
+ body.classList.replace('s2', 's3');
+ caption('Install it in one click');
+ await wait(1700);
+ if (alive()) endIntro();
+ }
+ function endIntro() {
+ if (!intro.on) return;
+ intro.on = false;
+ intro.run++;
+ if (intro.restore) intro.restore();
+ document.body.classList.remove('intro', 's0', 's1', 's2', 's3', 'start');
+ const s = document.querySelector('.intro-skip');
+ if (s) s.remove();
+ caption('');
+ store('numplay-intro', '1');
+ render();
+ }
+
+ // ------------------------------------------------------------------ the logo's keys, GitHub
+ function logoKeys() {
+ const keys = [...document.querySelectorAll('.keys i')];
+ let busy = false;
+ const wave = () => {
+ if (busy) return;
+ busy = true;
+ keys.forEach((k, i) => {
+ setTimeout(() => k.classList.add('down'), 45 * i);
+ setTimeout(() => k.classList.remove('down'), 45 * i + 130);
+ });
+ setTimeout(() => { busy = false; }, 45 * keys.length + 200);
+ };
+ $('#logo').addEventListener('pointerenter', wave);
+ $('#logo').addEventListener('click', () => { wave(); if (intro.on) endIntro(); else playIntro(); });
+ }
+ async function stars() {
+ try {
+ let n = sessionStorage.getItem('numplay-stars');
+ if (!n) {
+ const r = await fetch('https://api.github.com/repos/Mason363/NumPlay');
+ if (!r.ok) return;
+ n = String((await r.json()).stargazers_count);
+ sessionStorage.setItem('numplay-stars', n);
+ }
+ const v = +n, b = $('#stars');
+ b.textContent = v >= 1000 ? (v / 1000).toFixed(v >= 10000 ? 0 : 1) + 'k' : String(v);
+ b.hidden = false;
+ } catch (e) { /* (offline, or GitHub said no: the button still works) */ }
}
// ------------------------------------------------------------------ the sheet, tips and toasts
@@ -470,13 +878,13 @@
t.textContent = msg;
t.classList.add('show');
clearTimeout(toastTimer);
- toastTimer = setTimeout(() => t.classList.remove('show'), 2600);
+ toastTimer = setTimeout(() => t.classList.remove('show'), 2800);
}
function tips() {
const tip = $('#tip');
let on = null;
document.addEventListener('pointerover', (e) => {
- if (e.pointerType === 'touch') return;
+ if (e.pointerType === 'touch' || dragging) return;
const t = e.target.closest('[data-tip]');
if (t === on) return;
on = t;
@@ -502,43 +910,94 @@
toast("The games didn't load, try again in a minute");
return;
}
+ kit.langs = kit.langs || ['en'];
+ for (const g of kit.games) byId[g.id] = g;
+ kit.byId = byId;
+ kits.en = kit;
rg = kit.games.find((g) => g.roms) || null;
- if (rg) $('#rom-file').accept = Object.keys(EXT).filter((e) => (rg.systems || [1, 2, 3]).includes(EXT[e])).map((e) => '.' + e).join(',');
+ try {
+ const c = store('numplay-icon');
+ if (c) { const j = JSON.parse(c); custom = { url: j.url, obj: Uint8Array.from(atob(j.obj), (x) => x.charCodeAt(0)) }; }
+ } catch (e) { custom = null; }
+
const small = $('#small'), big = $('#big');
+ const badge = '<span class="badge"><svg class="tick" viewBox="0 0 12 12"><path d="M2.5 6.2l2.3 2.3 4.7-5" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>' +
+ '<svg class="plus" viewBox="0 0 12 12"><path d="M6 2.5v7M2.5 6h7" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg></span>';
for (const g of kit.games) {
if (g === rg) continue;
- const b = el('button', 'app off', { type: 'button', 'aria-label': g.title, 'aria-pressed': 'false' });
+ const b = el('button', 'app off', { type: 'button', 'aria-label': g.title, 'aria-pressed': 'false', 'data-id': g.id });
b.appendChild(el('img', '', { src: KIT + 'icons/' + g.id + '.png', alt: '', draggable: 'false' }));
- b.addEventListener('click', () => toggle(g.id));
+ b.insertAdjacentHTML('beforeend', badge);
+ b.addEventListener('click', () => {
+ if (justDragged) { justDragged = false; return; }
+ toggle(g.id);
+ if (matchMedia('(hover: none)').matches) { showPreview(g.id); hidePreview(1600); }
+ });
+ b.addEventListener('pointerenter', (e) => { if (e.pointerType !== 'touch') showPreview(g.id); });
+ b.addEventListener('pointerleave', (e) => { if (e.pointerType !== 'touch') hidePreview(120); });
+ b.addEventListener('focus', () => showPreview(g.id));
+ b.addEventListener('contextmenu', (e) => { if (holding || e.pointerType === 'touch') e.preventDefault(); });
+ b.addEventListener('blur', () => hidePreview(120));
(g.xl ? big : small).appendChild(b);
buttons.set(g.id, b);
}
- const vs = $('#variants');
- for (const v of kit.variants) {
- const b = el('button', '', { type: 'button', role: 'radio', 'data-v': v, 'aria-label': VARIANT_NAMES[v] || v, 'data-tip': VARIANT_NAMES[v] || v });
- b.appendChild(el('img', '', { src: KIT + 'variants/' + v + '.png', alt: '' }));
- b.addEventListener('click', () => { st.variant = v; render(); });
- vs.appendChild(b);
- }
+ sortable(small);
+ sortable(big);
+
+ // the app's settings
+ const sec = $('#secret');
+ SECRETS.forEach((s, i) => { const o = el('option', '', { value: String(i) }); o.textContent = s; sec.appendChild(o); });
+ sec.addEventListener('change', () => { st.app.secret = +sec.value; render(); });
+ $('#hint').addEventListener('change', (e) => { st.app.hint = e.target.checked; render(); });
+ $('#app-name').addEventListener('input', (e) => { st.app.name = e.target.value.slice(0, 20); render(); });
+ for (const b of document.querySelectorAll('[data-open]'))
+ b.addEventListener('click', () => { st.app.open = b.dataset.open; renderApp(); render(); });
+ $('#icon-file').addEventListener('change', async (e) => {
+ const f = e.target.files[0];
+ e.target.value = '';
+ if (!f) return;
+ try {
+ custom = await iconFrom(f);
+ store('numplay-icon', JSON.stringify({ url: custom.url, obj: btoa(String.fromCharCode(...custom.obj)) }));
+ st.app.icon = 'custom';
+ if (PRESETS[st.app.name] === undefined && st.app.name === ' ') st.app.name = 'NumPlay';
+ renderApp(); render();
+ } catch (err) { toast("That picture didn't work, try a PNG or JPEG"); }
+ });
+ $('#app-chip').addEventListener('click', (e) => { renderApp(); openPop($('#app-pop'), e.currentTarget); });
+ $('#lang-chip').addEventListener('click', (e) => { renderApp(); openPop($('#lang-pop'), e.currentTarget); });
+ document.addEventListener('pointerdown', (e) => {
+ if (popOpen && !e.target.closest('.pop, .chip, .cap button')) closePops();
+ });
+
for (const b of document.querySelectorAll('.cap button'))
b.addEventListener('click', () => {
if (b.dataset.cap === 'std' && st.cap === 'xl') {
const over = usedBytes() - kit.appSpace;
if (over > 0) { bump(b, 'shake'); toast('Take ' + size(over) + ' of games out first'); return; }
+ st.cap = 'std'; closePops(); render(); return;
}
- st.cap = b.dataset.cap;
- render();
+ if (b.dataset.cap === 'xl' && st.cap !== 'xl') askXL(b);
});
$('#install').addEventListener('click', (e) => go(e.currentTarget, true));
$('#download').addEventListener('click', (e) => go(e.currentTarget, false));
- for (const b of [$('#install'), $('#download')]) {
+ for (const b of [$('#install'), $('#download'), $('#app-chip'), $('#lang-chip')]) {
b.addEventListener('pointerenter', prefetch, { once: true });
b.addEventListener('focus', prefetch, { once: true });
}
- $('#rom-file').addEventListener('change', (e) => { addRoms([...e.target.files]); e.target.value = ''; });
$('#sheet').addEventListener('click', (e) => { if (e.target.id === 'sheet' || e.target.closest('.sheet-close')) closeSheet(); });
- document.addEventListener('keydown', (e) => { if (e.key === 'Escape') closeSheet(); });
+ document.addEventListener('keydown', (e) => {
+ if (e.key === 'Escape') { closeSheet(); closePops(); if (holding) { holding.classList.remove('held'); holding = null; } }
+ if (intro.on && e.key !== 'Tab') endIntro();
+ });
+
if (rg) {
+ $('#retro').hidden = false;
+ $('#retro-icon').src = KIT + 'icons/' + rg.id + '.png';
+ const exts = Object.keys(EXT).filter((x) => (rg.systems || [1, 2, 3]).includes(EXT[x]));
+ $('#rom-file').accept = exts.map((x) => '.' + x).join(',');
+ $('#drop-sub').textContent = exts.map((x) => '.' + x).join(' ');
+ $('#rom-file').addEventListener('change', (e) => { addRoms([...e.target.files]); e.target.value = ''; });
let depth = 0;
const files = (e) => e.dataTransfer && [...e.dataTransfer.types].includes('Files');
addEventListener('dragenter', (e) => { if (files(e)) { depth++; document.body.classList.add('dragging'); e.preventDefault(); } });
@@ -553,11 +1012,15 @@
});
}
tips();
+ logoKeys();
+ const first = !store('numplay-intro') && !location.hash;
restore();
+ if (st.lang !== 'en') loadKit(st.lang).then(render).catch(() => { st.lang = 'en'; render(); });
render();
- addEventListener('hashchange', () => { st.picked.clear(); st.cap = 'std'; st.variant = 'NumPlay'; restore(); render(); });
- $('#studio').setAttribute('aria-busy', 'false');
+ addEventListener('hashchange', () => { restore(); render(); });
+ stars();
(window.requestIdleCallback || setTimeout)(() => loadTools().catch(() => {}), { timeout: 3000 });
+ if (first) playIntro();
}
start();
})();
diff --git a/customize/index.html b/customize/index.html
index 8b832eb6..f537b93c 100644
--- a/customize/index.html
+++ b/customize/index.html
@@ -4,18 +4,58 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="color-scheme" content="light">
-<title>NumPlay Studio</title>
-<meta name="description" content="Pick the NumWorks games you want, add your own Game Boy and NES games for Retro-Go, and get one NumPlay app with all of them.">
+<title>NumPlay Studio: free games for your NumWorks calculator</title>
+<meta name="description" content="Pick the free games you want for your NumWorks calculator, add your own Game Boy, NES and Sega games, and get one app with all of them. NumPlay Studio builds it right in your browser.">
+<link rel="canonical" href="https://mason363.github.io/NumPlay/customize/">
<link rel="icon" href="kit/variants/NumPlay.png">
+<meta name="theme-color" content="#e6e8ec">
+<meta property="og:type" content="website">
+<meta property="og:site_name" content="NumPlay">
+<meta property="og:title" content="NumPlay Studio: free games for your NumWorks calculator">
+<meta property="og:description" content="Pick your games, drop in Game Boy, NES and Sega games, install. Free and open source.">
+<meta property="og:url" content="https://mason363.github.io/NumPlay/customize/">
+<meta property="og:image" content="https://mason363.github.io/NumPlay/customize/og.png">
+<meta property="og:image:width" content="1200">
+<meta property="og:image:height" content="630">
+<meta name="twitter:card" content="summary_large_image">
+<meta name="twitter:title" content="NumPlay Studio: free games for your NumWorks calculator">
+<meta name="twitter:description" content="Pick your games, drop in Game Boy, NES and Sega games, install. Free and open source.">
+<meta name="twitter:image" content="https://mason363.github.io/NumPlay/customize/og.png">
+<script type="application/ld+json">
+{
+ "@context": "https://schema.org",
+ "@type": "WebApplication",
+ "name": "NumPlay Studio",
+ "url": "https://mason363.github.io/NumPlay/customize/",
+ "image": "https://mason363.github.io/NumPlay/customize/og.png",
+ "description": "Pick the free games you want for your NumWorks calculator, add your own Game Boy, NES and Sega games, and get one NumPlay app with all of them.",
+ "applicationCategory": "GameApplication",
+ "operatingSystem": "NumWorks calculator (N0110, N0115, N0120)",
+ "offers": { "@type": "Offer", "price": "0", "priceCurrency": "USD" },
+ "author": { "@type": "Person", "name": "Mason Chen", "url": "https://github.com/Mason363" },
+ "isPartOf": { "@type": "SoftwareSourceCode", "name": "NumPlay", "codeRepository": "https://github.com/Mason363/NumPlay", "license": "https://www.gnu.org/licenses/gpl-3.0.html" }
+}
+</script>
<link rel="stylesheet" href="app.css">
</head>
<body>
-<a class="brand" href="../">
- <img id="brand-icon" src="kit/variants/NumPlay.png" alt="">
- <span>NumPlay</span>
-</a>
+<h1 class="sr">NumPlay Studio: pick free games for your NumWorks calculator, add your own Game Boy, NES and Sega games, and install one app with all of them</h1>
-<main id="studio" aria-busy="true">
+<header class="top">
+ <button id="logo" class="logo" type="button" aria-label="NumPlay: play the intro again" data-tip="Play the intro again">
+ <img class="logo-icon" src="kit/variants/NumPlay.png" alt="" width="40" height="40">
+ <span class="keys" aria-hidden="true"><i>N</i><i>u</i><i>m</i><i class="y">P</i><i class="y">l</i><i class="y">a</i><i class="y">y</i></span>
+ </button>
+ <a id="star" class="star" href="https://github.com/Mason363/NumPlay" target="_blank" rel="noopener">
+ <svg viewBox="0 0 16 16" width="20" height="20" aria-hidden="true"><path fill="currentColor" d="M8 0a8 8 0 0 0-2.53 15.59c.4.07.55-.17.55-.38v-1.33c-2.23.48-2.7-1.07-2.7-1.07-.36-.92-.89-1.17-.89-1.17-.73-.5.06-.49.06-.49.8.06 1.23.83 1.23.83.72 1.22 1.88.87 2.34.66.07-.52.28-.87.5-1.07-1.78-.2-3.65-.89-3.65-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82a7.6 7.6 0 0 1 4 0c1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.870 3.75-3.66 3.95.29.25.54.73.54 1.48v2.2c0 .21.15.46.55.38A8 8 0 0 0 8 0z"/></svg>
+ <span>Star on GitHub</span>
+ <b id="stars" class="count" hidden></b>
+ </a>
+</header>
+
+<div id="caption" class="caption" aria-live="polite"></div>
+
+<main id="studio">
<section id="small" class="grid small" aria-label="Games in NumPlay"></section>
<section class="device" aria-label="Your calculator">
@@ -29,17 +69,26 @@
</div>
<div class="side-by">
<div id="calc" class="calc">
- <img class="calc-img" src="calculator.webp" alt="A NumWorks calculator" draggable="false">
+ <div class="shadow" aria-hidden="true"></div>
+ <img class="calc-img" src="calculator.webp" alt="A NumWorks calculator" draggable="false" width="1018" height="2000">
<div id="screen" class="screen" role="img" aria-label="Space on the calculator">
<div class="status"><span id="status-line"></span><span class="battery"><i id="battery"></i></span></div>
<div id="map" class="map"></div>
+ <div id="preview" class="preview" aria-hidden="true"><img alt=""></div>
<div class="drop-hint" aria-hidden="true">
<svg viewBox="0 0 24 24" width="30" height="30" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 4v11"/><path d="M7 10l5 5 5-5"/><path d="M5 20h14"/></svg>
</div>
</div>
</div>
<div class="actions">
- <div id="variants" class="variants" role="radiogroup" aria-label="App icon"></div>
+ <button id="app-chip" type="button" class="chip" aria-haspopup="dialog" aria-expanded="false" data-tip="Icon, name and how it opens">
+ <img id="app-chip-icon" src="kit/variants/NumPlay.png" alt="" width="28" height="28">
+ <svg class="caret" viewBox="0 0 12 12" width="10" height="10" aria-hidden="true"><path d="M3 4.5l3 3 3-3" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/></svg>
+ </button>
+ <button id="lang-chip" type="button" class="chip lang" aria-haspopup="dialog" aria-expanded="false" data-tip="The app's language">
+ <span id="lang-chip-label">EN</span>
+ <svg class="caret" viewBox="0 0 12 12" width="10" height="10" aria-hidden="true"><path d="M3 4.5l3 3 3-3" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/></svg>
+ </button>
<button id="install" type="button" class="install"><span>Install</span></button>
<button id="download" type="button" class="round" aria-label="Download NumPlay.nwa" data-tip="Download NumPlay.nwa">
<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 4v12"/><path d="M6 11l6 6 6-6"/><path d="M5 20h14"/></svg>
@@ -50,15 +99,49 @@
<section class="side" aria-label="Big games and Retro-Go">
<div id="big" class="grid big"></div>
- <div id="carts" class="carts" aria-label="Retro-Go games">
- <label id="add-rom" class="cart add" for="rom-file" data-tip="Add Game Boy, NES or Sega games">
- <svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" aria-hidden="true"><path d="M12 5v14"/><path d="M5 12h14"/></svg>
+ <div id="retro" class="retro" hidden>
+ <div class="retro-head">
+ <img id="retro-icon" alt="" width="34" height="34">
+ <div><b>Retro-Go</b><span class="systems">Game Boy · NES · Sega</span></div>
+ </div>
+ <label id="drop" class="drop" for="rom-file">
+ <span class="drop-art" aria-hidden="true"><i class="c1"></i><i class="c2"></i><i class="c3"></i></span>
+ <span class="drop-text">Drop your games here</span>
+ <span id="drop-sub" class="drop-sub">.gb .gbc .nes .sms .gg</span>
</label>
<input id="rom-file" type="file" multiple accept=".gb,.gbc,.nes,.sms,.gg">
+ <div id="carts" class="carts" aria-label="Your Retro-Go games"></div>
</div>
</section>
</main>
+<div id="app-pop" class="pop" role="dialog" aria-label="Your app" hidden>
+ <div class="pop-row">
+ <span class="pop-label">Icon</span>
+ <div id="icons" class="icon-pick" role="radiogroup" aria-label="Icon"></div>
+ </div>
+ <div class="pop-row">
+ <label class="pop-label" for="app-name">Name</label>
+ <input id="app-name" class="field" maxlength="20" spellcheck="false" autocomplete="off">
+ </div>
+ <div class="pop-row">
+ <span class="pop-label">Opens as</span>
+ <div class="segctl" role="radiogroup" aria-label="Opens as">
+ <button type="button" role="radio" data-open="numplay" aria-checked="true">NumPlay</button>
+ <button type="button" role="radio" data-open="matrices" aria-checked="false">Matrices</button>
+ </div>
+ </div>
+ <div id="secret-row" class="pop-row" hidden>
+ <label class="pop-label" for="secret">Secret</label>
+ <select id="secret" class="field"></select>
+ <label class="tick"><input id="hint" type="checkbox" checked> hint</label>
+ </div>
+</div>
+<div id="lang-pop" class="pop narrow" role="dialog" aria-label="Language" hidden>
+ <div id="langs" class="segctl col" role="radiogroup" aria-label="Language"></div>
+</div>
+<input id="icon-file" type="file" accept="image/*" hidden>
+
<div id="sheet" class="sheet" hidden>
<div class="sheet-card" role="dialog" aria-modal="true" aria-labelledby="sheet-title">
<button type="button" class="sheet-close" aria-label="Close">
@@ -77,10 +160,20 @@
</span><span>Drop NumPlay.nwa there</span></li>
</ol>
<a class="install wide" href="https://my.numworks.com/apps" target="_blank" rel="noopener">Open the installer</a>
+ <a class="star-ask" href="https://github.com/Mason363/NumPlay" target="_blank" rel="noopener">
+ <svg viewBox="0 0 24 24" width="20" height="20" aria-hidden="true"><path fill="#f5b70a" d="M12 2.5l2.9 6 6.6.9-4.8 4.6 1.2 6.5L12 17.4l-5.9 3.1 1.2-6.5L2.5 9.4l6.6-.9z"/></svg>
+ <span>Like it? A star on GitHub helps more people find NumPlay</span>
+ </a>
</div>
</div>
-<footer class="foot"><a href="https://github.com/Mason363/NumPlay">Made by Mason Chen as part of NumPlay</a></footer>
+<footer class="foot">
+ <a href="https://github.com/Mason363/NumPlay">Made by Mason Chen as part of NumPlay</a>
+ <span aria-hidden="true">·</span>
+ <a href="../">NumPlay's page</a>
+</footer>
+
+<noscript><p class="noscript">NumPlay Studio needs JavaScript to build your NumPlay. You can also <a href="https://github.com/Mason363/NumPlay/releases/latest/download/NumPlay.nwa">download NumPlay.nwa</a> with every game.</p></noscript>
<div id="tip" class="tip" role="tooltip"></div>
<div id="toast" class="toast" role="status" aria-live="polite"></div>
diff --git a/customize/og.png b/customize/og.png
new file mode 100644
index 00000000..12458157
Binary files /dev/null and b/customize/og.png differ
diff --git a/docs/media/studio.png b/docs/media/studio.png
new file mode 100644
index 00000000..12458157
Binary files /dev/null and b/docs/media/studio.png differ