GUIButton2DNode(position, font, text, outline, padding, text_color, focused_text_color, pressed_text_color, background_color, focused_background_color, pressed_background_color, outline_color, focused_outline_color, pressed_outline_color, rotation, scale, opacity, letter_spacing, line_spacing, disabled, layer)
Draws a simple square button with an outline, background color, and text. The text, padding, and outline thicknesses define how large the button will be. There is no way to set the button to an exact size other than by hand tweaking the scale
Parameters:
position
[value: Vector2, type: Vector2]
font
[value: FontResource, type: FontResource]
text
[value: any, type: string]
outline
[value: any (how thick the outline should be, in px), type: float]
padding
[value: any (amount of empty space between the text and outline, in px), type: float]
text_color
[value: any color that the base text color should blend to (works best with white text), type: Color|int (RGB565)]
focused_text_color
[value: any color, type: Color|int (RGB565)]
pressed_text_color
[value: any color, type: Color|int (RGB565)]
background_color
[value: any color, type: Color|int (RGB565)]
focused_background_color
[value: any color, type: Color|int (RGB565)]
pressed_background_color
[value: any color, type: Color|int (RGB565)]
outline_color
[value: any color, type: Color|int (RGB565)]
focused_outline_color
[value: any color, type: Color|int (RGB565)]
pressed_outline_color
[value: any color, type: Color|int (RGB565)]
rotation
[value: any (radians), type: float]
scale
[value: Vector2, type: Vector2]
opacity
[value: 0 ~ 1.0, type: float]
letter_spacing
[value: any, type: float]
line_spacing
[value: any, type: float]
disabled
[value: True or False (when True, element will not be focused by default navigation system), type: bool]
layer
[value: 0 ~ 127, type: int]
Attributes:
add_child(child)
[returns: None
]
get_child(index)
[returns: Node
]
get_child_count()
[returns: 0 or positive integer
]
mark_destroy()
[returns: None
]
mark_destroy_all()
[returns: None
]
mark_destroy_children()
[returns: None
]
remove_child(child)
[returns: None
]
tick(self, dt)
[returns: None
]
on_before_focused(button)
[returns: True or False
]
on_focused(button)
[returns: None
]
on_just_focused(button)
[returns: None
]
on_just_unfocused(button)
[returns: None
]
on_pressed(button)
[returns: None
]
on_just_pressed(button)
[returns: None
]
on_just_released(button)
[returns: None
]
position
[value: Vector2, type: Vector2]
global_position
[value: Vector2 (read-only), type: Vector2]
font
[value: FontResource, type: FontResource]
text
[value: any, type: string]
outline
[value: any (how thick the outline should be, in px), type: float]
padding
[value: any (amount of empty space between the text and outline, in px), type: float]
text_color
[value: color that the base text color should blend to (works best with white text), type: Color|int (RGB565)]
focused_text_color
[value: color, type: Color|int (RGB565)]
pressed_text_color
[value: color, type: Color|int (RGB565)]
background_color
[value: color, type: Color|int (RGB565)]
focused_background_color
[value: color, type: Color|int (RGB565)]
pressed_background_color
[value: color, type: Color|int (RGB565)]
outline_color
[value: color, type: Color|int (RGB565)]
focused_outline_color
[value: color, type: Color|int (RGB565)]
pressed_outline_color
[value: color, type: Color|int (RGB565)]
rotation
[value: any (radians), type: float]
scale
[value: Vector2, type: Vector2]
opacity
[value: 0 ~ 1.0, type: float]
letter_spacing
[value: any, type: float]
line_spacing
[value: any, type: float]
disabled
[value: True or False (when True, element will not be focused by default navigation system), type: bool]
focused
[value: True or False (can be read to see if focused or set to focus it), type: boolean]
pressed
[value: True or False (can be read to see if pressed or set to press it), type: boolean]
width
[value: any (total width of the button, read-only), type: float]
height
[value: any (total height of the button, read-only), type: float]
layer
[value: 0 ~ 127, type: int]
Overrides:
tick(self, dt)
[returns: None
] [value: function, type: function]
on_focused(button)
[returns: None
] [value: function, type: function]
on_just_focused(button)
[returns: None
] [value: function, type: function]
on_just_unfocused(button)
[returns: None
] [value: function, type: function]
on_pressed(button)
[returns: None
] [value: function, type: function]
on_just_pressed(button)
[returns: None
] [value: function, type: function]
on_just_released(button)
[returns: None
] [value: function, type: function]
file: src/nodes/2D/gui_button_2d_node.c
landing