Goo: Gui and Animation library.

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
adrix89
Party member
Posts: 135
Joined: Fri Oct 15, 2010 10:58 am

Re: Goo: Gui and Animation library.

Post by adrix89 »

I know why: the folder is named "Dark", while the code refers to "dark". Capitalization matters! Renaming it makes it work in .loves and on Linux/Mac.
Ok it works
Where?
I mean my post,edited something
I use Workflowy but you can check out Dynalist as its the better offer.
User avatar
Lap
Party member
Posts: 256
Joined: Fri Apr 30, 2010 3:46 pm

Re: Goo: Gui and Animation library.

Post by Lap »

ATTENTION TO EVERYONE USING GOO! SERIOUS BUG THAT NEEDS TO BE FIXED!

Code: Select all

function goo.object:destroy()
	if self.parent then
		for k,v in pairs(self.parent.children) do
			if v == self then table.remove(self.parent.children,k) end
		end
	end
	for i,child in ipairs(self.children) do
		child:destroy()
	end
	self = nil
	return
end
Needs to become:

Code: Select all

function goo.object:destroy()
	if self.parent then
		for k,v in pairs(self.parent.children) do
			if v == self then 
			table.remove(self.parent.children,k)
				for i = self.z, #self.parent.children do
				self.parent.children[i].z = i
				end
			end
		end
	end
	for i,child in ipairs(self.children) do
		child:destroy()
	end
	self = nil
	return
end
This bug has been silently plaguing me for months. All sorts of goo objects and other elements would seemingly disappear at random. I thought it was related to the many changes I've made to goo, but I just confirmed it's a long standing bug.

Without this you'll "lose" goo elements. You can check them and their tables will still exist, but they won't be drawn. The reason for all of this is that in the standard release of Goo, when objects are destroyed the other objects on higher layers will not update correctly. This causes layers to later get overwritten in the main BASEOBJECT table, orphaning them forever. Now feed me your karma :ultraglee:
User avatar
whitebear
Citizen
Posts: 86
Joined: Sun Mar 15, 2009 1:50 am

Re: Goo: Gui and Animation library.

Post by whitebear »

How would I go about doing this in essence:

Code: Select all

function PerkList[i].button:onClick ()
	if PerkList[i].hasit == 0 then
	if Points => PerkList[i].cost then
	Points = Points - PerkList[i].cost
		PerkList[i].hasit = 1
	end
	elseif PerkList[i].hasit == 1 then
	Points = Points + PerkList[i].cost
		PerkList[i].hasit = 0
	end
	panel:setTitle( "Traits ( You have ".. Points.." points to spend)" )
end
The function doesn't like having in it's call. Is there some way to do this without causing an error?
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Goo: Gui and Animation library.

Post by Robin »

whitebear wrote:The function doesn't like having in it's call. Is there some way to do this without causing an error?

That's because it isn't a call, it's a definition.

Fortunately, Lua being Lua, you can do this:

Code: Select all

PerkList[i].button.onClick = function (self)
	if PerkList[i].hasit == 0 then
	if Points => PerkList[i].cost then
	Points = Points - PerkList[i].cost
		PerkList[i].hasit = 1
	end
	elseif PerkList[i].hasit == 1 then
	Points = Points + PerkList[i].cost
		PerkList[i].hasit = 0
	end
	panel:setTitle( "Traits ( You have ".. Points.." points to spend)" )
end
Help us help you: attach a .love.
User avatar
whitebear
Citizen
Posts: 86
Joined: Sun Mar 15, 2009 1:50 am

Re: Goo: Gui and Animation library.

Post by whitebear »

This is one of the best gui's out there but has anyone gotten the goo.text working? because either the code has bug or it's done differently from goo.textinput
There is no simple text object in example so it's possible it was missed in beta testing.
User avatar
adrix89
Party member
Posts: 135
Joined: Fri Oct 15, 2010 10:58 am

Re: Goo: Gui and Animation library.

Post by adrix89 »

whitebear wrote:This is one of the best gui's out there but has anyone gotten the goo.text working? because either the code has bug or it's done differently from goo.textinput
There is no simple text object in example so it's possible it was missed in beta testing.
My version works,but its for 0.7
It also doesn't have the fix Lap was talking about
I use Workflowy but you can check out Dynalist as its the better offer.
User avatar
whitebear
Citizen
Posts: 86
Joined: Sun Mar 15, 2009 1:50 am

Re: Goo: Gui and Animation library.

Post by whitebear »

I fixed the text.lua file
Should work with this. Not sure how well it works when getting off the borders but at least doesn't give error.
The original file:

Code: Select all

-- STATIC TEXT
goo.text = class('goo static text', goo.object)
function goo.text:initialize( parent )
	super.initialize(self,parent)
	self.text = "no text"
end
function goo.text:draw(x,y)
	love.graphics.setColor( unpack(self.color) )
	love.graphics.print( self.text, x, y )
end
function goo.text:setText( text )
	self.text = text or ""
end
function goo.text:getText()
	return self.text
end

return goo.text
New file:

Code: Select all

-- STATIC TEXT
goo.text = class('goo static text', goo.object)
function goo.text:initialize( parent )
	super.initialize(self,parent)
	self.text = "no text"
	self.color = {0,0,0,255}
end
function goo.text:draw()
	love.graphics.setColor( unpack(self.color) )
	love.graphics.print( self.text, self.x, self.y )
end
function goo.text:setText( text )
	self.text = text or ''
end
function goo.text:getText()
	return self.text
end

return goo.text
User avatar
TheAncientGoat
Prole
Posts: 9
Joined: Sat Dec 04, 2010 5:41 pm

Re: Goo: Gui and Animation library.

Post by TheAncientGoat »

Anyone still maintaining this lib? I added a getAbsoluteSize method sothat you can centre align buttons.

in goo.lua:

Code: Select all

function goo.base:getAbsoluteSize() return 0,0 end

function goo.object:getAbsoluteSize( w, h )
	local w, h = w or self.w, h or self.h
	return (w*self.parent.xscale), (h*self.parent.yscale)
not exactly groundbreaking stuff, but it's a useful little function
User avatar
qubodup
Inner party member
Posts: 775
Joined: Sat Jun 21, 2008 9:21 pm
Location: Berlin, Germany
Contact:

Re: Goo: Gui and Animation library.

Post by qubodup »

Would anybody mind forking https://github.com/perky/Goo/network and adding the changes that have been added in this thread? That would be super-handy-dandy.. :)
lg.newImage("cat.png") -- made possible by lg = love.graphics
-- Don't force fullscreen (it frustrates those who want to try your game real quick) -- Develop for 1280x720 (so people can make HD videos)
User avatar
ljdp
Party member
Posts: 209
Joined: Sat Jan 03, 2009 1:04 pm
Contact:

Re: Goo: Gui and Animation library.

Post by ljdp »

Tell you what. I've got this afternoon free, i'll just update the main repository :)

Edit: New version is under 'Experimental' branch for now.
Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests