READMEAAAAA

This commit is contained in:
Josh
2018-05-29 11:10:59 -05:00
parent f9d3a0c3f5
commit a0e9c2f432
4 changed files with 45 additions and 4 deletions

View File

View File

@@ -3,6 +3,45 @@ A library that adds simple GUI elements for you to utilize in your Love2D games.
## Basic Setup
Download JUI and place the JUI folder in your project, the library can be required with:
```lua
local JUI = require("JUI/JUIlib") -- I recommend calling the required variable "JUI"
-- that's what I'll be using in all docs and examples
```
The JUIlib object returns the following objects for you to use:
- UIContainer
- Frame
- TextBox
- Dimension
- Vector2D
- RGBColor
- parent() function
To set up a basic UI scene, a UIContainer is created and objects to be rendered are parented to it. The UIContainer must be rendered and updated inside the appropriate Love2D functions.
```lua
-- creates a UIContainer and a Frame object, and renders them.
local scene = JUI.UIContainer:new()
local frame = JUI.Frame:new()
frame:setBackgroundColor(JUI.RGBColor:new(255, 128, 128))
JUI.parent(scene, frame) -- the current method of setting the parent of an object
-- first object is the new parent of the second object
-- I don't particularly like this method, and am looking for an alternative
function love.update(delta)
scene:update(delta) -- the UIContainer will recursively call update(delta) on all descendants
end
function love.draw()
scene:render() -- same thing with render()
end
```
## API
#### UIBase class
@@ -80,7 +119,9 @@ Dimension:new(number xScale, number yScale, number xPixel, number yPixel)
Methods:
```lua
number, number getScaleXY()
number, number getPixelXY()
number, number, number, number getComponents()
```
Operators:

View File

@@ -33,8 +33,8 @@ function Dimension:getPixelXY()
return self.x.pixel, self.y.pixel
end
function Dimension:getPosition()
function Dimension:getComponents()
return self:getScaleXY(), self:getPixelXY()
end
return Dimension

View File

@@ -1,6 +1,6 @@
_G.stringList = {}
local JUI = require("JUI")
local JUI = require("JUIlib")
local bigboy = JUI.Dimension:new(0.3, 0.2)