- ui: hybrid: an SDL game that also drives Tauri (Application::run() hands over to JumPHP\Tauri\Hybrid): native
dialogs, tray icon, shortcuts and HTML windows beside its own; a plain game headless, in the browser, on phones and
without FFI. bin/jumphp run uses the Tauri image; export:standalone a micro with SDL + FFI (tools/hybrid-extensions.txt).
games/hello-hybrid: SDL balls + an HTML control panel.
- JumPHP\Native\Clipboard (Tauri, browser copy), App::tray() (JumPHP\Tauri\Tray), App::globalShortcut();
native.copy / native.paste for pages; a command PHP waits for that fails now fails its Task ('result' event)
- runtime: clipboard-manager, global-shortcut, tray-icon; panics of a command stay on the native side; idle time
after each frame so WebViews keep painting beside a busy game; JUMPHP_TAURI_TRACE=1
- .github/workflows/tauri.yml: the library for Linux, Windows, macOS (universal), hello-desktop run for real on
each, release tauri-<key> (tools/tauri-key.sh); bin/jumphp tauri:download, used before building
- app:export --windows; the standalone workflow takes an extension list (the apps' / hybrid games' micros)
- docs/tauri.md, docs/tauri.fr.md, AGENTS.md §16, README, TODO
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01JkYTqpYNZKwTnRZHQRD5HP
26 lines
1.4 KiB
JavaScript
26 lines
1.4 KiB
JavaScript
// The panel: every change goes to PHP (App\Desktop), which the game (BallsScene) reads at its next frame.
|
||
const $ = (id) => document.getElementById(id);
|
||
const colours = ['#ffcc33', '#ff5577', '#33ccff', '#66ee88', '#c58cff', '#ffffff'];
|
||
|
||
const show = (s) => {
|
||
$('balls').value = s.balls; $('ballsOut').textContent = s.balls;
|
||
$('speed').value = s.speed; $('speedOut').textContent = `${Number(s.speed).toFixed(1)}×`;
|
||
$('pause').textContent = s.paused ? 'Resume' : 'Pause';
|
||
document.querySelectorAll('.swatches button').forEach((b) => b.classList.toggle('on', b.dataset.c === s.colour));
|
||
};
|
||
const set = async (change) => show(await jumphp.invoke('set', change));
|
||
|
||
for (const c of colours) {
|
||
const b = document.createElement('button');
|
||
b.style.background = c; b.dataset.c = c; b.title = c;
|
||
b.addEventListener('click', () => set({colour: c}));
|
||
$('swatches').appendChild(b);
|
||
}
|
||
$('balls').addEventListener('input', (e) => set({balls: Number(e.target.value)}));
|
||
$('speed').addEventListener('input', (e) => set({speed: Number(e.target.value)}));
|
||
$('pause').addEventListener('click', () => set({paused: $('pause').textContent === 'Pause'}));
|
||
$('shot').addEventListener('click', () => jumphp.invoke('shot'));
|
||
|
||
jumphp.on('settings', show); // the game or the tray changed something
|
||
jumphp.on('stats', (s) => { $('sBalls').textContent = s.balls; $('sBounces').textContent = s.bounces; $('sFps').textContent = s.fps; });
|
||
jumphp.invoke('settings').then(show);
|