Code: Select all
button.label = tostring(number)
Code: Select all
button.label = tostring(number)
Code: Select all
function love.load()
number=0
text=gui:text(tostring(number))
button=gui:button('Click me')
function button.click(this,x,y)
number=number+1
text.label = tostring(number)
end
end
Code: Select all
Gspot.mousepress = function(this, x, y, button)
this:unfocus()
if this.mousein then
local element = this.mousein
if element.elementtype ~= 'hidden' then element:getparent():setlevel() end
if button == mouseL then
if element.drag then
this.drag = element
element.offset = {x = x - element:getpos().x, y = y - element:getpos().y}
end
end
end
end
Gspot.mouserelease = function(this, x, y, button)
if this.drag then
local element = this.drag
if button == mouseR then
if element.rdrop then element:rdrop(this.mouseover) end
if this.mouseover and this.mouseover.rcatch then this.mouseover:rcatch(element.id) end
else
if element.drop then element:drop(this.mouseover) end
if this.mouseover and this.mouseover.catch then this.mouseover:catch(element) end
end
end
this.drag = nil
if this.mousein then
local element = this.mousein
if button == mouseL then
if this.mousedt < this.dblclickinterval and element.dblclick then element:dblclick(x, y, button)
elseif element.click then element:click(x, y); this.mousedt = 0 end
elseif button == mouseR and element.rclick then element:rclick(x, y)
elseif button == 'wu' and element.wheelup then element:wheelup(x, y)
elseif button == 'wd' and element.wheeldown then element:wheeldown(x, y)
end
end
end
Code: Select all
pos.y = pos.y - math.floor(((this.style.unit - this.style.font:getHeight()) / 2) + 0.5)
Code: Select all
pos.y = pos.y - math.floor((this.style.unit / 4) + 0.5)
These are new features, and Gspöt is currently being maintained only to fix bugs and update to latest versions of Löve. There are libraries more advanced than Gspöt, see e.g. Slab.Anase Skyrider wrote: ↑Mon Feb 01, 2021 11:06 pm I'd love to see more updates on this library like: differentiating click from mousedown, clicks getting called on mouse-up instead of mouse-down, and easier ways to add those sorts of events to other frames.
[...]
The ability to set the drawing scale of an image would be most helpful, too.
Anase Skyrider wrote: ↑Tue Feb 02, 2021 12:06 amA notable change I discovered with some testing is that if you make this.mousedt = 0 only when it registers a regular click, you won't see other mouse events contributing to double-clicking, only left-clicking contributes to detecting a double-click. Without that 2nd change, you can quickly right-click and then left-click to get a double-click.
I have pushed fixes for the text element click and for the doubleclick issues, thanks for the reports.Anase Skyrider wrote: ↑Tue Feb 02, 2021 1:02 am The Gspot.util.containspoint function might need to be revisted.
Users browsing this forum: Ahrefs [Bot] and 31 guests