Skip to content

feat(core): declare full-screen windows and generate the canvas contract - #123

Open
oglassdev wants to merge 2 commits into
mainfrom
feat/fullscreen-surface
Open

oglassdev wants to merge 2 commits into
mainfrom
feat/fullscreen-surface

Conversation

@oglassdev

Copy link
Copy Markdown
Contributor

Adds full-screen windows, a third surface beside windows and HUDs. Layout targets a fixed 480x270 canvas, which a core text shader (#117) maps onto the screen from glyph runs on a client-only text display. This PR declares and compiles full-screen windows and generates the canvas contract that #117 (shaders) and #118 (Minestom session) build on. It adds no shader, session, or input behaviour.

Authoring API

  • JSX: <Fullscreen name="menu" mode="unlocked" backdrop="#0b0e13">…</Fullscreen>. Raw: fullscreen({ name, mode?, backdrop?, theme?, children?, debug_name? }). List them with defineWindows({ fullscreens: [...] }).
  • mode: "unlocked" (default) or "horse" (FullscreenMode).
  • Interaction is allowed: regions become controls, with actions, default_action, and hover. Inventory elements (items, collections, sections, patterns, anvil), sprite slots, and region tooltip/item_model are rejected.

Canvas contract

Marker encoding. A marker is a 24-bit RGB value sent with text opacity 253:

Bits Field
23-20 signature 0xA
19-18 kind: 0 content, 1 cursor, 2 backdrop, 3 reserved
17-10 layer
9-0 index into WINDOW_FS_COLORS (0 = white)

Layers. Backdrop 0, static 1, runtime layers[i] → i + 2 (≤ 253), overlay 254, cursor 255.

GLSL (assets/minecraft/shaders/include/window_fullscreen.glsl, Part::Fullscreen):

  • Canvas and mapping: WINDOW_FS_CANVAS, WINDOW_FS_DEGREES_PER_PIXEL, WINDOW_FS_EDGE_ANGLES, WINDOW_FS_SNAP_EPSILON, WINDOW_FS_BLOCKS_PER_PIXEL
  • Markers: WINDOW_FS_MARKER_ALPHA, WINDOW_FS_MARKER_SIGNATURE, WINDOW_FS_KIND_{CONTENT,CURSOR,BACKDROP}, WINDOW_FS_{BACKDROP,OVERLAY,CURSOR}_LAYER
  • Cursor and HUD strip: WINDOW_FS_CURSOR_SIZE, WINDOW_FS_HUD_STRIP (96 half-width, 56 tall, GUI px)
  • Tables: WINDOW_FS_COLOR_COUNT, WINDOW_FS_COLORS[], WINDOW_FS_CONTROL_COUNT, WINDOW_FS_CONTROLS[] (by control index)
  • Functions: window_fs_payload, window_fs_is_marker, window_fs_kind, window_fs_layer, window_fs_color, window_fs_cursor_at

Kotlin / manifest. The manifest gains fullscreens and fullscreen_canvas. Generated code: WindowFullscreenEntries.all / .canvas, WindowFullscreenDefinitions, and WindowPackData.fullscreens / fullscreenCanvas.

  • FullscreenCanvasEntry: width, height, degreesPerPixel, edgeYaw, edgePitch, snapEpsilon, hitMargin, displayScale, markerAlpha, cursor (text, marker, width, height), backdrop, overlayMarker, hudHiddenWorldAge (-1_000_000_001), hudStripHeight, hudStripHalfWidth, hudMaxHealth
  • FullscreenEntry: surface (kind, mode, size), static, staticMarker, slots, controls (index, x, y, width, height, action, defaultAction, hover, source), switches, art, tints, layers, markers, backdropMarker, handles
  • FullscreenDefinition(manifest, name) exposes canvas and surface. The typed view is left to feat(runtime): add the full-screen session with fake-survival input and a hidden HUD #118.

Every run is net-zero from the canvas origin, so a glyph's canvas position is its position in the line. Packs without full-screen windows emit nothing new, and every existing golden hash is unchanged.

Known limits

  • A static composite wider than 256 px still fails, so a full-canvas frame does not work yet.
  • Markers break under text shadows, so runs must be sent without shadow.
  • Debug descriptors and previews ignore full-screen windows.

Checks

  • just test-rust -p window-core: pass (238 lib tests, including 4 new pipeline tests and 2 contract tests)
  • just lint: pass
  • just check-ts, just test-ts: pass
  • just golden: all 14 cases ok (new fullscreen case)
  • just gradle :runtime:compileKotlin: pass. The generated fullscreen golden Kotlin also compiles against :runtime, checked with a temporary copy that was then removed.

Closes #116
Part of #115

Add Fullscreen / fullscreen() authoring with an unlocked or horse mode,
lay full-screen windows out on a 480x270 canvas, compile them into
fullscreen/{name} glyphs with precomputed markers, and emit the canvas
contract as window_fullscreen.glsl and generated Kotlin entries.

Closes #116
Part of #115
…adowed text

Full-screen composites larger than a 256 px font atlas page are split into
glyph tiles with deterministic codepoints and concatenated as net-zero runs.
Full-screen textures move to font/fullscreen/{window,builtin}/ so they cannot
collide with window or HUD textures. Shadowed full-screen slots are a compile
error because shadows break marker detection.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(core): declare full-screen windows and generate the canvas contract

1 participant