Banjo API 0.0.1
C99 game development API
Loading...
Searching...
No Matches
template.c

Minimal Banjo program demonstrating the init-work-cleanup lifecycle pattern.

Minimal Banjo program demonstrating the init-work-cleanup lifecycle pattern.Every Banjo program follows this structure: initialize subsystems with bj_begin(), do your work, then cleanup with bj_end().

#include <banjo/log.h> // Logging: bj_info, bj_warn, bj_error, bj_debug
#include <banjo/main.h> // Lifecycle: bj_begin, bj_end
#include <banjo/system.h> // Subsystem flags: BJ_VIDEO_SYSTEM, BJ_AUDIO_SYSTEM
int main(int argc, char* argv[]) {
(void)argc;
(void)argv;
// Initialize Banjo subsystems. Choose what you need:
// BJ_VIDEO_SYSTEM - windows, rendering, events
// BJ_AUDIO_SYSTEM - audio playback
// Returns false on failure (unsupported platform, insufficient resources).
return 1;
}
// With Banjo initialized, use its features. Here we just log a message.
bj_info("Hello Banjo!");
// Always cleanup before exit to release all Banjo resources.
bj_end();
return 0;
}
#define bj_info(...)
Log a message using the BJ_LOG_INFO level.
Definition log.h:105
bj_bool bj_begin(int systems, struct bj_error **error)
Initializes the system.
void bj_end(void)
De-initializes the system.
@ BJ_VIDEO_SYSTEM
Definition system.h:20
@ BJ_AUDIO_SYSTEM
Definition system.h:19
Logging utility functions.
Portable main substitution and application callback facilities.
Header file for system interactions.