Functions | |
caca_display_t * | caca_create_display (cucul_canvas_t *) |
Attach a caca graphical context to a cucul canvas. | |
int | caca_free_display (caca_display_t *) |
Detach a caca graphical context from a cucul backend context. | |
cucul_canvas_t * | caca_get_canvas (caca_display_t *) |
Get the canvas attached to a caca graphical context. | |
int | caca_refresh_display (caca_display_t *) |
Flush pending changes and redraw the screen. | |
int | caca_set_display_time (caca_display_t *, unsigned int) |
Set the refresh delay. | |
unsigned int | caca_get_display_time (caca_display_t const *) |
Get the display's average rendering time. | |
unsigned int | caca_get_display_width (caca_display_t const *) |
Get the display width. | |
unsigned int | caca_get_display_height (caca_display_t const *) |
Get the display height. | |
int | caca_set_display_title (caca_display_t *, char const *) |
Set the display title. | |
int | caca_set_mouse (caca_display_t *, int) |
Show or hide the mouse pointer. | |
int | caca_set_cursor (caca_display_t *, int) |
Show or hide the cursor. | |
char const * | caca_get_version (void) |
Return the libcaca version. |
caca_display_t* caca_create_display | ( | cucul_canvas_t * | cv | ) |
Create a graphical context using device-dependent features (ncurses for terminals, an X11 window, a DOS command window...) that attaches to a libcucul canvas. Everything that gets drawn in the libcucul canvas can then be displayed by the libcaca driver.
If no cucul canvas is provided, a new one is created. Its handle can be retrieved using caca_get_canvas() and it is automatically destroyed when caca_free_display() is called.
If an error occurs, NULL is returned and errno is set accordingly:
ENOMEM
Not enough memory.ENODEV
Graphical device could not be initialised.
cv | The cucul cavas. |
int caca_free_display | ( | caca_display_t * | dp | ) |
Detach a graphical context from its cucul backend and destroy it. The libcucul canvas continues to exist and other graphical contexts can be attached to it afterwards.
If the cucul canvas was automatically created by caca_create_display(), it is automatically destroyed and any handle to it becomes invalid.
This function never fails.
dp | The libcaca graphical context. |
cucul_canvas_t* caca_get_canvas | ( | caca_display_t * | dp | ) |
Return a handle on the cucul_canvas_t object that was either attached or created by caca_create_display().
This function never fails.
dp | The libcaca graphical context. |
int caca_refresh_display | ( | caca_display_t * | dp | ) |
Flush all graphical operations and print them to the display device. Nothing will show on the screen until this function is called.
If caca_set_display_time() was called with a non-zero value, caca_refresh_display() will use that value to achieve constant framerate: if two consecutive calls to caca_refresh_display() are within a time range shorter than the value set with caca_set_display_time(), the second call will be delayed before performing the screen refresh.
This function never fails.
dp | The libcaca display context. |
int caca_set_display_time | ( | caca_display_t * | dp, | |
unsigned int | usec | |||
) |
Set the refresh delay in microseconds. The refresh delay is used by caca_refresh_display() to achieve constant framerate. See the caca_refresh_display() documentation for more details.
If the argument is zero, constant framerate is disabled. This is the default behaviour.
This function never fails.
dp | The libcaca display context. | |
usec | The refresh delay in microseconds. |
unsigned int caca_get_display_time | ( | caca_display_t const * | dp | ) |
Get the average rendering time, which is the average measured time between two caca_refresh_display() calls, in microseconds. If constant framerate was activated by calling caca_set_display_time(), the average rendering time will be close to the requested delay even if the real rendering time was shorter.
This function never fails.
dp | The libcaca display context. |
unsigned int caca_get_display_width | ( | caca_display_t const * | dp | ) |
If libcaca runs in a window, get the usable window width. This value can be used for aspect ratio calculation. If libcaca does not run in a window or if there is no way to know the font size, most drivers will assume a 6x10 font is being used. Note that the units are not necessarily pixels.
This function never fails.
dp | The libcaca display context. |
unsigned int caca_get_display_height | ( | caca_display_t const * | dp | ) |
If libcaca runs in a window, get the usable window height. This value can be used for aspect ratio calculation. If libcaca does not run in a window or if there is no way to know the font size, assume a 6x10 font is being used. Note that the units are not necessarily pixels.
This function never fails.
dp | The libcaca display context. |
int caca_set_display_title | ( | caca_display_t * | dp, | |
char const * | title | |||
) |
If libcaca runs in a window, try to change its title. This works with the ncurses, S-Lang, OpenGL, X11 and Win32 drivers.
If an error occurs, -1 is returned and errno is set accordingly:
ENOSYS
Display driver does not support setting the window title.
dp | The libcaca display context. | |
title | The desired display title. |
int caca_set_mouse | ( | caca_display_t * | dp, | |
int | flag | |||
) |
Show or hide the mouse pointer. This function works with the ncurses, S-Lang and X11 drivers.
If an error occurs, -1 is returned and errno is set accordingly:
ENOSYS
Display driver does not support hiding the mouse pointer.
dp | The libcaca display context. | |
flag | 0 hides the pointer, 1 shows the system's default pointer (usually an arrow). Other values are reserved for future use. |
int caca_set_cursor | ( | caca_display_t * | dp, | |
int | flag | |||
) |
Show or hide the cursor, for devices that support such a feature.
If an error occurs, -1 is returned and errno is set accordingly:
ENOSYS
Display driver does not support showing the cursor.
dp | The libcaca display context. | |
flag | 0 hides the cursor, 1 shows the system's default cursor (usually a white rectangle). Other values are reserved for future use. |
char const* caca_get_version | ( | void | ) |
Return a read-only string with the libcaca version information.
This function never fails.