Game Console is a real-time console that allows you to:
- View or edit variables.
- Call methods.
- Log messages.
- Monitor variables.
- Monitor methods.
- Customize appearence with themes.
- Profile your app
- Add your own commands by extending this lib.
- Use basic autocomplete
V 3.0.0
- API changes - GameConsole renamed to GC, registerFunction changed, registerFieldRemoved etc..
- Monitor improved and refactored.
- Print command added.
- Profiler added
- Added unit tests to ensure core working with neko, cpp and flash targets.
For more changes or other versions, check CHANGELOG file.
Using GameConsole is very straightforward:
import pgr.gconsole.GC;
GC.init();
GC.log("This text will be logged.");
GC.registerFunction(this.testFunction, "functionAlias");
GC.registerObject(this, "objectAlias");
Now while running your game or app, press TAB, then type "help" or "commands" to see what commands or keys are availible.
For more help and check the Wiki (may not be up-to-date) and/or see the comments in GC.hx.
A screen shot of gconsole running on Adam's Atomic Mode game.
Allows to follow the values of registered fields, (including private fields and with getter methods)
For example, to monitor player x position:
CG.monitorField(player, "x", "playerX")
Thats it! Press CTRL + TAB to bring the monitor up inside the game
GCProfiler is lightweight and portable, it allows to know in runtime:
- What code is taking more cpu
- How many times is some code executed inside other code block.
- How much time code takes to execute (benchmark)
- Other statistics not displayed (absolute elapsed, min, max, totalInstances etc..)
To profile a block simply do:
GC.beginProfile("SampleName");
GC.endProfile("SampleName");
To toggle the profiler use SHIFT + TAB.
The screenshot below shows multiple nested samples, idents are used to show the samples hierarchy.
- EL elapsed milliseconds)
- AVG average elapsed milliseconds)
- EL(%) elapsed percentage
- AVG(%) average elapsed percentage
- # Occurrences of sample inside root sample
- Name Sample name
More documentation and examples comming soon.
Email me any suggestions, comments, bug reports etc.. you have.
Or create a new issue (even better).
Make sure tests work with your changes by running tests/testFlash.bat, testNeko.bat, testWindows.bat Update tests or write new ones if necessary, the objective is to garantee the console works in all targets as its supposed to.
Thanks to:
- Artem Pecheny
- Jesse Talavera
- Samuel Batista
- Alexander Hohlov
And others submiting issues/feedback so far.