Skip to content

draw_spritebutton

Thomas edited this page Aug 25, 2020 · 1 revision

uiz_draw_spriteButton_

Draws a quick sprite to be used as button, at specified position.
Normally returns false, but true when the mouse is released.

The sprite should have these images:

  • 0: The mouse is not hovering over the button
  • 1: The mouse is hovering over the button
  • 2: The mouse is clicking the button

parameters

  • uiz_draw_spriteButton(x1, y1, x2, y2, color, oncolor, incolor, sprite, alpha): Draws a sprite button. (doesn't have to be on a uiZ object)

    • x1: The x coordinate of the left side of your button.
    • y1: The y coordinate of the top side of your button.
    • x2: The x coordinate of the right side of your button.
    • y2: The y coordinate of the bottom side of your button.
    • color: the normal color, when the mouse is not over the button.
    • oncolor: The color of the button when the mouse is over it.
    • incolor: The color of the button when the mouse is pressing it.
    • sprite: The sprite to use to draw the button.
    • alpha: The alpha of the button.
  • uiz_draw_spriteButton_state(x1, y1, x2, y2, color, oncolor, incolor, sprite, alpha, state): Draws a sprite button. (doesn't have to be on a uiZ object). The normal function uses the mouse state to determine the blending color and sprite sub image. This function uses a custom provided argument to define the button state.

    • x1: The x coordinate of the left side of your button.
    • y1: The y coordinate of the top side of your button.
    • x2: The x coordinate of the right side of your button.
    • y2: The y coordinate of the bottom side of your button.
    • color: the normal color, in state 0.
    • oncolor: The color of the button in state 1.
    • incolor: The color of the button in state 2
    • sprite: The sprite to use to draw the button.
    • alpha: The alpha of the button.
    • state: What state the button should be in (0, 1 or 2). You can also feed in the return value of uiz_draw_spriteButton_step.
  • state = uiz_draw_spriteButton_step(x1, y1, x2, y2, currentState): Checks the state of the object and updates the sprite button if needed. Returns state of button (which needs to be fed to uiz_draw_spriteButton_state). If this number is negative, the state has changed. This function needs to be called on a uiZ object. It should be placed in the user ever 2 or 3.

    • state: The state of the spriteButton, you can feed this into uiz_draw_spriteButton_state.
    • x1: The x coordinate of the left side of your button.
    • y1: The y coordinate of the top side of your button.
    • x2: The x coordinate of the right side of your button.
    • y2: The y coordinate of the bottom side of your button.
    • currentState: What state the button is returned by this function in the last step. For the very first step, this value can be set to 0.

Wiki pages

🏑Home / General
πŸ“ƒTutorials
πŸ‘ͺ Parent
↕️ Positioning
πŸ›  Fixing & Updating
πŸ• Depth
πŸ“ƒ Templates and Examples
πŸŒ† Background
πŸ“‡ Structures
🎈 Objects

obj_uiZ_3waybutton
obj_uiZ_button
obj_uiZ_checkbox
obj_uiZ_clock
obj_uiZ_colorbox
obj_uiZ_cover
obj_uiZ_drawdslist obj_uiZ_dropdown
obj_uiZ_easybutton
obj_uiZ_frame
obj_uiZ_framescrollbar
obj_uiZ_functionbar
obj_uiZ_gradientsquare
obj_uiZ_gradientroundrect
obj_uiZ_gridlist
obj_uiZ_huesquare
obj_uiZ_loadingbar
obj_uiZ_loadingcircle
obj_uiZ_menubutton
obj_uiZ_mousemenu
obj_uiZ_radiobox
obj_uiZ_rotator
obj_uiZ_slider
obj_uiZ_scrollbar
obj_uiZ_slider_2col
obj_uiZ_slickslider
obj_uiZ_slideframe
obj_uiZ_sprbutton
obj_uiZ_spriteanimationbutton
obj_uiZ_spritecounter
obj_uiZ_stringbox
obj_uiZ_sliderstruct
obj_uiZ_surfacecanvas
obj_uiZ_sprite
obj_uiZ_square
obj_uiZ_squarebutton
obj_uiZ_swipicon
obj_uiZ_switch
obj_uiZ_tabslider
obj_uiZ_tabs
obj_uiZ_treelist
obj_uiZ_text
obj_uiZ_text_background
obj_uiZ_textarea
obj_uiZ_valuebox


🎈 Your own objects
🚫 Destroy
🐭 Mouse
πŸ’» Windows (uiz)
🌌 Animations
❓ General
πŸ“’ Numbers
πŸ“’ Strings
✏️ Draw
🚩 Popup
πŸ“‚ Files
πŸ’» Windows (os)
Clone this wiki locally