nodesnim/nodescontrol/texture_button

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 = "TextureButton"): TextureButtonPtr {...}{.raises: [],
    tags: [].}

Creates a new TextureButton node pointer.

Arguments:

  • name is a node name.

Examples:

var my_button = TextureButton("TextureButton")

Methods

method draw(self: TextureButtonPtr; w, h: GLfloat) {...}{.raises: [GLerror, Exception],
    tags: [RootEffect].}
this method uses in the window.nim.
method duplicate(self: TextureButtonPtr): 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.