CRpoll_event | R Documentation |
Polls next event in event queue provided in graphics_list.
CRpoll_event(graphics_list, status = NULL)
graphics_list |
List containing pointers to window, renderer etc. created with |
status |
Optional list |
CRpoll_event
returns a response_list.
Distinguish type of response (keyboard, mouse, etc.) by element type. Possible types are "key_down", "key_up", "mouse_button_down", "mouse_button_up", "mouse_motion", "mouse_wheel", "window_event", "controller_button_down", "controller_button_up", "controller_axis_motion", "quit".
Distinguish specific reaction by element code. Keyboard codes can be converted to Utf-8 strings via intToUtf8
or looked up at https://wiki.libsdl.org/SDLKeycodeLookup.
label gives more understandable descriptions of some events, such as window-events.
state encodes several keyboard states.
For mouse events, elements x and y indicate the mouse's position in the window area.
Element timestamp indicates when the OS registered the response.
Returns NULL
if no response is present in queue. Otherwise, a response_list specifying the polled response. Response_list contains elements type
(type of event), code
(specific event), label
(description of event), state
(some qualifying information of event), val
(value for event), x
and y
(e.g. mouse coordinates), and timestamp
(time of event).
rout <- NULL
while (!is.null(rout <- CRpoll_event(gs))) {
if (rout$type == "window_event" && rout$label == "close") {
run <- FALSE
} else if (rout$type == "key_down") {
RT <- CRget_time()
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.