Banjo API 0.0.1
C99 game development API
Loading...
Searching...
No Matches
Video

Data Structures

struct  bj_video_layer_t
struct  bj_video_layer_create_info

Typedefs

typedef void(* bj_window_end_fn_t) (struct bj_video_layer_t *p_layer, bj_error **p_error)
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)
typedef void(* bj_window_delete_window_fn_t) (struct bj_video_layer_t *p_layer, bj_window *p_window)
typedef void(* bj_window_poll_events_fn_t) (struct bj_video_layer_t *p_layer)
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)
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)
typedef void(* bj_window_flush_framebuffer_fn_t) (struct bj_video_layer_t *p_layer, const bj_window *p_window)
typedef struct bj_video_layer_t bj_video_layer

Detailed Description

Manage window creation and pixel-based drawing.

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.


Data Structure Documentation

◆ bj_video_layer_t

struct bj_video_layer_t

Structure describing a video layer backend.

This contains all the function pointers that define the backend behavior, as well as backend-specific data.

See also
bj_video_layer_create_info
Collaboration diagram for bj_video_layer_t:
Data Fields
bj_window_create_window_fn_t create_window Create a window.
bj_window_create_framebuffer_fn_t create_window_framebuffer Create a framebuffer.
struct bj_video_layer_data_t * data Backend-specific data.
bj_window_delete_window_fn_t delete_window Delete a window.
bj_window_end_fn_t end Terminate the video layer.
bj_window_flush_framebuffer_fn_t flush_window_framebuffer Present framebuffer.
bj_window_get_size_fn_t get_window_size Retrieve window dimensions.
bj_window_poll_events_fn_t poll_events Poll window events.

◆ bj_video_layer_create_info

struct bj_video_layer_create_info

Structure used to declare a video backend implementation.

This is registered during initialization to allow choosing the appropriate video layer at runtime.

See also
bj_video_layer
Collaboration diagram for bj_video_layer_create_info:
Data Fields
bj_video_layer *(*)(bj_error **p_error) create Function to create the backend.
const char * name Name of the video backend.

Typedef Documentation

◆ bj_video_layer

Structure describing a video layer backend.

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

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.

The framebuffer is a pixel buffer that can be written to by the application and later flushed to the screen.

Parameters
p_layerPointer to the video layer.
p_windowTarget window.
p_errorOutput 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)

Define a function used to create a new window.

Parameters
p_layerPointer to the video layer.
titleTitle of the window.
xInitial x position of the window.
yInitial y position of the window.
widthWidth of the window in pixels.
heightHeight of the window in pixels.
flagsWindow 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

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.

Parameters
p_layerPointer to the video layer.
p_windowWindow to destroy.
See also
bj_window

◆ bj_window_end_fn_t

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.

This function is called to release all resources associated with the layer.

Parameters
p_layerPointer to the video layer.
p_errorOutput error pointer.
See also
bj_video_layer

◆ bj_window_flush_framebuffer_fn_t

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.

This is typically called after rendering to the framebuffer.

Parameters
p_layerPointer to the video layer.
p_windowTarget 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)

Define a function used to retrieve the size of a window.

Parameters
p_layerPointer to the video layer.
p_windowTarget window.
p_widthOutput width in pixels.
p_heightOutput height in pixels.
Returns
1 on success, 0 on failure.
See also
bj_window

◆ bj_window_poll_events_fn_t

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.

Parameters
p_layerPointer to the video layer.
See also
bj_dispatch_events