Drive the engine's mouse cursor from the VR aim ray on the game quad
build / build (push) Successful in 1m44s
build / build (push) Successful in 1m44s
The game quad's laser beam was purely visual - aiming at the game's own UI (inventory, menus, dialogs) had no way to interact with it. Add a real mouse pointer: absolute cursor position plus a single left click, mirroring a plain point-and-click mouse (no mouselook, no right-click, no drag). New xr_mouse.c/h bridges the aim-ray hit-test to the vendored engine's own public mouse API - mouse_put_xy() for position, a synthetic SDL_MOUSEBUTTONDOWN/UP (SDL_BUTTON_LEFT) via SDL_PushEvent for clicks, the same technique nativeSendPrintableChar() already uses for synthetic keyboard input. No engine patch needed. Deliberately bypasses SDLActivity.onNativeMouse()/SDL_MOUSEMOTION/SetMouseXY(), whose physical-window-size scaling is unreliable in this headless immersive build. xr_input_try_game_quad() now reports the hit u,v; a new g_game_touch_active[] tracks a held click on the game quad so it survives the ray straying onto the keyboard/menu before release, gating those overlays' claims the same way pending overlay touches already do.
This commit is contained in:
@@ -74,6 +74,13 @@ void xr_shutdown(void);
|
||||
// laser pointer always matches whatever's actually visible.
|
||||
void xr_get_game_quad_extent(float *distance_m, float *half_width_m, float *half_height_m);
|
||||
|
||||
// Pixel resolution of the game quad's own swapchain - i.e. game_width/
|
||||
// game_height as passed to xr_init() (grd_cap->w/h, see Shock.c's
|
||||
// InitSDL()) - the logical coordinate space xr_input.c needs to convert a
|
||||
// game-quad ray hit's normalized u,v into engine mouse coordinates (see
|
||||
// xr_mouse.h).
|
||||
void xr_get_game_resolution(int *width, int *height);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user