mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-16 02:56:09 -04:00
Show awful HUD for web client when running on a mobile device, and attempt to get touch and on-screen keyboard to work.
not sure if this works though since I'm only using the android emulator
This commit is contained in:
parent
a6773e8f79
commit
e608660785
30
src/Window.c
30
src/Window.c
@ -3037,8 +3037,8 @@ void Window_Init(void) {
|
|||||||
});
|
});
|
||||||
);
|
);
|
||||||
|
|
||||||
Pointers_Count = 1;
|
Input_TouchMode = EM_ASM_INT_V({ return /iPhone|iPad|iPod|Android/i.test(navigator.userAgent); });
|
||||||
/* TODO: detect touch like device here from useragent */
|
Pointers_Count = Input_TouchMode ? 0 : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window_Create(int width, int height) {
|
void Window_Create(int width, int height) {
|
||||||
@ -3138,8 +3138,30 @@ void Window_AllocFramebuffer(Bitmap* bmp) { }
|
|||||||
void Window_DrawFramebuffer(Rect2D r) { }
|
void Window_DrawFramebuffer(Rect2D r) { }
|
||||||
void Window_FreeFramebuffer(Bitmap* bmp) { }
|
void Window_FreeFramebuffer(Bitmap* bmp) { }
|
||||||
|
|
||||||
void Window_OpenKeyboard(void) { }
|
void Window_OpenKeyboard(void) {
|
||||||
void Window_CloseKeyboard(void) { }
|
if (!Input_TouchMode) return;
|
||||||
|
Platform_LogConst("OPEN SESAME");
|
||||||
|
EM_ASM({
|
||||||
|
var elem = window.cc_inputElem;
|
||||||
|
if (!elem) {
|
||||||
|
elem = document.createElement('input');
|
||||||
|
window.cc_inputElem = elem;
|
||||||
|
}
|
||||||
|
|
||||||
|
document.body.appendChild(elem);
|
||||||
|
elem.focus();
|
||||||
|
elem.click();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
void Window_CloseKeyboard(void) {
|
||||||
|
if (!Input_TouchMode) return;
|
||||||
|
Platform_LogConst("CLOSE SESAME");
|
||||||
|
EM_ASM({
|
||||||
|
if (!window.cc_inputElem) return;
|
||||||
|
document.body.removeChild(window.cc_inputElem);
|
||||||
|
window.cc_inputElem = null;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
void Window_EnableRawMouse(void) {
|
void Window_EnableRawMouse(void) {
|
||||||
Window_RegrabMouse();
|
Window_RegrabMouse();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user