feat(studio): adopt the 640x360 native graphics contract
Test / Tests and coverage
Intrepid/Prometeu/Studio/pipeline/head This commit looks good

Update the new JavaFX UI's frame sizing and pointer cancellation while
preserving zoom and scrolling. Adapt Pong, Fragments and the camera scene
to the native viewport, and update exact visual references and IPC fixtures.

Build and run all three examples against qualified installed runtimes.
Observe an actual Pong paddle collision and verify native frame captures.
Retain the qualification evidence generated for the tested native bundles.

Validated by the complete verify and desktop integration gates, including
the existing 30-second Play measurement and 20 Play/Stop cycles.

Work: WRK-0016 / DEC-0001 / PLN-0001
Commit and push explicitly authorized by the user after completion.
This commit is contained in:
2026-11-20 10:34:45 +00:00
parent 71b62a8e0a
commit 666a36d133
20 changed files with 13649 additions and 88 deletions
+7 -2
View File
@@ -1,8 +1,13 @@
# 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.
build with Shipper and use Debug Play. The effect covers the native 640×360 field.
Its procedural cells are 16 pixels: 920 cells retain the original sample's
computational workload, while 8-pixel cells over the larger field exhausted the
existing VM frame budget. This content adjustment preserves the effect's update
rhythm without changing machine limits. The final cell row is clipped to 8 pixels;
star sizes and motion remain unchanged. These cells are drawing primitives, not a
restriction on the machine's 8/16/32-pixel glyph tiles.
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
+6 -4
View File
@@ -2,9 +2,11 @@ import { Color } from @core:color;
import { Gfx } from @sdk:gfx;
declare global ticks: int = 0;
declare const SCREEN_W: int = 320;
declare const SCREEN_H: int = 180;
declare const CELL: int = 8;
declare const SCREEN_W: int = 640;
declare const SCREEN_H: int = 360;
// Keep the procedural workload within the existing VM frame budget at 640x360.
// The last row is clipped to the final 8 pixels of the framebuffer.
declare const CELL: int = 16;
[Init]
fn init() -> void
@@ -140,4 +142,4 @@ fn frame() -> void
Gfx.fill_rect(star_f, star_y5, star_s5, star_s5, rgb565(star_c5));
}
// Estimated frame cost: ~920 fills + ~2760 fractal-iteration steps + 6 twinkling parallax stars/frame at CELL=8.
// 920 fills + 2760 fractal-iteration steps + 6 twinkling stars/frame at CELL=16.
+3 -1
View File
@@ -3,7 +3,9 @@
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.
the scene with bounds for the native 640×360 viewport. The three active 8-pixel
layers extend to 45 rows by continuing their existing bottom terrain; the
base layer is 720 pixels wide, so the camera travels from x=0 to x=80. 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.
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+40 -7
View File
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.10" tiledversion="1.12.1" orientation="orthogonal" renderorder="right-down" width="120" height="34" tilewidth="8" tileheight="8" infinite="0" nextlayerid="4" nextobjectid="1">
<map version="1.10" tiledversion="1.12.1" orientation="orthogonal" renderorder="right-down" width="120" height="45" tilewidth="8" tileheight="8" infinite="0" nextlayerid="4" nextobjectid="1">
<tileset firstgid="1" source="../tileset/tileset.tsx"/>
<layer id="1" name="Layer 1" width="90" height="34" visible="0" locked="1">
<layer id="1" name="Layer 1" width="90" height="45" visible="0" locked="1">
<data encoding="csv">
8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
8,8,8,8,8,8,8,8,1,1,1,1,1,1,8,8,8,8,1,1,1,1,1,1,1,1,1,1,1,1,8,8,8,8,8,8,1,8,8,8,8,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,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8
</data>
</data>
</layer>
<layer id="2" name="Layer 2" width="90" height="34" visible="0" locked="1">
<layer id="2" name="Layer 2" width="90" height="45" visible="0" locked="1">
<data encoding="csv">
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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camera_x: int = 0;
declare global camera_mult: int = 1;
declare const MAX_FRAMES: int = 4;
declare const CAMERA_SPEED: int = 1;
// The base scene is 90 tiles of 8 pixels; viewport is the fixed native 640.
declare const CAMERA_MAX_X: int = 90 * 8 - 640;
[Init]
fn init() -> void
@@ -56,7 +58,7 @@ fn frame() -> void
}
camera_x = camera_x + (camera_mult * CAMERA_SPEED);
if (camera_x >= 240 || camera_x <= 0)
if (camera_x >= CAMERA_MAX_X || camera_x <= 0)
{
camera_mult = -1 * camera_mult;
}
+4 -2
View File
@@ -24,8 +24,10 @@ The CPU moves more slowly and starts tracking when the ball enters its half.
## Source
`src/main.pbs` separates input, state transitions, simulation and rendering.
The game uses a fixed 480×270 field, quarter-pixel integer coordinates and four
small simulation substeps per logical frame. Ball speed is capped so it cannot
The game uses a fixed 640×360 field, quarter-pixel integer coordinates and four
small simulation substeps per logical frame. Positions and speeds follow the larger native arena while paddle/ball sizes and
match rules remain unchanged. At maximum speed each substep is 2.5 pixels, below
the 8-pixel paddle thickness. Ball speed is capped so it cannot
jump through a paddle. It uses the existing `@sdk:input`, `@sdk:gfx` and
`@core:color` modules; no external art, audio, save system or engine changes are
required for this first version. Every new match clears scores and positions.
+49 -48
View File
@@ -2,10 +2,11 @@ import { Color } from @core:color;
import { Gfx } from @sdk:gfx;
import { Pad, Button } from @sdk:input;
// One logical frame is one game tick. Ball coordinates use quarter pixels.
// Native 640x360 arena. One logical frame is one game tick; ball uses quarter pixels.
// Speeds track the larger playfield while paddle/ball art and mechanics stay unchanged.
declare const SCALE: int = 4;
declare const FIELD_TOP: int = 72;
declare const FIELD_BOTTOM: int = 238;
declare const FIELD_BOTTOM: int = 328;
declare const PADDLE_H: int = 36;
declare const BALL_SIZE: int = 6;
declare const MENU: int = 0;
@@ -16,14 +17,14 @@ declare const FINISHED: int = 4;
declare global phase: int = 0;
declare global resume_phase: int = 0;
declare global player_y: int = 137;
declare global cpu_y: int = 137;
declare global player_y: int = 182;
declare global cpu_y: int = 182;
declare global player_score: int = 0;
declare global cpu_score: int = 0;
declare global ball_x: int = 948;
declare global ball_y: int = 608;
declare global ball_vx: int = 4;
declare global ball_vy: int = 2;
declare global ball_x: int = 1268;
declare global ball_y: int = 788;
declare global ball_vx: int = 6;
declare global ball_vy: int = 3;
declare global serve_ticks: int = 60;
declare global hit_flash: int = 0;
@@ -39,12 +40,12 @@ fn abs_i(value: int) -> int {
}
fn prepare_serve(direction: int) -> void {
player_y = 137;
cpu_y = 137;
ball_x = 237 * SCALE;
ball_y = 152 * SCALE;
ball_vx = direction * 4;
ball_vy = if (player_score + cpu_score) % 2 == 0 { 2 } else { -3 };
player_y = 182;
cpu_y = 182;
ball_x = 317 * SCALE;
ball_y = 197 * SCALE;
ball_vx = direction * 6;
ball_vy = if (player_score + cpu_score) % 2 == 0 { 3 } else { -4 };
serve_ticks = 60;
hit_flash = 0;
phase = SERVING;
@@ -64,27 +65,27 @@ fn init() -> void {
}
fn move_player(up: bool, down: bool) -> void {
if up && !down { player_y = player_y - 4; }
if down && !up { player_y = player_y + 4; }
if up && !down { player_y = player_y - 6; }
if down && !up { player_y = player_y + 6; }
player_y = clamp(player_y, FIELD_TOP, FIELD_BOTTOM - PADDLE_H);
}
fn move_cpu() -> void {
// The CPU reacts only in its half and is slower than the human paddle.
let target: int = 137;
if ball_vx > 0 && ball_x > 240 * SCALE {
let target: int = 182;
if ball_vx > 0 && ball_x > 320 * SCALE {
target = ball_y / SCALE + BALL_SIZE / 2 - PADDLE_H / 2;
}
if target > cpu_y + 2 { cpu_y = cpu_y + 2; }
if target < cpu_y - 2 { cpu_y = cpu_y - 2; }
if target > cpu_y + 3 { cpu_y = cpu_y + 3; }
if target < cpu_y - 3 { cpu_y = cpu_y - 3; }
cpu_y = clamp(cpu_y, FIELD_TOP, FIELD_BOTTOM - PADDLE_H);
}
fn bounce(paddle_y: int, direction: int) -> void {
let speed: int = clamp(abs_i(ball_vx) + 1, 4, 7);
let speed: int = clamp(abs_i(ball_vx) + 1, 6, 10);
ball_vx = direction * speed;
let offset: int = ball_y / SCALE + BALL_SIZE / 2 - paddle_y - PADDLE_H / 2;
ball_vy = clamp(offset / 5, -4, 4);
ball_vy = clamp(offset * 3 / 10, -6, 6);
if ball_vy == 0 {
ball_vy = if (player_score + cpu_score) % 2 == 0 { -1 } else { 1 };
}
@@ -103,7 +104,7 @@ fn point(player_won: bool) -> void {
}
fn move_ball() -> void {
// At max speed each substep travels 1.75 px, below the paddle thickness.
// At max speed each substep travels 2.5 px, below the paddle thickness.
for substep: int from 0 until 4 {
ball_x = ball_x + ball_vx;
ball_y = ball_y + ball_vy;
@@ -125,9 +126,9 @@ fn move_ball() -> void {
bounce(player_y, 1);
}
}
if ball_vx > 0 && x + BALL_SIZE >= 430 && x <= 438 {
if ball_vx > 0 && x + BALL_SIZE >= 590 && x <= 598 {
if y + BALL_SIZE > cpu_y && y < cpu_y + PADDLE_H {
ball_x = (430 - BALL_SIZE) * SCALE;
ball_x = (590 - BALL_SIZE) * SCALE;
bounce(cpu_y, -1);
}
}
@@ -136,7 +137,7 @@ fn move_ball() -> void {
point(false);
return;
}
if ball_x > 460 * SCALE {
if ball_x > 620 * SCALE {
point(true);
return;
}
@@ -189,11 +190,11 @@ fn draw_digit(value: int, x: int, y: int, color: Color) -> void {
}
fn draw_overlay(title: str, line_one: str, line_two: str) -> void {
Gfx.draw_square(112, 111, 256, 90, Color.rgb(57, 81, 106), Color.rgb(12, 22, 39));
Gfx.fill_rect(112, 111, 3, 90, Color.rgb(77, 237, 205));
Gfx.draw_text(136, 125, title, Color.rgb(236, 244, 250));
Gfx.draw_text(136, 150, line_one, Color.rgb(155, 176, 198));
Gfx.draw_text(136, 174, line_two, Color.rgb(77, 237, 205));
Gfx.draw_square(192, 156, 256, 90, Color.rgb(57, 81, 106), Color.rgb(12, 22, 39));
Gfx.fill_rect(192, 156, 3, 90, Color.rgb(77, 237, 205));
Gfx.draw_text(216, 170, title, Color.rgb(236, 244, 250));
Gfx.draw_text(216, 195, line_one, Color.rgb(155, 176, 198));
Gfx.draw_text(216, 219, line_two, Color.rgb(77, 237, 205));
}
fn draw() -> void {
@@ -204,22 +205,22 @@ fn draw() -> void {
Gfx.clear(Color.rgb(7, 14, 26));
Gfx.draw_text(24, 17, "PONG", white);
Gfx.draw_text(24, 32, "PROMETEU", muted);
Gfx.draw_text(370, 17, "FIRST TO 5", muted);
Gfx.draw_text(138, 34, "YOU", mint);
Gfx.draw_text(313, 34, "CPU", coral);
draw_digit(player_score, 190, 19, mint);
draw_digit(cpu_score, 272, 19, coral);
Gfx.fill_rect(237, 28, 3, 3, muted);
Gfx.fill_rect(237, 39, 3, 3, muted);
Gfx.draw_text(530, 17, "FIRST TO 5", muted);
Gfx.draw_text(218, 34, "YOU", mint);
Gfx.draw_text(393, 34, "CPU", coral);
draw_digit(player_score, 270, 19, mint);
draw_digit(cpu_score, 352, 19, coral);
Gfx.fill_rect(317, 28, 3, 3, muted);
Gfx.fill_rect(317, 39, 3, 3, muted);
Gfx.draw_square(20, 66, 440, 178, Color.rgb(37, 57, 79), Color.rgb(13, 23, 40));
for y: int from 76 until 238 step 13 {
Gfx.fill_rect(239, y, 2, 6, Color.rgb(43, 61, 82));
Gfx.draw_square(20, 66, 600, 268, Color.rgb(37, 57, 79), Color.rgb(13, 23, 40));
for y: int from 76 until 328 step 13 {
Gfx.fill_rect(319, y, 2, 6, Color.rgb(43, 61, 82));
}
Gfx.fill_rect(40, player_y + 3, 10, PADDLE_H, Color.rgb(20, 58, 60));
Gfx.fill_rect(430, cpu_y + 3, 10, PADDLE_H, Color.rgb(65, 37, 46));
Gfx.fill_rect(590, cpu_y + 3, 10, PADDLE_H, Color.rgb(65, 37, 46));
Gfx.fill_rect(42, player_y, 8, PADDLE_H, mint);
Gfx.fill_rect(430, cpu_y, 8, PADDLE_H, coral);
Gfx.fill_rect(590, cpu_y, 8, PADDLE_H, coral);
if phase == PLAYING || phase == SERVING || phase == PAUSED {
let x: int = ball_x / SCALE;
@@ -232,15 +233,15 @@ fn draw() -> void {
if hit_flash > 0 { Gfx.draw_square(x - 2, y - 2, 10, 10, mint, white); }
}
Gfx.draw_text(24, 254, "UP / DOWN MOVE", muted);
Gfx.draw_text(344, 254, "START PAUSE", muted);
Gfx.draw_text(24, 344, "UP / DOWN MOVE", muted);
Gfx.draw_text(504, 344, "START PAUSE", muted);
if phase == MENU {
draw_overlay("LET'S PLAY PONG", "YOU VS CPU / FIRST TO 5", "A / START - PLAY");
} else if phase == SERVING {
let countdown = if serve_ticks > 40 { "3" } else if serve_ticks > 20 { "2" } else { "1" };
Gfx.draw_text(220, 111, "READY", mint);
Gfx.draw_text(236, 128, countdown, white);
Gfx.draw_text(190, 188, "A - SERVE NOW", muted);
Gfx.draw_text(300, 156, "READY", mint);
Gfx.draw_text(316, 173, countdown, white);
Gfx.draw_text(270, 233, "A - SERVE NOW", muted);
} else if phase == PAUSED {
draw_overlay("PAUSED", "A / START - RESUME", "B - MAIN MENU");
} else if phase == FINISHED {