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:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user