Shadow Engine Logo
Shadow Engine - Lua Script API

Mobile Functions

Functions for mobile device input, touch controls, and Android-specific features.


mobileC

mobileC:Bool

Returns whether the game is currently running on a mobile device.

Example:


mobileControlsMode

mobileControlsMode():String

Returns the current mobile controls mode as a string.


extraButtonPressed

extraButtonPressed(button:String = 'first'):Bool

Returns whether an extra mobile control button is currently being held.

Examples:


extraButtonJustPressed

extraButtonJustPressed(button:String = 'first'):Bool

Returns whether an extra mobile control button was just pressed in this frame.


extraButtonJustReleased

extraButtonJustReleased(button:String = 'first'):Bool

Returns whether an extra mobile control button was just released in this frame.


extraButtonReleased

extraButtonReleased(button:String = 'first'):Bool

Returns whether an extra mobile control button is not being pressed (released).


vibrate

vibrate(duration:Int, ?period:Int = 0):Void

Makes the device vibrate for the specified duration.

Examples:


addTouchPad

addTouchPad(DPadMode:String, ActionMode:String, ?addToCustomSubstate:Bool = false, ?posAtCustomSubstate:Int = -1):Void

Adds a customizable touchpad to the screen.


removeTouchPad

removeTouchPad():Void

Removes the currently active touchpad.


addTouchPadCamera

addTouchPadCamera(?defaultDrawTarget:Bool = false):Void

Adds a camera specifically for the touchpad.


touchPadJustPressed

touchPadJustPressed(button:Dynamic):Bool

Returns whether a touchpad button was just pressed in this frame.


touchPadPressed

touchPadPressed(button:Dynamic):Bool

Returns whether a touchpad button is currently being held.


touchPadJustReleased

touchPadJustReleased(button:Dynamic):Bool

Returns whether a touchpad button was just released in this frame.


touchPadReleased

touchPadReleased(button:Dynamic):Bool

Returns whether a touchpad button is not being pressed (released).


touchJustPressed

touchJustPressed():Bool

Returns whether the screen was just touched in this frame.


touchPressed

touchPressed():Bool

Returns whether the screen is currently being touched.


touchJustReleased

touchJustReleased():Bool

Returns whether the screen touch was just released in this frame.


touchReleased

touchReleased():Bool

Returns whether the screen is not being touched (released).


touchPressedObject

touchPressedObject(object:String, ?camera:String):Bool

Returns whether a specific object is being touched.


touchJustPressedObject

touchJustPressedObject(object:String, ?camera:String):Bool

Returns whether a specific object was just touched in this frame.


touchJustReleasedObject

touchJustReleasedObject(object:String, ?camera:String):Bool

Returns whether touch was just released from a specific object.


touchReleasedObject

touchReleasedObject(object:String, ?camera:String):Bool

Returns whether a specific object is not being touched.


touchOverlapsObject

touchOverlapsObject(object:String, ?camera:String):Bool

Returns whether the current touch position overlaps with an object.


Android-Specific Functions

These functions are only available on Android devices.


isDolbyAtmos

isDolbyAtmos():Bool

Returns whether the device supports Dolby Atmos audio.


isAndroidTV

isAndroidTV():Bool

Returns whether the device is an Android TV.


isTablet

isTablet():Bool

Returns whether the device is a tablet.


isChromebook

isChromebook():Bool

Returns whether the device is a Chromebook.


isDeXMode

isDeXMode():Bool

Returns whether Samsung DeX mode is active.


backJustPressed

backJustPressed():Bool

Returns whether the Android back button was just pressed.


backPressed

backPressed():Bool

Returns whether the Android back button is being held.


backJustReleased

backJustReleased():Bool

Returns whether the Android back button was just released.


menuJustPressed():Bool

Returns whether the Android menu button was just pressed.


menuPressed():Bool

Returns whether the Android menu button is being held.


menuJustReleased():Bool

Returns whether the Android menu button was just released.


getCurrentOrientation

getCurrentOrientation():String

Returns the current screen orientation as a string.


setOrientation

setOrientation(hint:String):Void

Sets the screen orientation.

Examples:


minimizeWindow

minimizeWindow():Void

Minimizes the app window (sends to background).


showToast

showToast(text:String, duration:Int, ?xOffset:Int = 0, ?yOffset:Int = 0):Void

Shows an Android toast notification.

Example:


isScreenKeyboardShown

isScreenKeyboardShown():Bool

Returns whether the on-screen keyboard is currently visible.


clipboardHasText

clipboardHasText():Bool

Returns whether the clipboard contains text.


clipboardGetText

clipboardGetText():String

Returns the text currently in the clipboard.


clipboardSetText

clipboardSetText(text:String):Void

Sets text to the clipboard.


manualBackButton

manualBackButton():Void

Manually triggers the back button action programmatically.


setActivityTitle

setActivityTitle(text:String):Void

Sets the Android activity/window title.