feat(samples): add Pong and refresh test projects

Add the Studio-created Pong project with a short match against CPU, pause,
score and restart controls. Refresh legacy samples for current PBS input,
RGBA colors and preloaded assets while preserving existing identities.

Run convenience launchers against the current build and configured runtime;
keep local caches and native assistant configuration ignored.

Validation: shell syntax, JSON, registry identity/image preservation and
whitespace checks passed. Pong ran in Studio as confirmed by the user.
Build/pack/runtime validation of the refreshed samples remains pending.
This commit is contained in:
2026-11-05 17:15:17 +00:00
parent bf31184d4d
commit b2410e6edc
17 changed files with 479 additions and 72 deletions
+3
View File
@@ -14,3 +14,6 @@ Desktop.ini
# Linux / Unix desktop metadata
.directory
*~
/.codex/config.toml
/.studio/mcp/
/assets/.prometeu/cache.json
+15
View File
@@ -0,0 +1,15 @@
# Fragments
A procedural fractal/cloud effect with moving stars. Open the project in Studio,
build with Shipper and use Debug Play. The sample keeps its original logical
320×180 field and 8-pixel cells; the host framebuffer is 480×270.
The effect's palette formulas produce RGB565 values. `rgb565()` explicitly expands
the 5/6/5-bit channels into the current RGBA8888 Color representation. No image
assets or controls are needed.
`./run.sh` launches the current `build/` directory after a successful Studio build.
It reads `.studio/setup.json`, accepts `PROMETEU_RUNTIME` as an explicit override,
and uses the existing local `runtime` symlink only if no runtime was configured.
Python 3 is required by this convenience launcher. Historical `cartridge/` binaries
are preserved and are not used by this launcher.
+8 -8
View File
@@ -1,9 +1,9 @@
{
"name": "fragments",
"version": "1.0.0",
"language": "pbs",
"stdlib": "1",
"target": "Game",
"dependencies": [
]
}
"name" : "fragments",
"version" : "1.0.0",
"language" : "pbs",
"stdlib" : "1",
"target" : "Game",
"dependencies" : [ ],
"app_id" : 477476525
}
+33 -5
View File
@@ -1,7 +1,35 @@
#!/bin/zsh
#!/bin/sh
set -eu
set -e
PROJECT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
for artifact in program.pbx manifest.json assets.pa; do
if [ ! -f "$PROJECT_DIR/build/$artifact" ]; then
printf '%s\n' "Build this project in Studio Shipper before running it." >&2
exit 1
fi
done
cp build/assets.pa cartridge
cp build/program.pbx cartridge
./runtime/prometeu run cartridge
RUNTIME_PATH=${PROMETEU_RUNTIME:-}
if [ -z "$RUNTIME_PATH" ]; then
RUNTIME_PATH=$(python3 - "$PROJECT_DIR" <<'CONFIG_PY'
import json,sys
from pathlib import Path
root=Path(sys.argv[1])
setup=root/'.studio/setup.json'
try:
value=json.loads(setup.read_text()).get('prometeuRuntimePath') if setup.exists() else None
except (ValueError,OSError) as error:
raise SystemExit('Cannot read project runtime configuration: '+str(error))
print(value or root/'runtime')
CONFIG_PY
)
fi
case "$RUNTIME_PATH" in
/*) ;;
*) RUNTIME_PATH="$PROJECT_DIR/$RUNTIME_PATH" ;;
esac
if [ ! -x "$RUNTIME_PATH/prometeu" ]; then
printf '%s\n' "Runtime not found: $RUNTIME_PATH/prometeu" "Select it in Studio or set PROMETEU_RUNTIME to its installation directory." >&2
exit 1
fi
exec "$RUNTIME_PATH/prometeu" run "$PROJECT_DIR/build"
+17 -9
View File
@@ -20,6 +20,15 @@ fn abs_i(v: int) -> int
return v;
}
// The effect's palette arithmetic is RGB565. Current Color values are RGBA8888.
fn rgb565(value: int) -> Color
{
let r: long = ((value / 2048) % 32) as long;
let g: long = ((value / 32) % 64) as long;
let b: long = (value % 32) as long;
return Color.rgb(r * 255 / 31, g * 255 / 63, b * 255 / 31);
}
[Frame]
fn frame() -> void
{
@@ -28,7 +37,7 @@ fn frame() -> void
let cy : int = SCREEN_H / 2;
let phase : int = ticks / 2;
Gfx.clear(new Color(33));
Gfx.clear(rgb565(33));
for y: int from 0 until SCREEN_H step CELL {
let dy : int = y - cy;
@@ -84,7 +93,7 @@ fn frame() -> void
};
let color_raw : int = r * 2048 + g * 32 + b;
Gfx.fill_rect(x, y, CELL, CELL, new Color(color_raw));
Gfx.fill_rect(x, y, CELL, CELL, rgb565(color_raw));
}
}
@@ -123,13 +132,12 @@ fn frame() -> void
let star_c4 : int = 40159 + twinkle4 * 1696;
let star_c5 : int = 52831 + twinkle5 * 992;
Gfx.fill_rect(star_a, star_y0, star_s0, star_s0, new Color(star_c0));
Gfx.fill_rect(star_b, star_y1, star_s1, star_s1, new Color(star_c1));
Gfx.fill_rect(star_c, star_y2, star_s2, star_s2, new Color(star_c2));
Gfx.fill_rect(star_d, star_y3, star_s3, star_s3, new Color(star_c3));
Gfx.fill_rect(star_e, star_y4, star_s4, star_s4, new Color(star_c4));
Gfx.fill_rect(star_f, star_y5, star_s5, star_s5, new Color(star_c5));
Gfx.fill_rect(star_a, star_y0, star_s0, star_s0, rgb565(star_c0));
Gfx.fill_rect(star_b, star_y1, star_s1, star_s1, rgb565(star_c1));
Gfx.fill_rect(star_c, star_y2, star_s2, star_s2, rgb565(star_c2));
Gfx.fill_rect(star_d, star_y3, star_s3, star_s3, rgb565(star_c3));
Gfx.fill_rect(star_e, star_y4, star_s4, star_s4, rgb565(star_c4));
Gfx.fill_rect(star_f, star_y5, star_s5, star_s5, rgb565(star_c5));
//Gfx.clear(new Color(33));
}
// Estimated frame cost: ~920 fills + ~2760 fractal-iteration steps + 6 twinkling parallax stars/frame at CELL=8.