Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- API Stuff
- local UI = NewUI() -- Created the initial UI
- UI:New(Type) -- Type can be TextButton, TextLabel, TextBox, ImageButton, or ImageLabel
- -- Returns the new object
- UI:Draw() -- Draws the UI.
- UI:Listen() -- Listens for button presses, text box presses, etc.
- UI:StopListen() -- Stops listening
- UI:Output(Function) -- What listen outputs to, so you don't need to parallel two functions.
- -- Parameters are Event, P1, P2, P3, P4, P5
- -- Specific to all elements
- Element = UI:New("TextLabel")
- Element:Size(x, y)
- Element:GetSize()
- Element:Position(x, y)
- Element:GetPosition()
- Element:BackgroundColor(col)
- Element:ShowBackground(Bool)
- Element:Visible(Bool)
- Element:GetVisible()
- Element:ZIndex(Num) -- Set the ZIndex. The higher the ZIndex the higher the elements layer will be.
- Element:GetZIndex()
- Element:Active(Bool)
- Element:GetActive()
- Element:New(Type) -- Type is the Type. Same as UI:New(), but it's within the element.
- -- Doing something like ChildElement:Position(1, 1) will set the position to the top corner of the
- -- parent element. Use this for efficiency and optimizing code. Like only drawing that one element
- -- so it doesn't have to redraw everything else. It will draw all of the children, and setting the visiblity
- -- will also apply to the children.
- Element:Draw() -- Draws the element on the screen.
- -- Image type specific functions
- Image = UI:New("ImageLabel") -- ImageLabel or ImageButton
- Image:Image(ImageT) -- ImageT is the loaded image. ImageT = paintutils.loadImage("filename")
- -- Button type specific functions
- Button = UI:New("TextButton") -- ImageButton or TextButton
- Button:Button1Click(Function) -- Function is the Function called when mouse button 1 is pressed. The
- -- parameters are X position, Y position.
- -- Other functions are Button2Click and Button3Click.
- Button:GetButton1Click() -- Returns the function you set, if you haven't set one it returns nil
- -- Other functions are GetButton2Click and GetButton3Click
- Button:MouseDrag1(Function) -- Function is the function called when mouse button1 is dragged. Parameters
- -- are X position and Y position.
- -- Other functions are MouseDrag2 and MouseDrag3
- Button:GetMouseDrag1() -- Same as GetButton1Click()
- -- Other functions are GetMouseDrag2 and GetMouseDrag3
- -- Text specific functions
- Text = UI:New("TextLabel") -- TextLabel, TextButton, or TextBox
- Text:Text(Tex) -- Tex is the string you want to set the text to.
- Text:SetXAlignment(Dir) -- Dir is the position you want the text. It can be "left", "right", or "center"
- Text:SetYAlignment(Dir) -- Dir is the position you want the text. It can be "top", "bottom", or "center"
- Text:GetXAlignment() -- 1 is left, 3 is right, 2 is center
- Text:GetYAlignment() -- 1 is top, 2 is center, 3 is bottom
- Text:ShowText(Bool) -- true or false
- Text:GetShowText() -- returns true or false
- Text:MultiLine(Bool) -- Allows multiline
- Text:GetMultiLine() -- returns true or false
- Text:GetText()
- Text:TextColor(col) -- colors.red, colors.blue, etc.
- Text:GetTextColor()
- Text:MouseScroll(Function) -- Function for MouseScroll. Parameters are direction, x, y
- -- TextBox sepcific
- Box = UI:New("TextBox")
- Box:ActiveTextColor(col) -- Color that shows when text is active.
- Box:EnterPress(Function) -- Function called when enter is pressed.
- Box:GetEnterPress()
- Box:ClearTextOnFocus(Bool) -- true or false
- Box:GetClearTextOnFocus()
- Box:Focus() -- Make the box the focused element
- Box:StopFocus() -- Stop making it focused
- Box:TextChar(Char) -- Similar to read(Char). Makes the text shown the character. Box:TextChar("*") for a password
- Box:GetTextChar()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement