Banjo API 1.0.0-rc.2
Low-level C99 game development API
Loading...
Searching...
No Matches
window.h
Go to the documentation of this file.
1
97
98#ifndef BJ_WINDOW_H
99#define BJ_WINDOW_H
100
101#include <banjo/api.h>
102#include <banjo/error.h>
103#include <banjo/rect.h>
104
106struct bj_window;
107
120struct bj_render_target;
121
138typedef void (*bj_window_draw_fn)(
139 struct bj_window* window,
140 struct bj_render_target* target,
141 const struct bj_rect* dirty,
142 void* user_data
143);
144
171typedef void (*bj_window_resize_fn)(
172 struct bj_window* window,
173 int width,
174 int height,
175 void* user_data
176);
177
194#ifndef BJ_NO_TYPEDEF
196#endif
197
221 const char* title,
222 uint16_t x,
223 uint16_t y,
224 uint16_t width,
225 uint16_t height,
226 uint8_t flags,
227 struct bj_error** error
228);
229
236 struct bj_window* window
237);
238
257 struct bj_window* window
258);
259
271 struct bj_window* window
272);
273
288 struct bj_window* window,
289 uint8_t flags
290);
291
304 const struct bj_window* window,
305 int key
306);
307
330 const struct bj_window* window,
331 int* width,
332 int* height
333);
334
356 struct bj_window* window,
358 void* user_data
359);
360
392 struct bj_window* window,
394 void* user_data
395);
396
422
435
457 struct bj_window* window,
458 const struct bj_rect* rect
459);
460
470static inline void bj_invalidate_window(struct bj_window* window) {
472}
473
496 struct bj_render_target* target
497);
498
499
500#endif
General-purpose definitions for Banjo API.
bj_window * window
Definition bitmap_blit.c:24
Recoverable error handling.
struct bj_render_target bj_render_target
Definition api.h:346
struct bj_error bj_error
Definition api.h:333
#define BANJO_EXPORT
Definition api.h:163
uint32_t bj_bool
Boolean type used throughout the Banjo API.
Definition api.h:257
struct bj_bitmap bj_bitmap
Definition api.h:328
struct bj_window bj_window
Definition api.h:354
Axis-aligned rectangle: a top-left corner plus a width and height.
Definition rect.h:33
uint8_t bj_get_window_flags(struct bj_window *window, uint8_t flags)
Get window 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.
Definition window.h:138
void bj_set_window_fullscreen(struct bj_window *window, bj_bool enable)
Enter or leave fullscreen on window.
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.
Definition window.h:470
void bj_set_window_should_close(struct bj_window *window)
Flag a given window to be closed.
bj_bool bj_is_window_fullscreen(struct bj_window *window)
Report whether window is currently fullscreen.
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.
int bj_get_key(const struct bj_window *window, int key)
Query the current state of a key for a given window.
bj_window_flag
A set of flags describing some properties of a bj_window.
Definition window.h:186
void bj_set_resize_callback(struct bj_window *window, bj_window_resize_fn fn, void *user_data)
Register the resize callback for window.
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.
Definition window.h:171
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.
int bj_get_window_size(const struct bj_window *window, int *width, int *height)
Retrieve the size of the window.
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.
Definition window.h:187
@ BJ_WINDOW_FLAG_FULLSCREEN
Start the window fullscreen (see bj_set_window_fullscreen).
Definition window.h:191
@ BJ_WINDOW_FLAG_KEY_REPEAT
Key repeat event is enabled (see bj_set_key_callback).
Definition window.h:189
@ BJ_WINDOW_FLAG_RESIZABLE
User may resize the window.
Definition window.h:190
@ BJ_WINDOW_FLAG_ALL
All flags set.
Definition window.h:192
@ BJ_WINDOW_FLAG_CLOSE
Window should be closed by the application.
Definition window.h:188
Axis-aligned rectangle in pixel coordinates.