NAME

Graphics::Raylib::Keyboard - Deal with Keyboard Input

VERSION

version 0.008

SYNOPSIS

use Graphics::Raylib::Keyboard;

$key = Graphics::Raylib::Keyboard->new; # More concise this way
print "a is pressed down\n" if $key->down('a');
print "b is not being pressed down\n" if $key->up('a');
print "last key pressed is ", $key->latest, "\n";

KEY CODES in Graphics::Raylib::Keyboard namespace

KEY_SPACE KEY_ESCAPE KEY_ENTER KEY_BACKSPACE KEY_RIGHT KEY_LEFT KEY_DOWN KEY_UP KEY_F1
KEY_F2 KEY_F3 KEY_F4 KEY_F5 KEY_F6 KEY_F7 KEY_F8 KEY_F9 KEY_F10 KEY_F11 KEY_F12
KEY_LEFT_SHIFT KEY_LEFT_CONTROL KEY_LEFT_ALT KEY_RIGHT_SHIFT KEY_RIGHT_CONTROL
KEY_RIGHT_ALT KEY_ZERO KEY_ONE KEY_TWO KEY_THREE KEY_FOUR KEY_FIVE KEY_SIX KEY_SEVEN
KEY_EIGHT KEY_NINE KEY_A KEY_B KEY_C KEY_D KEY_E KEY_F KEY_G KEY_H KEY_I KEY_J KEY_K
KEY_L KEY_M KEY_N KEY_O KEY_P KEY_Q KEY_R KEY_S KEY_T KEY_U KEY_V KEY_W KEY_X KEY_Y KEY_Z

Sample usage:

use Graphics::Raylib::Keyboard ':keys'; # imports keys
use Graphics::Raylib::Keyboard ':all';  # imports keys and possibly more
use Graphics::Raylib '+family';         # implies use Graphics::Raylib::Keyboard ':all';
# alternatively write the namespace in front, e.g.:
Graphics::Raylib::Keyboard::KEY_NINE

METHODS AND ARGUMENTS

new()

Optional. Returns a Graphics::Raylib::Keyboard object that saves you typing that prefix all the time.

pressed([$key])

Returns last pressed key. if a $key argument is supplied, detects if that given key has been pressed once.

down($key)

Detects if key is being pressed down

released($key)

Detects if a key has been released once

up($key)

Detects if a key is NOT being pressed

$exit = exit() or $exit(KEY_ESCAPE)

L-value subroutine to access the key used to exit the program

$keyboard = Graphics::Raylib::Keyboard->new; # More concise this way
print "Exit key is ",  $key->exit, "\n";
$key->exit(Graphics::Raylib::Keyboard::KEY_ENTER); # Lets use the Enter key instead of Escape

GIT REPOSITORY

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

SEE ALSO

Graphics-Raylib

Graphics-Raylib-XS

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.