ui Button Ani
ui Button Ani
Button widget have abilities to draw sprites at different locations within the instance size, you can have the a background drawn or be transparent. It supports text alignment, toggle option and button groups. To add a button to add the object to the room and change the create code, you do NOT assign a sprite to the object(or child object), to assign the sprite you use the uiButtonSprite property.
uiAlign = fa_left; This is for horizontal text alignment, fa_left, fa_center,fa_right;
uiAlignV = fa_top; This is for vertical text alignment, fa_middle, fa_top, fa_bottom
uiXscale = 1.0; This will allow you to draw the button at a scale factor. this is the X scale to draw.
uiYscale = 1.0; This will allow you to draw the button at a scale factor. this is the Y scale to draw.
uiButtonState = 0; //0 = up, 1 = down The current state of the button in a button group. Can be used set/get the button state of button group (see button groups). Also to get the state when using the toggle mode.
uiButtonSprite= -1; The sprite to draw with the button.
uiSpriteIndex=0; Similar to the sprite index setting on normal objects in GMStudio;
uiSpriteAlign=fa_center; Alignment of horizontal sprite in button.
uiSpriteAlignV=fa_middle; alignment of vertical sprite in button
uiSpriteScale=1.0; This will allow you to draw the sprite at a scale (same x/y scale). You normally may set this to 0 (zero) which means to fill the widget based on room design.
uiButtonSpriteDown= -1; The sprite to draw with the button is down. Is really useful when doing a toggle button. Like a volume control would show a mute icon instead of the speaker icon when up.
uiSpriteIndexDown=0; Sprite index when button is pressed. Works with uiButtonSpriteDown.
uiDownColor=c_green; The color of the background when button is pressed.
uiPressFlash=false; Will cause the button to flash (uiDownColor) when pressed.
uiFlashCounter=0; if uiFlashButton then how long to flash counter, it’s a number (30 is equal to one second, 60 would equal 2 seconds)
uiBackColor2 = 0; The background of the button is solid filled, but if you set this it will be gradient filled between uiBackColor and this color;
uiShadowColor =c_gray; This is the color of the shadow that is draw when uiDrawBackColor=true;
uiIsToggle = false; This will set the button to toggle, which means it will stay down once pressed and released when it is pressed again. You can check the state of the button by reading uiButtonState.
uiSpriteAngle=0-360; This is the angle that the sprite will be drawn.
uiEnforceFocus=true; //check if button was in focus on press When true then the button is considered ‘pressed’ when it is pressed and released. If false, then it allows user to move around and the button is considered ‘pressed’ when it is released on the widget. (for keyboards for example, mouse up pressed is preferred)
uiButtonGroup = 0; //button group Button Groups Button groups are when you group a set of buttons together so that when one is pressed the other buttons in the same group are released. To group buttons together you only need to set uiButtonGroup=x (where x is a number greater than 0) . So if you wanted multi button groups on the same screen, you would assign uiButtonGroup=1 on all the button widgets in the first group, and uiButtonGroup=2 for the other group. To get which button is selected, check the ui_button_name.uiButtonState=1; or you can do it easier by setting it through the event object. See Interacting with Widgets…
uiTextFixedX=10; If you want to override where the text will be drawn on the button. You can even use negative numbers, so -20 will draw the text 20 pixels to the left of current button x position.
uiTextFixedY=10; If you want to override where the text will be drawn on the button. Example, 20 will draw the text 20 pixels down from the current button y position.
uiTextFixed=false; Normally text is transformed/animated as the button, you can specify to not use and transformations on the draw text by setting this to true.
uiTextTrim=false; if you want to trim the text if it doesn’t fit on the button or allow it to draw outside button area. Useful to draw long text strings over a sprite button.
uiDownOffset=3; when button is pressed it is auto-shifted this many pixels. you can adjust, zero would not move the button on pressed.
uiBackScale=1; this allows you to draw the background smaller than the buttons touch area, for example with a keyboard you want a bigger area than the keyboard. (ex 0.