Skip to content

Object_functions

Thomas edited this page Sep 19, 2020 · 2 revisions

Your own objects

This page contains some basic information on how you can create your own objects. As a starting point, it is recommended that you take a look at the templates and use that as a starting point.

Events

Your own uiZ object can contain the following User Defined events:

  • User Defined 0: Put your draw code here. You may draw whatever you need from the coordinates rx,ry to rlx,rly (but not on rlx or rly itself). The ix,iy and ilx,ily refer to the inner coordinates of the object. Anything you draw here will be contained within a certain area.
  • User Defined 1: Defines mouse behavior. By default this should contain uiz_mouse_docheck(). This event may change if you decide to use scrollbars for example. If this event is omitted, the object cannot interact with the mouse.
  • User Defined 2: An event that is activate whenever the mouse state of the object changes. So for example when the mouse wasn't on the object before, but is now. Or when the mouse starts clicking the object. This event fires once per state change. The variable "kmouseover" can be read and compared to the constants uiz_nomouse, uiz_mouseover, uiz_mouseclick, uiz_mousepressed and uiz_mousereleased to determine what the mouse is doing.
  • User Defined 3: An event which is continuously fired as long as the mouse is hovering over the object.
  • User Defined 4: Works like a step event, but can be enabled or disabled on demand by using the uiz_updater_step() and uiz_updater_unstep() functions. Useful if an object does a temporary animation.
  • User Defined 5: Used to run code once in the end step event. Use the function uiz_updater_step_endcheck() to run this event once.
  • User Defined 6: Used to run code once in the begin step event. Use the function uiz_updater_step_beginCheck() to run this event once.
  • User Defined 7: Used for scrollbar specific code. If your object uses a scrollbar, then this event is activated when the mouse hovers over your scrollable object. This differs from User Defined 3 in that objects that don't have a scrollbar are ignored. This means that if this object has scrollbars and User Defined 3 is firing, then User Defined 7 is also firing. If User Defined 7 is firing, this doesn't necessarily mean that User Defined 3 is also firing on this object. See obj_uiZ_template_scrollbar for an example.
  • User Defined 8: Activated whenever the position or settings of the object change. (called during a "fix")

Functions

  • uiz_objinit(): Initializes all uiZ variables on a uiZ object. Should be called in the create event of such an object.
  • uiz_endobject(): Cleans up any data structures in the uiZ object. Needs te be called in the Destroy, Game End and Room End events.
  • uiz_mouse_docheck(): Handles all mouse code for this object. This should be placed in the User Defined 1 event. Use this if you object doesn't support scrolling.
  • uiz_mouse_docheck_scrollable(): Handles all mouse code for this object. This should be placed in the User Defined 1 event. Use this if you object does support scrolling.

Drawing

Drawing happens in the User Defined 0 event. You need to manually set up containment here.

To see how to use backgrounds in your own scripts, look at "Background in custom objects".

For example, a User Defined 0 event could look like this:

if uiz_cntn() then{//this code is used to make sure everything drawn here stays within a certain boundry.
    //put draw code here
    uiz_back();
    sdbm("drawing!")
    uiz_containend()
}

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