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
# Android build results
android/.cxx/
android/.idea/
android/.gradle/
android/build/

View file

@ -637,11 +637,11 @@ void Game_Free(void* obj) {
#define Game_DoFrameBody() \
render = Stopwatch_Measure();\
Window_ProcessEvents();\
if (!WindowInfo.Exists) return;\
\
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 > 0.0) { Game_FrameStart = render; Game_RenderFrame(delta); }

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -81,7 +81,7 @@ void Window_Close(void) {
}
#if defined HW_RVL
void Window_ProcessEvents(void) {
void Window_ProcessEvents(double delta) {
/* TODO implement */
WPAD_ScanPads();
u32 mods = WPAD_ButtonsDown(0) | WPAD_ButtonsHeld(0);
@ -108,7 +108,7 @@ void Window_ProcessEvents(void) {
}
#elif defined HW_DOL
void Window_ProcessEvents(void) {
void Window_ProcessEvents(double delta) {
/* TODO implement */
PADStatus pads[4];
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;
while (SDL_PollEvent(&e)) {
switch (e.type) {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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