The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Graphics::Raylib::Shape - Collection of drawable shapes

VERSION

version 0.025

SYNOPSIS

    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;
    };

DESCRIPTION

Basic geometric shapes that can be drawn while in a Graphics::Raylib::draw block.

Coordinates and width/height pairs are represented as array-refs to 2 elements

METHODS AND ARGUMENTS

draw()

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];
    }
pixel( position => [$x, $y], color => $color )

Prepares a single pixel for drawing.

line( start => [$x, $y], end => [$x, $y], color => $color )

Prepares a line for drawing.

circle( center => [$x, $y], radius => $r, color => $color )

Prepares a circle for drawing.

rectangle( position => [$x, $y], size => [$width, $height], color => $color )

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.

triangle( vertices => [ [$x1,$y1], [$x2,$y2], [$x3,$y3] ], color => $color )

Prepares a triangle for drawing.

GIT REPOSITORY

http://github.com/athreef/Graphics-Raylib

SEE ALSO

Graphics::Raylib Graphics::Raylib::Color

AUTHOR

Ahmad Fatoum <athreef@cpan.org>, http://a3f.at

COPYRIGHT AND LICENSE

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.