Hi. I've created a UI library for LÖVE. The idea is that for all UI elements their state and input logic is abstracted away while the user of the library only has to care about how each element is drawn. This makes it easy to create all sorts of UIs for games (since in games they need to look really different all the time) and also makes it simpler to build more complex UI elements on top of the ones that exist right now. The library is under development still, I've only added 3 UI elements so far and no themes, but I thought I'd publish it as it is now to see if people find it useful or not.
Thranduil
Documentation
[Library] Thranduil
[Library] Thranduil
Last edited by adnzzzzZ on Sat Mar 21, 2015 5:50 am, edited 1 time in total.
Re: [Library, WIP] Thranduil
looks really cool
i may use it in future projects
i may use it in future projects
Re: [Library, WIP] Thranduil
I tried using the library, but I couldnt figure out if there is like a function or something that gets called when button is being clicked. In general if you click a button, you can start holding down on top of button, then drag mouse off from button and release, but it doesn't actually do clicking. I am not really sure if its neccessary to be able to cancel a click, but currently from what I tested you cannot have a state where released is true and down is true, or maybe it was, but this would mean that you would yourself have to manually keep a state of each button.
Also out of curiosity I tried the gui with android phone, because that is what I have been looking for, a gui that works with Android phone (currently Quickie is only one, but I had a problem with the button click being registered few frames after the click ), but sadly at least out of box thranduil didn't.
Also out of curiosity I tried the gui with android phone, because that is what I have been looking for, a gui that works with Android phone (currently Quickie is only one, but I had a problem with the button click being registered few frames after the click ), but sadly at least out of box thranduil didn't.
- Roland_Yonaba
- Inner party member
- Posts: 1563
- Joined: Tue Jun 21, 2011 6:08 pm
- Location: Ouagadougou (Burkina Faso)
- Contact:
Re: [Library, WIP] Thranduil
I dont know for the name... Why not cap up the "U" ?
Just my two cents.
This is awesome anyway. Nice API, and well written documentation.
I'd love some demos though.
Just my two cents.
This is awesome anyway. Nice API, and well written documentation.
I'd love some demos though.
Re: [Library, WIP] Thranduil
That is some pretty impressive documentation. The library seems awesome and it is clear that you have put a lot of effect into it
Re: [Library, WIP] Thranduil
There's no function that gets called when anything happens. All that happens is that the object's state changes and if you wanna do anything you keep looking at that:Muris wrote:I tried using the library, but I couldnt figure out if there is like a function or something that gets called when button is being clicked. In general if you click a button, you can start holding down on top of button, then drag mouse off from button and release, but it doesn't actually do clicking. I am not really sure if its neccessary to be able to cancel a click, but currently from what I tested you cannot have a state where released is true and down is true, or maybe it was, but this would mean that you would yourself have to manually keep a state of each button.
Code: Select all
function update(dt)
button:update(dt)
if button.pressed then
doYourPressedAction()
end
if button.down then
doYourDownAction()
end
if button.released then
doYourReleasedAction()
end
end
Code: Select all
function update(dt)
button:update(dt)
if button.released and button.hot then
doYourReleasedAction()
end
end
I don't care about mobile so yea, it won't work there. It should be some work to get it working there because you have to change the Input module https://github.com/adonaac/thomas to support the additional events that exist in mobile and then add those events to each UI element.Muris wrote:Also out of curiosity I tried the gui with android phone, because that is what I have been looking for, a gui that works with Android phone (currently Quickie is only one, but I had a problem with the button click being registered few frames after the click ), but sadly at least out of box thranduil didn't.
Re: [Library, WIP] Thranduil
I don't like the decision that I have to call button:update() and button:draw() myself. By using GSpot I only have to register gspot:update() in my update function and everything is done. Like you register the Input Callbacks.
Re: [Library, WIP] Thranduil
Well, I made that decision because that gives the user more control over his UI objects and makes things more explicit. Imagine the idea is to create one of those terminals that some games have:
It really doesn't help you when coding the logic for these things to have your UI objects hidden away somewhere and doing too many things automatically, right?
Anyway, you can change this if you want by creating UI.update and UI.draw functions in the UI.lua file, going over the elements list and updating/drawing each object.
And then just register UI.update and UI.draw on love.update and love.draw. The if not element.parent check is so that you don't update/draw elements that are inside a frame twice, since when objects are added to a frame, their parent attribute is changed to point to the frame and the frame already takes care of updating/drawing its children.
It really doesn't help you when coding the logic for these things to have your UI objects hidden away somewhere and doing too many things automatically, right?
Anyway, you can change this if you want by creating UI.update and UI.draw functions in the UI.lua file, going over the elements list and updating/drawing each object.
Code: Select all
UI.update = function(dt)
for _, element in ipairs(UI.elements) do
if not element.parent then
element:update(dt)
end
end
end
UI.draw = function()
for _, element in ipairs(UI.elements) do
if not element.parent then
element:draw()
end
end
end
Re: [Library, WIP] Thranduil
I added your library in the wiki (you can fix information yourself, if I'm wrong) :
https://www.love2d.org/wiki/Thranduil
Shown in the GUI list :
https://www.love2d.org/wiki/Graphical_User_Interface
https://www.love2d.org/wiki/Thranduil
Shown in the GUI list :
https://www.love2d.org/wiki/Graphical_User_Interface
My projects current projects : dragoon-framework (includes lua-newmodule, lua-provide, lovemodular, , classcommons2, and more ...)
Who is online
Users browsing this forum: Google [Bot] and 1 guest