From 6c0eaf8469a3f4876cb067e11824a030bf37bcac Mon Sep 17 00:00:00 2001 From: gbc dev Date: Fri, 17 Jul 2026 00:27:18 +0200 Subject: 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. --- src/render.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/render.h') 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); -- cgit v1.3.1-sl0p