![]() |
cmdfx 0.2.0
Lightweight game engine for your terminal
|
Represents a CmdFX button. More...
#include <button.h>
Public Attributes | |
CmdFX_Sprite * | sprite |
The sprite associated with this button. | |
int | x |
The X position of the button. | |
int | y |
The Y position of the button. | |
int | id |
The unique ID of the button. | |
CmdFX_ButtonCallback * | callback |
The callback function to be called when the button is clicked. | |
Represents a CmdFX button.
Buttons are objects that can be clicked on by the user and perform an action when clicked. Buttons have a sprite for visual implementation while also including a callback function to be called when the button is clicked.
CmdFX_ButtonCallback* CmdFX_Button::callback |
The callback function to be called when the button is clicked.
This function is called when the button is clicked. The function should take a pointer to the button and a pointer to the mouse event as parameters. The function should return nothing.
int CmdFX_Button::id |
The unique ID of the button.
This is assigned when it is on the screen. It is used to identify the button when editing or removing it. This value is identical to the value of sprite->id - 1
, but will not change if the sprite is removed.
If the button is removed or not on the screen, this value will be -1
.
CmdFX_Sprite* CmdFX_Button::sprite |
The sprite associated with this button.
This sprite is used to render the button on the screen. All buttons are static sprites, meaning they are not affected by the physics engine.
int CmdFX_Button::x |
The X position of the button.
This is the same as sprite->x
, but is used to determine the position of the button on the screen. This value is set when the button is drawn.
int CmdFX_Button::y |
The Y position of the button.
This is the same as sprite->y
, but is used to determine the position of the button on the screen. This value is set when the button is drawn.