### ----------------------------------------------------
### -- Terminal::Caca
### -- Licenses: MIT
### -- Authors: Ahmad M. Zawawi
### -- File: examples/00-hello-world-raw.raku
### ----------------------------------------------------
#!/usr/bin/env raku

use v6;
use Terminal::Caca::Raw;

# Initialize library
my $NULL = CacaDisplay.new;
my $dp   = caca_create_display($NULL);
my $cv   = caca_get_canvas($dp);

# Set window title
caca_set_display_title($dp, "Raku rocks");

# Say hello world
my $text = ' Hello world, from Raku! ';
caca_set_color_ansi($cv, CACA_WHITE, CACA_BLUE);
caca_put_str($cv, 10, 10, $text);

# Draw an ASCII-art box around it
caca_draw_thin_box($cv, 9, 9, $text.chars + 2, 3);

# Refresh display
caca_refresh_display($dp);

# Wait for a key press event
caca_get_event($dp, CACA_EVENT_KEY_PRESS, $NULL, -1);

# Clean up library
caca_free_display($dp);


