Buttons, along with thumbsticks, form the primary means of interaction by the end-users with the games. Buttons can be used to perform a variety of actions, include:
These actions ae determined by the script attached to the button, as well as the events registered to the listeners within your game development engine of choice.
It is possible to do straight lua in the script field, but it is better to call functions that are defined elsewhere in the lua script.
To add a button, all that needs to be done is clicking on the icon in the sidebar.
When setting up the styles for a button, select the previously created stylesheet to be applied. That stylesheet will set the font, image base, and image other properties. Then, all that needs to be done is to enter the text to be displayed on the button, if there is any.
Finally, to ensure that your button actually does something within the game, set up the script. The video example uses Lua within the button’s “Script” field, but to call that same function from elsewhere in your project, all you need to do is insert ClickedButton() in the “Script” field.
NOTE: The following images/gifs/videos need to be included in this section
To use buttons for various purposes on the engines, first an event needs to be registered to the action of clicking the button:
TR.actions.registerAction(data.playerId + [Lua Script])
In the event that you want to have an action (such as firing a weapon, or jumping) stop when the button is released, you need to also add a listener for when the button has been released.
TableRealmsModel.instance.GetData<bool>(GetDeviceID() + ".Button.Fire.Pressed");
TableRealmsModel.instance.GetData<bool>(GetDeviceID() + ".Button.Fire.Released");
TableRealmsTiny.Model.GetData(TableRealmsTiny.P2PManager.GetMyInstance() + ".Button.Fire.Pressed");
TableRealmsTiny.Model.GetData(TableRealmsTiny.P2PManager.GetMyInstance() + ".Button.Fire.Released");
TODO:
TODO: