Simple button library help

Showcase your libraries, tools and other projects that help your fellow love users.
Post Reply
Tonmoy Mojumder
Prole
Posts: 12
Joined: Sat Oct 21, 2023 1:33 pm

Simple button library help

Post 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
User avatar
dusoft
Party member
Posts: 654
Joined: Fri Nov 08, 2013 12:07 am
Location: Europe usually
Contact:

Re: Simple button library help

Post by dusoft »

I bet it doesn't, this is not Javascript. Please refer to the wiki and mousepressed events.
Tonmoy Mojumder
Prole
Posts: 12
Joined: Sat Oct 21, 2023 1:33 pm

Re: Simple button library help

Post by Tonmoy Mojumder »

Thank you it woked for .I missed love.mousepressed functions
User avatar
dusoft
Party member
Posts: 654
Joined: Fri Nov 08, 2013 12:07 am
Location: Europe usually
Contact:

Re: Simple button library help

Post by dusoft »

Good to hear that.
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest