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

NAME

Graphics::Raylib::Util - Utility functions for use With Graphics::Raylib::XS

VERSION

version 0.025

SYNOPSIS

# returns Graphics::Raylib::XS::{Vector2,Vector3, Vector4} depending on scalar @coords
my $vector = Graphics::Raylib::Util::vector(@coords);

DESCRIPTION

Raylib deals a lot in value-passed structs. This module builds these structs.

METHODS AND ARGUMENTS

vector(@coords)

Constructs a Graphics::Raylib::XS::Vector2, Graphics::Raylib::XS::Vector3 or Graphics::Raylib::XS::Vector4 depending on number of arguments. Croaks otherwise.

typedef struct Vector2 {
float x;
float y;
} Vector2;
typedef struct Vector3 {
float x;
float y;
float z;
} Vector3;
typedef struct Vector4 {
float x;
float y;
float z;
float w;
} Vector3;
rectangle(x => $x, y => $y, width => $width, height => $height) or rectangle(position => $posVector2, size => $sizeVector2)

Constructs a Graphics::Raylib::XS::Rectangle.

camera3d(position => $pos3d, target => $target3d, up => $up3d, fovy => $fovy)

Constructs a Graphics::Raylib::XS::Camera3D.

typedef struct Camera3D {
Vector3 position;
Vector3 target;
Vector3 up;
float fovy;
int type;
} Camera3D;
image(data => $str, size => [$width, $height], [ mipmaps => 1, format => UNCOMPRESSED_R8G8B8A8 ])

Constructs a Graphics::Raylib::XS::Image.

typedef struct Image {
void *data; // Image raw data
int width; // Image base width
int height; // Image base height
int mipmaps; // Mipmap levels, 1 by default
int format; // Data format (PixelFormat type)
} Image;

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.