Application:getKeyboardModifiers

From GiderosMobile
Revision as of 22:01, 20 January 2021 by MoKaLux (talk | contribs) (added example from rrraptor)

Available since: Gideros 2019.5
Class: Application

Description

Returns the current keyboard modifiers.

(number) = application:getKeyboardModifiers()

Return values

Returns (number) the current modifiers bitfield

Example

Checks if Control key is pressed

stage:addEventListener(Event.KEY_DOWN, function(e)
	local modifier = application:getKeyboardModifiers()
	print("CRTL: ", (modifier & KeyCode.MODIFIER_CTRL) > 0)
end)

stage:addEventListener(Event.KEY_UP, function(e)
	local modifier = application:getKeyboardModifiers()
	print("CRTL: ", (modifier & KeyCode.MODIFIER_CTRL) > 0)
end)