WASM Backend: - src/backend/wasm.zig: Browser backend using extern JS functions - web/zcatgui.js: Canvas 2D rendering bridge (~200 LOC) - web/index.html: Demo page with event handling - examples/wasm_demo.zig: Widget showcase for browser - Output: 18KB WASM binary Android Backend: - src/backend/android.zig: ANativeActivity + ANativeWindow - examples/android_demo.zig: Touch-enabled demo - Touch-to-mouse event mapping - Logging via __android_log_print - Targets: ARM64 (device), x86_64 (emulator) iOS Backend: - src/backend/ios.zig: UIKit bridge via extern C functions - ios/ZcatguiBridge.h: Objective-C header - ios/ZcatguiBridge.m: UIKit implementation (~320 LOC) - CADisplayLink render loop - Touch event queue with @synchronized - Targets: ARM64 (device), ARM64 simulator Build System: - WASM: zig build wasm - Android: zig build android / android-x86 - iOS: zig build ios / ios-sim - Conditional compilation for platform detection Documentation: - docs/MOBILE_WEB_BACKENDS.md: Comprehensive guide (~400 lines) - Updated DEVELOPMENT_PLAN.md with FASE 10 - Updated CLAUDE.md with new commands Stats: 3 backends, ~1500 new LOC, cross-platform ready 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
117 lines
3.2 KiB
HTML
117 lines
3.2 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>zcatgui - WASM Demo</title>
|
|
<style>
|
|
* {
|
|
margin: 0;
|
|
padding: 0;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
body {
|
|
background: #1a1a2e;
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
justify-content: center;
|
|
min-height: 100vh;
|
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
color: #eee;
|
|
}
|
|
|
|
h1 {
|
|
margin-bottom: 1rem;
|
|
font-weight: 300;
|
|
color: #4cc9f0;
|
|
}
|
|
|
|
#app-container {
|
|
border: 2px solid #4361ee;
|
|
border-radius: 8px;
|
|
overflow: hidden;
|
|
box-shadow: 0 10px 40px rgba(67, 97, 238, 0.3);
|
|
}
|
|
|
|
#app-canvas {
|
|
display: block;
|
|
background: #16213e;
|
|
}
|
|
|
|
#loading {
|
|
position: absolute;
|
|
color: #888;
|
|
}
|
|
|
|
.info {
|
|
margin-top: 1rem;
|
|
font-size: 0.9rem;
|
|
color: #888;
|
|
}
|
|
|
|
.info kbd {
|
|
background: #333;
|
|
padding: 2px 6px;
|
|
border-radius: 3px;
|
|
font-family: monospace;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<h1>zcatgui WASM Demo</h1>
|
|
|
|
<div id="app-container">
|
|
<canvas id="app-canvas" width="800" height="600"></canvas>
|
|
<div id="loading">Loading WASM...</div>
|
|
</div>
|
|
|
|
<p class="info">
|
|
Click canvas to focus. Use <kbd>Tab</kbd> to navigate, <kbd>Enter</kbd> to activate.
|
|
</p>
|
|
|
|
<script src="zcatgui.js"></script>
|
|
<script>
|
|
(async function() {
|
|
const loading = document.getElementById('loading');
|
|
|
|
try {
|
|
// Initialize runtime
|
|
const runtime = new ZcatguiRuntime('app-canvas');
|
|
|
|
// Load WASM module
|
|
const wasm = await runtime.load('zcatgui-demo.wasm');
|
|
|
|
// Hide loading indicator
|
|
loading.style.display = 'none';
|
|
|
|
// Call WASM main/init function
|
|
if (wasm.exports._start) {
|
|
wasm.exports._start();
|
|
} else if (wasm.exports.main) {
|
|
wasm.exports.main();
|
|
} else if (wasm.exports.wasm_main) {
|
|
wasm.exports.wasm_main();
|
|
}
|
|
|
|
console.log('zcatgui WASM loaded successfully');
|
|
|
|
// If there's an update/frame function, call it in a loop
|
|
if (wasm.exports.wasm_frame) {
|
|
function frame() {
|
|
wasm.exports.wasm_frame();
|
|
requestAnimationFrame(frame);
|
|
}
|
|
requestAnimationFrame(frame);
|
|
}
|
|
|
|
} catch (error) {
|
|
loading.textContent = `Error: ${error.message}`;
|
|
loading.style.color = '#f72585';
|
|
console.error('Failed to load zcatgui WASM:', error);
|
|
}
|
|
})();
|
|
</script>
|
|
</body>
|
|
</html>
|