whoa/src/client/gui/web/OsGui.cpp
Alex Tiernan-Berry d4d359acea feat(web): add Emscripten/WASM build infrastructure
Adds the platform layer for building whoa as a WebAssembly application:

Working:
- CMake configuration for WHOA_SYSTEM_WEB with pthreads and ASYNCIFY
- Web entry point and HTML shell template
- Event loop adapted for emscripten_set_main_loop callback model
- WebSocket-based networking (WowConnection over JS WebSocket API)
- Sound system stubs (audio not yet implemented)
- FetchFS for async file loading from web server
- Freetype fixes for WASM compatibility (type mismatches)
- Input handling for web canvas

Missing (in separate commits):
- WebGPU graphics backend (CGxDeviceWebGPU)
- WGSL shaders
- API selection in Device.cpp
2026-02-06 02:21:20 +00:00

37 lines
912 B
C++

#include "client/gui/OsGui.hpp"
#include <emscripten/html5.h>
void* OsGuiGetWindow(int32_t type) {
// No native window handle on web
return nullptr;
}
bool OsGuiIsModifierKeyDown(int32_t key) {
EmscriptenKeyboardEvent state;
// Get current keyboard state from Emscripten
// Note: This only works if a key event was recently processed
switch (key) {
case 0: // KEY_LSHIFT
case 1: // KEY_RSHIFT
return false; // Would need to track state manually
case 2: // KEY_LCONTROL
case 3: // KEY_RCONTROL
return false;
case 4: // KEY_LALT
case 5: // KEY_RALT
return false;
default:
return false;
}
}
int32_t OsGuiProcessMessage(void* message) {
// Not used on web - events come through Emscripten callbacks
return 0;
}
void OsGuiSetGxWindow(void* window) {
// No-op on web
}