winzik/tauri/include/jumphp_tauri.h
David Nurdin 40fe26d4f8 Hybrid games in one window: the SDL game drawn inside its Tauri window (app.embed)
- game.yaml ui: hybrid + app: {embed: true}: SDL draws into memory (no SDL window, video driver dummy), each picture
  (a BMP) goes to the runtime through jt_frame(); JumPHP's page engine/web/tauri/game.html (served as
  /__jumphp/game.html) draws the newest one on a canvas, sharp and letterboxed, and sends keyboard, mouse and focus
  back into the engine's InputManager (JumPHP\Tauri\EmbeddedGame); F11 makes the Tauri window fullscreen
- runtime: jt_frame(), the jumphpframe:// scheme (204 while no newer picture), engine pages under /__jumphp/
- Engine emits 'rendered' after each frame and 'fullscreen-request' without an SDL window; Sdl::isEmbedded();
  NativeRuntime::picture()
- stage-game.sh: apps and hybrid games carry engine/web/tauri (games' packages unchanged)
- tried for real with Pong on Xvfb: the menu in the Tauri window, Enter from the page started a game

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01JkYTqpYNZKwTnRZHQRD5HP
2026-11-01 08:38:55 +01:00

18 lines
989 B
C

/* JumPHP's Tauri runtime (libjumphp_tauri): what PHP loads with FFI (engine/src/Tauri/TauriRuntime.php).
* All calls on the process' main thread. See tauri/src/lib.rs and docs/tauri.md. */
#ifndef JUMPHP_TAURI_H
#define JUMPHP_TAURI_H
#include <stddef.h>
/* Runs the app (native event loop on this thread) until PHP sends {"cmd":"app.exit"}; returns the exit code,
* negative when it could not start. frame() is called at every frame: PHP reads jt_poll() and calls jt_send(). */
int jt_run(const char *config_json, void (*frame)(void));
/* The events since the last call: a JSON array, valid until the next call. */
const char *jt_poll(void);
/* One command, a JSON object {"cmd": "window.set_title", ...}: run after the current frame. */
void jt_send(const char *command_json);
/* The embedded game's newest picture (ui: hybrid, app.embed): a BMP, served as jumphpframe://localhost/frame. */
void jt_frame(const unsigned char *data, size_t len);
const char *jt_version(void);
#endif