Jasoco wrote:I wonder how hard it would be to implement this into my map editor.
That depends on what you wanna do. If it's just placing simple UI elements around then it should be pretty easy, like:
Code: Select all
function init()
button = UI.Button(x, y, w, h, settings)
end
function update(dt)
button:update(dt)
if button.pressed then
doEditorButtonThing()
end
end
function draw()
button:draw()
end
But if you wanna create more complex UI objects, like a file/directory selector thingy, then you'll have to do a lot of manual work using the basic UI objects that this library provides. It saves some work but if you want anything more complex you'll still have to do stuff.
---
Also, I made a Chatbox example to show how to create more complex UI objects using the library. Basically you just create an object of your own that will contain multiple simple UI objects, like buttons, sliders, textareas and so on. Then you create some logic to coordinate between them and get the desired behavior of the complex UI object you wanna create. In this case the Chatbox uses 2 textareas (one input area where the user types and one that is the chat log), 1 scrollarea to make it so that the chat log can be scrolled, and 1 button that can be used to send the message from the textinput to the chat log (can also do it with enter though).