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.

Studio: the other calculators as the NumWorks

Mason3631aaf2d0b7a24
diff --git a/customize/app.css b/customize/app.css
index f5031a0e..705004da 100644
--- a/customize/app.css
+++ b/customize/app.css
@@ -127,7 +127,7 @@ body.dragging-icon, body.dragging-icon * { cursor: grabbing !important; user-sel
/* ---- the calculator, up close: its screen is the space, OK installs, Back downloads, a star sticker on it */
.device { grid-area: device; position: sticky; top: 0; height: 100vh; overflow: hidden; align-self: start; perspective: 2400px; perspective-origin: 50% 32%; }
/* beside the calculator: the space used, a block for each game, stacked from the bottom in the launcher's order */
-.meter { position: absolute; z-index: 1; left: calc(50% - var(--cw) / 2 - 66px); width: 52px; top: calc(30px + var(--cw) * 0.105); bottom: 34px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
+.meter { position: absolute; z-index: 1; left: calc(50% - var(--pw, var(--cw)) / 2 - 66px); width: 52px; top: calc(30px + var(--cw) * var(--mt, 0.105)); bottom: 34px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.used { font-size: 18px; font-weight: 750; letter-spacing: -0.4px; font-variant-numeric: tabular-nums; line-height: 1; }
.cap-of { font-size: 12px; font-weight: 600; color: var(--mute); white-space: nowrap; font-variant-numeric: tabular-nums; line-height: 1; }
.bar {
@@ -275,14 +275,23 @@ body.dragging .drop-hint { display: flex; }
.calcs button:disabled { cursor: default; }
.calcs button:disabled img, .calcs button:disabled b { opacity: 0.4; }
/* on another calculator: its games only, as files of their own, so NumPlay's app, its language, the space for
- apps and your own games and apps step aside; its photo, and a zip of the games */
+ apps and your own games and apps step aside. Its picture is where the NumWorks's is, as tall (2000 of its pixels to
+ the NumWorks's 2000: --pw its width, --pa its shape, app.js), with Studio's screen under its LCD, cut out of it; the
+ bar beside it from the top of its screen (--mt). It fades out at the bottom, over the Download */
.port { display: none; }
-.other .port { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 24px 16px 40px; }
-.port-img { display: block; height: min(480px, calc(100vh - 190px)); width: auto; margin-bottom: 14px; user-select: none; }
-.port-used { margin: 0; font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
+.other .port { display: block; position: absolute; inset: 0; }
+.port-calc {
+ position: absolute; top: 30px; left: calc(50% - var(--pw) / 2); width: var(--pw); aspect-ratio: var(--pa);
+ -webkit-mask: linear-gradient(#000 calc(100vh - 250px), transparent calc(100vh - 150px)); mask: linear-gradient(#000 calc(100vh - 250px), transparent calc(100vh - 150px));
+}
+.port-calc.loading { visibility: hidden; }
+.port-img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; user-select: none; }
+.port-dl { position: absolute; left: 50%; bottom: 34px; transform: translateX(-50%); }
+.wide .preview img { width: 83.333%; margin: 0 auto; object-fit: fill; } /* (the Casio's: 320 of its 384, rows squeezed, as its port draws them) */
+.other .cap-of { white-space: pre-line; text-align: center; line-height: 1.3; }
.install:disabled { background: var(--track); color: var(--mute); cursor: default; }
.install.busy { cursor: progress; opacity: 0.6; }
-.other .calc, .other .meter, .other #app-chip, .other #lang-chip, .other #space-chip, .other .retro, .other #dock-download { display: none !important; }
+.other .calc, .other #app-chip, .other #lang-chip, .other #space-chip, .other .retro, .other #dock-download { display: none !important; }
.other .title button { cursor: default; }
.app.away { display: none; }
.step-icon.n { font-size: 17px; font-weight: 750; }
@@ -452,9 +461,13 @@ html.intro-wait main { opacity: 0; }
-webkit-mask: linear-gradient(#000 calc(100% - 18px), transparent); mask: linear-gradient(#000 calc(100% - 18px), transparent);
}
.meter { display: none; }
- .other .device { height: auto; -webkit-mask: none; mask: none; }
- .other .port { position: static; padding: 8px 0 0; }
- .port-img { height: 300px; margin-bottom: 4px; }
+ /* (another calculator: down to the same place, fading there, then its Download) */
+ .other .device { height: calc(var(--cw) * 1.066 + 30px + 78px); -webkit-mask: none; mask: none; }
+ .port-calc {
+ -webkit-mask: linear-gradient(#000 calc(var(--cw) * 1.066 - 18px), transparent calc(var(--cw) * 1.066));
+ mask: linear-gradient(#000 calc(var(--cw) * 1.066 - 18px), transparent calc(var(--cw) * 1.066));
+ }
+ .port-dl { bottom: 16px; }
.foot { justify-content: center; }
.dock {
position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 30; max-width: 520px; margin: 0 auto;
diff --git a/customize/app.js b/customize/app.js
index ad7458f3..59660bdc 100644
--- a/customize/app.js
+++ b/customize/app.js
@@ -26,27 +26,33 @@
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
+ let W = 320, H = 222; // the screen below its status bar, in the calculator's pixels (CALCS: each one's)
// The calculators the games are made for (platform/): the NumWorks, where they go in as one app linked here, and
// the others, where each game is a file of its own (kit/ports: ports.json, then <target>/<file>) and they come as
- // one zip. How to install them: steps of text and [link, url] ('@zip': the zip's name; that step isn't in its README)
+ // one zip. Each one's picture (calcs/<id>-full.webp, 2000 pixels tall as calculator.webp is, its LCD cut out: pic, its
+ // width and the LCD's left, top, right and bottom in it), its screen (in its pixels: where a game's picture goes) and
+ // its space for games (in MB, about: what's free on one). How to install them: steps of text and [link, url] ('@zip':
+ // the zip's name; that step isn't in its README)
const CLIBS = 'https://github.com/CE-Programming/libraries/releases/latest';
const TICONNECT = 'https://education.ti.com/en/products/computer-software/ti-connect-ce-sw';
const CALCS = {
numworks: { name: 'NumWorks' },
ti84ce: {
- name: 'TI-84 Plus CE', models: 'and TI-83 Premium CE', photo: 'ti84ce.png', zip: 'NumPlay-TI84CE.zip',
+ name: 'TI-84 Plus CE', models: 'and TI-83 Premium CE', zip: 'NumPlay-TI84CE.zip',
+ pic: [859, 116.7, 148.2, 743, 622.2], screen: [320, 240], space: 3, // (its archive: games run from there)
steps: [['Unzip @zip'], ['Send ', ['clibs.8xg', CLIBS], ' and the games with ', ['TI Connect CE', TICONNECT]],
['Press prgm, pick a game, press enter']],
warn: ['On OS 5.5 or newer, the games need ', ['arTIfiCE', 'https://yvantt.github.io/arTIfiCE/'], ' first.'],
},
nspire: {
- name: 'TI-Nspire CX', models: 'CX and CX II, with Ndless', photo: 'nspire.png', zip: 'NumPlay-Nspire.zip',
+ name: 'TI-Nspire CX', models: 'CX and CX II, with Ndless', zip: 'NumPlay-Nspire.zip',
+ pic: [950, 130.6, 173.8, 813.5, 689.5], screen: [320, 240], space: 90,
steps: [['Install ', ['Ndless', 'https://ndless.me'], ' on the calculator'], ['Unzip @zip'],
['Send the games with TI-Nspire Link'], ['Open a game from My Documents']],
},
'casio-cg': {
- name: 'Casio fx-CG50', models: 'and Graph 90+E', photo: 'casio_cg50.png', zip: 'NumPlay-CasioCG.zip',
+ name: 'Casio fx-CG50', models: 'and Graph 90+E', zip: 'NumPlay-CasioCG.zip',
+ pic: [944, 94.5, 257.5, 848.5, 682.2], screen: [384, 216], space: 16, // (its storage memory)
steps: [['Unzip @zip'], ['Plug the calculator in and pick USB Flash on it'], ['Copy the games to it, then eject it'],
['Press MENU and pick a game']],
},
@@ -85,7 +91,8 @@
const spaces = () => kit.spaces && kit.spaces.length ? kit.spaces :
[{ id: 'std', size: kit.appSpace }, { id: 'xl', size: kit.xlAppSpace || XL_SPACE }];
const space = () => spaces().find((s) => s.id === st.cap) || spaces()[0];
- const capacity = () => space().size;
+ const nwCap = () => space().size;
+ const capacity = () => (other() ? CALCS[st.calc].space * MiB : nwCap()); // (the calculator's, as you picked it)
const nwagra = () => st.cap.startsWith('xl');
const mb = (b) => +(b / MiB).toFixed(2) + ' MB';
const langKit = () => kits[st.lang] || kit;
@@ -112,12 +119,15 @@
}
// a big game too big to go beside the launcher in this space (kit.json "alone") goes on its own there,
// as its own app: as if you installed just that game
- const alone = (id) => !!game(id).alone && own([id], []) + flash(id) > capacity();
+ const alone = (id) => !!game(id).alone && own([id], []) + flash(id) > nwCap();
// (one too big for this space even on its own, as FNAF World is but for Nwagra's 6 MB)
- const bigger = (id) => alone(id) && game(id).alone.size > capacity();
+ const bigger = (id) => alone(id) && game(id).alone.size > nwCap();
const solo = () => ordered().find(alone) || null;
let before = null; // your games while one of those is picked, back when it's taken out
- function items() {
+ // what's on the calculator, each a block: on another one, the games picked for it, each its file's size
+ const items = () => (other() ? portPicks().map((id) => ({ key: id, id, name: byId[id].title, bytes: portList()[id].size,
+ color: hex(byId[id].top), icon: byId[id].icon ? KIT + 'icons/' + id + '.png' : null })) : nwItems());
+ function nwItems() {
const s = solo();
if (s) {
const g = byId[s];
@@ -181,7 +191,6 @@
let shownUsed = 0, previewing = null;
function render() {
- if (other()) return renderPort();
const list = items(), cap = capacity();
const used = list.reduce((s, it) => s + it.bytes, 0);
const over = used > cap;
@@ -246,7 +255,7 @@
if ([...bar.children].filter((c) => want.includes(c)).some((c, i) => c !== want[i])) for (const c of want) bar.appendChild(c);
bar.classList.toggle('over', over);
$('#used').textContent = (used / MiB).toFixed(2);
- $('#cap-of').textContent = 'of ' + +(cap / MiB).toFixed(2) + ' MB';
+ $('#cap-of').textContent = 'of ' + (other() ? 'about\n' : '') + +(cap / MiB).toFixed(2) + ' MB';
$('#screen').classList.toggle('over', over);
$('#screen').setAttribute('aria-label', 'Space on the calculator: ' + size(used) + ' of ' + size(cap) + ', each game a block its size');
@@ -255,6 +264,9 @@
shownUsed = used;
if (!previewing) $('#status-line').textContent = (used / MiB).toFixed(2) + ' OF ' + +(cap / MiB).toFixed(2) + ' MB';
$('#battery').style.width = 'calc(' + Math.min(100, 100 * used / cap) + '% - 2px)';
+ $('#dock-used').textContent = (used / MiB).toFixed(2) + ' of ' + mb(cap);
+ $('#dock').classList.toggle('over', over);
+ if (other()) return renderPort(used, cap);
// the icons, in the order they go in the launcher
const s0 = solo(), picks = ordered();
@@ -271,8 +283,6 @@
arrange();
$('#space-chip-label').textContent = mb(cap);
$('#space-chip').dataset.tip = SPACES[space().id] + '|your calculator\'s space for apps';
- $('#dock-used').textContent = (used / MiB).toFixed(2) + ' of ' + mb(cap);
- $('#dock').classList.toggle('over', over);
// (a game on its own has its own icon, name and language)
const s = solo(), file = s ? game(s).alone.file : 'NumPlay.nwa';
for (const c of [$('#app-chip'), $('#lang-chip')]) c.disabled = !!s;
@@ -348,7 +358,7 @@
let previewTimer = 0;
function showPreview(id) {
const g = byId[id];
- if (!g || !g.preview || dragging || other()) return;
+ if (!g || !g.preview || dragging) return;
clearTimeout(previewTimer);
previewing = id;
const p = $('#preview'), img = p.querySelector('img');
@@ -377,11 +387,12 @@
b.addEventListener('animationend', () => b.classList.remove(cls), { once: true });
}
function overflow(bytes) {
- toast("That doesn't fit: " + size(bytes) + ' too much' + (st.cap === 'std' ? '. Epsilon 26 and Nwagra give more space' : '. Take games out first'));
+ toast("That doesn't fit: " + size(bytes) + ' too much' + (!other() && st.cap === 'std' ? '. Epsilon 26 and Nwagra give more space' : '. Take games out first'));
$('#screen').classList.add('over');
setTimeout(() => render(), 500);
}
function toggle(id, quiet) {
+ if (other()) return togglePort(id);
const s = solo(), b = quiet ? null : buttons.get(id);
if (st.picked.has(id)) {
st.picked.delete(id);
@@ -688,7 +699,7 @@
if (solo()) st.picked = new Set([solo()]);
// a pick that no longer fits the calculator (the kit grew): drop the biggest games until it does
const big = ordered().sort((a, b) => flash(a) - flash(b));
- while (usedBytes() > capacity() && big.length) st.picked.delete(big.pop());
+ while (nwItems().reduce((a, it) => a + it.bytes, 0) > nwCap() && big.length) st.picked.delete(big.pop());
}
// ------------------------------------------------------------------ the kit
@@ -1098,10 +1109,16 @@
function setCalc(id) {
st.calc = known(id) && calcReady(id) ? id : 'numworks';
const c = CALCS[st.calc], o = other();
- if (o && !st.port[st.calc]) { // (as last time, or the games NumPlay starts with)
+ if (o && !st.port[st.calc]) { // (as last time, or the games NumPlay starts with; as many as fit, the biggest out first)
const list = portList(), saved = store('numplay-port-' + st.calc);
- st.port[st.calc] = new Set(saved !== null ? saved.split(',').filter((x) => list[x])
- : kit.games.filter((g) => g.default && list[g.id]).map((g) => g.id));
+ const picks = st.port[st.calc] = new Set((saved !== null ? saved.split(',') : kit.games.filter((g) => g.default).map((g) => g.id))
+ .filter((x) => list[x] && buttons.has(x)));
+ let n = [...picks].reduce((a, x) => a + list[x].size, 0);
+ for (const x of [...picks].sort((a, b) => list[b].size - list[a].size)) {
+ if (n <= c.space * MiB) break;
+ picks.delete(x);
+ n -= list[x].size;
+ }
}
document.documentElement.classList.toggle('other', o);
for (const [gid, b] of buttons) b.classList.toggle('away', !onCalc(gid));
@@ -1119,7 +1136,31 @@
$('#calc-chip-img').src = 'calcs/' + st.calc + '.png';
$('#calc-chip-label').textContent = c.name;
$('#calc-chip').dataset.tip = c.name + '|your calculator';
- if (o) Object.assign($('#port-img'), { src: MEDIA + 'calcs/' + c.photo, alt: 'A ' + c.name });
+ // its picture, as big as the NumWorks's (2000 of its pixels as tall), with Studio's screen under its cut-out LCD (a
+ // hair under the bezel all round), and the bar beside it from the top of its screen; the NumWorks's back in its well
+ const scr = $('#screen'), dev = document.querySelector('.device');
+ if (o) {
+ const [w, l, t, r, b] = c.pic, m = 1.5, pc = (v, of) => (100 * v / of).toFixed(3) + '%';
+ const img = $('#port-img'), src = 'calcs/' + st.calc + '-full.webp', box = $('#port-calc');
+ if (img.getAttribute('src') !== src) { // (its screen shows with it, not before)
+ box.classList.add('loading');
+ Object.assign(img, { src, alt: 'A ' + c.name });
+ img.decode().catch(() => {}).then(() => { if (img.getAttribute('src') === src) box.classList.remove('loading'); });
+ }
+ Object.assign(scr.style, { left: pc(l - m, w), top: pc(t - m, 2000), width: pc(r - l + 2 * m, w), height: pc(b - t + 2 * m, 2000) });
+ $('#port-calc').prepend(scr);
+ dev.style.setProperty('--pw', 'calc(var(--cw) * ' + (w / 1018).toFixed(4) + ')');
+ dev.style.setProperty('--pa', w + ' / 2000');
+ dev.style.setProperty('--mt', ((t - 47) / 1018).toFixed(4));
+ [W, H] = [c.screen[0], Math.round(c.screen[1] * 0.925)];
+ } else if (scr.parentNode.id === 'port-calc') {
+ scr.removeAttribute('style');
+ document.querySelector('.well').appendChild(scr);
+ for (const v of ['--pw', '--pa', '--mt']) dev.style.removeProperty(v);
+ [W, H] = [320, 222];
+ }
+ // (the Casio's screen is wider: a game's 320 by 240 picture goes in the middle of it, squeezed to its height)
+ scr.classList.toggle('wide', o && c.screen[0] / c.screen[1] > 1.5);
const dl = $('#dock-install');
dl.textContent = o ? 'Download' : 'Install';
dl.disabled = false;
@@ -1132,31 +1173,36 @@
watchDock();
render();
}
- function renderPort() {
+ // (render's part for another calculator: the icons, as on the NumWorks, and its Download)
+ function renderPort(used, cap) {
const c = CALCS[st.calc], list = portList(), picks = st.port[st.calc];
for (const [id, b] of buttons) {
if (!list[id]) continue;
- const on = picks.has(id);
+ const on = picks.has(id), fits = on || used + list[id].size <= cap;
b.classList.toggle('on', on);
- b.classList.toggle('off', !on);
- b.classList.remove('nofit');
+ b.classList.toggle('off', !on && fits);
+ b.classList.toggle('nofit', !fits);
b.setAttribute('aria-pressed', on);
b.dataset.tip = byId[id].title + '|' + size(list[id].size);
}
arrange();
const ids = portPicks(), n = ids.length;
- const text = n ? n + (n === 1 ? ' game · ' : ' games · ') + size(ids.reduce((a, id) => a + list[id].size, 0)) : 'No games picked';
- $('#port-used').textContent = $('#dock-used').textContent = text;
- $('#dock').classList.remove('over');
$('#port-dl').disabled = $('#dock-install').disabled = !n;
- $('#port-dl').dataset.tip = 'Download ' + c.zip;
+ $('#port-dl').dataset.tip = 'Download ' + c.zip + '|' + n + (n === 1 ? ' game' : ' games');
store('numplay-port-' + st.calc, ids.join(','));
save();
}
function togglePort(id) {
- const picks = st.port[st.calc], on = !picks.has(id);
- if (on) picks.add(id); else picks.delete(id);
- bump(buttons.get(id), on ? 'pop-on' : 'pop-off');
+ const picks = st.port[st.calc], b = buttons.get(id);
+ if (picks.has(id)) {
+ picks.delete(id);
+ bump(b, 'pop-off');
+ } else {
+ const over = usedBytes() + portList()[id].size - capacity();
+ if (over > 0) { bump(b, 'shake'); overflow(over); return; }
+ picks.add(id);
+ bump(b, 'pop-on');
+ }
render();
}
function renderCalcs() {
@@ -2103,7 +2149,6 @@
b.insertAdjacentHTML('beforeend', badge);
b.addEventListener('click', () => {
if (justDragged) { justDragged = false; return; }
- if (other()) { togglePort(g.id); return; }
toggle(g.id);
if (matchMedia('(hover: none)').matches) { showPreview(g.id); hidePreview(1600); }
});
@@ -2181,7 +2226,7 @@
// files dropped anywhere: apps (.nwa) to your apps, PICO-8 carts to NumPico, the rest to Retro-Go
let fileDrag = 0;
const files = (e) => e.dataTransfer && [...e.dataTransfer.types].includes('Files');
- addEventListener('dragenter', (e) => { if (files(e)) { fileDrag++; document.body.classList.add('dragging'); e.preventDefault(); } });
+ addEventListener('dragenter', (e) => { if (files(e) && !other()) { fileDrag++; document.body.classList.add('dragging'); e.preventDefault(); } });
addEventListener('dragover', (e) => { if (files(e)) e.preventDefault(); });
addEventListener('dragleave', () => { if (--fileDrag <= 0) { fileDrag = 0; document.body.classList.remove('dragging'); } });
addEventListener('drop', async (e) => {
@@ -2189,6 +2234,7 @@
e.preventDefault();
fileDrag = 0;
document.body.classList.remove('dragging');
+ if (other()) return;
const all = [...e.dataTransfer.files], nwa = all.filter((f) => /\.nwa$/i.test(f.name));
const p8 = all.filter((f) => /\.p8(\.png)?$/i.test(f.name)), rest = all.filter((f) => !nwa.includes(f) && !p8.includes(f));
if (nwa.length) await addApps(nwa);
diff --git a/customize/calcs/casio-cg-full.webp b/customize/calcs/casio-cg-full.webp
new file mode 100644
index 00000000..598fd117
Binary files /dev/null and b/customize/calcs/casio-cg-full.webp differ
diff --git a/customize/calcs/nspire-full.webp b/customize/calcs/nspire-full.webp
new file mode 100644
index 00000000..9282969d
Binary files /dev/null and b/customize/calcs/nspire-full.webp differ
diff --git a/customize/calcs/ti84ce-full.webp b/customize/calcs/ti84ce-full.webp
new file mode 100644
index 00000000..15fb84ac
Binary files /dev/null and b/customize/calcs/ti84ce-full.webp differ
diff --git a/customize/index.html b/customize/index.html
index efd1cf73..e81119a8 100644
--- a/customize/index.html
+++ b/customize/index.html
@@ -157,9 +157,10 @@
<a id="star" class="sticker" href="https://github.com/Mason363/NumPlay" target="_blank" rel="noopener" aria-label="Star NumPlay on GitHub" data-tip="Star NumPlay on GitHub|it helps other people find it"></a>
</div>
<div id="port" class="port">
- <img id="port-img" class="port-img" alt="" draggable="false">
- <p id="port-used" class="port-used"></p>
- <button id="port-dl" type="button" class="install">Download</button>
+ <div id="port-calc" class="port-calc">
+ <img id="port-img" class="port-img" alt="" draggable="false">
+ </div>
+ <button id="port-dl" type="button" class="install port-dl">Download</button>
</div>
</section>
</main>