Method: Rubygame.key2str

Defined in:
lib/rubygame/event.rb

.key2str(sym, mods) ⇒ Object

Converts a keyboard symbol (keysym) into a human-readable text string. If either Shift key was being pressed, alphanumeric or punctuation keys will be made uppercase or alternate, based on U.S. keyboard layout. E.g. “a” becomes “A”, “1” becomes “!”, and “/” becomes “?”.



140
141
142
143
144
145
146
147
148
# File 'lib/rubygame/event.rb', line 140

def Rubygame.key2str( sym, mods )
	if (mods.include? K_LSHIFT) or (mods.include? K_RSHIFT)
		return (Rubygame::Key::KEY2UPPER[sym]\
			or Rubygame::Key::KEY2ASCII[sym] or "")
	else
		return (Rubygame::Key::KEY2LOWER[sym]\
			or Rubygame::Key::KEY2ASCII[sym] or "")
	end
end