#include "SDL_events.h"
#include "SDL_video.h"
#include "begin_code.h"
#include "close_code.h"
Include dependency graph for SDL_console.h:
Go to the source code of this file.
Data Structures | |
struct | console_information_td |
Defines | |
#define | CON_CHARS_PER_LINE 127 |
#define | CON_BLINK_RATE 500 |
#define | CON_CHAR_BORDER 4 |
#define | CON_DEFAULT_PROMPT "]" |
#define | CON_LINE_SCROLL 2 |
#define | CON_SCROLL_INDICATOR "^" |
#define | CON_INS_CURSOR "_" |
#define | CON_OVR_CURSOR "|" |
#define | CON_DEFAULT_HIDEKEY SDLK_ESCAPE |
#define | CON_OPENCLOSE_SPEED 25 |
Typedefs | |
typedef console_information_td | ConsoleInformation |
Enumerations | |
enum | { CON_CLOSED, CON_CLOSING, CON_OPENING, CON_OPEN } |
Functions | |
DECLSPEC SDL_Event *SDLCALL | CON_Events (SDL_Event *event) |
DECLSPEC void SDLCALL | CON_Show (ConsoleInformation *console) |
DECLSPEC void SDLCALL | CON_Hide (ConsoleInformation *console) |
DECLSPEC int SDLCALL | CON_isVisible (ConsoleInformation *console) |
DECLSPEC void SDLCALL | CON_UpdateOffset (ConsoleInformation *console) |
DECLSPEC void SDLCALL | CON_DrawConsole (ConsoleInformation *console) |
DECLSPEC ConsoleInformation *SDLCALL | CON_Init (const char *FontName, SDL_Surface *DisplayScreen, int lines, SDL_Rect rect) |
DECLSPEC void SDLCALL | CON_Destroy (ConsoleInformation *console) |
DECLSPEC void SDLCALL | CON_Free (ConsoleInformation *console) |
DECLSPEC void SDLCALL | CON_Out (ConsoleInformation *console, const char *str,...) |
DECLSPEC void SDLCALL | CON_Alpha (ConsoleInformation *console, unsigned char alpha) |
DECLSPEC void SDLCALL | CON_AlphaGL (SDL_Surface *s, int alpha) |
DECLSPEC int SDLCALL | CON_Background (ConsoleInformation *console, const char *image, int x, int y) |
DECLSPEC void SDLCALL | CON_Position (ConsoleInformation *console, int x, int y) |
DECLSPEC int SDLCALL | CON_Resize (ConsoleInformation *console, SDL_Rect rect) |
DECLSPEC int SDLCALL | CON_Transfer (ConsoleInformation *console, SDL_Surface *new_outputscreen, SDL_Rect rect) |
DECLSPEC void SDLCALL | CON_Topmost (ConsoleInformation *console) |
DECLSPEC void SDLCALL | CON_SetPrompt (ConsoleInformation *console, char *newprompt) |
DECLSPEC void SDLCALL | CON_SetHideKey (ConsoleInformation *console, int key) |
DECLSPEC void SDLCALL | CON_Execute (ConsoleInformation *console, char *command) |
DECLSPEC void SDLCALL | CON_SetExecuteFunction (ConsoleInformation *console, void(*CmdFunction)(ConsoleInformation *console2, char *command)) |
DECLSPEC void SDLCALL | CON_SetTabCompletion (ConsoleInformation *console, char *(*TabFunction)(char *command)) |
DECLSPEC void SDLCALL | CON_TabCompletion (ConsoleInformation *console) |
DECLSPEC void SDLCALL | CON_NewLineConsole (ConsoleInformation *console) |
DECLSPEC void SDLCALL | CON_NewLineCommand (ConsoleInformation *console) |
DECLSPEC void SDLCALL | CON_UpdateConsole (ConsoleInformation *console) |
DECLSPEC void SDLCALL | Default_CmdFunction (ConsoleInformation *console, char *command) |
DECLSPEC char *SDLCALL | Default_TabFunction (char *command) |
DECLSPEC void SDLCALL | DrawCommandLine () |
DECLSPEC void SDLCALL | Cursor_Left (ConsoleInformation *console) |
DECLSPEC void SDLCALL | Cursor_Right (ConsoleInformation *console) |
DECLSPEC void SDLCALL | Cursor_Home (ConsoleInformation *console) |
DECLSPEC void SDLCALL | Cursor_End (ConsoleInformation *console) |
DECLSPEC void SDLCALL | Cursor_Del (ConsoleInformation *console) |
DECLSPEC void SDLCALL | Cursor_BSpace (ConsoleInformation *console) |
DECLSPEC void SDLCALL | Cursor_Add (ConsoleInformation *console, SDL_Event *event) |
DECLSPEC void SDLCALL | Clear_Command (ConsoleInformation *console) |
DECLSPEC void SDLCALL | Assemble_Command (ConsoleInformation *console) |
DECLSPEC void SDLCALL | Clear_History (ConsoleInformation *console) |
DECLSPEC void SDLCALL | Command_Up (ConsoleInformation *console) |
DECLSPEC void SDLCALL | Command_Down (ConsoleInformation *console) |
|
Number of visible characters in a line. Lines in the history, the commandline, or CON_Out strings cannot be longer than this. Remark that this number does NOT include the '/0' character at the end of a string. So if we create a string we do this char* mystring[CON_CHARS_PER_LINE + 1]; |
|
Cursor blink frequency in ms |
|
Border in pixels from the left margin to the first letter |
|
Default prompt used at the commandline |
|
Scroll this many lines at a time (when pressing PGUP or PGDOWN) |
|
Indicator showing that you scrolled up the history |
|
Cursor shown if we are in insert mode |
|
Cursor shown if we are in overwrite mode |
|
Defines the default hide key (that Hide()'s the console if pressed) |
|
Defines the opening/closing speed when the console switches from CON_CLOSED to CON_OPEN |
|
This is a struct for each consoles data |
|
|
|
Takes keys from the keyboard and inputs them to the console if the console isVisible(). If the event was not handled (i.e. WM events or unknown ctrl- or alt-sequences) the function returns the event for further processing. ***The prototype of this function will change in the next major release to int CON_Events(ConsoleInformation* console, SDL_Event *event) ** |
|
Makes the console visible |
|
Hides the console |
|
Returns 1 if the console is opening or open, 0 else |
|
Internal: Updates visible state. This function is responsible for the opening/closing animation. Only used in CON_DrawConsole() |
|
Draws the console to the screen if it is visible (NOT if it isVisible()). It get's drawn if it is REALLY visible ;-) |
|
Initializes a new console.
|
|
Frees DT_DrawText and calls CON_Free |
|
Frees all the memory loaded by the console |
|
Function to send text to the console. Works exactly like printf and supports the same format |
|
Sets the alpha level of the console to the specified value (0 - transparent, 255 - opaque). Use this function also for OpenGL. |
|
Internal: Sets the alpha channel of an SDL_Surface to the specified value. Preconditions: the surface in question is RGBA. 0 <= a <= 255, where 0 is transparent and 255 opaque |
|
Sets a background image for the console |
|
Changes current position of the console to the new given coordinates |
|
Changes the size of the console |
|
Beams a console to another screen surface. Needed if you want to make a Video restart in your program. This function first changes the OutputScreen Pointer then calls CON_Resize to adjust the new size. ***Will disappear in the next major release. Instead i will introduce a new function called CON_ReInit or something that adjusts the internal parameters etc *** |
|
Give focus to a console. Make it the "topmost" console. This console will receive events sent with CON_Events() ***Will disappear in the next major release. There is no need for such a focus model *** |
|
Modify the prompt of the console. If you want a backslash you will have to escape it. |
|
Set the key, that invokes a CON_Hide() after press. default is ESCAPE and you can always hide using ESCAPE and the HideKey (2 keys for hiding). compared against event->key.keysym.sym !! |
|
Internal: executes the command typed in at the console (called if you press 'Return') |
|
Sets the callback function that is called if a command was typed in. The function you would like to use as the callback will have to look like this: |
|
Sets the callback function that is called if you press the 'Tab' key. The function has to look like this: |
|
Internal: Gets called when TAB was pressed and executes the function you have earlier registered with CON_SetTabCompletion() |
|
Internal: makes a newline (same as printf("\n") or CON_Out(console, "\n") ) |
|
Internal: shift command history (the one you can switch with the up/down keys) |
|
Internal: updates console after resize, background image change, CON_Out() etc. This function draws the upper part of the console (that holds the history) |
|
Internal: Default Execute callback |
|
Internal: Default TabCompletion callback |
|
Internal: draws the commandline the user is typing in to the screen. Called from within CON_DrawConsole() *** Will change in the next major release to void DrawCommandLine(ConsoleInformation* console) *** |
|
Internal: Gets called if you press the LEFT key (move cursor left) |
|
Internal: Gets called if you press the RIGHT key (move cursor right) |
|
Internal: Gets called if you press the HOME key (move cursor to the beginning of the line |
|
Internal: Gets called if you press the END key (move cursor to the end of the line |
|
Internal: Called if you press DELETE (deletes character under the cursor) |
|
Internal: Called if you press BACKSPACE (deletes character left of cursor) |
|
Internal: Called if you type in a character (add the char to the command) |
|
Internal: Called if you press Ctrl-C (deletes the commandline) |
|
Internal: Called if the command line has changed (assemles console->Command from LCommand and RCommand |
|
Internal: Called if you press Ctrl-L (deletes the History) |
|
Internal: Called if you press UP key (switches through recent typed in commands |
|
Internal: Called if you press DOWN key (switches through recent typed in commands |