|
24 | 24 | #pragma GCC diagnostic pop |
25 | 25 | #pragma GCC diagnostic pop |
26 | 26 | #include <physac/src/physac.h> |
| 27 | +#include <GLFW/glfw3.h> |
27 | 28 | #include <cstring> |
28 | 29 | #include <cstdint> |
29 | 30 |
|
30 | 31 | #include "robin-hood-hashing/src/include/robin_hood.h" |
31 | | -#include "SDL_events.h" |
32 | 32 | #include "include/var.h" |
33 | 33 | #include "include/module.h" |
34 | 34 | #include "include/param.h" |
@@ -1378,15 +1378,18 @@ static int cmd_guiunlock(int argc, slib_par_t *params, var_t *retval) { |
1378 | 1378 | return 1; |
1379 | 1379 | } |
1380 | 1380 |
|
| 1381 | +static int cmd_poll_events(int argc, slib_par_t *params, var_t *retval) { |
| 1382 | + glfwPollEvents(); |
| 1383 | + return 1; |
| 1384 | +} |
| 1385 | + |
1381 | 1386 | static int cmd_wait_events(int argc, slib_par_t *params, var_t *retval) { |
1382 | | - auto timeoutMS = get_param_int(argc, params, 0, -1); |
1383 | | - SDL_Event event; |
1384 | | - if (timeoutMS > 0) { |
1385 | | - SDL_WaitEventTimeout(&event, timeoutMS); |
| 1387 | + float waitMillis = get_param_int(argc, params, 0, -1); |
| 1388 | + if (waitMillis > 0) { |
| 1389 | + glfwWaitEventsTimeout(waitMillis / 1000); |
1386 | 1390 | } else { |
1387 | | - SDL_WaitEvent(&event); |
| 1391 | + glfwWaitEvents(); |
1388 | 1392 | } |
1389 | | - SDL_PushEvent(&event); |
1390 | 1393 | return 1; |
1391 | 1394 | } |
1392 | 1395 |
|
@@ -1833,6 +1836,7 @@ static FUNC_SIG lib_proc[] = { |
1833 | 1836 | {3, 3, "GUISETSTYLE", cmd_guisetstyle}, |
1834 | 1837 | {2, 2, "GUISTATUSBAR", cmd_guistatusbar}, |
1835 | 1838 | {0, 0, "GUIUNLOCK", cmd_guiunlock}, |
| 1839 | + {0, 0, "POLLEVENTS", cmd_poll_events}, |
1836 | 1840 | {0, 1, "WAITEVENTS", cmd_wait_events}, |
1837 | 1841 | {0, 0, "CLOSEPHYSICS", cmd_closephysics}, |
1838 | 1842 | {1, 1, "DESTROYPHYSICSBODY", cmd_destroyphysicsbody}, |
|
0 commit comments