Skip to content

sliderframe

Thomas edited this page Sep 27, 2020 · 4 revisions

obj_uiZ_slideframe

This is an advanced version of the obj_uiZ_frame object. It is a panel that can be slided out from the side of the screen.

It is made to give structure to your ui objects, by giving the ability to "slide" the frame from a corner.

This object has some strict requirements of how it should be set up. It should follow these rules:

  • This menu can be either on the left, right, top or bottom side of another frame,object or screen and nowhere else. To do this you either need to:
    1. uiz_position_t(sf, uiz_snapleft, uiz_fill); or,
    2. uiz_position_t(sf, uiz_snapright, uiz_fill); or,
    3. uiz_position_t(sf, uiz_fill, uiz_snaptop); or,
    4. uiz_position_t(sf, uiz_fill, uiz_snapbottom);
  • The setpointx and setpointy variables must remain untouched.
  • The frame,object or window this object is in must be bigger than the size of the menu.
  • The frame,object or window this object is in must be bigger than the size of the mouse grabbing point.
  • This object can (but doesn't have to) automatically handle an obj_uiZ_spriteanimationbutton, and an obj_uiZ_cover. But you must create and define these objects yourself. The cover can be used to black out everything outside the slidewindow while the spriteanimationbutton can be used as a menu button.

Property Variables

  • mark[false]: marks the frame with a color.
  • markcolor[random color]: The color to mark the frame with if mark=true.
  • debugmark[false]: Draw a square (with the color of markcolor) at the positions of the frame for debug purposes. Also displays the frame's instance id.
  • menubutton[noone]: Should be the instance id of a obj_uiZ_spriteanimationbutton. You have to create this object and place it a good position yourself. The slideframeobject will do the rest of the work for you. Make this noone if you don't have a menubutton.
  • blackframe[noone]: Should be the instance id of a obj_uiZ_cover. You have to create this object yourself. The object should cover the background of the frame. (in most cases the entire screen) The slideframeobject will do the rest of the work for you, also making sure that any content behind the cover will be clickable when the menu is contracted. Having a cover will gray out any content that's not part of the menu.
  • blackframeanimation[uiz_circular_out]: The animation with which the cover's alpha should increase/decrease.
  • blackframealpha[0.4]: The maximum alpha the blackframe should become when the slideframe is extended.
  • blackframeformouse[true]: Whether the menu should be contracted when the blackframe cover object has been clicked (blackframeformouse=true), or if the menu should be contracted when any other place on the screen except for the sliderframe has been clicked.
  • snaptime[0.25]: The time in seconds it takes for the frame to move from one side to the other. (Used when the user slides the frame and released it in the middle)
  • menumousecoversize[0.5]: The size of the clickable mouse area.(Half of this area will be placed on the inside of the frame and half of it on the outside.)
  • menumousecoversizetype[dp]: The type of size for the clickable mouse area. (Half of this area will be placed on the inside of the frame and half of it on the outside.)
  • mouseborderoutside[true]: Whether the mouse should be able to grab the frame on the outside. If this is enabled than other objects near the sliderframe might be (partly) unpressable.
  • mouseborderinside[true]: Whether the mouse should be able to grab the frame on the inside.

Readable variables

  • inanim: Value from 0 to 1 of how far the slider has been extended.
  • value: Boolean value of whether the slider has been extended.

Scripts

  • uiz_sliderframe_setvalue(instance id,boolean value):
    • instanceid: the instance id of the instance you want to modify
    • value: Boolean value of whether the slider should be extended.
  • uiz_sliderframe_setmark(instanceid,mark[false],color[random color]):
    • instanceid: the instance id of the instance you want to modify
    • mark: marks the frame with a color.
    • color: The color to mark the frame with if mark=true.
  • uiz_sliderframe_setdebugmark(instanceid,debugmark[false]):
    • instanceid: the instance id of the instance you want to modify
    • debugmark[false]: Draw a square (with the color of markcolor) at the positions of the frame for debug purposes. Also displays the frame's instance id.
  • uiz_sliderframe_setmenubutton(instanceid,spriteanimationbutton instance id[0]):
    • instanceid: the instance id of the instance you want to modify
    • spriteanimationbutton instance id: Should be the instance id of a obj_uiZ_spriteanimationbutton. You have to create this object and place it a good position yourself. The slideframeobject will do the rest of the work for you. Make this noone if you don't have a menubutton.
  • uiz_sliderframe_setblackframe(instanceid,cover instanceid[noone],animation[uiz_circular_out],alpha[0.4]):
    • instanceid: the instance id of the instance you want to modify
    • cover instanceid: Should be the instance id of a obj_uiZ_cover. You have to create this object yourself. The object should cover the background of the frame. (in most cases the entire screen) The slideframeobject will do the rest of the work for you, also making sure that any content behind the cover will be clickable when the menu is contracted. Having a cover will gray out any content that's not part of the menu.
  • animation: The animation with which the cover's alpha should increase/decrease.
  • alpha: The maximum alpha the blackframe should become when the slideframe is extended.
  • uiz_sliderframe_setmousesettings(instanceid,coversize[0.5],coversizetype[dp],borderoutside[true],borderinside[true],snaptime[0.25]):
    • instanceid: the instance id of the instance you want to modify
    • coversize: The size of the clickable mouse area.(Half of this area will be placed on the inside of the frame and half of it on the outside.)
    • coversizetype: The type of size for the clickable mouse area. (Half of this area will be placed on the inside of the frame and half of it on the outside.)
    • borderoutside: Whether the mouse should be able to grab the frame on the outside. If this is enabled than other objects near the sliderframe might be (partly) unpressable.
    • borderinside: Whether the mouse should be able to grab the frame on the inside.
    • snaptime: The time in seconds it takes for the frame to move from one side to the other. (Used when the user slides the frame and released it in the middle)
  • value=uiz_sliderframe_getextended(instanceid):
    • value: Boolean value of whether the slider has been extended.
    • instanceid: the instance id of the instance you want to modify

Example

The following code will put a slideframe in a window. The slideframe is filled with a gradient square. To test the example, drag the mouse from the left side of the window to the right. Don't drag the window border (and resize the window), but go a few pixels to the right.

uiz_init();
var w = uiz_window_create(0.5, fc, 0.5, fc);
uiz_fix(w);

var sf = uiz_c(obj_uiZ_slideframe);
uiz_setParent(sf, w);
uiz_position_t(sf, uiz_snapleft, uiz_fill);
uiz_size_w(sf, 0.5, fc);
uiz_fix(sf);

var o = uiz_c(obj_uiZ_gradientsquare);
uiz_setParent(o, sf);
uiz_position_t(o, uiz_fill, uiz_fill);
uiz_fix(o);

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