It is the convenient alternative of the Button node.
Types
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. normal_color*: ColorRef ## text color, whenwhen button is not pressed and not hovered. hover_color*: ColorRef ## text color, when button hovered. press_color*: ColorRef ## text color, when button pressed. on_click*: proc (x, y: float): void ## This called, when user clicks on button.
TextureButtonPtr = ptr TextureButtonObj
Procs
proc TextureButton(name: string; variable: var TextureButtonObj): TextureButtonPtr {...}{. raises: [], tags: [].}
-
Creates a new TextureButton node pointer.
Arguments:
- name is a node name.
- variable is a TextureButtonObj variable.
Examples:
var my_button_obj: TextureButtonObj my_button = TextureButton("TextureButton", my_button_obj)
proc TextureButton(obj: var TextureButtonObj): TextureButtonPtr {...}{.inline, raises: [], tags: [].}
-
Creates a new TextureButton node pointer with default node name "TextureButton".
Arguments:
- variable is a TextureButtonObj variable.
Examples:
var my_button_obj: TextureButtonObj my_button = TextureButton(my_button_obj)
Methods
method draw(self: TextureButtonPtr; w, h: GLfloat) {...}{.raises: [GLerror, Exception], tags: [RootEffect].}
- this method uses in the window.nim.
method duplicate(self: TextureButtonPtr; obj: var TextureButtonObj): TextureButtonPtr {...}{. base, raises: [], tags: [].}
- Duplicates TextureButton object and creates a new TextureButton node pointer.
method handle(self: TextureButtonPtr; event: InputEvent; mouse_on: var NodePtr) {...}{. raises: [Exception], tags: [RootEffect].}
- Handles user input. This uses in the window.nim.
method setNormalTexture(self: TextureButtonPtr; texture: GlTextureObj) {...}{.base, raises: [], tags: [].}
- Changes button texture, when it not pressed and not hovered.
method setHoverTexture(self: TextureButtonPtr; texture: GlTextureObj) {...}{.base, raises: [], tags: [].}
- Changes button texture, when it hovered.
method setPressTexture(self: TextureButtonPtr; texture: GlTextureObj) {...}{.base, raises: [], tags: [].}
- Changes button texture, when it pressed.