ldk_log_raw
#define ldk_log_raw(out, level, fg, bg, components, fmt, ...) \
x_log_raw(ldk_module_get(LDK_MODULE_LOG), (out), (level), (fg), (bg), \
(components), fmt, ##__VA_ARGS__)
Engine root and global module access
Entry point for the LDK engine. Provides initialization, shutdown, and access to core submodules.
#define ldk_log_raw(out, level, fg, bg, components, fmt, ...) \
x_log_raw(ldk_module_get(LDK_MODULE_LOG), (out), (level), (fg), (bg), \
(components), fmt, ##__VA_ARGS__)
#define ldk_log_debug(fmt, ...) \
x_log_debug(ldk_module_get(LDK_MODULE_LOG), fmt, ##__VA_ARGS__)
#define ldk_log_info(fmt, ...) \
x_log_info(ldk_module_get(LDK_MODULE_LOG), fmt, ##__VA_ARGS__)
#define ldk_log_warning(fmt, ...) \
x_log_warning(ldk_module_get(LDK_MODULE_LOG), fmt, ##__VA_ARGS__)
#define ldk_log_error(fmt, ...) \
x_log_error(ldk_module_get(LDK_MODULE_LOG), fmt, ##__VA_ARGS__)
#define ldk_log_fatal(fmt, ...) \
x_log_fatal(ldk_module_get(LDK_MODULE_LOG), fmt, ##__VA_ARGS__)
typedef struct LDKRoot LDKRoot;
typedef enum LDKModuleType{
LDK_MODULE_ASSET_MANAGER,
LDK_MODULE_ECS,
LDK_MODULE_EVENT,
LDK_MODULE_LOG,
LDK_MODULE_RENDERER,
LDK_MODULE_SCENE_MANAGER,
LDK_MODULE_ASSET_SOURCE,
LDK_MODULE_AUDIO,
LDK_MODULE_JOBS,
}LDKModuleType;
typedef struct LDKConfig{
XSmallstr title;
XFSPath config_file_path;
XFSPath runtree_path;
XFSPath icon_path;
XFSPath asset_root;
XFSPath log_file;
XFSPath game_dll;
i32 display_width;
i32 display_height;
i32 resolution_width;
i32 resolution_height;
u32 shadow_map_resolution;
float shadow_distance;
i32 initial_ui_index_capacity;
i32 initial_ui_vertex_capacity;
bool fullscreen;
}LDKConfig;
Initialize the engine.
LDK_API bool ldk_engine_initialize(const char *config_ini_path);
const char *config_ini_pathTrue if the operation succeeds; false otherwise.
Populate an engine configuration from parsed INI settings.
LDK_API bool ldk_engine_config_from_ini(
LDKConfig *out_config,
XIni *ini,
const char *config_ini_path
);
LDKConfig *out_configXIni *iniconst char *config_ini_pathTrue if the operation succeeds; false otherwise.
Initialize the engine from a configuration supplied by the caller.
LDK_API bool ldk_engine_initialize_with_config(const LDKConfig *config);
const LDKConfig *configTrue if the operation succeeds; false otherwise.
Set the internal resolution used for game rendering.
LDK_API bool ldk_engine_render_resolution_set(
i32 width,
i32 height
);
i32 widthi32 heightTrue if the operation succeeds; false otherwise.
Set shadow map resolution and shadow distance.
LDK_API bool ldk_engine_shadow_settings_set(
u32 resolution,
float distance
);
u32 resolutionfloat distanceTrue if the operation succeeds; false otherwise.
Check whether the engine is initialized.
LDK_API bool ldk_engine_is_initialized(void);
True when the queried condition holds; false otherwise.
Process one engine frame.
LDK_API void ldk_engine_frame(void);
Access the context of a registered engine module.
LDK_API void * ldk_module_get(LDKModuleType module_type);
LDKModuleType module_typePointer to the requested object or data; NULL when unavailable.
Enter the engine main loop and return its exit code.
LDK_API i32 ldk_engine_run(void);
Process or engine exit code.
Get the input mouse state.
LDK_API void ldk_input_mouse_state_get(LDKMouseState *out_state);
LDKMouseState *out_stateTest whether the button is currently held.
LDK_API bool ldk_input_mouse_button_is_pressed(
LDKMouseState *state,
LDKMouseButton button
);
LDKMouseState *stateLDKMouseButton buttonTrue when the queried condition holds; false otherwise.
Test whether the button was pressed during the current input update.
LDK_API bool ldk_input_mouse_button_down(
LDKMouseState *state,
LDKMouseButton button
);
LDKMouseState *stateLDKMouseButton buttonTrue if the operation succeeds; false otherwise.
Test whether the button was released during the current input update.
LDK_API bool ldk_input_mouse_button_up(
LDKMouseState *state,
LDKMouseButton button
);
LDKMouseState *stateLDKMouseButton buttonTrue if the operation succeeds; false otherwise.
Get the accumulated mouse wheel movement in the input snapshot.
LDK_API i32 ldk_input_mouse_wheel_delta(LDKMouseState *state);
LDKMouseState *stateThe resulting integer value.
Get the mouse cursor position.
LDK_API LDKPoint ldk_input_mouse_cursor(LDKMouseState *state);
LDKMouseState *stateThe resulting point.
Get the mouse cursor position relative to the active client area.
LDK_API LDKPoint ldk_input_mouse_cursor_relative(LDKMouseState *state);
LDKMouseState *stateThe resulting point.
Get the input keyboard state.
LDK_API void ldk_input_keyboard_state_get(LDKKeyboardState *out_state);
LDKKeyboardState *out_stateTest whether the key is currently held.
LDK_API bool ldk_input_keyboard_key_is_pressed(
LDKKeyboardState *state,
LDKKeycode keycode
);
LDKKeyboardState *stateLDKKeycode keycodeTrue when the queried condition holds; false otherwise.
Test whether the key was pressed during the current input update.
LDK_API bool ldk_input_keyboard_key_down(
LDKKeyboardState *state,
LDKKeycode keycode
);
LDKKeyboardState *stateLDKKeycode keycodeTrue if the operation succeeds; false otherwise.
Test whether the key was released during the current input update.
LDK_API bool ldk_input_keyboard_key_up(
LDKKeyboardState *state,
LDKKeycode keycode
);
LDKKeyboardState *stateLDKKeycode keycodeTrue if the operation succeeds; false otherwise.
Set the embedded editor game viewport used for input remapping.
LDK_API void ldk_input_game_view_set(
float x,
float y,
float width,
float height,
u32 game_width,
u32 game_height
);
float xfloat yfloat widthfloat heightu32 game_widthu32 game_heightClear the editor game viewport input remapping.
LDK_API void ldk_input_game_view_clear(void);
Get the game.
LDK_API LDKGame * ldk_game_get(void);
Pointer to the requested object or data; NULL when unavailable.
Load a statically linked game instance.
LDK_API bool ldk_game_instance_load_static(void);
True if the operation succeeds; false otherwise.
Shut down the engine.
LDK_API void ldk_engine_terminate(void);
Request termination of the engine main loop with an exit code.
LDK_API void ldk_engine_stop(i32 exit_code);
i32 exit_codeLoad a game module from a dynamic library.
LDK_API bool ldk_game_instance_load_from_shared_lib(const char *path);
const char *pathTrue if the operation succeeds; false otherwise.
Initialize the game instance.
LDK_API bool ldk_game_instance_initialize(void);
True if the operation succeeds; false otherwise.
Start the game instance.
LDK_API bool ldk_game_instance_start(void);
True if the operation succeeds; false otherwise.
Stop gameplay without unloading the game module or clearing the ECS. The editor may then reload the original scene from disk. A stop requested during an update is completed at the safe frame boundary.
LDK_API bool ldk_game_instance_stop(void);
True if the operation succeeds; false otherwise.
Pause the game instance.
LDK_API bool ldk_game_instance_pause(void);
True if the operation succeeds; false otherwise.
Resume the game instance.
LDK_API bool ldk_game_instance_resume(void);
True if the operation succeeds; false otherwise.
Advance a paused game by one update step.
LDK_API bool ldk_game_instance_step(void);
True if the operation succeeds; false otherwise.
Check whether the game instance is started.
LDK_API bool ldk_game_instance_is_started(void);
True when the queried condition holds; false otherwise.
Check whether the game instance is paused.
LDK_API bool ldk_game_instance_is_paused(void);
True when the queried condition holds; false otherwise.
Check whether the game instance is in a single-step update.
LDK_API bool ldk_game_instance_is_stepping(void);
True when the queried condition holds; false otherwise.
Check whether the game instance is currently updating.
LDK_API bool ldk_game_instance_is_updating(void);
True when the queried condition holds; false otherwise.
Shut down the game instance.
LDK_API void ldk_game_instance_terminate(void);
Unload the game instance.
LDK_API bool ldk_game_instance_unload(void);
True if the operation succeeds; false otherwise.
Get the engine main window.
LDK_API LDKWindow ldk_engine_main_window_get(void);
Handle to the requested object or resource.
Get the engine main window handle.
LDK_API LDKWindow ldk_main_window(void);
Handle to the requested object or resource.
Get a read-only pointer to the active engine configuration.
LDK_API const LDKConfig * ldk_engine_config_get(void);
Pointer to the requested object or data; NULL when unavailable.