| 1 | use 5.38.0; | ||
| 2 | use experimental 'class'; | ||
| 3 | |||
| 4 | package Game::Snake::Cell 0.11; | ||
| 5 | class Game::Snake::Cell { | ||
| 6 | our $VERSION = 0.11; | ||
| 7 | use Raylib::FFI; | ||
| 8 | use Raylib::Color; | ||
| 9 | field $x : param = 0; | ||
| 10 | field $y : param = 0; | ||
| 11 | field $width : param = 20; | ||
| 12 | field $height : param = 20; | ||
| 13 | field $color : param; | ||
| 14 | |||
| 15 | method x () { $x } | ||
| 16 | method y () { $y } | ||
| 17 | |||
| 18 | method draw { | ||
| 19 | my ($self) = @_; | ||
| 20 | my $rectangle = Raylib::FFI::Rectangle->new( | ||
| 21 | x => $x, | ||
| 22 | y => $y, | ||
| 23 | width => $width, | ||
| 24 | height => $height | ||
| 25 | ); | ||
| 26 | DrawRectangleRec($rectangle, $color); | ||
| 27 | #DrawRectangleLines($x, $y, $width, $height, Raylib::Color::WHITE); | ||
| 28 | } | ||
| 29 | } | ||
| 30 | 1; | ||
| 31 | |||
| 32 | =pod | ||
| 33 | |||
| 34 | =cut |