Global debug overlay (should I use a scene)

So I am presently showing debug information (FPS, RAM, etc.) in each scene. The information is gathered during enterFrame of the scene with focus, and is shown using local objects. But I’m replicating a lot of code, and it seems like maybe I should create a separate scene for the debug info, and have one set of display objects to visualize the debug info. Does it make sense to do this? This scene would be loaded and shown based on a setting that would be enabled through the app

One of the “cool” things about Composer scenes is that we have a “HUD” mode. If you do not put an object in a scene’s view group, it will sit on top.

In your case, you could start your enterFrame/debug information in main.lua (or put it in a module and call it from main.lua) and don’t treat them as Composer objects at all, and it will draw on top of any Composer screen.

Rob

Oh wow, that makes things super simple. Question about the enterFrame listener though, if I have multiple listeners, in this case one in main.lua (to do my FPS calcs), and another in game.lua (to run mygame loop logic). Are the events asynchronous and run in parallel? or are they synchronous (and if they are, can I assume the code is run in order from first declared listener to last).