I have two issues currently with my LÖVE code right now. First, my mousepress is being brought over to another gamestate unintentionally. I have a "main" gamestate, and an "optionmenu" gamestate in this code. The buttons in "main" are positioned the same in "optionmenu". So, when I click the button "Options", it changes to "optionmenu" but at the same time it clicks the button "Windowed" which toggles fullscreen in gamestate "optionmenu".
Code: Select all
function love.mousepressed(x, y, button)
if gamestate == "menu" then
if button == 'l' then
--user pressed left click
button_click(x,y)
end
end
--options menu mouse clicks
if gamestate == "optionmenu" then
if button == 'l' then
--user pressed left click
optionbutton_click(x,y)
end
end
end
The second issue I have is with highlighting my buttons, which are images, using love.graphics.setColorMode( "combine" ) and love.graphics.setColor(255,255,255) as below:
Code: Select all
function button_draw()
--this gets called in love.draw()
for i, v in ipairs(button) do
--accessing content from button table
--mode = love.graphics.getColorMode()
if v.mouseover == true then
--highlight selected button
love.graphics.setColorMode( "combine" )
love.graphics.setColor(255,255,255)
love.graphics.draw(v.pic, v.x - (v.pic:getWidth()/2), v.y)
end
if v.mouseover == false then
--remove highlight from selected button
love.graphics.setColorMode( "replace" )
love.graphics.draw(v.pic, v.x - (v.pic:getWidth()/2), v.y)
end
end
end
Any help or assistance in this regard is greatly appreciated
P.S: To exit my problem.love at any time, just hit Escape on your keyboard.
Don't worry about the background image, it's there just to show the Exit button highlighting issue.