Page 9 of 17
Re: Gspöt - retained GUI lib
Posted: Thu Dec 13, 2012 4:58 pm
by Karai17
Thank you very much for this big fix, it really helps me out!
I understand that it can be tiresome to work on the same thing over a long period of time. With the scrollgroup bug fixed, Gspot is, like, 95% amazing. A pretty good score if you ask me
![Wink ;)](./images/smilies/ms-wink.png)
I'll poke around and see if I can't get those things working on my own.
![Smile :)](./images/smilies/ms-smile.png)
Re: Gspöt - retained GUI lib
Posted: Sat Dec 15, 2012 7:50 am
by Karai17
![Cool :cool:](./images/smilies/ms-sunglass.png)
Double Post
How do you interact with other instances of Gspot? I want to display the chat system I made on more than one of my screens without having to lose any data or pasting a whole bunch of code. Is that possible
![Confused :?](./images/smilies/ms-confused.png)
Re: Gspöt - retained GUI lib
Posted: Sat Dec 15, 2012 9:01 am
by trubblegum
I might do something like :
Code: Select all
require("Gspot")
love.load = function()
state = {
common = {gui = Gspot()},
menu = {
gui = Gspot(),
update = function(this, dt)
state.common.gui:update(dt)
this.gui:update(dt)
end,
draw = function()
// you get the idea ..
end
},
world = {gui = Gspot(),
// these should really inherit from a gamestate class, since they contain identical functions.
}
}
state.current = state.menu
end
love.update = function(dt)
state.current:update()
end
love.draw = function()
state.current:draw()
end
love.mousepressed = function()
// prioritize as you see fit ..
if state.common.gui.mousein then state.common.gui:mousepress(x, y, button) else state.current.gui:mousepress(x, y, button) end
end
// etc ..
Or you could just group up your elements with functions to construct each group as required (you should be doing this anyway). Pass them a reference to a Gspot instance if you're using more than one at a time, but one gui at a time is probably easier in the long run.
I presume when you built the element you want to interact with, you kept a reference to it, so use it.
Re: Gspöt - retained GUI lib
Posted: Sat Dec 15, 2012 6:12 pm
by Karai17
Thanks for the reply, mate. I'm not using a state system in my game. Instead, I am using separate love-like instances for each screen so access to a previous screen's data (such as construction references), without passing it forward, is difficult. I tried passing my chat forward and, as expected, the new instance of Gspot isn't paying it any heed.
I originally had only a single instance of Gspot but my entire gui would show up on every screen, so that wasn't too helpful either... Perhaps a global table filled with each ui group (like you posted above) is the answer.
https://github.com/karai17/love-und-pan ... nt/screens
Re: Gspöt - retained GUI lib
Posted: Sat Dec 15, 2012 6:56 pm
by trubblegum
Karai17 wrote:separate love-like instances
What is this I don't even.
Re: Gspöt - retained GUI lib
Posted: Sat Dec 15, 2012 7:13 pm
by Karai17
Magic.
Each screen runs in its own love sandbox, controlling the main callbacks (load, update, draw, etc). Have a look through my project's code if you'd like.
https://github.com/karai17/love-und-panzer
Re: Gspöt - retained GUI lib
Posted: Sat Dec 15, 2012 10:43 pm
by trubblegum
Um .. no thanks.
Re: Gspöt - retained GUI lib
Posted: Sat Dec 15, 2012 11:20 pm
by Karai17
No need for that :\
Re: Gspöt - retained GUI lib
Posted: Sat Nov 28, 2015 7:28 pm
by DeltaF1
Sorry to necro this thread, but as trubblegum hasn't posted here for 3 years, I figured I'd make a post with a slightly updated version of the library. I replaced references to love.screen with love.window, removed the keyrepeat features of the library (I'll probably add these back in updated for 0.9) and tweaked the text input element to use love.textinput instead of love.keypressed (I will also be updating this so that backspace and delete work with utf8 strings properly). I'd make a pull request on github, but trubblegum seems to have dissapeared, so here it is.
The original repository is
here
- Gspot.lua
- Updated for 0.9.x
- (36.32 KiB) Downloaded 180 times
Re: Gspöt - retained GUI lib
Posted: Sat Nov 28, 2015 7:30 pm
by Karai17
You could fork his repo and continue on with your own forum thread if you want to become the de facto maintainer of the project.
![Smile :)](./images/smilies/ms-smile.png)