Graphics::Raylib::Shape - Collection of drawable shapes
version 0.019
use Graphics::Raylib::Shape::Pixel; use Graphics::Raylib::Shape::Circle; use Graphics::Raylib::Shape::Rectangle; use Graphics::Raylib::Shape::Triangle; # example Graphics::Raylib::draw { Graphics::Raylib::Rectangle( position => [0,0], size => [10,10], color => Graphics::Raylib::Color::MAROON, )->draw; };
Basic geometric shapes that can be drawn while in a Graphics::Raylib::draw block.
Graphics::Raylib::draw
Coordinates and width/height pairs are represented as array-refs to 2 elements
Call this on any of the following shapes while in a Graphics::Raylib::draw block in order to draw the shape.
Wrap-around progress bar example:
use Graphics::Raylib; use Graphics::Raylib::Shape; use Graphics::Raylib::Color; my $block_size = 50; my $g = Graphics::Raylib->window($block_size*10, $block_size, "Test"); $g->fps(5); my $rect = Graphics::Raylib::Shape->rectangle( position => [1,0], size => [$block_size, $block_size], color => Graphics::Raylib::Color::DARKGREEN ); my $i = 0; while (!$g->exiting) { Graphics::Raylib::draw { $g->clear; $rect->draw; }; $i %= 10; $rect->{position} = [$i * $block_size, 0]; }
Prepares a single pixel for drawing.
Prepares a line for drawing.
Prepares a circle for drawing.
Prepares a solid color rectangle for drawing. if $color is an arrayref of 2 Colors, the fill color will be a gradient of those two.
Prepares a triangle for drawing.
http://github.com/athreef/Graphics-Raylib
Graphics::Raylib Graphics::Raylib::Color
Ahmad Fatoum <athreef@cpan.org>, http://a3f.at
<athreef@cpan.org>
Copyright (C) 2017 Ahmad Fatoum
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Graphics::Raylib, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Graphics::Raylib
CPAN shell
perl -MCPAN -e shell install Graphics::Raylib
For more information on module installation, please visit the detailed CPAN module installation guide.