Kohi Game Engine
application_types.h
Go to the documentation of this file.
1 
12 #pragma once
13 
14 #include "application_config.h"
15 #include "core/engine.h"
16 #include "platform/platform.h"
17 
18 struct render_packet;
19 struct frame_data;
20 struct application_config;
21 
23 typedef enum application_stage {
39 
40 struct application_state;
41 
46 typedef struct application {
49 
56  b8 (*boot)(struct application* app_inst);
57 
63  b8 (*initialize)(struct application* app_inst);
64 
71  b8 (*update)(struct application* app_inst, struct frame_data* p_frame_data);
72 
79  b8 (*prepare_frame)(struct application* app_inst, struct frame_data* p_frame_data);
80 
87  b8 (*render_frame)(struct application* app_inst, struct frame_data* p_frame_data);
88 
95  void (*on_window_resize)(struct application* app_inst, const struct kwindow* window);
96 
101  void (*shutdown)(struct application* app_inst);
102 
103  void (*lib_on_unload)(struct application* game_inst);
104 
105  void (*lib_on_load)(struct application* game_inst);
106 
109 
112 
115 
application_stage
Represents the various stages of application lifecycle.
Definition: application_types.h:23
@ APPLICATION_STAGE_INITIALIZING
Application is currently initializing.
Definition: application_types.h:31
@ APPLICATION_STAGE_SHUTTING_DOWN
Application is in the process of shutting down.
Definition: application_types.h:37
@ APPLICATION_STAGE_UNINITIALIZED
Application is in an uninitialized state.
Definition: application_types.h:25
@ APPLICATION_STAGE_RUNNING
Application is currently running.
Definition: application_types.h:35
@ APPLICATION_STAGE_BOOTING
Application is currently booting up.
Definition: application_types.h:27
@ APPLICATION_STAGE_BOOT_COMPLETE
Application completed boot process and is ready to be initialized.
Definition: application_types.h:29
@ APPLICATION_STAGE_INITIALIZED
Application initialization is complete.
Definition: application_types.h:33
struct application application
Represents the basic application state in a application. Called for creation by the application.
_Bool b8
8-bit boolean type
Definition: defines.h:58
This file contains structures and logic pertaining to the overall engine itself. The engine is respon...
This file contains the platform layer, or at least the interface to it. Each platform should provide ...
Represents configuration for the application. The application config is fed to the engine on creation...
Definition: application_config.h:46
Definition: game_state.h:40
Represents the basic application state in a application. Called for creation by the application.
Definition: application_types.h:46
void(* on_window_resize)(struct application *app_inst, const struct kwindow *window)
Function pointer to handle resizes, if applicable.
Definition: application_types.h:95
b8(* prepare_frame)(struct application *app_inst, struct frame_data *p_frame_data)
Function pointer to application's prepare_frame function.
Definition: application_types.h:79
void(* lib_on_load)(struct application *game_inst)
Definition: application_types.h:105
application_config app_config
The application configuration.
Definition: application_types.h:48
void(* shutdown)(struct application *app_inst)
Shuts down the application, prompting release of resources.
Definition: application_types.h:101
application_stage stage
The application stage of execution.
Definition: application_types.h:108
b8(* initialize)(struct application *app_inst)
Function pointer to application's initialize function.
Definition: application_types.h:63
b8(* render_frame)(struct application *app_inst, struct frame_data *p_frame_data)
Function pointer to application's render_frame function.
Definition: application_types.h:87
struct application_state * state
application-specific state. Created and managed by the application.
Definition: application_types.h:111
b8(* boot)(struct application *app_inst)
Function pointer to the application's boot sequence. This should fill out the application config with...
Definition: application_types.h:56
void(* lib_on_unload)(struct application *game_inst)
Definition: application_types.h:103
void * engine_state
A block of memory to hold the engine state. Created and managed by the engine.
Definition: application_types.h:114
dynamic_library game_library
Definition: application_types.h:116
b8(* update)(struct application *app_inst, struct frame_data *p_frame_data)
Function pointer to application's update function.
Definition: application_types.h:71
Definition: platform.h:30
Engine-level current frame-specific data.
Definition: frame_data.h:11
Represents a window in the application.
Definition: platform.h:69