-
-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deinitialize Slab #44
Comments
Hi @flamendless, are you calling Slab.Initialize multiple times? This should only need to be called once in love.load. What is the context of your situation where this needs to be called multiple times? |
Upon further testing, the problem is not with multiple It seems that when there is loaded frames in the previous state and then switching to another state as well. Im also testing whether it has something to do with the widgets themselves. |
This is getting tricker, I've tried:
Test 1:
Test 2:
Test 3:
Test 4:
|
Does Slab store data/internal state dependent on the client's usage? Like storing ID and data Slab widgets need? Maybe there should be a |
Hi @flamendless, thanks for looking into this. Slab does store some state information for the various controls based on the ID given to those function calls. However, Slab should not need any additional information from the user and will only act on the data when the function is called. There is some validation that occurs for windows prior to drawing the requested windows and controls. I am still curious though why multiple Slab.Initialize, Slab.Update, and Slab.Draw is being called. Slab.Initialize should only be called a single time through the love.load method. Slab.Update should only be called from love.update once per frame and Slab.Draw should only be called from love.draw once per frame. The Slab.Draw call should be made at the end of your draw loop. love.update -> Your Game Update -> Slab Update -> Slab Function Calls Slab.Update should be called at the start of your debugging system. Any other states within that system should not need to call this function again. Any Slab function calls after this Update call should work fine. And these states should not need to call Slab.Draw. I will try reproducing the issue using the steps you mentioned in your previous post. I might add some assertions so that Initialize, Update, and Draw are called in their proper places and only once. I am also looking into potentially needing only the Slab.Initialize call in the project and have Slab internally manage the Update and Draw calls. |
Hi, I've finally found the solution after reading what you've said. I did this: --debugging system
local slab_init = false
--init() --called every scene load
if not slab_init then Slab.Initialize slab_init = true end So it's sure that it is only initialized once.
in the example, the Last question: Should Slab widgets be done in |
Hi @flamendless, good to hear you have found a solution. Slab.Update should be called before any other Slab functions. The Slab.Update primes the internal state for Slab function calls. Slab widgets ideally should be done in the update loop, but Slab widgets do not make love.graphics.* function calls until Slab.Draw is called, so theoretically, Slab widgets can be done anywhere before Slab.Draw. |
Hi, in cases where there are multiple Slab initialized/used (i.e when switching from one state to another), Slab hangs the system upon exit.
I am still unsure of how this weird behavior happens as my project is very complex. I think that when multiple files/states uses Slab causes the issue (though they are not processed at the same time).
The text was updated successfully, but these errors were encountered: