Page 3 of 3

Re: Mousepressed not working?

Posted: Wed Oct 17, 2018 6:35 pm
by xpali2
pedrosgali wrote: Wed Oct 17, 2018 6:26 pm The main.lua file should look like this:

Code: Select all

local menu = require "menu"

function love.load()
  menu_load()
end

function love.mousepressed(x, y, b)
  menu_mousepressed(x, y, b)
end

function love.update(dt)
  
end

function love.draw()
  menu_draw()
end
Well I'm sure there will be other things in there but that's the minimum you need to get your code working. Once you do your positioning is off :P You're drawing a box 400 wide with the text but checking a box 200 wide for clicks.
I changed this. Thanks for your help.

Re: Mousepressed not working?

Posted: Wed Oct 17, 2018 6:39 pm
by pedrosgali
No problem, next time if you post a .love file like I did it'll be a lot easier to help you as all the code will be there for us to look at.

Re: Mousepressed not working?

Posted: Wed Oct 17, 2018 6:58 pm
by xpali2
pedrosgali wrote: Wed Oct 17, 2018 6:39 pm No problem, next time if you post a .love file like I did it'll be a lot easier to help you as all the code will be there for us to look at.
Forgive my noobiness, how do I change my seperate lua files into a .love file?

Re: Mousepressed not working?

Posted: Wed Oct 17, 2018 7:02 pm
by pedrosgali
just zip them up and rename from .zip to .love

Re: Mousepressed not working?

Posted: Wed Oct 17, 2018 7:15 pm
by xpali2
pedrosgali wrote: Wed Oct 17, 2018 7:02 pm just zip them up and rename from .zip to .love
There it is. A .love file of my project with the directories that it uses. I have tested it on my PC and it works exactly the same as it would in my IDE. So the buttons don't actually seem to print anything.

Re: Mousepressed not working?

Posted: Wed Oct 17, 2018 8:39 pm
by mastermarkus
In your main.lua you have "love.mouspressed" it should be "love.mousepressed" you were missing an ("e").

Re: Mousepressed not working?

Posted: Thu Oct 18, 2018 12:47 am
by pgimeno
xpali2 wrote: Wed Oct 17, 2018 6:14 pm I'll tell you it's just as frustrating on my end. If I am not giving you something you think you need to see to solve the issue then ask away, I am not an experienced coder so I can't guess what you need to hear. I have to say that I don't get what you mean with "two mousepressed events" if you could explain. I have checked the console many times by putting a print outside of the basic callbacks in main.lua that print to the console I am viewing: https://ibb.co/f6LEaf. I have tried "LoveMousepressed = love.mousepressed" but nothing changes, no errors or anything. Btw, mousemoved does work, so I reckon the mouse isn't the problem, meaning the mouse module is also not the issue.
It's not about what I need to hear. It's about offering the code for us to look. As pedrosgali has demonstrated, the issue is not in main.lua or in the snippet you have pasted, therefore if you want us to help, we need to look elsewhere. But we can't unless we have enough code to allow us to reproduce the problem.

Edit: It seems you have provided the code and mastermarkus has identified the problem.

Re: Mousepressed not working?

Posted: Thu Oct 18, 2018 8:07 am
by xpali2
mastermarkus wrote: Wed Oct 17, 2018 8:39 pm In your main.lua you have "love.mouspressed" it should be "love.mousepressed" you were missing an ("e").
Ah, I am a real idiot... Thanks and sorry for wasting your time to all.