90 *frag_color = final_color;
103 (void)w; (void)dirty; (void)user_data;
113static void*
setup(
struct bj_app* app,
void* init_data) {
140static void teardown(
struct bj_app* app,
void* user_data) {
146int main(
int argc,
char* argv[]) {
147 (void)argc; (void)argv;
Application lifecycle: callback-driven setup, step, and teardown.
int main(int argc, char *argv[])
static void step(struct bj_app *app, struct bj_tick_info tick, void *user_data)
static void teardown(struct bj_app *app, void *user_data)
bj_audio_play_note_data data
static void * setup(struct bj_app *app, void *init_data)
Header file for Bitmap type.
static void on_draw(struct bj_window *w, struct bj_render_target *target, const struct bj_rect *dirty, void *user_data)
Sytem event management API.
int bj_run_app(bj_app_setup_fn setup, bj_app_step_fn step, bj_app_fixed_step_fn fixed_step, bj_app_teardown_fn teardown, void *init_data)
Drive the application lifecycle.
void bj_quit_app(struct bj_app *app, int exit_code)
Signal the given application to exit on the next iteration.
Timing snapshot handed to the step and fixed-step callbacks.
struct bj_render_target bj_render_target
struct bj_window bj_window
void bj_dispatch_events(void)
Poll and dispatch all pending events.
void bj_close_on_escape(struct bj_window *window, const struct bj_key_event *event, void *user_data)
Handle the ESC key to close a window.
bj_key_callback_fn bj_set_key_callback(bj_key_callback_fn callback, void *user_data)
Set the global callback for keyboard key events.
static bj_real bj_vec2_len(struct bj_vec2 v)
Euclidean length: sqrt(x^2 + y^2).
static struct bj_vec3 bj_vec3_scale(struct bj_vec3 v, bj_real s)
Uniform scaling by a scalar: v * s.
static struct bj_vec2 bj_vec2_map(struct bj_vec2 a, bj_real(*f)(bj_real))
Apply a scalar function component-wise: (f(x), f(y)).
static struct bj_vec2 bj_vec2_sub(const struct bj_vec2 lhs, const struct bj_vec2 rhs)
Component-wise subtraction: lhs - rhs.
#define BJ_FZERO
Zero constant in bj_real.
static struct bj_vec3 bj_vec3_add(struct bj_vec3 lhs, struct bj_vec3 rhs)
Component-wise addition: lhs + rhs.
#define bj_abs
Absolute value.
static bj_real bj_fract(bj_real x)
Fractional part of x.
#define bj_exp
Exponential.
static struct bj_vec2 bj_vec2_scale(struct bj_vec2 v, bj_real s)
Uniform scaling by a scalar: v * s.
#define BJ_F(x)
Literal suffix helper for bj_real when float is selected.
float bj_real
Selected real type for float configuration.
Axis-aligned rectangle: a top-left corner plus a width and height.
2D vector of bj_real components.
3D vector of bj_real components.
#define BJ_SHADER_STANDARD_FLAGS
Flagset alias for bj_shader_bitmap.
void bj_shader_bitmap(struct bj_bitmap *bitmap, bj_bitmap_shading_fn shader, void *data, uint8_t flags)
Applies a shader function to every pixel in a bitmap.
bj_bool bj_begin(int systems, struct bj_error **error)
Initialises the system.
void bj_end(void)
De-initialises the system.
double bj_run_time(void)
Gets the current time in seconds since Banjo initialisation.
void bj_set_draw_callback(struct bj_window *window, bj_window_draw_fn fn, void *user_data)
Register the redraw callback for window.
static void bj_invalidate_window(struct bj_window *window)
Mark the whole window as needing a repaint.
struct bj_window * bj_bind_window(const char *title, uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint8_t flags, struct bj_error **error)
Create a new struct bj_window with the specified attributes.
struct bj_bitmap * bj_render_target_bitmap(struct bj_render_target *target)
Reach the software framebuffer behind a render target.
bj_bool bj_should_close_window(struct bj_window *window)
Get the close flag state of a window.
void bj_unbind_window(struct bj_window *window)
Deletes a struct bj_window object and releases associated memory.
Logging utility functions.
Portable main() replacement with platform-aware entry shim.
Basic shader-like bitmap manipulation.
int shader_code(bj_vec3 *frag_color, const bj_vec2 frag_coords, void *data)
static bj_vec3 palette(bj_real t)
Header file for system interactions.
Header file for time manipulation utilities.
Header file for bj_window type.