5519ed2f72
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.
18 lines
423 B
CMake
18 lines
423 B
CMake
idf_component_register(
|
|
SRCS "main.c" "voice_ws_client.c" "scenario_server.c" "plip_virtual.c" "plip_ui.c" "stimulus.c" "cmd_exec.c" "gamebook.c"
|
|
INCLUDE_DIRS "."
|
|
PRIV_REQUIRES
|
|
driver
|
|
esp_event
|
|
esp_http_client
|
|
esp_http_server
|
|
esp_netif
|
|
esp_wifi
|
|
json
|
|
nvs_flash
|
|
spiffs
|
|
scenario_mesh
|
|
espressif__esp-box-3
|
|
lvgl__lvgl
|
|
)
|