code wiki / _hdl_build / nx_game_cards.nx
nx_game_cards.nx source
↩ module page · 32 lines · 3491 B
1// nx_game_cards.nx -- sovereign CARD-GALLERY emitter for nishifamily.com: generates a games page where
2// each emitted game is a CARD (title + blurb + Play link to its self-contained sovereign-wasm .html). The
3// page is site presentation (HTML/CSS only, no game logic); the GAMES are pure-Nishi wasm (logic+render in
4// our wasm, browser blits only). Data-driven: add a card() call per game as emitters land -> the gallery
5// grows autonomously. usage: nx_game_cards <out.html>. license_tier: ORIGINAL expect_exit: 0
6import "nx_syscalls.nx"
7
8func w(fd: i64, s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(fd, s, n); return 0 }
9
10// one card: title, href to the playable, blurb, accent hex color (e.g. "#5ad27a").
11func card(fd: i64, title: *u8, href: *u8, blurb: *u8, accent: *u8) -> i64 {
12 w(fd, "<a class='card' href='" as *u8); w(fd, href); w(fd, "'><div class='thumb' style='background:" as *u8); w(fd, accent)
13 w(fd, "'></div><div class='meta'><h3>" as *u8); w(fd, title); w(fd, "</h3><p>" as *u8); w(fd, blurb); w(fd, "</p></div></a>\n" as *u8)
14 return 0
15}
16
17func main(argc: i64, argv: *i64) -> i64 {
18 var out: *u8 = "knowledge/sovereign-games.html" as *u8
19 if argc >= 2 { out = argv[1] as *u8 }
20 let fd: i64 = sys_openat_wr(out, 0x1a4)
21 if fd < 0 { w(2, "cards: open failed\n" as *u8); return 1 }
22 w(fd, "<!doctype html><html><head><meta charset='utf-8'><meta name='viewport' content='width=device-width,initial-scale=1'><title>Nishi Sovereign Games</title><style>body{margin:0;background:#0d1018;color:#e8ecf4;font-family:system-ui,sans-serif}header{padding:28px 20px;text-align:center;border-bottom:1px solid #1d2433}h1{margin:0 0 6px}header p{color:#8b95a7;margin:0;font-size:14px}.grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:16px;padding:20px;max-width:1000px;margin:0 auto}.card{display:block;background:#151b27;border:1px solid #232c3d;border-radius:10px;overflow:hidden;text-decoration:none;color:inherit;transition:transform .12s,border-color .12s}.card:hover{transform:translateY(-3px);border-color:#3a4760}.thumb{height:120px}.meta{padding:12px 14px}.meta h3{margin:0 0 4px;font-size:16px}.meta p{margin:0;color:#8b95a7;font-size:12px}footer{text-align:center;color:#5c667a;font-size:12px;padding:24px}</style></head><body>" as *u8)
23 w(fd, "<header><h1>Nishi Sovereign Games</h1><p>Built bits-up in the Nishi ecosystem: game logic + rendering compiled to our OWN WebAssembly. The browser only blits our framebuffer + forwards keys - no 3rd-party engine, no canvas drawing, no floats.</p></header><div class='grid'>\n" as *u8)
24 // --- cards (one per emitted game; grows as emitters land) ---
25 card(fd, "Nishi Arcade" as *u8, "arcade.html" as *u8, "collect-class - sovereign wasm - integer raster, no canvas-draw" as *u8, "linear-gradient(135deg,#1b5e3a,#5ad27a)" as *u8)
26 card(fd, "Nishi 2048" as *u8, "2048.html" as *u8, "sliding-tile puzzle - merge logic + sovereign-font numbers, no float" as *u8, "linear-gradient(135deg,#b8893a,#edc850)" as *u8)
27 card(fd, "Nishi Platformer" as *u8, "platformer.html" as *u8, "auto-runner - integer jump physics, no float - scaffolded from the universal builder catalog" as *u8, "linear-gradient(135deg,#1d3a5e,#5aa0d2)" as *u8)
28 w(fd, "</div><footer>Nishi ecosystem - hardware rung up - autonomously emitted - nishifamily.com</footer></body></html>\n" as *u8)
29 sys_close(fd)
30 w(1, "cards: wrote gallery\n" as *u8)
31 return 0
32}