libcaca-tutorial - Online Linux Manual PageSection : 3caca
Updated : Tue Jan 26 2021
Source : Version 0.99.beta19
Note : libcaca
NAMElibcaca-tutorial − A libcaca tutorial First, a very simple working program, to check for basic libcaca functionalities. #include <caca.h>
int main(void)
{
caca_canvas_t *cv; caca_display_t *dp; caca_event_t ev;
dp = caca_create_display(NULL);
if(!dp) return 1;
cv = caca_get_canvas(dp);
caca_set_display_title(dp, "Hello!");
caca_set_color_ansi(cv, CACA_BLACK, CACA_WHITE);
caca_put_str(cv, 0, 0, "This is a message");
caca_refresh_display(dp);
caca_get_event(dp, CACA_EVENT_KEY_PRESS, &ev, -1);
caca_free_display(dp);
return 0;
}What does it do? • Create a display. Physically, the display is either a window or a context in a terminal (ncurses, slang) or even the whole screen (VGA). • Get the display's associated canvas. A canvas is the surface where everything happens: writing characters, sprites, strings, images... It is unavoidable. Here the size of the canvas is set by the display. • Set the display's window name (only available in windowed displays, does nothing otherwise). • Set the current canvas colours to black background and white foreground. • Write the string 'This is a message' onto the canvas, using the current colour pair. • Refresh the display, causing the text to be effectively displayed. • Wait for an event of type CACA_EVENT_KEY_PRESS. • Free the display (release memory). Since it was created together with the display, the canvas will be automatically freed as well. You can then compile this code on an UNIX-like system using the following commans (requiring pkg-config and gcc): gcc `pkg-config --libs --cflags caca` example.c -o example
0
Johanes Gumabo
Data Size : 6,364 byte
man-libcaca-tutorial.3cacaBuild : 2024-12-05, 20:55 :
Visitor Screen : x
Visitor Counter ( page / site ) : 3 / 239,052
Visitor ID : :
Visitor IP : 3.149.254.35 :
Visitor Provider : AMAZON-02 :
Provider Position ( lat x lon ) : 39.962500 x -83.006100 : x
Provider Accuracy Radius ( km ) : 1000 :
Provider City : Columbus :
Provider Province : Ohio , : ,
Provider Country : United States :
Provider Continent : North America :
Visitor Recorder : Version :
Visitor Recorder : Library :
Online Linux Manual Page : Version : Online Linux Manual Page - Fedora.40 - march=x86-64 - mtune=generic - 24.12.05
Online Linux Manual Page : Library : lib_c - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Online Linux Manual Page : Library : lib_m - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Data Base : Version : Online Linux Manual Page Database - 24.04.13 - march=x86-64 - mtune=generic - fedora-38
Data Base : Library : lib_c - 23.02.07 - march=x86-64 - mtune=generic - fedora.36
Very long time ago, I have the best tutor, Wenzel Svojanovsky . If someone knows the email address of Wenzel Svojanovsky , please send an email to johanes_gumabo@yahoo.co.id .
If error, please print screen and send to johanes_gumabo@yahoo.co.id
Under development. Support me via PayPal.