How to scale like this and keep my love.mousepressed to work.HELP
Posted: Thu Feb 06, 2020 8:46 pm
How to scale like this and keep my love.mousepressed to work. when i click on the start(is an image button) button it dont work.but when i remove the love.graphics.scale() it works. but i want to keep the love.graphics.scale(). it works great on mobile
state = "menu"
start_button = love.graphics.newImage("start.png")
dx = 228
dy = 398
image_height = start_button:getHeight()
image_width = start_button:getWidth()
scalex = 795
scaley = 720
window_width = love.graphics.getWidth()
window_height = love.graphics.getHeight()
function love.load()
end
function love.draw()
love.graphics.scale(window_width /scalex,window_height / scaley)
if state =="play" then
love.graphics.print("The Game Has Started",200,200)
end
if state =="menu" then
love.graphics.draw(start_button,dx,dy)
end
end
function love.mousepressed(x,y,button)
if x > dx and x < dx + image_width and y > dy and y < dy + image_height then
state = "play"
end
end