General-purpose definitions for Banjo API.
Recoverable error handling.
struct bj_render_target bj_render_target
uint32_t bj_bool
Boolean type used throughout the Banjo API.
struct bj_bitmap bj_bitmap
struct bj_window bj_window
Axis-aligned rectangle: a top-left corner plus a width and height.
uint8_t bj_get_window_flags(struct bj_window *window, uint8_t flags)
void(* bj_window_draw_fn)(struct bj_window *window, struct bj_render_target *target, const struct bj_rect *dirty, void *user_data)
Redraw callback signature.
void bj_set_window_fullscreen(struct bj_window *window, bj_bool enable)
bj_bool bj_window_has_flag(struct bj_window *window, uint8_t flag)
Report whether a window has a given flag set.
void bj_set_draw_callback(struct bj_window *window, bj_window_draw_fn fn, void *user_data)
static void bj_invalidate_window(struct bj_window *window)
Mark the whole window as needing a repaint.
bj_bool bj_window_should_close(struct bj_window *window)
Report whether a window's close flag is set.
struct bj_window * bj_create_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 window with the given attributes.
void bj_set_window_draw_callback(struct bj_window *window, bj_window_draw_fn fn, void *user_data)
Register the redraw callback for window.
void bj_set_window_should_close(struct bj_window *window)
Flag a window to be closed.
bj_bool bj_is_window_fullscreen(struct bj_window *window)
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)
void bj_window_leave_fullscreen(struct bj_window *window)
Return window from fullscreen to a normal window.
int bj_get_key(const struct bj_window *window, int key)
bj_window_flag
A set of flags describing some properties of a bj_window.
void bj_window_enter_fullscreen(struct bj_window *window)
Put window into fullscreen.
bj_bool bj_window_is_key_pressed(const struct bj_window *window, int key)
Report whether a key is currently held down on a window.
void bj_set_resize_callback(struct bj_window *window, bj_window_resize_fn fn, void *user_data)
struct bj_bitmap * bj_render_target_bitmap(struct bj_render_target *target)
Reach the software framebuffer behind a render target.
void(* bj_window_resize_fn)(struct bj_window *window, int width, int height, void *user_data)
Window-resize callback signature.
bj_bool bj_window_is_fullscreen(struct bj_window *window)
Report whether window is currently fullscreen.
void bj_set_window_resize_callback(struct bj_window *window, bj_window_resize_fn fn, void *user_data)
Register the resize callback for window.
uint8_t bj_window_flags(struct bj_window *window)
Return all of a window's flags.
int bj_window_size(const struct bj_window *window, int *width, int *height)
Retrieve a window's drawable size, in pixels.
bj_bool bj_should_close_window(struct bj_window *window)
void bj_unbind_window(struct bj_window *window)
void bj_destroy_window(struct bj_window *window)
Destroy a window and release its resources.
int bj_get_window_size(const struct bj_window *window, int *width, int *height)
void bj_invalidate_rect(struct bj_window *window, const struct bj_rect *rect)
Mark a region of window as needing a repaint.
@ BJ_WINDOW_FLAG_NONE
No Flag.
@ BJ_WINDOW_FLAG_FULLSCREEN
Start the window fullscreen (see bj_window_enter_fullscreen).
@ BJ_WINDOW_FLAG_KEY_REPEAT
Key repeat event is enabled (see bj_set_key_callback).
@ BJ_WINDOW_FLAG_RESIZABLE
User may resize the window.
@ BJ_WINDOW_FLAG_ALL
All flags set.
@ BJ_WINDOW_FLAG_CLOSE
Window should be closed by the application.
Axis-aligned rectangle in pixel coordinates.