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.
C calculatorcalculator-gamescasiochesscrossy-roaddrive-madfx-cg50gamesgeometry-dashgraphing-calculatorndlessnumworksnumworks-appsnumworks-calculatornumworks-gamenumworks-gamestetristi-84-plus-ceti-nspire
Icons: NumPlay in teal, and every app icon with the same corners
Mason Chen31ab82820c72
diff --git a/docs/media/icon-invisible.png b/docs/media/icon-invisible.pngindex 976705af..d2083252 100644Binary files a/docs/media/icon-invisible.png and b/docs/media/icon-invisible.png differdiff --git a/docs/media/icon-matrices.png b/docs/media/icon-matrices.pngindex 99823088..10f940fc 100644Binary files a/docs/media/icon-matrices.png and b/docs/media/icon-matrices.png differdiff --git a/docs/media/icon.png b/docs/media/icon.pngindex fbd50449..39d671b1 100644Binary files a/docs/media/icon.png and b/docs/media/icon.png differdiff --git a/docs/media/social.png b/docs/media/social.pngindex abff317d..e4f069f9 100644Binary files a/docs/media/social.png and b/docs/media/social.png differdiff --git a/games/balatro/src/icon.png b/games/balatro/src/icon.pngindex 4e045ca0..78b4fad3 100644Binary files a/games/balatro/src/icon.png and b/games/balatro/src/icon.png differdiff --git a/games/breakout/src/icon.png b/games/breakout/src/icon.pngindex a5d4707b..b624f7f7 100644Binary files a/games/breakout/src/icon.png and b/games/breakout/src/icon.png differdiff --git a/games/buckshot/docs/icon.png b/games/buckshot/docs/icon.pngindex bdc5e72d..79edc74e 100644Binary files a/games/buckshot/docs/icon.png and b/games/buckshot/docs/icon.png differdiff --git a/games/buckshot/src/icon.png b/games/buckshot/src/icon.pngindex 74c119ed..5084d649 100644Binary files a/games/buckshot/src/icon.png and b/games/buckshot/src/icon.png differdiff --git a/games/celeste/src/icon.png b/games/celeste/src/icon.pngindex e7a279e6..f84faca9 100644Binary files a/games/celeste/src/icon.png and b/games/celeste/src/icon.png differdiff --git a/games/championisland/docs/icon.png b/games/championisland/docs/icon.pngindex 578f6e7f..eb41787c 100644Binary files a/games/championisland/docs/icon.png and b/games/championisland/docs/icon.png differdiff --git a/games/championisland/src/icon.png b/games/championisland/src/icon.pngindex f925eb25..2304cfe2 100644Binary files a/games/championisland/src/icon.png and b/games/championisland/src/icon.png differdiff --git a/games/chess/docs/icon.png b/games/chess/docs/icon.pngindex c4de3844..ff67cfd9 100644Binary files a/games/chess/docs/icon.png and b/games/chess/docs/icon.png differdiff --git a/games/chess/src/icon.png b/games/chess/src/icon.pngindex 3c80b1a7..b8d7951f 100644Binary files a/games/chess/src/icon.png and b/games/chess/src/icon.png differdiff --git a/games/connectfour/src/icon.png b/games/connectfour/src/icon.pngindex fc3e0ec1..35c0e263 100644Binary files a/games/connectfour/src/icon.png and b/games/connectfour/src/icon.png differdiff --git a/games/crossyroad/assets/icon.png b/games/crossyroad/assets/icon.pngindex d83b45cc..965d8df1 100644Binary files a/games/crossyroad/assets/icon.png and b/games/crossyroad/assets/icon.png differdiff --git a/games/finalearth2/src/icon.png b/games/finalearth2/src/icon.pngindex 98d9f8ed..81751ad0 100644Binary files a/games/finalearth2/src/icon.png and b/games/finalearth2/src/icon.png differdiff --git a/games/flappybird/src/icon.png b/games/flappybird/src/icon.pngindex fd6a28c3..e533cedf 100644Binary files a/games/flappybird/src/icon.png and b/games/flappybird/src/icon.png differdiff --git a/games/g2048/src/icon.png b/games/g2048/src/icon.pngindex 19227b82..1f173a4b 100644Binary files a/games/g2048/src/icon.png and b/games/g2048/src/icon.png differdiff --git a/games/hollowknight/src/icon.png b/games/hollowknight/src/icon.pngindex 0c691deb..bf0ece98 100644Binary files a/games/hollowknight/src/icon.png and b/games/hollowknight/src/icon.png differdiff --git a/games/minesweeper/src/icon.png b/games/minesweeper/src/icon.pngindex 529e90d4..f97dd2e9 100644Binary files a/games/minesweeper/src/icon.png and b/games/minesweeper/src/icon.png differdiff --git a/games/numblocks/src/icon.png b/games/numblocks/src/icon.pngindex 5ad9a0cf..d39e2d4e 100644Binary files a/games/numblocks/src/icon.png and b/games/numblocks/src/icon.png differdiff --git a/games/numdash/assets/icon.png b/games/numdash/assets/icon.pngindex e2ba194a..0b437229 100644Binary files a/games/numdash/assets/icon.png and b/games/numdash/assets/icon.png differdiff --git a/games/numdrive/src/icon.png b/games/numdrive/src/icon.pngindex 262c0580..0411e61f 100644Binary files a/games/numdrive/src/icon.png and b/games/numdrive/src/icon.png differdiff --git a/games/numpowder/src/icon.png b/games/numpowder/src/icon.pngindex b6a19b9d..d1c37852 100644Binary files a/games/numpowder/src/icon.png and b/games/numpowder/src/icon.png differdiff --git a/games/numvisuals/src/icon.png b/games/numvisuals/src/icon.pngindex 2baa8af2..9aedf68a 100644Binary files a/games/numvisuals/src/icon.png and b/games/numvisuals/src/icon.png differdiff --git a/games/pacman/src/icon.png b/games/pacman/src/icon.pngindex d31a1fb2..cbfe34e5 100644Binary files a/games/pacman/src/icon.png and b/games/pacman/src/icon.png differdiff --git a/games/portal/docs/icon.png b/games/portal/docs/icon.pngindex 8d04ad26..c9d98b42 100644Binary files a/games/portal/docs/icon.png and b/games/portal/docs/icon.png differdiff --git a/games/portal/src/icon.png b/games/portal/src/icon.pngindex 8d04ad26..c9d98b42 100644Binary files a/games/portal/src/icon.png and b/games/portal/src/icon.png differdiff --git a/games/snake/src/icon.png b/games/snake/src/icon.pngindex b48eed12..f435fa88 100644Binary files a/games/snake/src/icon.png and b/games/snake/src/icon.png differdiff --git a/games/solitaire/src/icon.png b/games/solitaire/src/icon.pngindex 117febdd..867036bf 100644Binary files a/games/solitaire/src/icon.png and b/games/solitaire/src/icon.png differdiff --git a/games/tetris/tetris/src/data/icon.png b/games/tetris/tetris/src/data/icon.pngindex c330d48f..8513c2b2 100644Binary files a/games/tetris/tetris/src/data/icon.png and b/games/tetris/tetris/src/data/icon.png differdiff --git a/launcher/assets/icon-matrices.png b/launcher/assets/icon-matrices.pngindex 7d2c70dd..9d91bed2 100644Binary files a/launcher/assets/icon-matrices.png and b/launcher/assets/icon-matrices.png differdiff --git a/launcher/assets/icon.png b/launcher/assets/icon.pngindex 5a6fb77d..b2a8fbe5 100644Binary files a/launcher/assets/icon.png and b/launcher/assets/icon.png differdiff --git a/launcher/src/settings.c b/launcher/src/settings.cindex 3d7cc479..62501f0f 100644--- a/launcher/src/settings.c+++ b/launcher/src/settings.c@@ -12,7 +12,7 @@#define DANGER_TOP 0x8C1D23#define DANGER_BOTTOM 0x2A080B#define OK_GREEN 0x2FB36B-#define ACCENT 0x7B43FF+#define ACCENT 0x1F8A7D /* NumPlay's teal (its icon's) */#define ROW_H 34#define ROWS_Y 50#define HOLD_MS 1400diff --git a/tools/make_icon.py b/tools/make_icon.pyindex cfc8cd50..490a1050 100644--- a/tools/make_icon.py+++ b/tools/make_icon.py@@ -1,50 +1,82 @@#!/usr/bin/env python3"""Draws NumPlay's home screen icon (55x56, like the calculator's own apps):-a white game pad on a warm-to-cool gradient. Usage: make_icon.py out.png [size]"""+a white game pad on a deep teal to sky blue gradient with a fine grain.++Also the corner every app icon shares (corner_mask): a rounded square whose+radius is 12 pixels at 55 wide, anti-aliased. tools/round_icons.py applies it+to the games' icons.++Usage: make_icon.py out.png [big.png WIDTH] (the second file: a bigger copy+with transparent corners, for the README)"""+import randomimport sysfrom PIL import Image, ImageDraw-S = 8+SS = 8 # supersampling+RADIUS = 12 # the corner's radius at 55 pixels wide+# the gradient, from the top left to the bottom right+STOPS = ((0.0, (19, 58, 50)), (0.35, (27, 108, 100)), (0.7, (92, 152, 176)), (1.0, (66, 150, 208)))+INK = (24, 78, 66) # the d-pad: the gradient's deep green+SAGE = (126, 146, 112) # a button: sage green+BLUE = (58, 134, 196) # the other: sky blue+GRAIN = 9 # the grain's strength (levels of 255 either way)+++def corner_mask(w, h):+ """The shape every app icon shares, as an L mask of w x h (anti-aliased)."""+ r = RADIUS * w / 55 * SS+ m = Image.new("L", (w * SS, h * SS), 0)+ ImageDraw.Draw(m).rounded_rectangle([0, 0, w * SS - 1, h * SS - 1], radius=r, fill=255)+ return m.resize((w, h), Image.LANCZOS)+++def gradient_at(t):+ for (t0, c0), (t1, c1) in zip(STOPS, STOPS[1:]):+ if t <= t1:+ k = (t - t0) / (t1 - t0)+ k = k * k * (3 - 2 * k) # smooth between the stops+ return tuple(a + (b - a) * k for a, b in zip(c0, c1))+ return STOPS[-1][1]def icon(w=55, h=56):- """Drawn for 55x56 and scaled for other sizes."""- S = 8 * w / 55- W, H = int(w * 8), int(h * 8)- # diagonal gradient- top, bottom = (255, 94, 98), (123, 67, 255)- grad = Image.new("RGB", (W, H))+ """Drawn for 55x56 and scaled for other sizes; RGBA with transparent corners."""+ S = SS * w / 55+ W, H = w * SS, h * SS+ # the gradient, at the icon's own size (it is smooth), with its grain+ rnd = random.Random(363)+ grad = Image.new("RGB", (w, h))px = grad.load()- for y in range(H):- for x in range(W):- t = (x * 0.35 + y * 0.65) / (W * 0.35 + H * 0.65)- px[x, y] = tuple(int(a + (b - a) * t) for a, b in zip(top, bottom))- mask = Image.new("L", (W, H), 0)- ImageDraw.Draw(mask).rounded_rectangle([0, 0, W - 1, H - 1], radius=12 * S, fill=255)- out = Image.new("RGBA", (W, H), (0, 0, 0, 0))- out.paste(grad, (0, 0), mask)- d = ImageDraw.Draw(out)- # soft shadow, then the pad+ for y in range(h):+ for x in range(w):+ t = (x * 0.45 + y * 0.55) / ((w - 1) * 0.45 + (h - 1) * 0.55)+ n = rnd.uniform(-GRAIN, GRAIN)+ px[x, y] = tuple(max(0, min(255, int(c + n + 0.5))) for c in gradient_at(t))+ # the pad, supersampled+ pad = Image.new("RGBA", (W, H), (0, 0, 0, 0))+ d = ImageDraw.Draw(pad)cx, cy = W / 2, H / 2pw, ph = 42 * S, 26 * S- def pad(dx, dy, fill):+ def body(dx, dy, fill):d.rounded_rectangle([cx - pw / 2 + dx, cy - ph / 2 + dy, cx + pw / 2 + dx, cy + ph / 2 + dy], radius=ph / 2,fill=fill)- pad(0, 2 * S, (60, 20, 90, 90))- pad(0, 0, (255, 255, 255, 255))- ink = (120, 70, 220, 255)+ body(0, 2 * S, (8, 40, 34, 90)) # its soft shadow+ body(0, 0, (255, 255, 255, 255))# d-paddx, dy, a, b = cx - 10.5 * S, cy, 5.5 * S, 2 * S- d.rounded_rectangle([dx - a, dy - b, dx + a, dy + b], radius=S, fill=ink)- d.rounded_rectangle([dx - b, dy - a, dx + b, dy + a], radius=S, fill=ink)+ d.rounded_rectangle([dx - a, dy - b, dx + a, dy + b], radius=S, fill=INK + (255,))+ d.rounded_rectangle([dx - b, dy - a, dx + b, dy + a], radius=S, fill=INK + (255,))# buttons- for bx, by, col in ((cx + 8 * S, cy + 2.5 * S, (255, 94, 98, 255)), (cx + 13 * S, cy - 2.5 * S, ink)):+ for bx, by, col in ((cx + 8 * S, cy + 2.5 * S, SAGE), (cx + 13 * S, cy - 2.5 * S, BLUE)):r = 3 * S- d.ellipse([bx - r, by - r, bx + r, by + r], fill=col)- return out.resize((w, h), Image.LANCZOS)+ d.ellipse([bx - r, by - r, bx + r, by + r], fill=col + (255,))+ out = grad.convert("RGBA")+ out.alpha_composite(pad.resize((w, h), Image.LANCZOS))+ out.putalpha(corner_mask(w, h))+ return outif __name__ == "__main__":@@ -53,5 +85,6 @@ if __name__ == "__main__":flat = Image.new("RGB", im.size, (255, 255, 255))flat.paste(im, (0, 0), im)flat.save(sys.argv[1])- if len(sys.argv) > 2:- im.resize((int(sys.argv[2]), int(int(sys.argv[2]) * 56 / 55)), Image.LANCZOS).save(sys.argv[1].replace(".png", "@big.png"))+ if len(sys.argv) > 3:+ bw = int(sys.argv[3])+ icon(bw, round(bw * 56 / 55)).save(sys.argv[2])diff --git a/tools/media/social.py b/tools/media/social.pyindex edba9599..fbe70340 100644--- a/tools/media/social.py+++ b/tools/media/social.py@@ -1,7 +1,6 @@#!/usr/bin/env python3"""Renders docs/media/social.png, the 1280x640 picture shown when therepository is shared (upload it in the repository's settings)."""-import jsonimport osimport sys@@ -15,18 +14,18 @@ import make_icon # noqa: E402W, H = 1280, 640bg = Image.new("RGB", (W, H))px = bg.load()-a, b = (40, 22, 110), (12, 10, 40)+a, b = (16, 62, 58), (10, 22, 40) # the icon's deep teal, into a night bluefor y in range(H):for x in range(W):t = (x * 0.4 + y * 0.6) / (W * 0.4 + H * 0.6)px[x, y] = tuple(int(p + (q - p) * t) for p, q in zip(a, b))img = bg.convert("RGBA")-games = {g["id"]: g for g in json.load(open(os.path.join(ROOT, "games", "games.json")))}-shots = [("numdash", 1), ("crossyroad", 1), ("numdrive", 0), ("tetris", 1)]+shots = ["numdash/docs/screenshots/gameplay.png", "crossyroad/screenshots/river.png", "numdrive/docs/shot1.png",+ "tetris/docs/shot2.png"]cw, ch = 290, 218-for k, (gid, i) in enumerate(shots):+for k, shot in enumerate(shots):x, y = 650 + (k % 2) * (cw + 24), 90 + (k // 2) * (ch + 24)- im = Image.open(os.path.join(ROOT, "games", gid, games[gid]["shots"][i])).convert("RGB").resize((cw, ch), Image.LANCZOS)+ im = Image.open(os.path.join(ROOT, "games", shot)).convert("RGB").resize((cw, ch), Image.LANCZOS)sh = Image.new("RGBA", (cw + 60, ch + 60), (0, 0, 0, 0))ImageDraw.Draw(sh).rounded_rectangle([30, 36, cw + 30, ch + 36], radius=18, fill=(0, 0, 0, 160))img.alpha_composite(sh.filter(ImageFilter.GaussianBlur(12)), (x - 30, y - 30))@@ -44,6 +43,6 @@ f2 = ImageFont.truetype(font, 36)f2.set_variation_by_axes([700])d = ImageDraw.Draw(img)d.text((64, 282), "NumPlay", font=f1, fill=(255, 255, 255))-d.multiline_text((72, 410), "Every game for your\nNumWorks calculator,\nin one app.", font=f2, fill=(220, 215, 255),+d.multiline_text((72, 410), "Every game for your\nNumWorks calculator,\nin one app.", font=f2, fill=(205, 232, 232),spacing=8)img.convert("RGB").save(os.path.join(ROOT, "docs", "media", "social.png"), optimize=True)diff --git a/tools/round_icons.py b/tools/round_icons.pynew file mode 100644index 00000000..633e0a51--- /dev/null+++ b/tools/round_icons.py@@ -0,0 +1,25 @@+#!/usr/bin/env python3+"""Gives every app icon the same rounded corners: make_icon.corner_mask (a radius of 12 pixels at 55 wide, the+corner of NumPlay's own icon). Each icon keeps its picture; outside the corner it becomes transparent, which the+calculator draws as the home screen's white and GitHub as its page. An icon already rounder there stays as it is.+The colour under the transparency is the icon on white, for tools that ignore it (Tetris' Rust build).++Usage: round_icons.py ICON.png... (rewritten in place; 55x56 app icons and their bigger copies)+Run it again after redrawing an icon with a game's own script (balatro, chess, crossyroad, numblocks and portal have+one), as those draw square or differently rounded corners."""+import os+import sys++from PIL import Image, ImageChops++sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))+from make_icon import corner_mask # noqa: E402++for path in sys.argv[1:]:+ im = Image.open(path).convert("RGBA")+ alpha = ImageChops.darker(im.getchannel("A"), corner_mask(*im.size))+ flat = Image.new("RGB", im.size, (255, 255, 255))+ flat.paste(im.convert("RGB"), (0, 0), alpha)+ flat.putalpha(alpha)+ flat.save(path, optimize=True)+ print("rounded", path, im.size)diff --git a/tools/variant_icons.py b/tools/variant_icons.pyindex bb4b6978..0d48f5f4 100644--- a/tools/variant_icons.py+++ b/tools/variant_icons.py@@ -13,6 +13,9 @@ import sysfrom PIL import Image, ImageDraw+sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))+from make_icon import RADIUS # noqa: E402 (the corner every app icon shares)+W, H, S = 55, 56, 8INK, ORANGE, SLATE = (65, 65, 71), (255, 183, 52), (101, 105, 117)BANDS = ((0, 245), (17, 236), (35, 217), (50, 210)) # grey bands of the calculator's light icons, from the top@@ -41,7 +44,7 @@ def matrices(size=(W, H)):x, y = (16.5 + j * 12) * S, (16 + i * 12) * Sd.rounded_rectangle([x, y, x + 10 * S, y + 10 * S], radius=2 * S, fill=ORANGE if i == j else SLATE)mask = Image.new("L", im.size, 0)- ImageDraw.Draw(mask).rounded_rectangle([0, 0, W * S - 1, H * S - 1], radius=7 * S, fill=255)+ ImageDraw.Draw(mask).rounded_rectangle([0, 0, W * S - 1, H * S - 1], radius=RADIUS * S, fill=255)im.paste(tile, (0, 0), mask)return im.resize(size, Image.LANCZOS)@@ -50,7 +53,7 @@ def invisible_preview(size):w, h = size[0] * 4, size[1] * 4im = Image.new("RGBA", (w, h), (0, 0, 0, 0))d = ImageDraw.Draw(im)- d.rounded_rectangle([0, 0, w - 1, h - 1], radius=w // 8, fill=(255, 255, 255, 255))+ d.rounded_rectangle([0, 0, w - 1, h - 1], radius=RADIUS * w / 55, fill=(255, 255, 255, 255))dash, gap, t, c = w // 14, w // 20, max(2, w // 60), (190, 190, 196, 255)inset = t * 2for x in range(inset + w // 8, w - inset - w // 8, dash + gap):