Sha256: dca6de120b0f9dfbfdef93d3fd6d48ec59923af1da46ad5fd05a908afcac6e90
Contents?: true
Size: 413 Bytes
Versions: 21
Compression:
Stored size: 413 Bytes
Contents
class ProconBypassMan::AnalogStickPosition attr_accessor :x, :y def initialize(x:, y:) @x = x.to_i @y = y.to_i end def to_binary analog_stick_data = [ (@x & "0xff".to_i(16)), ((@y << 4) & "0xf0".to_i(16)) | ((@x >> 8) & "0x0f".to_i(16)), (@y >> 4) & "0xff".to_i(16), ] hex = analog_stick_data.map{ |x| x.to_s(16).rjust(2, "0") }.join [hex].pack("H*") end end
Version data entries
21 entries across 21 versions & 1 rubygems
Version | Path |
---|---|
procon_bypass_man-0.1.22 | lib/procon_bypass_man/domains/analog_stick_position.rb |