aboutsummaryrefslogtreecommitdiffstats
path: root/src/render.h
diff options
context:
space:
mode:
authorgbc dev <gbc@localhost>2026-07-17 00:27:18 +0200
committergbc dev <gbc@localhost>2026-07-17 00:27:18 +0200
commit6c0eaf8469a3f4876cb067e11824a030bf37bcac (patch)
tree731f75c98d3da0ea420817f8116895d994924039 /src/render.h
parentgb: boot ROM (BIOS) support (diff)
downloadsl0pboy-6c0eaf8469a3f4876cb067e11824a030bf37bcac.tar.gz
sl0pboy-6c0eaf8469a3f4876cb067e11824a030bf37bcac.tar.xz
sl0pboy-6c0eaf8469a3f4876cb067e11824a030bf37bcac.zip
render: Game Boy chrome, LCD palette recolor, and frame capture
- --chrome: draw a DMG-style 'sl0pboy' shell around the LCD in sixel mode, with a bitmap-font silk-screen (logo, labels), speaker grille, power LED, and buttons that light up while held. - LCD palette recolor (render_set_palette): remap the LCD to a 4-shade palette by luminance for the classic monochrome look ('dmg'/'green' pea green, 'pocket'/'gray'); applies to every render path. - Refactor the sixel encoder into generic build_palette_buf/encode_sixel_buf operating on any RGB888 buffer, shared by the bare LCD and the chrome canvas. - render_capture_size/frame: produce the exact displayed frame (recolor + chrome) as an RGB buffer, for screenshots and video recording.
Diffstat (limited to 'src/render.h')
-rw-r--r--src/render.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/render.h b/src/render.h
index 03d6c7c..1be1290 100644
--- a/src/render.h
+++ b/src/render.h
@@ -11,6 +11,22 @@ void render_set_hud(int frameskip, bool turbo); // update HUD readout
// Switch terminal output to sixel graphics (scale = integer pixel zoom, >=1).
// Pass on=false to use the default Unicode half-block renderer.
void render_set_sixel(bool on, int scale);
+// Draw a Game Boy body/frame around the LCD (sixel output only); buttons on the
+// drawn shell light up while pressed. No effect unless sixel mode is enabled.
+void render_set_chrome(bool on);
+// Recolor the LCD output to a 4-shade palette by luminance, for the classic
+// monochrome-LCD look. Names: "dmg"/"green" (DMG-01 pea green), "pocket"/"gray"
+// (grayscale). NULL or unknown name = passthrough (true colors). Applies to
+// every render path (half-block, sixel, chrome).
+void render_set_palette(const char *name);
+
+// Frame capture for screenshots / video recording: produces the same pixels the
+// user sees, applying the LCD recolor palette and the Game Boy chrome when they
+// are enabled. render_capture_size reports the resulting dimensions (they only
+// change when chrome is toggled); render_capture_frame returns a pointer to an
+// internal contiguous RGB888 buffer (w*h*3 bytes, caller must not free).
+void render_capture_size(int *w, int *h);
+const u8 *render_capture_frame(GB *gb, int *w, int *h);
// Poll keyboard + control FIFO, update gb->buttons. False if quit requested.
bool input_poll(GB *gb);