Skip to content
Thomas edited this page Jun 14, 2020 · 2 revisions

obj_uiZ_switch

This is an object for inputting boolean values, trough something that looks like a switch. This object consists of a background. Inside of the background resides another background that represents the switch knob. This does mean that your object needs to have be rectangular (e.g. have one side that is longer than the other) for the inner knob to have have space to move.

Property Variables

  • switchtime[0.5]: Time in seconds it takes for the switch knob to move from one side to the other.
  • animation[uiz_straight]: The animation used for moving the switch knob from one side to the other.
  • knobsize[0.7]: The size of the knob relative to the width or height (the smallest out of these 2 will be used). Knob_diameter=min(width,height) * knobsize.

This object has a background, and all its associated variables about which you can learn more here

The default background variables differ though, here is an overview:

  • texturescript = uiz_back_spritestitch_4way_plus
  • sprite_normal = spr_uiZ_4way
  • color_normal = c_white
  • margin_normal = 5
  • sprite_texturemode = uiz_texturemode_fill
  • border_texturemode = -1
  • sprite_over = spr_uiZ_4way_over
  • color_over = -1
  • margin_over = -1
  • sprite_in = spr_uiZ_4way_in
  • color_in = -1
  • margin_in = -1
  • sprite_out = spr_uiZ_4way_in
  • color_out = -1
  • margin_out = -1

In addition to these background variables, a separate set for the inner knob also exists:

  • item_texturescript = uiz_back_spritestitch_4way_plus
  • item_texturescript_over = -1
  • item_texturescript_in = -1
  • item_texturescript_out = -1
  • item_sprite_normal = spr_uiZ_4way_inner
  • item_margin_normal = 5
  • item_sprite_texturemode = uiz_texturemode_fill
  • item_border_texturemode = -1
  • item_sprite_over = -1
  • item_margin_over = -1
  • item_sprite_in = -1
  • item_margin_in = -1
  • item_sprite_out = -1
  • item_margin_out = -1
  • item_color_normal = c_white
  • item_color_over = -1
  • item_color_in = -1
  • item_color_out = -1

Readable variables

  • update: Whether the switch is currently moving between two states.
  • updated: Whether the switch has just been clicked/has its value changed trough the _setvalue function.
  • value: Whether the switch knob is on the left/top (= false) or on the right/bottom (= true).

Functions

  • uiz_switch_setvalue(instanceid,value[false],doUpdate[false]): Changes the value of the switch using an animation. (as if the user has clicked it). This does nothing if the switch's value is the same as the value given by this function.
    • instanceid: the instance id of the instance you want to modify
    • value: Whether the switch knob should be on the left/top (= false) or on the right/bottom (= true).
    • doUpdate: Whether to set the "updated" variable to true or not if the value changes trough this function.
  • uiz_switch_setknobsize(instanceid,knobSize[0.7]):
    • instanceid: the instance id of the instance you want to modify
    • knobSize: The size of the knob relative to the width or height (the smallest out of these 2 will be used). Knob_diameter=min(width,height) * knobsize.
  • uiz_switch_setanimation(instanceid,animation[uiz_straight],time[0.5]):
    • instanceid: the instance id of the instance you want to modify
    • animation: The animation used for moving the switch knob from one side to the other.
    • time: Time in seconds it takes for the switch knob to move from one side to the other.
  • value=uiz_switch_getvalue(instanceid):
    • instanceid: the instance id of the instance you want to modify
  • multiple background item scripts:
    • uiz_background_item_texturescript(instanceid, script)
    • uiz_background_item_texturescript_ext(instanceid, normal, over, in, out)
    • uiz_background_item_texturemode(instanceid, sprite[uiz_texturemode_fill], [border[-1]])
    • uiz_background_item_normal(instanceid, sprite, color, margin)
    • uiz_background_item_over(instanceid, sprite, color, margin)
    • uiz_background_item_in(instanceid, sprite, color, margin)
    • uiz_background_item_out(instanceid, sprite, color, margin)

Visuals

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