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
add optio for games on the emulator + fix the dark mode
Lily Pitiote1c27895403e
diff --git a/Makefile b/Makefileindex 41267f1b..8d544a4a 100644--- a/Makefile+++ b/Makefile@@ -66,7 +66,7 @@ ARM_CFLAGS = -std=gnu11 $(EADK_CFLAGS) -DNP_VERSION='"$(VERSION)"' -Os -Wall -WeARM_LINK = -nostartfiles --specs=nano.specs -Wl,--relocatable -Wl,--gc-sections -Wl,-e,main \-Wl,-u,eadk_app_name -Wl,-u,eadk_app_icon -Wl,-u,eadk_api_level-.PHONY: all nwa apps check sim emu clean lang FORCE+.PHONY: all nwa apps check sim emu clean lang FORCE tetris-appall: nwa appsnwa: $(foreach v,$(VARIANTS),$(B)/$(v).nwa) $(B)/NumPlay-Upsilon.nwa@@ -203,6 +203,12 @@ APP_buckshot = $(B)/games/buckshot/buckshot.nwa:BuckshotRoulette.nwaAPP_portal = $(B)/games/portal/portal.nwa:PortalReturns.nwaAPP_chess = $(B)/games/chess/chess.nwa:NumChess.nwaAPP_tetris = games/tetris/tetris/target/thumbv7em-none-eabihf/release/tetris:Tetris.nwa++# Standalone Rust Tetris, without the full `apps` / launcher build.+tetris-app: | $(B)+ cd games/tetris/tetris && NWLINK="$(NWLINK)" $(CARGO) build --release --quiet+ cp $(word 1,$(subst :, ,$(APP_tetris))) $(B)/apps/Tetris.nwa+ arm-none-eabi-strip --strip-unneeded $(B)/apps/Tetris.nwaAPP_numvisuals = $(B)/games/numvisuals/numvisuals.nwa:NumVisuals.nwa# too big to share the calculator's app space with NumPlay: only on their ownAPP_celeste = $(B)/games/celeste/celeste.nwa:Celeste.nwadiff --git a/tools/build.py b/tools/build.pyindex 2b0c32b2..f42a2e93 100644--- a/tools/build.py+++ b/tools/build.py@@ -797,7 +797,7 @@ def _game_output(game: str) -> tuple[str, Path]:game_dir / "output" / "device" / f"{game}.nwa",game_dir / "build" / f"{game}.nwa"])if game == "tetris":- candidate = [game_dir / "tetris" / "target" / "thumbv7em-none-eabihf" / "release" / "tetris"]+ candidate = [ROOT / "build" / "data" / "apps" / "Tetris.nwa"]return file, next((p for p in candidate if p.is_file()), candidate[0])@@ -814,10 +814,11 @@ def _publish_game(game: str) -> Path:def _build_once(a) -> None:if a.game:if a.game == "tetris":- # Tetris is a Cargo project; the regular root apps target also- # creates standalone Tetris, but would compile ALL games. This path- # is intentionally disabled until the bridge is generalized.- raise RuntimeError("Tetris standalone single-game mode is not wired yet; use a full build")+ # Dedicated Cargo target: do not compile all NumPlay games.+ # The Make recipe uses the existing Windows nwlink.exe bridge.+ _run_make(["tetris-app"], jobs=a.jobs)+ _publish_game("tetris")+ return_game_output(a.game) # Fail before launching a compiler on invalid IDs.source_makefile = (ROOT / "games" / a.game / "Makefile").read_text(encoding="utf-8")active = "\n".join(x for x in source_makefile.splitlines()diff --git a/tools/emulator.py b/tools/emulator.pyindex 2f7d2fa7..419ab33d 100644--- a/tools/emulator.py+++ b/tools/emulator.py@@ -2422,6 +2422,7 @@ class CalculatorSkinApp(LiveApp):state="readonly", width=30)self._compiled_picker.pack(fill="x", pady=(2, 4))self._compiled_picker.bind("<Button-1>", lambda _e: self._refresh_compiled_games())+ self._compiled_picker.bind("<<ComboboxSelected>>", self._on_compiled_selection_changed)self._refresh_compiled_games()actions = tk.Frame(inner, bg=PANEL)actions.pack(fill="x", pady=(0, 3))@@ -2696,9 +2697,23 @@ class CalculatorSkinApp(LiveApp):style = ttk.Style(self.root)style.theme_use("clam")style.configure(".", background=PANEL, foreground=FG)- style.configure("TButton", background=PANEL_2)+ style.configure("TButton", background=PANEL_2, foreground=FG)+ style.map("TButton",+ foreground=[("disabled", MUTED), ("pressed", FG), ("active", FG)],+ background=[("pressed", SELECT), ("active", HOVER)])style.configure("TCheckbutton", background=PANEL, foreground=FG)+ style.map("TCheckbutton",+ foreground=[("disabled", MUTED), ("active", FG)],+ background=[("active", PANEL)])style.configure("TMenubutton", background=PANEL_2, foreground=FG)+ style.map("TMenubutton",+ foreground=[("disabled", MUTED), ("pressed", FG), ("active", FG)],+ background=[("pressed", SELECT), ("active", HOVER)])+ style.configure("TCombobox", foreground=FG, fieldbackground=PANEL_2,+ background=PANEL_2, arrowcolor=FG)+ style.map("TCombobox", foreground=[("readonly", FG), ("disabled", MUTED)],+ fieldbackground=[("readonly", PANEL_2)],+ background=[("active", HOVER)])style.configure("Horizontal.TProgressbar", background=ACCENT, troughcolor=PANEL_2)except tk.TclError:pass@@ -2741,10 +2756,27 @@ class CalculatorSkinApp(LiveApp):"a file, and reload it.")def _compiled_choices(self):+ """Offer every known app before it has been built, not just files on disk.++ A game is built on demand by `tools/build.py --game ID`. Discover its+ release filename from the manifest and the same APP_ assignments used+ by the root Makefile, including special-layout games.+ """root = REPO_ROOT / "build" / "compiled"- return ([root / "NumPlay.nwa"] if (root / "NumPlay.nwa").is_file() else []) + \- sorted(p for p in root.glob("NumPlay-*.nwa") if p.is_file()) + \- sorted(p for p in (root / "games").glob("*.nwa") if p.is_file())+ filenames = [+ "NumPlay.nwa", "NumPlay-Invisible.nwa", "NumPlay-Matrices.nwa",+ "NumPlay-Upsilon.nwa", "NumPlay-French.nwa", "NumPlay-Chinese.nwa",+ ]+ manifest = json.loads((REPO_ROOT / "games" / "games.json").read_text(encoding="utf-8"))+ game_names = {record["app"] for record in manifest if record.get("app")}+ makefile = (REPO_ROOT / "Makefile").read_text(encoding="utf-8")+ game_names.update(re.findall(+ r"(?m)^APP_\w+\s*=\s*[^:\n]+:(\S+\.nwa)\s*$", makefile))+ filenames.extend("games/" + name for name in sorted(game_names, key=str.casefold))+ # Keep any existing nonstandard exported files reachable, too.+ filenames.extend(p.relative_to(root).as_posix() for p in root.glob("NumPlay-*.nwa") if p.is_file())+ filenames.extend(p.relative_to(root).as_posix() for p in (root / "games").glob("*.nwa") if p.is_file())+ return [root / name for name in dict.fromkeys(filenames)]def _refresh_compiled_games(self):paths = self._compiled_choices()@@ -2754,6 +2786,17 @@ class CalculatorSkinApp(LiveApp):if self._compiled_paths:self._compiled_choice.set(next(iter(self._compiled_paths)))+ def _on_compiled_selection_changed(self, _event=None):+ """Retarget an active live watcher; never let two builds run together."""+ if self.mode_var.get() != "live" or self._closing:+ return+ selected = self._compiled_choice.get()+ self._stop_builder()+ self._set_build_state("Switching live target", selected, busy=True)+ # _start_builder waits for the stopped process tree on Windows before+ # starting a new compiler. It reads the *current* selection then.+ self._start_builder()+def _selected_compiled_path(self):return (REPO_ROOT / "build" / "compiled" / self._compiled_choice.get()).resolve()@@ -2781,6 +2824,8 @@ class CalculatorSkinApp(LiveApp):self.load(path)def _build_compiled_selection(self):+ if self.mode_var.get() == "live":+ self._stop_builder()self.mode_var.set("live")self.live_var.set(True)self._switch_mode()@@ -2883,11 +2928,17 @@ class CalculatorSkinApp(LiveApp):self.watch_var.set(True)selected = self._selected_compiled_path()game_id = self._game_id_for_compiled(selected) if selected else None+ if selected.parent.name == "games" and not game_id:+ self._set_build_state("Unknown standalone game", selected.name, error=True)+ returncmd = [sys.executable, "-u", str(BUILD_SCRIPT), "--watch", "-j2"]if game_id:+ # Only this game's sources compile; no full NumPlay launcher rebuild.cmd.extend(["--game", game_id])else:- cmd.extend(["--launcher-only", "--skip-languages"])+ cmd.append("--launcher-only")+ if selected.name not in ("NumPlay-French.nwa", "NumPlay-Chinese.nwa"):+ cmd.append("--skip-languages")flags = subprocess.CREATE_NEW_PROCESS_GROUP if os.name == "nt" else 0try:self.build_process = subprocess.Popen(cmd, cwd=str(REPO_ROOT),@@ -2995,7 +3046,7 @@ class CalculatorSkinApp(LiveApp):elif "Stable live-emulator input:" in line:self._builder_has_error = Falseself._builder_ready = True- self._set_build_state("Built", "Reloading build/compiled/NumPlay.nwa", busy=False)+ self._set_build_state("Built", f"Reloading {self._compiled_choice.get()}", busy=False)if self.mode_var.get() == "live" and self._selected_compiled_path().is_file():# Emulation runs in its own thread and will stop gracefully# before loading the atomically replaced file.