Gspöt - retained GUI lib

trubblegum
Party member
Posts: 192
Joined: Wed Feb 22, 2012 10:40 pm

Re: Gspöt - formerly Yet another stateful GUI

I'll start a new thread at some point for Gscrooter, or SCREWformer, or whatever the hell it ends up being called.

In the mean, here's a nice little feedback object for a Gspot element's click() or whatever :

Code: Select all

feedback = this.Gspot:element(this.Gspot:text('No Such Thinger D:', {x = 0, y = 32, w = 256, h = 16}, this.id))
feedback.alpha = 255
feedback.update = function(this, dt)
this.alpha = this.alpha - (255 * dt)
if this.alpha < 0 then this.Gspot:rem(this.id) end
local color = this.Gspot.color.fg
this.color = {color[1], color[2], color[3], this.alpha}
end


trubblegum
Party member
Posts: 192
Joined: Wed Feb 22, 2012 10:40 pm

Re: Gspöt - formerly Yet another stateful GUI

Gspot has had a major rewrite (thanks to some suggestions .. you know who you are). It should now be much more efficient, and a little easier to use.

The biggest change in functionality is that references are passed directly, so you no longer have to mess about with Gspot:element(id) and such tomfoolery.
I have been convinced that it was an unnecessary layer of abstraction which brought no real benefits.

Other changes include :
- type constructors are more flexible, as are many of elements' shiny new inherited methods
- element draw functions are now inherited from their element
- cascading element stylings, which are not yet working as expected

Other than that issue, which I'm working on, I think the whole thing runs a lot smoother.
Documentation is nearing completion over on the git wiki, and I'll be reworking the demo once that's done. It works, but it's way too cluttered.

I'll probably be moving the elements to individual includes, so you can cull the ones you don't want, and save some precious memory and deployment size. This will involve adding a conf.lua, similar to LÖVE's. Any objections?

trubblegum
Party member
Posts: 192
Joined: Wed Feb 22, 2012 10:40 pm

Re: Gspöt - formerly Yet another stateful GUI

Big commit today .. lots of optimization, granularization, and all kinds of other stuff that ends with "-ation"

- circle shapes, checkbox and feedback elements
- type operators
- improved drawing and boundary checking
etc

I'll get to updating the docs ASAP

SiENcE
Party member
Posts: 783
Joined: Thu Jul 24, 2008 2:25 pm
Location: Berlin/Germany
Contact:

Re: Gspöt - formerly Yet another stateful GUI

Im unsure to use Quickie or Gspöt. Hm...

trubblegum
Party member
Posts: 192
Joined: Wed Feb 22, 2012 10:40 pm

Re: Gspöt - formerly Yet another stateful GUI

They're very different breeds .. you would have to base your choice on what style of programming you prefer.

For sheer ease of use with simple interfaces, quickie probably has the goods. It also has the benefit of a developer who has more experience with Lua than I do.
It is very procedure-oriented, so you'll have to do state tracking yourself.

If you want to have your GUI around as an MCV style object, Gspot gives you direct access to persistent elements, but may take a little longer to learn the ins and outs of if you want to take full advantage of it.
There is also the possibility that, what with Gspot being the new kid, it still has undiscovered bugs. I'm pretty regular on the forum, so any you do find shouldn't take more than a day or so to set straight, but it's only fair to warn you that I've had no feedback on the current version, which in some ways differs greatly from the original.
Documentation is also out of date at the moment, but again, I'm accessible for questions, should they arise.

For a little background on the fundamental difference between the two libraries :
quickie works like this : http://en.wikipedia.org/wiki/Immediate_mode
Gspot works like this : http://en.wikipedia.org/wiki/Retained_mode

Hope that helps some. If anyone has experience, feel free to throw in your oar .. there are a lot of options around, so it can be a tough choice.

SiENcE
Party member
Posts: 783
Joined: Thu Jul 24, 2008 2:25 pm
Location: Berlin/Germany
Contact:

Re: Gspöt - formerly Yet another stateful GUI

Thanks for this infos.

I'm already using quickie, but I take a deeper look into yours.

linux-man
Citizen
Posts: 57
Joined: Thu Apr 28, 2011 4:51 pm

Re: Gspöt - formerly Yet another stateful GUI

Hi.
I can't make 2 scrollgroups to work. The first just disappear and all the elements are scrolled by the second. With the same parent or different parents.
Is it a bug?

SiENcE
Party member
Posts: 783
Joined: Thu Jul 24, 2008 2:25 pm
Location: Berlin/Germany
Contact:

Re: Gspöt - formerly Yet another stateful GUI

I swiched from Quickie to Gspöt. I use a lot of buttons and icons in my game and the fps drops a lot. I realized that Gspöt doesn't use spritebatch.

This should be improved.

btw. is there any other gui that uses spritebatch?

trubblegum
Party member
Posts: 192
Joined: Wed Feb 22, 2012 10:40 pm

Re: Gspöt - formerly Yet another stateful GUI

Spritebatch is kinda wacky, and I can't make sense of it, so it's unlikely to happen.
If the documentation improves to a point where you can actually tell what it does and how to do it, I might look at it.

I don't know about other GUI libs.

Apologies to the fellow with the scrollgroup problem .. I don't seem to be getting email notifications any more, so I'll check on my subscription settings.

Karai17
Party member
Posts: 883
Joined: Sun Sep 02, 2012 10:46 pm

Re: Gspöt - formerly Yet another stateful GUI

G'day mate!

Awesome library! I was wondering if there was an easy way to check which element has focus, or even better, to run a function when an element gains or loses focus?

Something like this:

Code: Select all

input = gui:input("text input", {x=0, y=0, w=48, h=16})

input.onFocus = function(this)
this:click()
end

input.click = function(this)
this.value = "focus/clicked!"
this:focus()
end

or maybe something similar to this:

Code: Select all

if gui.focus == input then -- note that gui.focus and input are not currently equal :(
input:click()
end

or even:

Code: Select all

gui.focus:click()

My goal is to have an element act the same, where it is focused by clicking or it is tabbed to using element.next.
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+

Dev Blog | GitHub | excessive ❤ moé

Who is online

Users browsing this forum: No registered users and 26 guests