The manual
ginnOS
The reference: libc, the libraries and the kernel
Loading...
Searching...
No Matches
canvas.c File Reference

a widget the program draws itself (a terminal, a game). More...

#include "idunn_internal.h"
#include <stdlib.h>

Functions

idunn_widget_t * idunn_canvas (const idunn_canvas_hooks_t *hooks, void *data)
 a widget the program draws itself: a terminal, a game.
void idunn_canvas_damage (idunn_widget_t *canvas, gfx_rect_t r)
 draw a rect of the canvas again (canvas coordinates)
void idunn_canvas_update (idunn_widget_t *canvas)
 a frame soon, so the frame hook runs (new data came)
void idunn_canvas_move (idunn_widget_t *canvas, gfx_rect_t area, int32_t dy)
 in the frame hook: move the pixels of area up (dy < 0) or down; the strip that comes into view is damaged.
void idunn_canvas_copy (idunn_widget_t *canvas, const char *text, size_t length)
 put text on the clipboard; ask for its text (an IDUNN_INPUT_PASTE comes)
void idunn_canvas_paste (idunn_widget_t *canvas)
void idunn_canvas_wake (idunn_widget_t *canvas, uint32_t ms)
 an IDUNN_INPUT_TIMER in ms (one at a time; a new call moves it)
void idunn_canvas_set_cursor (idunn_widget_t *canvas, uint32_t shape)
 the pointer shape over the canvas (IDUNN_CURSOR_)

Detailed Description

a widget the program draws itself (a terminal, a game).

the program gives hooks: draw the part of the window it is told to, take the input, hear of a new size, and (before a frame is drawn) move pixels that only moved. idunn lays the canvas out, gives it the keyboard and the pointer, and sends only the damaged parts.

Function Documentation

◆ idunn_canvas()

idunn_widget_t * idunn_canvas ( const idunn_canvas_hooks_t * hooks,
void * data )

a widget the program draws itself: a terminal, a game.

it takes the keyboard (Tab too), the pointer and the wheel. it is as large as its box lets it grow, or idunn_set_size.

◆ idunn_canvas_damage()

void idunn_canvas_damage ( idunn_widget_t * canvas,
gfx_rect_t r )

draw a rect of the canvas again (canvas coordinates)

◆ idunn_canvas_update()

void idunn_canvas_update ( idunn_widget_t * canvas)

a frame soon, so the frame hook runs (new data came)

◆ idunn_canvas_move()

void idunn_canvas_move ( idunn_widget_t * canvas,
gfx_rect_t area,
int32_t dy )

in the frame hook: move the pixels of area up (dy < 0) or down; the strip that comes into view is damaged.

◆ idunn_canvas_copy()

void idunn_canvas_copy ( idunn_widget_t * canvas,
const char * text,
size_t length )

put text on the clipboard; ask for its text (an IDUNN_INPUT_PASTE comes)

◆ idunn_canvas_paste()

void idunn_canvas_paste ( idunn_widget_t * canvas)

◆ idunn_canvas_wake()

void idunn_canvas_wake ( idunn_widget_t * canvas,
uint32_t ms )

an IDUNN_INPUT_TIMER in ms (one at a time; a new call moves it)

◆ idunn_canvas_set_cursor()

void idunn_canvas_set_cursor ( idunn_widget_t * canvas,
uint32_t shape )

the pointer shape over the canvas (IDUNN_CURSOR_)