Kohi Game Engine
application_types.h
Go to the documentation of this file.
1 
12 #pragma once
13 
14 #include "core/engine.h"
15 #include "platform/platform.h"
16 
17 struct render_packet;
18 struct frame_data;
19 
21 typedef enum application_stage {
37 
42 typedef struct application {
45 
52  b8 (*boot)(struct application* app_inst);
53 
59  b8 (*initialize)(struct application* app_inst);
60 
67  b8 (*update)(struct application* app_inst, struct frame_data* p_frame_data);
68 
75  b8 (*prepare_frame)(struct application* app_inst, struct frame_data* p_frame_data);
76 
83  b8 (*render_frame)(struct application* app_inst, struct frame_data* p_frame_data);
84 
91  void (*on_resize)(struct application* app_inst, u32 width, u32 height);
92 
97  void (*shutdown)(struct application* app_inst);
98 
99  void (*lib_on_unload)(struct application* game_inst);
100 
101  void (*lib_on_load)(struct application* game_inst);
102 
105 
107  void* state;
108 
111 
112  // TODO: Move this to somewhere better...
115 
118 
application_stage
Represents the various stages of application lifecycle.
Definition: application_types.h:21
@ APPLICATION_STAGE_INITIALIZING
Application is currently initializing.
Definition: application_types.h:29
@ APPLICATION_STAGE_SHUTTING_DOWN
Application is in the process of shutting down.
Definition: application_types.h:35
@ APPLICATION_STAGE_UNINITIALIZED
Application is in an uninitialized state.
Definition: application_types.h:23
@ APPLICATION_STAGE_RUNNING
Application is currently running.
Definition: application_types.h:33
@ APPLICATION_STAGE_BOOTING
Application is currently booting up.
Definition: application_types.h:25
@ APPLICATION_STAGE_BOOT_COMPLETE
Application completed boot process and is ready to be initialized.
Definition: application_types.h:27
@ APPLICATION_STAGE_INITIALIZED
Application initialization is complete.
Definition: application_types.h:31
struct application application
Represents the basic application state in a application. Called for creation by the application.
unsigned int u32
Unsigned 32-bit integer.
Definition: defines.h:25
_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: engine.h:29
Represents the basic application state in a application. Called for creation by the application.
Definition: application_types.h:42
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:75
void(* lib_on_load)(struct application *game_inst)
Definition: application_types.h:101
void * state
application-specific state. Created and managed by the application.
Definition: application_types.h:107
application_config app_config
The application configuration.
Definition: application_types.h:44
void(* shutdown)(struct application *app_inst)
Shuts down the application, prompting release of resources.
Definition: application_types.h:97
renderer_plugin render_plugin
Definition: application_types.h:114
application_stage stage
The application stage of execution.
Definition: application_types.h:104
void(* on_resize)(struct application *app_inst, u32 width, u32 height)
Function pointer to handle resizes, if applicable.
Definition: application_types.h:91
dynamic_library audio_library
Definition: application_types.h:116
b8(* initialize)(struct application *app_inst)
Function pointer to application's initialize function.
Definition: application_types.h:59
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:83
audio_plugin audio_plugin
Definition: application_types.h:117
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:52
void(* lib_on_unload)(struct application *game_inst)
Definition: application_types.h:99
dynamic_library renderer_library
Definition: application_types.h:113
void * engine_state
A block of memory to hold the engine state. Created and managed by the engine.
Definition: application_types.h:110
dynamic_library game_library
Definition: application_types.h:119
b8(* update)(struct application *app_inst, struct frame_data *p_frame_data)
Function pointer to application's update function.
Definition: application_types.h:67
Definition: audio_types.h:69
Definition: platform.h:36
Engine-level current frame-specific data.
Definition: frame_data.h:16
A structure which is generated by the application and sent once to the renderer to render a given fra...
Definition: renderer_types.h:1018
A generic "interface" for the renderer plugin. The renderer backend is what is responsible for making...
Definition: renderer_types.h:225