NAME
Raylib::App - Perlish wrapper for Raylib videogame library
SYNOPSIS
use 5.38.2;
use lib qw(lib);
use Raylib::App;
my $app = Raylib::App->window( 800, 600, 'Testing!' );
$app->fps(5);
my $fps = Raylib::Text::FPS->new();
my $text = Raylib::Text->new(
text => 'Hello, world!',
color => Raylib::Color::WHITE,
size => 20,
);
while ( !$app->exiting ) {
my $x = $app->width() / 2;
my $y = $app->height / 2;
$app->draw(
sub {
$app->clear();
$fps->draw();
$text->draw( $x, $y );
}
);
}
raylib
raylib is highly inspired by Borland BGI graphics lib and by XNA framework. Allegro and SDL have also been analyzed for reference.
NOTE for ADVENTURERS: raylib is a programming library to learn videogames programming; no fancy interface, no visual helpers, no auto-debugging... just coding in the most pure spartan-programmers way. Are you ready to learn? Jump to code examples or games!
DESCRIPTION
This module is a port of the Graphics::Raylib module to use Raylib::FFI instead of Graphics::Raylib::XS. It should be a drop-in replacement for Graphics::Raylib, but it is a work in progress.
METHODS
- new((%args)
-
Create a new Raylib::App object. The following arguments are accepted:
- title (defaults to $0)
-
The tile of the application and the window. Defaults to the name of the script.
- width
-
The width of the window.
- height
-
The height of the window.
- fps (defaults to 60)
-
The frames per second to target. Defaults to 60.
- background (defaults to Raylib::Color::BLACK)
-
The background color of the window, defaults to Raylib::Color::Black.
- window($width, $height, [$title = $0])
-
An alternate constructor for creating a new Raylib::App object. This method mirrors the API from Graphics::Raylib.
- fps([$new_fps])
-
Get or set the frames per second for the application.
- clear([$new_color])
-
Clear the window with the given color. If no color is given, the background color for the app is used.
- exiting()
-
Returns true if the window should close.
- draw($code)
-
Begins drawing, calls
$code->()
and ends drawing. - draws(@drawables)
-
Begins drawing, calls
draw
on each object in the list, and ends drawing. - draw3d($code)
-
Begins drawing in 3D, calls
$code->()
and ends drawing. - screenshot([$file])
-
Take a screenshot of the window and save it to the given file. If no file is given, a default filename based on the current timestamp is used.
- height() / width()
-
Get the height or width of the window.
SEE ALSO
AUTHOR
Chris Prather <chris@prather.org>
Based on the work of:
Ahmad Fatoum <athreef@cpan.org>
, http://a3f.at
COPYRIGHT AND LICENSE
This software is copyright (c) 2024 by Chris Prather.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
RAYLIB LICENSE
This is an unofficial wrapper of http://www.raylib.com.
raylib is Copyright (c) 2013-2016 Ramon Santamaria and available under the terms of the zlib/libpng license. Refer to XS/LICENSE.md
for full terms.
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 241:
=back without =over