Banjo API 0.0.1
Multi-purpose C99 API
Loading...
Searching...
No Matches
window.h File Reference

Header file for bj_window type.

#include <banjo/api.h>
#include <banjo/bitmap.h>
#include <banjo/input.h>
#include <banjo/memory.h>
Include dependency graph for window.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef struct bj_window_t bj_window
 Opaque typedef for the window type.
 
typedef enum bj_window_flag_t bj_window_flag
 A set of flags describing some properties of a bj_window.
 
typedef void(* bj_window_enter_event_t) (bj_window *p_window, bj_bool enter, int x, int y)
 Callback type for functions called when the mouse cursor enters a window.
 
typedef void(* bj_window_cursor_event_t) (bj_window *p_window, int x, int y)
 Callback type for functions called when the mouse cursor position changes.
 
typedef void(* bj_window_button_event_t) (bj_window *p_window, int, bj_event_action action, int x, int y)
 Callback type for functions called when a mouse button is pressed or released.
 
typedef void(* bj_window_key_event_t) (bj_window *p_window, bj_event_action action, bj_key key, int scancode)
 Callback type for functions called when a keyboard key is pressed or released.
 

Enumerations

enum  bj_window_flag_t { BJ_WINDOW_FLAG_NONE = 0x00 , BJ_WINDOW_FLAG_CLOSE = 0x01 , BJ_WINDOW_FLAG_KEY_REPEAT = 0x02 , BJ_WINDOW_FLAG_ALL = 0xFF }
 A set of flags describing some properties of a bj_window. More...
 

Functions

bj_windowbj_window_new (const char *p_title, uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint8_t flags)
 Create a new bj_window with the specified attributes.
 
void bj_window_del (bj_window *p_window)
 Deletes a bj_window object and releases associated memory.
 
void bj_window_set_should_close (bj_window *p_window)
 Flag a given window to be closed.
 
bj_bool bj_window_should_close (bj_window *p_window)
 Get the close flag state of a window.
 
bj_window_cursor_event_t bj_window_set_cursor_event (bj_window *p_window, bj_window_cursor_event_t p_callback)
 Set the callback for cursor events.
 
bj_window_button_event_t bj_window_set_button_event (bj_window *p_window, bj_window_button_event_t p_callback)
 Set the callback for button events.
 
bj_window_key_event_t bj_window_set_key_event (bj_window *p_window, bj_window_key_event_t p_callback)
 Set the callback for key events.
 
void bj_close_on_escape (bj_window *, bj_event_action, bj_key, int)
 An event call back for closing the window when escape key is pressed.
 
bj_window_enter_event_t bj_window_set_enter_event (bj_window *p_window, bj_window_enter_event_t p_callback)
 Set the callback for enter events.
 
uint8_t bj_window_get_flags (bj_window *p_window, uint8_t flags)
 Get window flags.
 
void bj_poll_events (void)
 Polls all pending events and dispatch them to callbacks.
 
bj_bitmapbj_window_get_framebuffer (bj_window *p_window, bj_error **p_error)
 Return the framebuffer attached to the window.
 
int bj_window_get_size (const bj_window *p_window, int *width, int *height)
 Retrieve the size of the window.
 
void bj_window_update_framebuffer (bj_window *p_window)
 Copy window's framebuffer onto screen.