Skip to contents

Button states for one controller

Usage

player(movie, idx = 1L)

Arguments

movie

A replayr_movie or replayr_poll_stream returned by read_movie() or a format-specific reader.

idx

Player index, 1-based. Defaults to 1 (player 1).

Value

Logical matrix, n_observations(movie) rows by n_buttons(movie) columns. Columns are named by the control keys of button_layout(), as in press_counts(), align_buttons() and polls(), so that player(movie)[, "a"] is the A button in every recording. The attributes button_ids and button_names hold the IDs and the labels of the columns; button_layout() has the whole layout.

Examples

  path <- system.file("extdata", "sample.fm2", package = "replayr")
  mv <- read_movie(path)
  p1 <- player(mv)
  colSums(p1)        # number of frames each button was held
#> dpad_right  dpad_left  dpad_down    dpad_up      start     select          b 
#>        900        900        900        900          6          4        900 
#>          a 
#>        450