Page 1 of 1
Newbie problem
Posted: 01 Jul 2009, 22:21
by Das Bruce
I have no clue what is wrong with this, does anyone have a clue? It's supposed to just draw the texture, it was working when it was in a test widget but it doesn't seem to like being a gadget. Should this part be synced or not?
Code: Select all
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
function gadget:GetInfo()
return {
name = "Button",
desc = "It's a button",
author = "Das Bruce",
date = "2009-07-01",
license = "Public Domain",
layer = 1,
enabled = true
}
end
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
local viewx=0
local viewy=0
local width=100
local height=100
local blx=200
local bly=200
if (gadgetHandler:IsSyncedCode()) then
function gadget:DrawScreen(viewx,viewy)
gl.PushMatrix()
gl.Translate(blx, bly, 0)
gl.Color( 1, 1, 1)
gl.Texture(":n:bitmaps/UI/button.png")
gl.TexRect(0, 0, width, height)
gl.Texture(false)
gl.PopMatrix()
end
end
Re: Newbie problem
Posted: 01 Jul 2009, 22:36
by Kloot
No, the DrawScreen callin doesn't exist in synced gadget space.
Re: Newbie problem
Posted: 01 Jul 2009, 23:10
by Argh
Right.
Code: Select all
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
function gadget:GetInfo()
return {
name = "Button",
desc = "It's a button",
author = "Das Bruce",
date = "2009-07-01",
license = "Public Domain",
layer = 1,
enabled = true
}
end
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
if (gadgetHandler:IsSyncedCode()) then
else
local viewx=0
local viewy=0
local width=100
local height=100
local blx=200
local bly=200
function gadget:DrawScreen(viewx,viewy)
gl.PushMatrix()
gl.Translate(blx, bly, 0)
gl.Color( 1, 1, 1)
gl.Texture(":n:bitmaps/UI/button.png")
gl.TexRect(0, 0, width, height)
gl.Texture(false)
gl.PopMatrix()
end
end
Re: Newbie problem
Posted: 01 Jul 2009, 23:15
by smoth
Code: Select all
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
function gadget:GetInfo()
return {
name = "Button",
desc = "It's a button",
author = "Das Bruce",
date = "2009-07-01",
license = "Public Domain",
layer = 1,
enabled = true
}
end
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
local viewx=0
local viewy=0
local width=100
local height=100
local blx=200
local bly=200
if ( not gadgetHandler:IsSyncedCode()) then
function gadget:DrawScreen(viewx,viewy)
gl.PushMatrix()
gl.Translate(blx, bly, 0)
gl.Color( 1, 1, 1)
gl.Texture(":n:bitmaps/UI/button.png")
gl.TexRect(0, 0, width, height)
gl.Texture(false)
gl.PopMatrix()
end
end
fixed
Re: Newbie problem
Posted: 01 Jul 2009, 23:31
by Das Bruce
And yet it still eludes me, my next guess would be the directory it's in but that seems to be right.
Code: Select all
mod.sdd\LuaRules\gadgets\button.lua
What else do you normally have to do to get a gadget to function?
Re: Newbie problem
Posted: 01 Jul 2009, 23:53
by Argh
Check the infolog.
Re: Newbie problem
Posted: 02 Jul 2009, 00:58
by Das Bruce
Nothing to suggest any problems.
Code: Select all
[ 0] Creating sky
[ 0] Loading LuaRules
[ 0] Loading LuaGaia
[ 0] Loading LuaUI
[ 0] Using LUAUI_DIRNAME = LuaUI/
[ 0] Reloaded ctrlpanel with: LuaUI/ctrlpanel.txt
[ 0] LuaUI: bound F11 to the widget selector
[ 0] LuaUI: bound CTRL+F11 to tweak mode
[ 0] Hello Spring
Re: Newbie problem
Posted: 02 Jul 2009, 03:00
by Argh
Are you loading the GadgetHandler?
I.E. ... are these files present?
Not sure why these aren't loaded by default nowadays, but I think they're still required.
Re: Newbie problem
Posted: 02 Jul 2009, 04:40
by Das Bruce
Fucking bingo.
Re: Newbie problem
Posted: 02 Jul 2009, 04:43
by Argh
Cool.