'How to connect LoveFrames components to changes made in love.update
I'm building a Love2D project and using LoveFrames as the UI library. I'm having trouble hooking components into changes that happen in love.update closure. For example, if a count variable is updated in love.update, I want the updated count to show in a frame's title. So below are snippets that show what I'm trying to achieve.
main.lua
local loveframes = require("libraries.loveframes")
local Home = require("screens.Home")
availablePlayersCount = 0
function love.load()
Home(loveframes)
end
Home.lua
function HomeScreen(loveframes)
local frame = loveframes.Create("frame")
frame:SetName(availablePlayersCount) -- This should update with respect to updates made in love.update
frame:SetState("homestate")
loveframes.SetState("homestate")
end
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|