It is the convenient alternative of the Button node.
Types
TextureButtonTouchHandler = proc (self: TextureButtonRef; x, y: float)
TextureButtonObj = object of LabelObj button_mask*: cint ## Mask for handle clicks action_mask*: cint ## BUTTON_RELEASE or BUTTON_CLICK. normal_background_texture*: GlTextureObj ## texture, when button is not pressed and not hovered. hover_background_texture*: GlTextureObj ## texture, when button hovered. press_background_texture*: GlTextureObj ## texture, when button pressed. on_touch*: TextureButtonTouchHandler ## This called, when user clicks on button.
TextureButtonRef = ref TextureButtonObj
Procs
proc TextureButton(name: string = "TextureButton"): TextureButtonRef {...}{. raises: [], tags: [].}
-
Creates a new TextureButton node.
Arguments:
- name is a node name.
Example:
var my_button = TextureButton("TextureButton")
Methods
method draw(self: TextureButtonRef; w, h: GLfloat) {...}{. raises: [GLerror, Exception, ResourceError], tags: [RootEffect].}
- this method uses in the window.nim.
method duplicate(self: TextureButtonRef): TextureButtonRef {...}{.base, raises: [], tags: [].}
- Duplicates TextureButton object and creates a new TextureButton node.
method handle(self: TextureButtonRef; event: InputEvent; mouse_on: var NodeRef) {...}{. raises: [Exception], tags: [RootEffect].}
- Handles user input. This uses in the window.nim.
method setNormalTexture(self: TextureButtonRef; texture: GlTextureObj) {...}{.base, raises: [GLerror], tags: [].}
- Changes button texture, when it not pressed and not hovered.
method setHoverTexture(self: TextureButtonRef; texture: GlTextureObj) {...}{.base, raises: [GLerror], tags: [].}
- Changes button texture, when it hovered.
method setPressTexture(self: TextureButtonRef; texture: GlTextureObj) {...}{.base, raises: [GLerror], tags: [].}
- Changes button texture, when it pressed.