Resolution independent 2D graphics engine
qr::key_var_mapper

Class Description

Event receiver which maps the current state of the keyboard into a tree variable of type qr::keyarr (std::vector of bool) on the node which the event receiver is attached to. Like any other scene graph variable this array can be accessed using the get_var method on the attached node, or any of its children. The element of the array representing a particular keysym will be true if the key is down and false if it is up. Inherits qr::event_receiver.

Public Methods

key_var_mapper (std::string var_name)

Protected Methods

void on_attach (scene_node *node)
void on_event (scene_node *node, event *n_event)
void on_detach (scene_node *node)

Details

qr::key_var_mapper::key_var_mapper ( std::string var_name
)

Description

Set the name of the tree variable

Paramiters

var_name Tree variable name
void qr::key_var_mapper::on_attach ( scene_node * node
) [protected, virtual]

Description

Create the tree variable for the key states with the provided name.

Paramiters

node
void qr::key_var_mapper::on_event ( scene_node * node,
event * n_event
) [protected, virtual]

Description

Detects key events and set the corresponding element of the keys array.

Paramiters

node
n_event
void qr::key_var_mapper::on_detach ( scene_node * node
) [protected, virtual]

Description

Delete the tree variable on detach.

Paramiters

node