Screenshots at bottom of this post.
Going through being remade. I've already remade a lot of the old stuff. Borders no longer are antialiased (Which made them look horrendous.) and borders no longer don't meet at the corners.
Shading is now a lot more efficient and event declerations don't take up so much space because I made a function for them.
All functions have been rewritten and captions (Now named 'toolTips') are more customisable. The update events in GUIs now is something like 20-30% more efficient, and I've improved it a lot in general.
Code: Select all
Tl;Dr edition:
Add "require("Class.lua") and require("GUIElements\/GUIMain.lua")" to the top of main.lua
Add "GUIUpdate()" in love.update(). Pass in dt as an argument.
Add "GUIDraw()" in love.draw().
All camelCase except class names like TextButton, which are PascalCase.
Create an object like this:
TextButton:new("ButtonName")
ButtonName.size = {x,y}
ButtonName.position = {x,y}
ButtonName.text = "Hello world"
CheckBox:new("CheckName")
Slider:new("SliderName")
You get the idea.
Events work as such:
TextButton:new("Button1")
Button1.mouseButtonLDown:connect(function(x,y)
print("Mouse clicked at x:"..x.." y:"..y)
end)
Or, obviously, you can do
function Button1ClickedEventFunctionThing(x,y)
print("Mouse clicked at x:"..x.." y:"..y)
end
TextButton:new("Button1")
Button1.mouseButtonLDown:connect(Button1ClickedEventFunctionThing)
Most properties can be found by looking at GUIClassDecleration.lua, these are in all GUI elements (With some excepts; textLabel doesn't inherit mouseClicked, mousePressed or mouseReleased)
That's about it. If you need any help, just post and if you're in GMT or a similar timezone I'll usualy respond within 10 minutes.
This uses my own class system (Multi-inheritance and inherit from multiple classes), and, so far has the following elements
- Checkbox
- TextButton
- Slider
- DropdownBox
- Tabs
- Frames (Contain other GUI elements which position relative)
- Text input
- If an element is behind another, it still registers all mouse events if you click it.
- No z-positioning (Not realy a bug but it comes under the red-I-won't-fix-but-you-can category)
- Tooltips with text padding, and adjustable text
- Events
- Easy to use
- Very flexible
- Almost everything is adjustable (border color, width, etc)
- Generally, assuming a variable name, you'll guess write (Variable names aren't cryptic)
- Needs you to require two files
- Multiple (About 5-6) lua files (One of the two you require requires them for you.)
- Requires you to remember lots of variables to use efficiently (Err, what doesn't?)
It's easy to attach a function to events; it's similar to http://roblox.com's event system, you just do this:
Code: Select all
function click()
end
Button.mouseButtonLDown:connect(click)
Code: Select all
Button.mouseButtonLDown:connect(function()
end)
To make a GUI, is all you type is:
Code: Select all
GuiName:new("VariableName")
Code: Select all
Checkbox:new("Check1")
Almost everything is fully adjustable, and some objects have their own callback functions- for example, checkbox has "checkStateChange".
It uses camelCase for all properties, methods etc, and PascalCase for classes. (eg CheckBox), and variables are named as simply as I could.
Post syntactic and whatnot feedback.
Some of you will find this a lot better than current systems, and some of you won't like it at all; fair enough, we all have opinions.
By the way; you only need one line of code in update and draw. GUIUpdate(), and GUIDraw() respectively. They both loop all GUIs and draw them.
That's about it. If you need any help, just post and if you're in GMT or a similar timezone I'll usualy respond within 10 minutes.