UITextureState

Classes

UITextureState : UIVisualState

Note

UIFrame component is automatically added to the node if it is not already present

A UI component that changes its texture based on interaction state.

Fields:
  • isMouseOver : bool - True if the mouse is currently over the component.

  • isMouseDown : bool - True if the component is currently being pressed.

  • isFocused : bool - True if the component is currently focused.

  • targetNode : NodeId - The node to set the texture on. If not set, the component’s node will be used.

  • activeTexture : TextureId = request_texture(“%builtin_package/active_texture.png”) - The texture when the component is active. Default is a white color texture.

  • inactiveTexture : TextureId = request_texture(“%builtin_package/inactive_texture.png”) - The texture when the component is not interactable. Default is a gray color texture.

  • hoverTexture : TextureId = request_texture(“%builtin_package/focused_texture.png”) - The texture when the component is hovered. Default is a light blue color texture.

  • pressedTexture : TextureId = request_texture(“%builtin_package/pressed_texture.png”) - The texture when the component is pressed. Default is a blue color texture.

  • focusedTexture : TextureId = request_texture(“%builtin_package/focused_texture.png”) - The texture when the component is focused. Default is a light blue color texture.

UITextureState.on_initialize()

Initializes the component and sets up event listeners.

UITextureState.on_destroy()

Removes event listeners.

UITextureState.setInteractable(val: bool; doFade: bool)

Sets interactable state and updates the texture.

Arguments:
  • val : bool

  • doFade : bool

UITextureState.calcTargetTexture(): TextureId

Returns the target texture based on the current state.

UITextureState.invalidate()

Updates the current texture based on the target texture.

UIBasicTextureState : UIVisualState

Note

UIFrame component is automatically added to the node if it is not already present

A UI component that changes its texture based on focus and interactable state.

Fields:
  • isFocused : bool - True if the component is currently focused.

  • targetNode : NodeId - The node to set the texture on. If not set, the component’s node will be used.

  • activeTexture : TextureId = request_texture(“%builtin_package/active_texture.png”) - The texture when the component is active. Default is a white color texture.

  • inactiveTexture : TextureId = request_texture(“%builtin_package/inactive_texture.png”) - The texture when the component is not interactable. Default is a gray color texture.

  • focusedTexture : TextureId = request_texture(“%builtin_package/focused_texture.png”) - The texture when the component is focused.

UIBasicTextureState.on_initialize()

Initializes the component and sets up event listeners.

UIBasicTextureState.on_destroy()

Removes event listeners.

UIBasicTextureState.setInteractable(val: bool; doFade: bool)

Sets interactable state and updates the texture.

Arguments:
  • val : bool

  • doFade : bool

UIBasicTextureState.calcTargetTexture(): TextureId

Returns the target texture based on the current state.

UIBasicTextureState.invalidate()

Updates the current texture based on the target texture.