Application:getKeyboardModifiers

From GiderosMobile
Revision as of 23:01, 20 January 2021 by MoKaLux (talk | contribs) (added example from rrraptor)
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

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)