Virtual_Buttons_Display()
Syntax: _Virtual_Buttons_Display()
Purpose: Displays any previously configured virtual buttons on the system, making them active for user input.
Important:
Virtual buttons must be defined using _Virtual_Buttons_Settings
before they can be displayed.
Virtual_Buttons_End
Syntax: _Virtual_Buttons_End
Purpose:
Signals the end of the configuration block started by
_Virtual_Buttons_Settings
.
Typically signifies you've finished defining button areas and
actions.
Virtual_Buttons_Hide()
Syntax: _Virtual_Buttons_Hide()
Purpose: Hides previously displayed virtual buttons and temporarily pauses their touch detection.
Virtual_Buttons_Settings
Syntax: _Virtual_Buttons_Settings
Purpose: This function is the core of creating virtual buttons. It allows you to define the appearance, touch areas, and actions associated with your buttons.
Requires Multitouch: Your device needs to support multitouch for this feature.
Parameters:
Background: "Image.png" - Specifies the background image (from resource folders) to use. This image should have transparent areas where buttons will be.
Buttons: { ... } - A block containing definitions for each button:
Single Letter Identifier: "F", "L", "R", etc.
Coordinates: e.g., 102, 405
Polygon: e.g., "-41,-41,39,-41,39,39,-41,39" (Defines the touch area)
Actions: { ... } - A block mapping button identifiers to the actions they trigger. Can be functions or Lu C code directly.
RefreshRate: Time in milliseconds controlling how frequently button presses are checked.
Restrictions: Not recommended to use with systems that rely on scrolling.
Virtual_Buttons_Test()
Syntax: _Virtual_Buttons_Test()
Purpose: A debugging tool that visually displays the polygons defining the touch areas of your virtual buttons. This helps with fine-tuning their placement and responsiveness.
Key Points:
Flexibility: Virtual buttons provide a way to add custom controls when physical buttons are not available or limited.
Customization: You have control over visuals, button placement, and the actions they trigger.
Example: The provided example gives a clear demonstration of how these commands work together to create a simple directional pad with a fire button.