Manage window creation and pixel-based drawing.
More...
The video API provides an abstraction for creating and managing platform-specific windows and their framebuffers. It supports event polling, framebuffer rendering, and resizing operations.
Each video backend implements this interface.
|
typedef void(* | bj_window_end_fn_t) (struct bj_video_layer_t *p_layer, bj_error **p_error) |
| Define a function used to terminate a video layer.
|
|
typedef bj_window *(* | bj_window_create_window_fn_t) (struct bj_video_layer_t *p_layer, const char *title, uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint8_t flags) |
| Define a function used to create a new window.
|
|
typedef void(* | bj_window_delete_window_fn_t) (struct bj_video_layer_t *p_layer, bj_window *p_window) |
| Define a function used to destroy an existing window.
|
|
typedef void(* | bj_window_poll_events_fn_t) (struct bj_video_layer_t *p_layer) |
| Define a function used to poll events for all windows.
|
|
typedef int(* | bj_window_get_size_fn_t) (struct bj_video_layer_t *p_layer, const bj_window *p_window, int *p_width, int *p_height) |
| Define a function used to retrieve the size of a window.
|
|
typedef bj_bitmap *(* | bj_window_create_framebuffer_fn_t) (struct bj_video_layer_t *p_layer, const bj_window *p_window, bj_error **p_error) |
| Define a function used to create a framebuffer for a window.
|
|
typedef void(* | bj_window_flush_framebuffer_fn_t) (struct bj_video_layer_t *p_layer, const bj_window *p_window) |
| Define a function used to present a framebuffer to the window surface.
|
|
typedef struct bj_video_layer_t | bj_video_layer |
| Structure describing a video layer backend.
|
|
◆ bj_video_layer_t
This contains all the function pointers that define the backend behavior, as well as backend-specific data.
- See also
- bj_video_layer_create_info
◆ bj_video_layer_create_info
struct bj_video_layer_create_info |
This is registered during initialization to allow choosing the appropriate video layer at runtime.
- See also
- bj_video_layer
Data Fields |
bj_video_layer *(*)(bj_error **p_error) |
create |
Function to create the backend. |
const char * |
name |
Name of the video backend. |
◆ bj_video_layer
This contains all the function pointers that define the backend behavior, as well as backend-specific data.
- See also
- bj_video_layer_create_info
◆ bj_window_create_framebuffer_fn_t
The framebuffer is a pixel buffer that can be written to by the application and later flushed to the screen.
- Parameters
-
p_layer | Pointer to the video layer. |
p_window | Target window. |
p_error | Output error pointer. |
- Returns
- A pointer to the new framebuffer, or NULL on error.
- See also
- bj_bitmap, bj_window
◆ bj_window_create_window_fn_t
typedef bj_window *(* bj_window_create_window_fn_t) (struct bj_video_layer_t *p_layer, const char *title, uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint8_t flags) |
- Parameters
-
p_layer | Pointer to the video layer. |
title | Title of the window. |
x | Initial x position of the window. |
y | Initial y position of the window. |
width | Width of the window in pixels. |
height | Height of the window in pixels. |
flags | Window creation flags. |
- Returns
- A pointer to the created window, or NULL on failure.
- See also
- bj_window, bj_video_layer
◆ bj_window_delete_window_fn_t
- Parameters
-
p_layer | Pointer to the video layer. |
p_window | Window to destroy. |
- See also
- bj_window
◆ bj_window_end_fn_t
This function is called to release all resources associated with the layer.
- Parameters
-
p_layer | Pointer to the video layer. |
p_error | Output error pointer. |
- See also
- bj_video_layer
◆ bj_window_flush_framebuffer_fn_t
This is typically called after rendering to the framebuffer.
- Parameters
-
p_layer | Pointer to the video layer. |
p_window | Target window. |
- See also
- bj_window, bj_bitmap
◆ bj_window_get_size_fn_t
typedef int(* bj_window_get_size_fn_t) (struct bj_video_layer_t *p_layer, const bj_window *p_window, int *p_width, int *p_height) |
- Parameters
-
p_layer | Pointer to the video layer. |
p_window | Target window. |
p_width | Output width in pixels. |
p_height | Output height in pixels. |
- Returns
- 1 on success, 0 on failure.
- See also
- bj_window
◆ bj_window_poll_events_fn_t