Advertisement
Alakazard12

Nova API

Feb 3rd, 2014
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.63 KB | None | 0 0
  1. -- API Stuff
  2.  
  3.  
  4.  
  5.  
  6. local UI = NewUI() -- Created the initial UI
  7.  
  8. UI:New(Type) -- Type can be TextButton, TextLabel, TextBox, ImageButton, or ImageLabel
  9. -- Returns the new object
  10.  
  11. UI:Draw() -- Draws the UI.
  12.  
  13. UI:Listen() -- Listens for button presses, text box presses, etc.
  14.  
  15. UI:StopListen() -- Stops listening
  16.  
  17. UI:Output(Function) -- What listen outputs to, so you don't need to parallel two functions.
  18. -- Parameters are Event, P1, P2, P3, P4, P5
  19.  
  20. -- Specific to all elements
  21.  
  22. Element = UI:New("TextLabel")
  23.  
  24. Element:Size(x, y)
  25. Element:GetSize()
  26.  
  27. Element:Position(x, y)
  28. Element:GetPosition()
  29.  
  30. Element:BackgroundColor(col)
  31. Element:ShowBackground(Bool)
  32.  
  33. Element:Visible(Bool)
  34. Element:GetVisible()
  35.  
  36. Element:ZIndex(Num) -- Set the ZIndex. The higher the ZIndex the higher the elements layer will be.
  37. Element:GetZIndex()
  38.  
  39. Element:Active(Bool)
  40. Element:GetActive()
  41.  
  42. Element:New(Type) -- Type is the Type. Same as UI:New(), but it's within the element.
  43. -- Doing something like ChildElement:Position(1, 1) will set the position to the top corner of the
  44. -- parent element. Use this for efficiency and optimizing code. Like only drawing that one element
  45. -- so it doesn't have to redraw everything else. It will draw all of the children, and setting the visiblity
  46. -- will also apply to the children.
  47.  
  48. Element:Draw() -- Draws the element on the screen.
  49.  
  50. -- Image type specific functions
  51.  
  52. Image = UI:New("ImageLabel") -- ImageLabel or ImageButton
  53. Image:Image(ImageT) -- ImageT is the loaded image. ImageT = paintutils.loadImage("filename")
  54.  
  55. -- Button type specific functions
  56.  
  57. Button = UI:New("TextButton") -- ImageButton or TextButton
  58.  
  59. Button:Button1Click(Function) -- Function is the Function called when mouse button 1 is pressed. The
  60. -- parameters are X position, Y position.
  61. -- Other functions are Button2Click and Button3Click.
  62.  
  63. Button:GetButton1Click() -- Returns the function you set, if you haven't set one it returns nil
  64. -- Other functions are GetButton2Click and GetButton3Click
  65.  
  66.  
  67. Button:MouseDrag1(Function) -- Function is the function called when mouse button1 is dragged. Parameters
  68. -- are X position and Y position.
  69. -- Other functions are MouseDrag2 and MouseDrag3
  70.  
  71. Button:GetMouseDrag1() -- Same as GetButton1Click()
  72. -- Other functions are GetMouseDrag2 and GetMouseDrag3
  73.  
  74.  
  75. -- Text specific functions
  76.  
  77. Text = UI:New("TextLabel") -- TextLabel, TextButton, or TextBox
  78.  
  79. Text:Text(Tex) -- Tex is the string you want to set the text to.
  80.  
  81. Text:SetXAlignment(Dir) -- Dir is the position you want the text. It can  be "left", "right", or "center"
  82.  
  83. Text:SetYAlignment(Dir) -- Dir is the position you want the text. It can  be "top", "bottom", or "center"
  84.  
  85. Text:GetXAlignment() -- 1 is left, 3 is right, 2 is center
  86. Text:GetYAlignment() -- 1 is top, 2 is center, 3 is bottom
  87.  
  88. Text:ShowText(Bool) -- true or false
  89. Text:GetShowText() -- returns true or false
  90.  
  91. Text:MultiLine(Bool) -- Allows multiline
  92. Text:GetMultiLine() -- returns true or false
  93.  
  94. Text:GetText()
  95.  
  96. Text:TextColor(col) -- colors.red, colors.blue, etc.
  97. Text:GetTextColor()
  98.  
  99. Text:MouseScroll(Function) -- Function for MouseScroll. Parameters are direction, x, y
  100.  
  101. -- TextBox sepcific
  102.  
  103. Box = UI:New("TextBox")
  104.  
  105. Box:ActiveTextColor(col) -- Color that shows when text is active.
  106. Box:EnterPress(Function) -- Function called when enter is pressed.
  107. Box:GetEnterPress()
  108.  
  109. Box:ClearTextOnFocus(Bool) -- true or false
  110. Box:GetClearTextOnFocus()
  111.  
  112. Box:Focus() -- Make the box the focused element
  113. Box:StopFocus() -- Stop making it focused
  114.  
  115. Box:TextChar(Char) -- Similar to read(Char). Makes the text shown the character. Box:TextChar("*") for a password
  116. Box:GetTextChar()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement