Code: Select all
function showTest()
party.party:addConnector('onDrawGui', self.go.id, "renderTest")
end
function renderTest(self,context)
local text = context.mouseX .. ", " .. context.mouseY
context.drawText(text, 50, 50)
end
Code: Select all
function showTest()
party.party:addConnector('onDrawGui', self.go.id, "renderTest")
end
function renderTest(self,context)
local text = context.mouseX .. ", " .. context.mouseY
context.drawText(text, 50, 50)
end
...And even then it's still slightly off.. because of the editor's title-bar.minmay wrote: Just press f to change it to fullscreen and back.
On (grand) occasion Petri (the programmer) has logged in here, and implemented feature requests over a drink...on the spot, though it's rare; (and awesome). But I don't expect another patch for LoG1 or LoG2; certainly not soon. The studio is working on a new game; (and has technically changed their name to do it). The editor works fine for most users; the GUI stuff is esoteric..rhavin wrote:This is a known problem? Why not just fix it? The button-function obviously does it right…
Code: Select all
function showPanel()
party.party:addConnector('onDrawGui', self.go.id, "renderTest")
end
function contextUnfucker(maxw, maxh)
cufu = {}
function cufu.init(self, w, h)
self.x = 0
self.y = 0
self.w = w
self.h = h
self._w = w
self._h = h
end
function cufu.recurse(self, context)
if (self.w > 1) then
local cw = math.ceil(self.w / 2)
if (context.button("", self.x, self.y, cw, self.h) == nil) then
self.x = self.x + cw
end
self.w = cw
end
if (self.h > 1) then
local ch = math.ceil(self.h / 2)
if (context.button("", self.x, self.y, self.w, ch) == nil) then
self.y = self.y + ch
end
self.h = ch
else
if (self.w < 2) then return end
end
self:recurse(context)
end
function cufu.unfuck(self, context)
if (Editor.isRunning()) then
self.w = self._w
self.h = self._h
if (context.button("", 0, 0, self._w, self._h) == nil) then
context.realX = -1
context.realY = -1
context.realW = -1
context.realH = -1
return
else
self.x = 0
self.y = 0
self:recurse(context)
context.realX = self.x
context.realY = self.y
context.realW = context.mouseX + context.width - self.x
context.realH = context.mouseY + context.height - self.y
end
else
context.realX = context.mouseX
context.realY = context.mouseY
context.realW = context.width
context.realH = context.height
end
end
cufu:init(maxw, maxh)
return cufu
end
function renderTest(self, context)
local ufu = contextUnfucker(3000,2000)
ufu:unfuck(context)
local text = context.realX .. ", " .. context.realY
context.drawText(text, 50, 20)
text = context.realW .. ", " .. context.realH
context.drawText(text, 50, 40)
text = context.mouseX .. ", " .. context.mouseY
context.drawText(text, 50, 60)
text = context.width .. ", " .. context.height
context.drawText(text, 50, 80)
end
Code: Select all
function showPanel()
party.party:addConnector('onDrawGui', self.go.id, "renderTest")
end
function contextUnfouler(maxw, maxh)
cufu = {}
function cufu.init(self, w, h)
self.x = 0
self.y = 0
self.w = w
self.h = h
self._w = w
self._h = h
end
function cufu.recurse(self, context)
if (self.w > 1) then
local cw = math.ceil(self.w / 2)
if (context.button("", self.x, self.y, cw, self.h) == nil) then
self.x = self.x + cw
end
self.w = cw
end
if (self.h > 1) then
local ch = math.ceil(self.h / 2)
if (context.button("", self.x, self.y, self.w, ch) == nil) then
self.y = self.y + ch
end
self.h = ch
else
if (self.w < 2) then return end
end
self:recurse(context)
end
function cufu.unfoul(self, context)
if (Editor.isRunning()) then
self.w = self._w
self.h = self._h
if (context.button("", 0, 0, self._w, self._h) == nil) then
context.realX = -1
context.realY = -1
context.realW = -1
context.realH = -1
return
else
self.x = 0
self.y = 0
self:recurse(context)
context.realX = self.x
context.realY = self.y
context.realW = context.mouseX + context.width - self.x
context.realH = context.mouseY + context.height - self.y
end
else
context.realX = context.mouseX
context.realY = context.mouseY
context.realW = context.width
context.realH = context.height
end
end
cufu:init(maxw, maxh)
return cufu
end
function renderTest(self, context)
local ufu = contextUnfouler(3000,2000)
ufu:unfoul(context)
local text = context.realX .. ", " .. context.realY
context.drawText(text, 50, 20)
text = context.realW .. ", " .. context.realH
context.drawText(text, 50, 40)
text = context.mouseX .. ", " .. context.mouseY
context.drawText(text, 50, 60)
text = context.width .. ", " .. context.height
context.drawText(text, 50, 80)
end
Can you please post an example? I'm completely new to lua and still try to understand. A ›connector‹ in terms of GR seems like something i'd call a callback: if a certain event happens (onDrawAttackPanel), the object (party) looks in his callback table for the event onDrawAttackPanel and calls every id.function specified there – thats how I understand what i read without really having any useful dokumentationIsaac wrote: There is also good reason to define certain hooks in the object rather than use addConnector() for them.