------------------------------------------------------------------------------- UConsole Documentation Contact : Nate 'm|d' Miller (vandals1@home.com), ICQ: 8347914 Web Site: http://nate.scuzzy.net/ ------------------------------------------------------------------------------- So you want to use UConsole do you? Well follow this document and you will be able to use it! Getting Started --------------- Frist things first is you need an image loading function. I have my own Targa loading functions which load 24 and 32 bit targas. In the code to load the Targas I setup all texture paramaters and I also bind the texture to a specified id. If you do not wish to use my Targa loading code, which is provided, you MUST make sure that you modify the functions "consoleLoadFont" and "consoleLoadBack". These functions load the background image and the font and you need to make them point to your own code that will a) setup texture paramaters and b) bind the texture. Please note that if you use a image size that isn't supported by OpenGL, i.e. an image size that is not a power of two, you must scale the image. Adding In The Console To Your APP --------------------------------- Adding in the console is relatively simple. 1) You must include "console.c", "console.h" and "conpos.c" in your project. 2) You need to define a console_t in your main project. 3) You need to initialize the console_t and set the font and background images must be loaded. Here is an example of the code to do so: consoleInit (&test, winW, winH, testDisplayFunc, "data\\font.tga", 13, "data\\back.tga", 14); 4) Now comes the part that greatly depends on the application that is being made. I will outline the things that need to be done in order for the console to function correctly. 5) The console needs to handle the ` key, or whatever one you chose. When this key is hit you need to set the console animation state to 1. If the console is DOWN and the ` key is hit you also need to set animate to 1. If this is unclear see the example provided in the "glutKeyboard" function. 6) If you would like command history on the console it must handle the up arrow keypress and down arrow. Once this keypress is handled a simple call to "consoleHistoryRecall" will cycle through the history for you. For the down arrow in the demo I have it clear the command line with consoleCommandLineClear. 7) Now we come to rendering the console. Since the console animates you will need to have some sort of idle function that will animate the console. In the idle function would call "consoleAnimate" if the consoles animation state is set to 1. Also in you main rendering function you will need to render the console so that when it is DOWN you can see it. For more information on this see "glutIdle" and "glutDisplay" in the sample provided. 8) In your window resizing funtion you also need to call consoleResize (...) to make sure that all values are updated. 9) If you would like to be able to scroll the console buffer up and down you will need to handle PageUp and PageDown. To set the console buffer back to its normal position you need to handle the Home key. Here is an example: consoleBufferMove (&con, UP); // moves the console buffer up consoleBufferMove (&con, DOWN); // moves the console buffer down consoleBufferMove (&con, HOME); // sets the console buffer to home Adding the console is something that is application specific. I do not know how every application will work so I tried to create an example that would be a good representation. From #4 on adding the console is application specific. Image Attributes ---------------- Background can be any type of image, I use a 24bit Targa. Font MUST contain an alpha channel. I use a 32bit Targa with the font defined in the alpha channel. The font image should be 16 chars by 16 chars. Look at my example image for help. The image can be any size as long as it follows this specification. In "conpos.c" there is code for generating the needed texture coordinates if you would like to use a font that does not have a character every 16 pixels. Problems -------- I do not know of any at this time and I hope that if there are any problems that they are weeded out in this release and can be fixed rapidly. Contact ------- If you are having any problem implementing UConsole or just need some help feel free to email me at vandals1@home.com and I will try to help out. LEGAL ----- Because of my lack of access to legal knowledge, the following text is only as legally restricting as any such text can be. It should be viewed as _strong_ advice. The code and executables in this archive and others related to it may be used without limit. This is includes public viewing for demonstrating OpenGL accelerated hardware and developing more advanced programs. Educational and Non-Commercial use ONLY! If you would like to use my code for a commercial venture please contact me and we can discuss it. I, Nate 'm|d' Miller am not responsible for any damage incurred by this program, through misuse or otherwise. I cannot assure you that the files in this archive have not been modified unless it was downloaded from my site.