MenuOverlay's key grid forwards every press to the game as real input: non-printable keys (Esc/Enter/Backspace) as an SDLActivity.onNativeKeyDown()/ onNativeKeyUp() pair, and printable keys (letters, Space) as a synthesized SDL_TEXTINPUT event pushed directly from native code, since the engine's pump_events() only picks up printable ASCII from that event type, not from SDL_KEYDOWN. Confirmed on-device, including that Space now correctly skips the intro cutscene alongside Esc/Enter.
This commit is contained in:
@@ -7,9 +7,32 @@
|
||||
#include <jni.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <SDL.h>
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_de_ladkau_questshock_QuestShockActivity_nativeChdir(JNIEnv *env, jclass clazz, jstring path) {
|
||||
const char *cpath = (*env)->GetStringUTFChars(env, path, NULL);
|
||||
chdir(cpath);
|
||||
(*env)->ReleaseStringUTFChars(env, path, cpath);
|
||||
}
|
||||
|
||||
// MenuOverlay's hand-built on-screen keyboard (see
|
||||
// MenuOverlay.commitPrintableChar()) has no real Android IME session behind
|
||||
// it, so printable characters can't reach the game via Android's usual IME
|
||||
// path - instead this builds and pushes an SDL_TEXTINPUT event directly,
|
||||
// the same event type/shape SDL's own Android backend pushes for typed
|
||||
// text, using only the public SDL_Event/SDL_PushEvent API. The engine's
|
||||
// pump_events() (sdl_events.c) only picks up printable characters from
|
||||
// this event, not from SDL_KEYDOWN (see handleKeyPress() in MenuOverlay.java
|
||||
// for why).
|
||||
JNIEXPORT void JNICALL
|
||||
Java_de_ladkau_questshock_MenuOverlay_nativeSendPrintableChar(JNIEnv *env, jclass clazz, jchar c) {
|
||||
SDL_Event event;
|
||||
SDL_zero(event);
|
||||
event.type = SDL_TEXTINPUT;
|
||||
event.text.timestamp = SDL_GetTicks();
|
||||
event.text.windowID = 0;
|
||||
event.text.text[0] = (char)c;
|
||||
event.text.text[1] = '\0';
|
||||
SDL_PushEvent(&event);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// Menu quad for questshock's immersive Quest build: MenuOverlay.java's
|
||||
// off-screen-rendered View tree (currently just a "Keyboard" button - see
|
||||
// the plan's step D for the on-screen keyboard that goes behind it),
|
||||
// toggled by xr_input.c's menu_toggle action and hit-tested by the same ray
|
||||
// xr_input.c already computes per hand.
|
||||
// off-screen-rendered View tree (a "Keyboard" button that swaps to a
|
||||
// hand-built on-screen key grid - there's no system IME to borrow once
|
||||
// immersive), toggled by xr_input.c's menu_toggle action and hit-tested by
|
||||
// the same ray xr_input.c already computes per hand.
|
||||
//
|
||||
// The menu has its own independent OpenXR swapchain, sized to exactly
|
||||
// xr_menu_get_content_size()'s dimensions (see xr_session.c, which creates
|
||||
|
||||
Reference in New Issue
Block a user