feat(box3): touch gamebook (tap to choose) #43
Reference in New Issue
Block a user
Delete Branch "feat/box3-touch-gamebook"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Touchscreen CYOA on the BOX-3: reads the same SD JSON pack, shows title+text+tappable choice buttons (LVGL). Hardware-validated: boots into a 6-story touch library.
Context: The Freenove gamebook is screen+buttons, the PLIP is audio+dial. The ESP32-S3-BOX-3 has a 320x240 touchscreen, so its natural format is a tap-to-choose "livre dont tu es le heros": read the passage on screen, tap a choice button to navigate. Approach: A new gamebook module reuses the same SD pack as the master (the JSON passages already carry screen/text/choices[label,goto]) and builds the UI on the already-running LVGL stack: a scrollable column with the title, the wrapped passage text, and one tappable button per choice. Changes: - New gamebook.c/.h: mounts the SD (bsp_sdcard_mount), reads /sdcard/gamebook/{library.json, <id>.json}, shows a story list, then per passage renders title + text + choice buttons; tapping a choice goes to its target, an ending offers "back to menu". cJSON runs on PSRAM hooks (the expanded books are ~80 KB JSON); LVGL calls are wrapped in bsp_display_lock at init (button callbacks already run in the LVGL task). - main.c: call gamebook_init() after the scenario server is up; it takes over the screen when a pack is on the SD, else no-op (the phone UI stays). - CMakeLists: build gamebook.c. Impact: With a JSON pack on its SD, the BOX-3 is a touch gamebook: tap a story, tap your choices. Text-only (no audio needed). Hardware-validated: boots into a 6-story touch library.