Bump android build gradle versions, also provide delta to Window_ProcessEvents for windowing backends that require knowing how much time has elapsed

This commit is contained in:
UnknownShadow200 2023-07-06 22:57:09 +10:00
parent 77f254faa4
commit 333e7dcc05
15 changed files with 25 additions and 24 deletions

1
.gitignore vendored
View File

@ -11,6 +11,7 @@
*.VC.VC.opendb *.VC.VC.opendb
# Android build results # Android build results
android/.cxx/
android/.idea/ android/.idea/
android/.gradle/ android/.gradle/
android/build/ android/build/

View File

@ -637,11 +637,11 @@ void Game_Free(void* obj) {
#define Game_DoFrameBody() \ #define Game_DoFrameBody() \
render = Stopwatch_Measure();\ render = Stopwatch_Measure();\
Window_ProcessEvents();\
if (!WindowInfo.Exists) return;\
\
delta = Stopwatch_ElapsedMicroseconds(Game_FrameStart, render) / (1000.0 * 1000.0);\ delta = Stopwatch_ElapsedMicroseconds(Game_FrameStart, render) / (1000.0 * 1000.0);\
\ \
Window_ProcessEvents(delta);\
if (!WindowInfo.Exists) return;\
\
if (delta > 1.0) delta = 1.0; /* avoid large delta with suspended process */ \ if (delta > 1.0) delta = 1.0; /* avoid large delta with suspended process */ \
if (delta > 0.0) { Game_FrameStart = render; Game_RenderFrame(delta); } if (delta > 0.0) { Game_FrameStart = render; Game_RenderFrame(delta); }

View File

@ -263,7 +263,7 @@ void Launcher_Run(void) {
#endif #endif
for (;;) { for (;;) {
Window_ProcessEvents(); Window_ProcessEvents(10 / 1000.0);
if (!WindowInfo.Exists || Launcher_ShouldExit) break; if (!WindowInfo.Exists || Launcher_ShouldExit) break;
Launcher_Active->Tick(Launcher_Active); Launcher_Active->Tick(Launcher_Active);

View File

@ -121,7 +121,7 @@ void Window_SetSize(int width, int height);
/* Raises the WindowClosing and WindowClosed events. */ /* Raises the WindowClosing and WindowClosed events. */
void Window_Close(void); void Window_Close(void);
/* Processes all pending window messages/events. */ /* Processes all pending window messages/events. */
void Window_ProcessEvents(void); void Window_ProcessEvents(double delta);
/* Sets the position of the cursor. */ /* Sets the position of the cursor. */
/* NOTE: This should be avoided because it is unsupported on some platforms. */ /* NOTE: This should be avoided because it is unsupported on some platforms. */

View File

@ -57,7 +57,7 @@ void Window_Close(void) {
/* TODO implement */ /* TODO implement */
} }
void Window_ProcessEvents(void) { void Window_ProcessEvents(double delta) {
hidScanInput(); hidScanInput();
/* TODO implement */ /* TODO implement */

View File

@ -278,7 +278,7 @@ static void RemakeWindowSurface(void) {
/* Loop until window gets created by main UI thread */ /* Loop until window gets created by main UI thread */
/* (i.e. until processSurfaceCreated is received) */ /* (i.e. until processSurfaceCreated is received) */
while (!winCreated) { while (!winCreated) {
Window_ProcessEvents(); Window_ProcessEvents(0.0);
Thread_Sleep(10); Thread_Sleep(10);
} }
@ -338,7 +338,7 @@ void Window_Close(void) {
/* ANativeActivity_finish(app->activity); */ /* ANativeActivity_finish(app->activity); */
} }
void Window_ProcessEvents(void) { void Window_ProcessEvents(double delta) {
JNIEnv* env; JNIEnv* env;
JavaGetCurrentEnv(env); JavaGetCurrentEnv(env);
/* TODO: Cache the java env */ /* TODO: Cache the java env */
@ -358,7 +358,7 @@ static void ShowDialogCore(const char* title, const char* msg) {
Platform_LogConst(title); Platform_LogConst(title);
Platform_LogConst(msg); Platform_LogConst(msg);
/* in case surface destroyed message has arrived */ /* in case surface destroyed message has arrived */
Window_ProcessEvents(); Window_ProcessEvents(0.0);
args[0].l = JavaMakeConst(env, title); args[0].l = JavaMakeConst(env, title);
args[1].l = JavaMakeConst(env, msg); args[1].l = JavaMakeConst(env, msg);

View File

@ -551,7 +551,7 @@ void Window_Close(void) {
WindowInfo.Exists = false; WindowInfo.Exists = false;
} }
void Window_ProcessEvents(void) { void Window_ProcessEvents(double delta) {
EventRef theEvent; EventRef theEvent;
EventTargetRef target = GetEventDispatcherTarget(); EventTargetRef target = GetEventDispatcherTarget();
OSStatus res; OSStatus res;

View File

@ -81,7 +81,7 @@ void Window_Close(void) {
} }
#if defined HW_RVL #if defined HW_RVL
void Window_ProcessEvents(void) { void Window_ProcessEvents(double delta) {
/* TODO implement */ /* TODO implement */
WPAD_ScanPads(); WPAD_ScanPads();
u32 mods = WPAD_ButtonsDown(0) | WPAD_ButtonsHeld(0); u32 mods = WPAD_ButtonsDown(0) | WPAD_ButtonsHeld(0);
@ -108,7 +108,7 @@ void Window_ProcessEvents(void) {
} }
#elif defined HW_DOL #elif defined HW_DOL
void Window_ProcessEvents(void) { void Window_ProcessEvents(double delta) {
/* TODO implement */ /* TODO implement */
PADStatus pads[4]; PADStatus pads[4];
PAD_Read(pads); PAD_Read(pads);

View File

@ -227,7 +227,7 @@ static void OnWindowEvent(const SDL_Event* e) {
} }
} }
void Window_ProcessEvents(void) { void Window_ProcessEvents(double delta) {
SDL_Event e; SDL_Event e;
while (SDL_PollEvent(&e)) { while (SDL_PollEvent(&e)) {
switch (e.type) { switch (e.type) {

View File

@ -513,7 +513,7 @@ void Window_Close(void) {
} }
extern void interop_RequestCanvasResize(void); extern void interop_RequestCanvasResize(void);
void Window_ProcessEvents(void) { void Window_ProcessEvents(double delta) {
if (!needResize) return; if (!needResize) return;
needResize = false; needResize = false;
if (!WindowInfo.Exists) return; if (!WindowInfo.Exists) return;

View File

@ -463,7 +463,7 @@ static void ToggleFullscreen(cc_bool fullscreen, UINT finalShow) {
SetWindowLongA(win_handle, GWL_STYLE, style); SetWindowLongA(win_handle, GWL_STYLE, style);
SetWindowPos(win_handle, NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED); SetWindowPos(win_handle, NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED);
ShowWindow(win_handle, finalShow); ShowWindow(win_handle, finalShow);
Window_ProcessEvents(); Window_ProcessEvents(0.0);
} }
suppress_resize = false; suppress_resize = false;
@ -509,7 +509,7 @@ void Window_Close(void) {
PostMessageA(win_handle, WM_CLOSE, 0, 0); PostMessageA(win_handle, WM_CLOSE, 0, 0);
} }
void Window_ProcessEvents(void) { void Window_ProcessEvents(double delta) {
HWND foreground; HWND foreground;
MSG msg; MSG msg;

View File

@ -370,7 +370,7 @@ void Clipboard_GetText(cc_string* value) {
/* wait up to 1 second for SelectionNotify event to arrive */ /* wait up to 1 second for SelectionNotify event to arrive */
for (i = 0; i < 100; i++) { for (i = 0; i < 100; i++) {
Window_ProcessEvents(); Window_ProcessEvents(0.0);
if (clipboard_paste_received) { if (clipboard_paste_received) {
String_AppendString(value, &clipboard_paste_text); String_AppendString(value, &clipboard_paste_text);
return; return;
@ -427,7 +427,7 @@ static void ToggleFullscreen(long op) {
SubstructureRedirectMask | SubstructureNotifyMask, &ev); SubstructureRedirectMask | SubstructureNotifyMask, &ev);
XSync(win_display, false); XSync(win_display, false);
XRaiseWindow(win_display, win_handle); XRaiseWindow(win_display, win_handle);
Window_ProcessEvents(); Window_ProcessEvents(0.0);
} }
cc_result Window_EnterFullscreen(void) { cc_result Window_EnterFullscreen(void) {
@ -443,7 +443,7 @@ void Window_Show(void) { XMapWindow(win_display, win_handle); }
void Window_SetSize(int width, int height) { void Window_SetSize(int width, int height) {
XResizeWindow(win_display, win_handle, width, height); XResizeWindow(win_display, win_handle, width, height);
Window_ProcessEvents(); Window_ProcessEvents(0.0);
} }
void Window_Close(void) { void Window_Close(void) {
@ -513,7 +513,7 @@ static void HandleWMPing(XEvent* e) {
} }
static void HandleGenericEvent(XEvent* e); static void HandleGenericEvent(XEvent* e);
void Window_ProcessEvents(void) { void Window_ProcessEvents(double delta) {
XEvent e; XEvent e;
Window focus; Window focus;
int focusRevert; int focusRevert;

View File

@ -460,7 +460,7 @@ static int MapNativeKey(int raw) {
return key; return key;
} }
void Window_ProcessEvents(void) { void Window_ProcessEvents(double delta) {
CCEvent event; CCEvent event;
int key; int key;

View File

@ -453,7 +453,7 @@ static void DebugScrollEvent(NSEvent* ev) {
Platform_Log3("SCROLL: %i.0 = (%i, %f3)", &steps, &raw, &dy); Platform_Log3("SCROLL: %i.0 = (%i, %f3)", &steps, &raw, &dy);
} }
void Window_ProcessEvents(void) { void Window_ProcessEvents(double delta) {
NSEvent* ev; NSEvent* ev;
int key, type, steps, x, y; int key, type, steps, x, y;
CGFloat dx, dy; CGFloat dx, dy;

View File

@ -386,7 +386,7 @@ void Window_Close(void) {
Event_RaiseVoid(&WindowEvents.Closing); Event_RaiseVoid(&WindowEvents.Closing);
} }
void Window_ProcessEvents(void) { void Window_ProcessEvents(double delta) {
SInt32 res; SInt32 res;
// manually tick event queue // manually tick event queue
do { do {
@ -408,7 +408,7 @@ void ShowDialogCore(const char* title, const char* msg) {
// TODO clicking outside message box crashes launcher // TODO clicking outside message box crashes launcher
// loop until alert is closed TODO avoid sleeping // loop until alert is closed TODO avoid sleeping
while (!completed) { while (!completed) {
Window_ProcessEvents(); Window_ProcessEvents(0.0);
Thread_Sleep(16); Thread_Sleep(16);
} }
} }