NAME

TCOD::Mouse - A representation of a mouse 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 $mouse->mbutton_pressed;

DESCRIPTION

This represents a TCOD mouse 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

x

The horizontal coordinate of the mouse cursor in pixels.

y

The vertical coordinate of the mouse cursor in pixels.

dx

The change in pixels in the horizontal coordinate of the mouse cursor.

dy

The change in pixels in the vertical coordinate of the mouse cursor.

cx

The horizontal coordinate of the mouse cursor in cells.

cy

The vertical coordinate of the mouse cursor in cells.

dcx

The change in cells in the horizontal coordinate of the mouse cursor.

dcy

The change in cells in the vertical coordinate of the mouse cursor.

lbutton

True if the left mouse button is pressed.

rbutton

True if the right mouse button is pressed.

mbutton

True if the middle mouse button or wheel is pressed.

lbutton_pressed

True if the left mouse button was pressed and released.

rbutton_pressed

True if the right mouse button was pressed and released.

mbutton_pressed

True if the middle mouse button or wheel was pressed and released.

wheel_up

True if the wheel was rolled up.

wheel_down

True if the wheel was rolled down.

FUNCTIONS

show_cursor

TCOD::Mouse::show_cursor( $bool );

By default, the mouse cursor in visible in windowed mode, hidden in fullscreen mode. You can change it with this function.

is_cursor_visible

$bool = TCOD::Mouse::is_cursor_visible;

Get the current status of the mouse cursor (visible or hidden).

move

TCOD::Mouse::move( $x, $y );

Set the cursor position (in pixel coordinates, where (0,0) is the top-left corner).

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.