rtengine/src/runtime/app.h
2024-02-09 00:07:35 +01:00

57 lines
1.3 KiB
C

#ifndef RT_APP_H
#define RT_APP_H
/* Platform specific application entry point */
#include "runtime.h"
#include "main_loop.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef void rt_app_register_cvars_fn(void);
typedef void rt_app_init_fn(void);
typedef void rt_app_shutdown_fn(void);
typedef struct {
/* Called before initialization. */
rt_app_register_cvars_fn *RegisterCVars;
/* Called after the runtime has finished initialization and
* before entering the main-loop */
rt_app_init_fn *Init;
/* Called after the main-loop and before the runtime starts its shutdown. */
rt_app_shutdown_fn *Shutdown;
/* Called by the update thread for each frame */
rt_main_loop_update_fn *Update;
/* Called by the render thread for each frame */
rt_main_loop_render_fn *Render;
} rt_app_callbacks;
#ifdef _WIN32
/* Forward declared here, to avoid including windows.h */
struct HINSTANCE__;
RT_DLLEXPORT int rtWin32Entry(struct HINSTANCE__ *hInstance,
struct HINSTANCE__ *hPrevInstance,
wchar_t *pCmdLine,
int nCmdShow,
rt_app_callbacks app_callbacks);
#elif defined(RT_USE_XLIB)
RT_DLLEXPORT int rtXlibEntry(int argc, char **argv, rt_app_callbacks app_callbacks);
#endif
#ifdef __cplusplus
}
#endif
#endif