Application:getKeyboardModifiers

From GiderosMobile
Revision as of 23:00, 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 mod = application:getKeyboardModifiers()
	print("CRTL: ", (mod & KeyCode.MODIFIER_CTRL) > 0)
end)

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