Flecs v3.2
A fast entity component system (ECS) for C & C++
Loading...
Searching...
No Matches

Optional addon for running the main application loop. More...

Collaboration diagram for App:

Classes

struct  ecs_app_desc_t
 Used with ecs_app_run(). More...
 

Typedefs

typedef int(* ecs_app_init_action_t) (ecs_world_t *world)
 Callback type for init action.
 
typedef struct ecs_app_desc_t ecs_app_desc_t
 Used with ecs_app_run().
 
typedef int(* ecs_app_run_action_t) (ecs_world_t *world, ecs_app_desc_t *desc)
 Callback type for run action.
 
typedef int(* ecs_app_frame_action_t) (ecs_world_t *world, const ecs_app_desc_t *desc)
 Callback type for frame action.
 

Functions

FLECS_API int ecs_app_run (ecs_world_t *world, ecs_app_desc_t *desc)
 Run application.
 
FLECS_API int ecs_app_run_frame (ecs_world_t *world, const ecs_app_desc_t *desc)
 Default frame callback.
 
FLECS_API int ecs_app_set_run_action (ecs_app_run_action_t callback)
 Set custom run action.
 
FLECS_API int ecs_app_set_frame_action (ecs_app_frame_action_t callback)
 Set custom frame action.
 

Detailed Description

Optional addon for running the main application loop.

Typedef Documentation

◆ ecs_app_frame_action_t

typedef int(* ecs_app_frame_action_t) (ecs_world_t *world, const ecs_app_desc_t *desc)

Callback type for frame action.

Definition at line 58 of file app.h.

◆ ecs_app_init_action_t

typedef int(* ecs_app_init_action_t) (ecs_world_t *world)

Callback type for init action.

Definition at line 33 of file app.h.

◆ ecs_app_run_action_t

typedef int(* ecs_app_run_action_t) (ecs_world_t *world, ecs_app_desc_t *desc)

Callback type for run action.

Definition at line 53 of file app.h.

Function Documentation

◆ ecs_app_run()

FLECS_API int ecs_app_run ( ecs_world_t * world,
ecs_app_desc_t * desc )

Run application.

This will run the application with the parameters specified in desc. After the application quits (ecs_quit() is called) the world will be cleaned up.

If a custom run action is set, it will be invoked by this operation. The default run action calls the frame action in a loop until it returns a non-zero value.

Parameters
worldThe world.
descApplication parameters.

◆ ecs_app_run_frame()

FLECS_API int ecs_app_run_frame ( ecs_world_t * world,
const ecs_app_desc_t * desc )

Default frame callback.

This operation will run a single frame. By default this operation will invoke ecs_progress() directly, unless a custom frame action is set.

Parameters
worldThe world.
descThe desc struct passed to ecs_app_run().
Returns
value returned by ecs_progress()

◆ ecs_app_set_frame_action()

FLECS_API int ecs_app_set_frame_action ( ecs_app_frame_action_t callback)

Set custom frame action.

See ecs_app_run_frame().

Parameters
callbackThe frame action.

◆ ecs_app_set_run_action()

FLECS_API int ecs_app_set_run_action ( ecs_app_run_action_t callback)

Set custom run action.

See ecs_app_run().

Parameters
callbackThe run action.