-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathentry.c
More file actions
62 lines (46 loc) · 1.24 KB
/
Copy pathentry.c
File metadata and controls
62 lines (46 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/*
This file is a part of yoyoengine. (https://github.com/zoogies/yoyoengine)
Copyright (C) 2023-2026 Ryan Zmuda
Licensed under the MIT license. See LICENSE file in the project root for details.
*/
/*
WARNING: PLEASE DO NOT MODIFY THIS FILE UNLESS YOU KNOW WHAT YOU ARE DOING!
Any custom behavior you want to implement can be done in `custom/*` with
the engine callback system.
*/
#include <yoyoengine/yoyoengine.h>
#include "yoyo_c_api.h"
#ifdef _WIN32
#include <windows.h>
#endif
bool YG_RUNNING; // extern: yoyo_c_api.h
static void mainloop(void){
if(YG_RUNNING){
ye_process_frame();
}
else{
#ifdef __EMSCRIPTEN__
emscripten_cancel_main_loop();
#endif
// shutdown engine
ye_shutdown_engine();
// printf("Game exited successfully\n");
exit(0);
}
}
int main(int argc, char *argv[]) {
YG_RUNNING = true;
yoyo_register_callbacks();
ye_init_engine();
#ifdef __EMSCRIPTEN__
emscripten_set_main_loop(mainloop, 0, 1);
#else
while (1) { mainloop(); }
#endif
return 0;
}
#ifdef _WIN32
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {
return main(__argc, __argv);
}
#endif