Class: UI::KeyShortcut

Inherits:
Sprite show all
Defined in:
docs/4_Systems_000_General_4_UI_Generics.rb

Overview

Class that show the sprite of a key

Direct Known Subclasses

KeyBinding

Constant Summary collapse

KeyIndex =

KeyIndex that holds the value of the Keyboard constants in the right order according to the texture

%i[A B C D E F G H I J K L M N O P Q R S T U V W X Y Z Num0 Num1 Num2 Num3 Num4 Num5 Num6 Num7 Num8 Num9 Space Backspace Enter LShift LControl LAlt Escape Left Right Up Down].collect(&Input::Keyboard.method(:const_get))
NUMPAD_KEY_INDEX =

KeyIndex for the NumPad Keys

[-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, kbd::Numpad0, kbd::Numpad1, kbd::Numpad2, kbd::Numpad3, kbd::Numpad4, kbd::Numpad5, kbd::Numpad6, kbd::Numpad7, kbd::Numpad8, kbd::Numpad9, -1, -1, -1, kbd::RShift, kbd::RControl, kbd::RAlt, -1, -1, -1, -1, -1]

Instance Attribute Summary

Attributes inherited from LiteRGSS::ShaderedSprite

#blendmode, #shader

Attributes inherited from LiteRGSS::Sprite

#__index__, #angle, #bitmap, #height, #mirror, #opacity, #ox, #oy, #src_rect, #viewport, #visible, #width, #x, #y, #z, #zoom, #zoom_x, #zoom_y

Instance Method Summary collapse

Methods inherited from Sprite

#load, #mouse_in?, #set_origin_div, #set_rect, #set_rect_div, #set_z, #simple_mouse_in?, #translate_mouse_coords, #update

Methods inherited from LiteRGSS::Sprite

new, #set_origin, #set_position

Methods inherited from LiteRGSS::Disposable

#dispose, #disposed?

Constructor Details

#initialize(viewport, key, red = false) ⇒ KeyShortcut

Create a new KeyShortcut sprite

Parameters:

  • viewport (Viewport)
  • key (Symbol, Integer)

    Input.trigger? argument (or Keyboard exact key if integer)

  • red (Boolean) (defaults to: false)

    pick the red texture instead of the blue texture



787
788
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 787

def initialize(viewport, key, red = false)
end

Instance Method Details

#find_key(key)

Find the key rect in the Sprite according to the input key requested

Parameters:

  • key (Symbol)

    the Virtual Input Key.



796
797
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 796

def find_key(key)
end

#show_key(key)

Show the exact key (when key from initialize was an interger)



799
800
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 799

def show_key(key)
end