Sha256: 19bc3c4fc65060c1d077821d8c09918ba7ac971cccb61fb13497288aca87e38f

Contents?: true

Size: 1002 Bytes

Versions: 1

Compression:

Stored size: 1002 Bytes

Contents

# frozen_string_literal: true

require_relative 'keyboard_char'

# Represents a keyboard key.
class KeyboardKey
  attr_reader :keyboard_char, :keyboard_shift_char, :keyboard_key_section, :keyboard_key_weight

  def initialize(keyboard_char, keyboard_shift_char, keyboard_key_section, keyboard_key_weight)
    # TODO: Check keyboard_char is_a? KeyboardChar
    # TODO: Check keyboard_shift_char is_a? KeyboardChar
    # TODO: Check keyboard_key_section is :left or :right

    @keyboard_char = keyboard_char
    @keyboard_shift_char = keyboard_shift_char
    @keyboard_key_section = keyboard_key_section
    @keyboard_key_weight = keyboard_key_weight
  end

  def self.make_key(char, shift_char, keyboard_key_section, keyboard_key_weight)
    # TODO: Check keyboard_key_section is :left or :right

    keyboard_char = KeyboardChar.new char
    keyboard_shift_char = KeyboardChar.new shift_char

    KeyboardKey.new keyboard_char, keyboard_shift_char, keyboard_key_section, keyboard_key_weight
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
MonkeyEngine-2.0.0 lib/MonkeyKeyboard/keyboard_key.rb