loveframes OnClick not working

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
Buby
Prole
Posts: 15
Joined: Mon Dec 07, 2015 4:28 am

loveframes OnClick not working

Post by Buby » Mon Dec 14, 2015 9:23 am

Hey guys! I was recently using loveframes and found out that the OnClick function does not work is there a fix?

Code: Select all

loveframes = require("assets.Source")
StartP = 0
loveframes.SetState("Menu")
local button = loveframes.Create("button")
button:SetState("Menu")
button:SetSize(love.window.getWidth() / 8, love.window.getHeight() / 27)
button:SetText("Play!")
button:Center()
button.OnClick = function(object)
StartP = 1 
end
It works when i do OnMouseEnter but not OnClick which i find weird please help!

-Note this is not the complete script I just sliced it to add the important bits
-I have already added all the loveframes. functions including mousepressed and mousereleased

Code: Select all

if 2+2 == 5 then
   love.event.push('quit')
end

User avatar
Nikolai Resokav
Party member
Posts: 140
Joined: Wed Apr 28, 2010 12:51 am
Location: United States

Re: loveframes OnClick not working

Post by Nikolai Resokav » Mon Dec 14, 2015 8:54 pm

The code you posted seems like should work, so I'm not quite sure what the problem is without more info. Can you post a .love of your project please? You could also send it to me in a pm if you aren't comfortable with posting it on the forums.

bobbyjones
Party member
Posts: 712
Joined: Sat Apr 26, 2014 7:46 pm

Re: loveframes OnClick not working

Post by bobbyjones » Tue Dec 15, 2015 3:20 am

Did you set the loveframes callbacks?
Check out my most recent medium post, please give feedback.
Link

Post Reply

Who is online

Users browsing this forum: Exabot [Bot] and 8 guests