Page 1 of 1

Simple button library help

Posted: Sat Oct 21, 2023 1:38 pm
by Tonmoy Mojumder
Here is my code
_G.love = require("love")

local ButtonManager = require("button")
ButtonManager.default.width = 100
ButtonManager.default.height = 40
ButtonManager.default.alignment = "center"

local startButton = ButtonManager.new("Start Game", 100, 100, 200, 80)
startButton.onClick = function()
print("Start the game!")
end

local quitButton = ButtonManager.new("Quit", 100, 300, 200, 90)
quitButton.onClick = function()
love.event.quit()
end

function love.load()
-- code
end

function love.draw()
ButtonManager.draw()
end


OnClick doesn't work for me.I am newbie kindly help

Re: Simple button library help

Posted: Sat Oct 21, 2023 4:07 pm
by dusoft
I bet it doesn't, this is not Javascript. Please refer to the wiki and mousepressed events.

Re: Simple button library help

Posted: Sat Oct 21, 2023 8:25 pm
by Tonmoy Mojumder
Thank you it woked for .I missed love.mousepressed functions

Re: Simple button library help

Posted: Sun Oct 22, 2023 8:29 pm
by dusoft
Good to hear that.