Sha256: fa2d5a60fc3f04eb07b836440c54554255fd55b26879334a57b237872b0d9e81
Contents?: true
Size: 924 Bytes
Versions: 31
Compression:
Stored size: 924 Bytes
Contents
module ProconBypassMan class ProconReader def initialize(binary: ) @binary = binary @analog_stick = ProconBypassMan::Procon::AnalogStick.new(binary: binary) freeze end # @return [Array<Symbol>] def pressing aware = ProconBypassMan::PressButtonAware.new(@binary) pressed_table = ::ProconBypassMan::Procon::ButtonCollection::BUTTONS.reduce({}) do |acc, button| acc[button] = aware.pressing_button?(button) acc end pressed_table.select { |_key, value| value }.keys end def left_analog_stick { x: @analog_stick.relative_x, y: @analog_stick.relative_y } end def left_analog_stick_by_abs { x: @analog_stick.abs_x, y: @analog_stick.abs_y } end def to_hash { left_analog_stick: left_analog_stick, left_analog_stick_by_abs: left_analog_stick_by_abs, buttons: pressing, } end end end
Version data entries
31 entries across 31 versions & 1 rubygems