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:
@@ -14,3 +14,6 @@ Desktop.ini
|
||||
# Linux / Unix desktop metadata
|
||||
.directory
|
||||
*~
|
||||
/.codex/config.toml
|
||||
/.studio/mcp/
|
||||
/assets/.prometeu/cache.json
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
# Scene and touch demo
|
||||
|
||||
Open this folder in Studio, build with Shipper and use Debug Play. The project
|
||||
uses the current Pad/Button and Touch input APIs and the existing Composer API.
|
||||
Touch advances the Link frames; releasing resets them. The camera pans through
|
||||
the scene. A/B/X demonstrate the log levels.
|
||||
|
||||
Packer preloads Zelda3 into glyph slot 0, tileset into glyph slot 1 and tiled2
|
||||
into scene slot 0. The scene is bound from Frame, after preloads complete.
|
||||
The old missing `ui/atlas2` registration and empty sound bank are retained with
|
||||
`included_in_build: false`; they are not required by this demo. Their identities
|
||||
are preserved for future repair/removal through the Assets workspace.
|
||||
|
||||
`./run.sh` launches the current `build/` directory after a successful Studio build.
|
||||
It reads the selected runtime from `.studio/setup.json`; `PROMETEU_RUNTIME` can
|
||||
supply an explicit installation override. If no runtime is configured, the existing
|
||||
local `runtime` symlink is used. Python 3 is required by this convenience launcher.
|
||||
The tracked historical `cartridge/` binaries are not rebuilt or used by the launcher.
|
||||
@@ -5,12 +5,12 @@
|
||||
"asset_id" : 3,
|
||||
"asset_uuid" : "21953cb8-4101-4790-9e5e-d95f5fbc9b5a",
|
||||
"root" : "ui/atlas2",
|
||||
"included_in_build" : true
|
||||
"included_in_build" : false
|
||||
}, {
|
||||
"asset_id" : 8,
|
||||
"asset_uuid" : "9a7386e7-6f0e-4e4c-9919-0de71e0b7031",
|
||||
"root" : "ui/sound",
|
||||
"included_in_build" : true
|
||||
"included_in_build" : false
|
||||
}, {
|
||||
"asset_id" : 15,
|
||||
"asset_uuid" : "87396aab-337e-479e-b1f4-ec296678389e",
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
{
|
||||
"name": "main test project",
|
||||
"version": "1.0.0",
|
||||
"language": "pbs",
|
||||
"stdlib": "1",
|
||||
"target": "Game",
|
||||
"dependencies": [
|
||||
]
|
||||
}
|
||||
"name" : "main test project",
|
||||
"version" : "1.0.0",
|
||||
"language" : "pbs",
|
||||
"stdlib" : "1",
|
||||
"target" : "Game",
|
||||
"dependencies" : [ ],
|
||||
"app_id" : 377753220
|
||||
}
|
||||
@@ -1,5 +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
|
||||
|
||||
./runtime/prometeu run build
|
||||
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"
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import { Log } from @sdk:log;
|
||||
import { Pad, Button, Touch } from @sdk:input;
|
||||
import { Composer } from @sdk:composer;
|
||||
import { Gfx } from @sdk:gfx;
|
||||
import { Assets } from @sdk:asset;
|
||||
|
||||
declare global loading_handle: int = -1;
|
||||
declare global loading_status: int = -1;
|
||||
// Preloaded by Packer: Zelda3 -> glyph slot 0, tileset -> glyph slot 1,
|
||||
// tiled2 -> scene slot 0. No separate atlas load is needed.
|
||||
declare global scene_bound: bool = false;
|
||||
declare global frame_counter: int = 0;
|
||||
declare global tile_id: int = 0;
|
||||
declare global camera_x: int = 0;
|
||||
@@ -13,49 +12,28 @@ declare global camera_mult: int = 1;
|
||||
declare const MAX_FRAMES: int = 4;
|
||||
declare const CAMERA_SPEED: int = 1;
|
||||
|
||||
declare struct Bla (a: int) {}
|
||||
|
||||
[Init]
|
||||
fn init() -> void
|
||||
{
|
||||
loading_handle= -1;
|
||||
loading_status = -1;
|
||||
scene_bound = false;
|
||||
frame_counter = 0;
|
||||
tile_id = 0;
|
||||
camera_x = 0;
|
||||
camera_mult = 1;
|
||||
Composer.bind_scene(0);
|
||||
let bla: Bla = new Bla(1);
|
||||
}
|
||||
|
||||
[Frame]
|
||||
fn frame() -> void
|
||||
{
|
||||
if (loading_handle == -1) {
|
||||
let t : (status: int, loading_handle: int) = Assets.load(assets.ui.atlas2, 3);
|
||||
if (t.status != 0) {
|
||||
Log.failure("load failed");
|
||||
} else {
|
||||
loading_handle = t.loading_handle;
|
||||
Log.info("state: loading");
|
||||
}
|
||||
} else {
|
||||
let s : int = Assets.status(loading_handle);
|
||||
if (s == 2) {
|
||||
let commit_status : int = Assets.commit(loading_handle);
|
||||
if (commit_status != 0) {
|
||||
Log.failure("commit failed");
|
||||
}
|
||||
} else if (s == 3) {
|
||||
let sprite_status : int = Composer.emit_sprite(0, 0, 150, 150, 1, 3, false, false, 1);
|
||||
if (sprite_status != 0) {
|
||||
Log.failure("emit_sprite failed");
|
||||
}
|
||||
} else {
|
||||
Log.info("state: waiting");
|
||||
}
|
||||
}
|
||||
|
||||
// Composer operations run during Frame, after preloads have completed.
|
||||
if (!scene_bound) {
|
||||
let status: int = Composer.bind_scene(0);
|
||||
if (status != 0) {
|
||||
Log.failure("Unable to bind the preloaded scene");
|
||||
return;
|
||||
}
|
||||
scene_bound = true;
|
||||
}
|
||||
|
||||
if (Touch.released())
|
||||
{
|
||||
@@ -82,8 +60,6 @@ fn frame() -> void
|
||||
{
|
||||
camera_mult = -1 * camera_mult;
|
||||
}
|
||||
Log.info("camera_x:" + camera_x);
|
||||
|
||||
Composer.set_camera(camera_x, 0);
|
||||
Composer.emit_sprite(tile_id, 0, (Touch.x() as int) - 16, (Touch.y() as int) + 8, 2, 0, true, false, 0);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user