StrongJoshua / libgdx-inGameConsole

A LibGdx library that allows a developer to add a console (similar to how it is featured in Source games) to their game.
https://www.strongjoshua.net/projects/games/libgdx-ingame-console
Apache License 2.0
132 stars 34 forks source link

Way to reuse console object? #51

Closed phunni closed 4 years ago

phunni commented 4 years ago

What's the best practice in terms of managing the Console and the CommandExecutors? It seems that the easiest way is to have a separate one for each Screen in the game - if relevant. Is that the normal way of managing it? Or is there a better way to manage the objects involved? I hope that all makes sense!

StrongJoshua commented 4 years ago

Hi, thanks for the question! Been a while since I worked on this, but you should be able to maintain a singular console between screens. If you want to change which commands are available depending the Stage, you should be able to set the command executor to a different one (see the tutorial: https://github.com/StrongJoshua/libgdx-inGameConsole/wiki/Tutorial).

Depending your needs, it may make more sense to re-instantiate the console between screens, especially if you're working with Stages. It's honestly up to you. The Console is just an in-game interface into your code.

If you have any more questions, feel free to ask!