The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

TCOD::Key - A representation of a key event

SYNOPSIS

    use TCOD;

    my $key   = TCOD::Key->new;
    my $mouse = TCOD::Mouse->new;

    TCOD::Sys::check_for_event( TCOD::EVENT_ANY, $key, $mouse );

    exit if $key->vk == TCOD::K_ESCAPE;

DESCRIPTION

This represents a TCOD key event. You will not normally be populating these objects. Most often you will create one, and pass it to one of the event listeners for it to be populated internally.

In effect, this is a read-only class.

SLOTS

vk

The keycode that has been pressed as one of the values in the Keycode enum. If no key has been pressed, this will be TCOD::K_NONE.

c

If the key is a printable character, this will hold that character as a string. Otherwise, it will be \0.

text

If the value of vk is TCOD::K_TEXT, this will hold the text that has been input.

pressed

True if a key has been pressed.

lalt

True if the left Alt key is pressed.

lctrl

True if the left Control key is pressed.

lmeta

True if the left Meta key is pressed.

ralt

True if the right Alt key is pressed.

rctrl

True if the right Control key is pressed.

rmeta

True if the right Meta key is pressed.

shift

True if the shift key is pressed.

SEE ALSO

TCOD
TCOD::Key
TCOD::Sys

COPYRIGHT AND LICENSE

Copyright 2021 José Joaquín Atria

This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.