[Library] Thranduil

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
SiENcE
Party member
Posts: 792
Joined: Thu Jul 24, 2008 2:25 pm
Location: Berlin/Germany
Contact:

Re: [Library, WIP] Thranduil

Post by SiENcE »

@adnzzzzZ Well yes, this is a solution. I would recommed both solution. One for easy handling and the one you suggest for better control.

About the consoles...would be nice to use with computercraft :) -> https://github.com/Sorroko/cclite
Last edited by SiENcE on Sat Mar 21, 2015 11:16 am, edited 1 time in total.
User avatar
adnzzzzZ
Party member
Posts: 305
Joined: Sun Dec 26, 2010 11:04 pm
Location: Porto Alegre, Brazil

Re: [Library] Thranduil

Post by adnzzzzZ »

Updated this with a bunch of new stuff, most notably:
  • Added Checkbox element
  • Added Slider element
  • Added Scrollarea element
  • Added Textarea element
  • Removed Textinput element (Textinput = Textarea with line height = 1)
Thranduil

Documentation
User avatar
Jasoco
Inner party member
Posts: 3725
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: [Library] Thranduil

Post by Jasoco »

I wonder how hard it would be to implement this into my map editor.
User avatar
adnzzzzZ
Party member
Posts: 305
Joined: Sun Dec 26, 2010 11:04 pm
Location: Porto Alegre, Brazil

Re: [Library] Thranduil

Post by adnzzzzZ »

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).
Attachments
chatbox.love
(363.49 KiB) Downloaded 143 times
User avatar
Jasoco
Inner party member
Posts: 3725
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: [Library] Thranduil

Post by Jasoco »

Well see I'd need to be able to add list items to a scrolling clickable list box that have the ability to have a custom icon that can be changed on the fly (Animated) with possibly two lines of text next to it in different fonts. As well as a list box that's just the icons. Each button would optionally have a tooltip too. Right now I have it working fine myself.

I'd also need popdown lists and other things. Right now my rudimentary GUI is working fine, and I've written my own custom GUI libraries before. I might just do that again. Usually I need to do a lot of demanding custom things which is why I end up writing most of my own libraries. Like my state stack manager, which I actually use to create the popdown menus and other GUI elements right now. I don't really know how well a stock GUI library would cooperate with my state stack anyway. lol
User avatar
adnzzzzZ
Party member
Posts: 305
Joined: Sun Dec 26, 2010 11:04 pm
Location: Porto Alegre, Brazil

Re: [Library] Thranduil

Post by adnzzzzZ »

I don't think it makes sense for you to try to use this because you seem to already have things working and you'd need to do a lot of work to get your specific UI elements working with this. Everything you mentioned can be done: scrollable clickable list box = scrollarea + buttons inside it that will be each element on that list; tooltip = making a textarea visible (inside a frame if you want it to be closeable) whenever .hot is set to true on a button; popdown list = 2 buttons to make the top of the popdown thingy and then when you click either it expands to a bigger frame with buttons inside it composing the list; state stack manager = completely on your side of things so it's all work you'd have to do kinda unrelated to the library... And so on. But doing all this is just a lot of work and if you already have those things working I don't know if there's any value in rewriting them?
User avatar
murks
Party member
Posts: 185
Joined: Tue Jun 03, 2014 4:18 pm

Re: [Library] Thranduil

Post by murks »

I found a small mistake in the current version:

UI.lua:5

Code: Select all

UI.Input = require(ui_path .. 'input/Input')
should be

Code: Select all

UI.Input = require(ui_path .. 'Input/Input')
User avatar
murks
Party member
Posts: 185
Joined: Tue Jun 03, 2014 4:18 pm

Re: [Library] Thranduil

Post by murks »

Hi there.
I used Thranduil in a game jam this weekend. It did its job, so thanks for that.

I didn't quite understand how to make button labels, so I did paint over the buttons using love.graphics.print(). Is it supposed to work like this?

I noticed a bug with buttons:
If the mouse cursor is already over the button when the button appears, then it is impossible to click the button.
Fern Silverthorn
Prole
Posts: 3
Joined: Sun Jun 07, 2015 3:31 am

Re: [Library] Thranduil

Post by Fern Silverthorn »

Thank you so much, If I ever get around to releasing my game you get a prime spot on in the credits.

I needed a GUI library and looking around I found yours and love frames on the wiki as the two with 9.x support.
The fact that yours accomplishes so much with so little (user) code is really cool,
it felt like using a library whereas love frames felt like learning an entire new language.

Huge props on the documentation and examples.
User avatar
parallax7d
Citizen
Posts: 82
Joined: Wed Jul 02, 2014 11:44 pm

Re: [Library] Thranduil

Post by parallax7d »

This library is magnificent, thanks for the thought and effort you put into it. I'm leaning towards using it in my project. What are your expectations as to future support and development on this lib? The docs are very nice, but would you consider making a comprehensive interactive demo?
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 69 guests