Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Global debug overlay (should I use a scene)
Started by Xorcist Oct 01 2019 11:33 AM

2 replies to this topic
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

Xorcist

[GLOBAL: userInfoPane.html]
Xorcist
  • Observer

  • 17 posts
  • Corona SDK

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



[TOPIC: post.html]
#2

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 26,207 posts
  • Enterprise

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



[TOPIC: post.html]
#3

Xorcist

[GLOBAL: userInfoPane.html]
Xorcist
  • Observer

  • 17 posts
  • Corona SDK

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).




[topic_controls]
[/topic_controls]