mmandel.com

animation, graphics, games, and other projects

GLConsole Library

GLConsole is a small library written in C++ intended to allow hobbyist game developers and researchers to easily add a ‘Quake-style’ debugging console to their applications. It has the following features:

  • Any variable in your code can easily be exposed for tweaking from the console

    Say you have a variable that controls the speed of a monster in your game:
    float monsterSpeed = 1.0f;

    Simply redelcare the variable like this to expose it to the console:
    CVar monsterSpeed("monster.speed", 1.0f);

    You can now tweak this variable from the console and changes will be restored the next time you load your application. CVars overload the cast and equals operators, so you’ll still be able to use them like their normal datatypes, minimizing required code changes:
    //monsterSpeed can be adjusted from the console without recompiling but still functions like a normal float
    float monsterSuperSpeed = monsterSpeed * 4.0f;

  • Any variables changed from the console are automatically serialized and restored the next time you launch the app, without the need to recompile any code
  • Full and partial tab completion with suggestions
  • Command history
  • Printf style logging functions to send any error or status messages to the console
  • It’s easy to add custom console commands that take any number of parameters to perform arbitrary tasks
  • Use of partial template specialization makes it easy to expose new data types to the console

Downloads
The release includes full source for the library plus an OpenGL/GLUT demo illustrating its usage
Version .50 Windows binary + source (~400Kb)

Screenshots