The Perl and Raku Conference 2025: Greenville, South Carolina - June 27-29 Learn more

use 5.38.0;
use experimental 'class';
package Game::Snake::Text 0.10;
class Game::Snake::Text {
our $VERSION = 0.10;
field $size : param;
field $x : param;
field $y : param;
field $text : param = "";
field $color : param = Raylib::Color::WHITE;
method draw ($text, @position) {
@position = ($x, $y) unless @position;
DrawText( $text, @position, $size, $color );
}
method text (@txt) {
$text = $txt[0] if @txt;
$text;
}
}
1;
=pod
=cut