MCPcopy Create free account
hub / github.com/Pagghiu/SaneCppLibraries / sokol_sleep

Function sokol_sleep

Examples/SCExample/SCExampleSokol.c:9–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7
8
9void sokol_sleep(void)
10{
11#if defined(__APPLE__)
12#if TARGET_OS_IPHONE
13
14 _sapp.ios.view.paused = YES;
15 // Not sure why we need 6 run loop to "eat" the pause event, probably they're used by MTKView
16 for(int i =0 ; i < 6; ++i)
17 {
18 CFRunLoopRunResult res = CFRunLoopRunInMode(kCFRunLoopDefaultMode, DBL_MAX, YES);
19 if(res == kCFRunLoopRunStopped)
20 {
21 break;
22 }
23 }
24 _sapp.ios.view.paused = NO;
25#else
26 CFRunLoopRunInMode(kCFRunLoopDefaultMode, DBL_MAX, 1);
27#endif
28#elif defined(_WIN32)
29 HWND hwnd = (HWND)sapp_win32_get_hwnd();
30 MSG msg;
31 GetMessageW(&msg, NULL, 0, 0);
32 if (msg.message == WM_QUIT)
33 {
34 PostMessage(hwnd, WM_CLOSE, 0, 0);
35 }
36 else if (msg.message != WM_TIMER)
37 {
38 TranslateMessage(&msg);
39 DispatchMessageW(&msg);
40 }
41#elif defined(__linux__)
42 XEvent event;
43 XNextEvent(_sapp.x11.display, &event);
44 XPutBackEvent(_sapp.x11.display, &event);
45#else
46#error "Unsupported platform"
47#endif
48}
49
50void sokol_wake_up(void)
51{

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected