Quickie [was: Immediate Mode Gui]

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
Roland_Yonaba
Inner party member
Posts: 1563
Joined: Tue Jun 21, 2011 6:08 pm
Location: Ouagadougou (Burkina Faso)
Contact:

Re: Quickie [was: Immediate Mode Gui]

Post by Roland_Yonaba »

Hi,

Well I tried playing around with Quickie. And man, I had to say, you did a pretty impressive work on this.
I had some problems at first to get how the concept of IMGUIs. Didn't know about that. But reading at the code, and taking a look at the demo provided was actually very useful.

But I ran into a weird issue with the latest version of Quickie, (this commit).
For instance, let's create and draw some buttons.

Code: Select all

function love.load()
   Ui = require 'Quickie'
end

function love.update(dt)
   if Ui.Button ({text = "Button 1", pos = {150, 440}, size = {200, 50}}) then end
   if Ui.Button ({text = "Button 2", pos = {150, 500}, size ={200, 50}}) then end
   if Ui.Button ({text = "Button 3", pos = {450, 440}, size = {200, 50}}) then end
   if Ui.Button ({text = "Button 4", pos = {450,500}, size = {200,50}}) then end
end

function love.draw()
   Ui.core.draw()
end
Screenie...
Image
Here it is. I'm hovering at the fourth button, and the first one remains highlited, no matter what. :x
In other words, anytime I attempt to add some buttons, the first one keep staying in 'hot' mode, like if the mouse was permanently hovering it...

I did tried the same snippet with a previous version (let's say, this commit). I had to tweak a little the code to match with the API's demands.
From what I could see, the difference between this commit and the latest one (above) is the changes you brought to the API.
Some methods where deleted, among them gui.core.disableKeyFocus(). Fact is, with the previous version, the issue I mentionned above could be easily fixed, using gui.core.disableKeyFocus().

So what are the odds ?
I opened an issue on Github, by the way.
And once again, that's a brilliant piece of work.
No I'll probably go get some sleep.
User avatar
beforan
Prole
Posts: 10
Joined: Sat Dec 15, 2012 1:15 pm
Location: Nottingham, UK

Re: Quickie [was: Immediate Mode Gui]

Post by beforan »

with the previous version, the issue I mentionned above could be easily fixed, using gui.core.disableKeyFocus().
I know this was some months ago now, but I've been using quickie this morning, and have discovered the equivalent in the latest version is gui.keyboard.disable() :)
User avatar
Roland_Yonaba
Inner party member
Posts: 1563
Joined: Tue Jun 21, 2011 6:08 pm
Location: Ouagadougou (Burkina Faso)
Contact:

Re: Quickie [was: Immediate Mode Gui]

Post by Roland_Yonaba »

Hi Beforan, thanks for the feedback.
I've totally forgot to mention it, but yes, the issue was solved, as of this commit. That was since... 3 months ago.
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: Quickie [was: Immediate Mode Gui]

Post by kikito »

vrld wrote:
kikito wrote:Te new push/pop business and the repetition scream "DSL" to me
Not quite sure what you mean: What repetitions and how does that relate to DSLs?
I've just realized I never answered this question. The repetition I was referring to was the need of writing push and pop every time. I don't know if it still how things are done, but I'd rather have a single group method taking a function as parameter instead of two separate push and pop methods.

So, instead of this:

Code: Select all

function love.update(dt)
    gui.group.push{grow = 'right'}
        gui.Checkbox{info = music, size = {'tight'}}
        gui.Checkbox{info = sound, size = {'tight'}}
    gui.group.pop{}
end
This:

Code: Select all

function love.update(dt)
    gui.group({grow = 'right'}, function()
        gui.Checkbox{info = music, size = {'tight'}}
        gui.Checkbox{info = sound, size = {'tight'}}
    end)
 end
You probably do something like that already, since I've seen you doing something similar in hump.camera.
When I write def I mean function.
zac503
Prole
Posts: 1
Joined: Tue May 21, 2013 7:04 pm

Re: Quickie [was: Immediate Mode Gui]

Post by zac503 »

So,

I'm working on my first Love2D game and this lib looks awesome. I've toyed around with it a bit and I'm finally understanding the general idea. I had a question though, Is there a way to change the graphics of the button elements? I'm doing a game with a pixel art feel and I was hoping I could update the buttons to match the general aesthetic of the game. Possibly load a preclick and click for the buttons?

Thanks!
User avatar
hryx
Party member
Posts: 110
Joined: Mon Mar 29, 2010 2:28 am
Location: SF<CA<USA

Re: Quickie [was: Immediate Mode Gui]

Post by hryx »

zac503 wrote:Is there a way to change the graphics of the button elements?
There sure is. Just edit style-default.lua (or create your own style file if you're feeling adventurous). All the actual widget drawing functions are in this file. In your case, edit the function Button().
User avatar
riidom
Citizen
Posts: 74
Joined: Wed Jun 19, 2013 4:28 pm
Location: irgendwo an der Elbe
Contact:

Re: Quickie [was: Immediate Mode Gui]

Post by riidom »

Hi, I discovered a little bug in the text-input. When you are at beginning of text and press Backspace, it will duplicate the existing text instead of doing nothing.

in input.lua:49
change

Code: Select all

elseif keyboard.key == 'backspace' then
to

Code: Select all

elseif keyboard.key == 'backspace' and w.info.cursor > 0 then
and it is fixed, if I havent overseen any terrible consequences.

Another thing that bugs me a little, is that I cant type Umlauts there, I guess I have to expand the check for the code var, maybe with a table of allowed ones? If you are already on this vlrd, let me know, then I rather wait :)

Also Slider2D crashes when operated by arrowkeys, but I didnt look into this, since I probably will have rare use for it, just wanna mention.
User avatar
vrld
Party member
Posts: 917
Joined: Sun Apr 04, 2010 9:14 pm
Location: Germany
Contact:

Re: Quickie [was: Immediate Mode Gui]

Post by vrld »

riidom wrote:Hi, I discovered a little bug in the text-input. When you are at beginning of text and press Backspace, it will duplicate the existing text instead of doing nothing.
Will fix it soon...ish (the Umlaut-thing too). Thanks for reporting!
riidom wrote:Also Slider2D crashes when operated by arrowkeys
What do you mean by "crashes"?
I have come here to chew bubblegum and kick ass... and I'm all out of bubblegum.

hump | HC | SUIT | moonshine
User avatar
riidom
Citizen
Posts: 74
Joined: Wed Jun 19, 2013 4:28 pm
Location: irgendwo an der Elbe
Contact:

Re: Quickie [was: Immediate Mode Gui]

Post by riidom »

Using your widget demo, I first click into the 2D Slider, to give it focus, then try to move the cross with cursor keys. On first keypress, I get:

Code: Select all

Error: Quickie/slider2d.lua:90: attempt to perform arithmetic on field 'x' (a nil value)
stack traceback:
	Quickie/slider2d.lua:90: in function 'Slider2D'
	main.lua:105: in function 'update'
	[string "boot.lua"]:407: in function <[string "boot.lua"]:373>
	[C]: in function 'xpcall'
When pressing up/down key, respective message for 'y'. Hope this helps!
User avatar
riidom
Citizen
Posts: 74
Joined: Wed Jun 19, 2013 4:28 pm
Location: irgendwo an der Elbe
Contact:

Re: Quickie [was: Immediate Mode Gui]

Post by riidom »

Me again,
excuse double-posting, but this is quite another topic than the one before.
I made a multiline-textview-widget, see demo below. Actually, it is not a widget, and I could need a little help in wrapping things properly up so it fits in better.
So far it features textadjusting, gotta call that manually, since doing each frame would kill peformance (at least for me), and text doesnt change each frame anyway.
Then there is the draw and the mousewheel hook, but that's better to view in sourcecode.
Hope the code isnt too shitty, if it is, let me know why! :)
mlvtest.love
(22.43 KiB) Downloaded 260 times
Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests