| 1 | use 5.38.0; | ||
| 2 | use experimental 'class'; | ||
| 3 | package Game::Snake::Text 0.11; | ||
| 4 | class Game::Snake::Text { | ||
| 5 | our $VERSION = 0.11; | ||
| 6 | use Raylib::FFI; | ||
| 7 | use Raylib::Color; | ||
| 8 | |||
| 9 | field $size : param; | ||
| 10 | field $x : param; | ||
| 11 | field $y : param; | ||
| 12 | field $text : param = ""; | ||
| 13 | field $color : param = Raylib::Color::WHITE; | ||
| 14 | |||
| 15 | method draw ($text, @position) { | ||
| 16 | @position = ($x, $y) unless @position; | ||
| 17 | DrawText( $text, @position, $size, $color ); | ||
| 18 | } | ||
| 19 | |||
| 20 | method text (@txt) { | ||
| 21 | $text = $txt[0] if @txt; | ||
| 22 | $text; | ||
| 23 | } | ||
| 24 | } | ||
| 25 | |||
| 26 | 1; | ||
| 27 | |||
| 28 | =pod | ||
| 29 | |||
| 30 | =cut |