To create a basic menu system, this is what you could do:
- Create a table with button labels, callbacks, and possibly some other data.
- In
love.drawscroll through this table and draw buttons - In
love.update(also possible in .draw if you want), check that the mouse is running over the button - If the mouse runs over the button and presses the button, call the button callback
, . , , , :
function pointInRectangle(pointx, pointy, rectx, recty, rectwidth, rectheight)
return pointx > rectx and pointy > recty and pointx < rectx + rectwidth and pointy < recty + rectheight
end
, :
love.load pressed = falselove.mousereleased pressed = truelove.draw, end, pressed = false
, true, , .