-
Notifications
You must be signed in to change notification settings - Fork 2
tutorial.basic.4
Hi, welcome back. How are you? Are you able to understand everything well? Donβt forget we have a manual, everything learned in this tutorial can be found as a reference in there.
So we know that we can set our position to types other than just pixels. But what about sizing. This has about the same basic options as posX/YType. Here is a list:
- px: gives a width or a height in pixels.
- dp: gives a width or a height in inches.
- fc: gives a width or height relative to the parentβs size.
There are a lot more options, but these are the oneβs youβll be using 99% of the time. Here is an example using fc values:
EXAMPLE 14:
//create event of a newly created object.
//initialize uiz
uiz_init()
//create our square object
square=uiz_c(obj_uiZ_square)
uiz_position(square, .3,fc, .6,fc);
uiz_size(square, .3,fc, .1,fc);
//fix our square object.
uiz_fix(square);
Now that you also know how to size your object, you are able to put your object in any position with any size.
There is one more thing that defines position though. If you look at image 16, you can see that (0.3,0.6) fc gives the position of the top-left corner of the object. You might not always want this tough. You might want the middle of the object to be around the position (0.3,0.6)fc instead of the top-left corner being there.
Well, this is possible in uiz! Go take a look in the manual. At the positioning page all the way at the bottom, there is a section called "set point".
The set point can be the values:
- uiz_left
- uiz_middle
- uiz_right
- uiz_top
- uiz_bottom
- uiz_auto.
(Some only work for the x component of the set point and some only work for the y component of the set point)
So what can you do with this? You can for example set setPointX to uiz_right and setPointY to uiz_middle like this:
EXAMPLE 15:
//create event of a newly created object.
//initialize uiz
uiz_init()
//create our square object
square=uiz_c(obj_uiZ_square)
uiz_position(square, .3,fc, .6,fc);
uiz_size(square, .3,fc, .1,fc);
uiz_setPoint(square, uiz_right, uiz_middle);
//fix our square object.
uiz_fix(square);
In the following image we can see that the position (0.3fc, 0.6fc) now refers to the right-middle part of the object.
IMAGE 18Do you need to set the set point manually each time? Well, you donβt. By default setPointX and setPointY are set to uiz_auto. If these values are set to uiz_auto then it will automatically pick a position in the object that fits the posXType or posYType the best. For example, for uiz_snapright, it will automatically pick a value of uiz_right for setPointX. This means that in 95% of cases, you don't need to change your set point.
In this tutorial you learned:
- How you can also apply px, dp and fc to the size of an object
- What a set point is
- How to change the set point
- What uiz_auto does with the set point
πTutorials
Basics 1: Basic positioning
Basics 2: Parenting system
Basics 3: Advanced positioning
Basics 4: Advanced sizing and set point
Basics 5: Canvas and containment
Basics 6: Alpha and depth
Basics 7: Using the manual and Animations
Basics 8: Object backgrounds
Basics 9: Grids
Basics 10: Framesets
Basics 11: Windows
Basics 12: Scroll bars
βοΈ Positioning
π Depth
π 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
π Strings
uiz_addChar
uiz_changechar
uiz_charCanHaveAddon
uiz_returnCharAddon
uiz_charIsNumber
uiz_charIsNumberOrText
uiz_getlines
uiz_gettext_contained
uiz_gettextlines_contained
uiz_getValidVariableName
uiz_isSpaceChar
uiz_lastStringChars
uiz_removeChar
uiz_replaceChars_
uiz_string_copy
uiz_string_digits
uiz_string_format
uiz_string_fromReal
uiz_string_real_getFracLength
uiz_string_real_getIntLength
uiz_string_repeat
uiz_string_replace
uiz_string_pos_at
uiz_stringUntilNewline