How to use OGLCONSOLE with SDL
OGLCONSOLE's source code is only two small files oglconsole.c and oglconsole.h, so it's very simple for even beginner programmers to drop OGLCONSOLE directly into their open source OpenGL projects.
You need only add literally 6 lines to your SDL+OpenGL application in order to hook OGLCONSOLE into it. In a rough fascimile of the order these lines will appear in your program, here is what they'll look like (click a line of code to view it in the source code of the example program below): include create create event draw quit
#include "oglconsole.h"
OGLCONSOLE_Create();
OGLCONSOLE_EnterKey(myCommandFunction);
OGLCONSOLE_SDLEvent(&event);
OGLCONSOLE_Draw();
OGLCONSOLE_Quit();
A full source code listing of a small SDL+OpenGL application is below downloaded from "NeHe"
here. A few improvements were made voluntarily, however all of the changes relevant to OGLCONSOLE are
highlighted with a white background so that you can see them clearly.
This source code of course doesn't show you the
cmdCB()
function mentioned in the code above. That is a function every programmer needs to write if he wants the player to interact with the application through a console / terminal type of interface. For information on this
click here.