UFO: Alien Invasion
|
Console related code. More...
#include "cl_console.h"
#include "client.h"
#include "cgame/cl_game.h"
#include "input/cl_keys.h"
#include "renderer/r_draw.h"
#include "../shared/utf8.h"
Go to the source code of this file.
Data Structures | |
struct | console_t |
Macros | |
#define | ColorIndex(c) (((c) - '0') & 0x07) |
#define | CONSOLE_CHAR_ALIGN 4 |
#define | NUM_CON_TIMES 8 |
#define | CON_TEXTSIZE 32768 |
#define | CONSOLE_CURSOR_CHAR 11 |
#define | CONSOLE_HISTORY_FILENAME "history" |
Functions | |
static void | Con_Clear (void) |
static void | Con_DrawText (const short *text, int x, int y, size_t width) |
void | Con_DrawString (const char *txt, int x, int y, unsigned int width) |
static void | Key_ClearTyping (void) |
void | Con_ToggleConsole_f (void) |
static void | Con_ToggleChat_f (void) |
static void | Con_Clear_f (void) |
Clears the console buffer. More... | |
void | Con_Scroll (int scroll) |
Scrolls the console. More... | |
void | Con_CheckResize (void) |
If the line width has changed, reformat the buffer. More... | |
void | Con_LoadConsoleHistory (void) |
Load the console history. More... | |
void | Con_SaveConsoleHistory (void) |
Stores the console history. More... | |
void | Con_Init (void) |
static void | Con_Linefeed (void) |
void | Con_Print (const char *txt) |
Handles cursor positioning, line wrapping, etc All console printing must go through this in order to be logged to disk If no console is visible, the text will appear at the top of the game window. More... | |
void | Con_Close (void) |
Hide the gameconsole if active. More... | |
static void | Con_DrawInput (void) |
The input line scrolls horizontally if typing goes beyond the right edge. More... | |
void | Con_DrawConsole (float frac) |
Draws the console with the solid background. More... | |
Variables | |
static const uint32_t | g_color_table [] |
static console_t | con |
static cvar_t * | con_notifytime |
static cvar_t * | con_history |
static cvar_t * | con_background |
const int | con_fontHeight = 12 |
const int | con_fontWidth = 10 |
const int | con_fontShift = 3 |
Console related code.
Definition in file cl_console.cpp.
#define ColorIndex | ( | c | ) | (((c) - '0') & 0x07) |
Definition at line 36 of file cl_console.cpp.
Referenced by Con_DrawString(), and Con_Print().
#define CON_TEXTSIZE 32768 |
Definition at line 53 of file cl_console.cpp.
Referenced by Con_CheckResize().
#define CONSOLE_CHAR_ALIGN 4 |
Definition at line 51 of file cl_console.cpp.
Referenced by Con_DrawConsole(), and Con_DrawInput().
#define CONSOLE_CURSOR_CHAR 11 |
Definition at line 54 of file cl_console.cpp.
Referenced by Con_DrawInput().
#define CONSOLE_HISTORY_FILENAME "history" |
Definition at line 55 of file cl_console.cpp.
Referenced by Con_LoadConsoleHistory(), and Con_SaveConsoleHistory().
#define NUM_CON_TIMES 8 |
Definition at line 52 of file cl_console.cpp.
If the line width has changed, reformat the buffer.
Definition at line 184 of file cl_console.cpp.
References Con_Clear(), con_fontShift, CON_TEXTSIZE, viddef_t::context, console_t::currentLine, console_t::displayLine, i, console_t::lineWidth, console_t::text, console_t::totalLines, viddef, and viddefContext_t::width.
Referenced by SCR_DrawConsole().
Definition at line 79 of file cl_console.cpp.
References CON_COLOR_WHITE, i, lengthof, and console_t::text.
Referenced by Con_CheckResize(), and Con_Clear_f().
Clears the console buffer.
Definition at line 163 of file cl_console.cpp.
References Con_Clear().
Referenced by Con_Init().
Hide the gameconsole if active.
Definition at line 393 of file cl_console.cpp.
References cls, key_console, key_game, Key_SetDest(), and client_static_s::keyDest.
void Con_DrawConsole | ( | float | frac | ) |
Draws the console with the solid background.
Definition at line 443 of file cl_console.cpp.
References Com_sprintf(), CON_COLOR_GREEN, CON_COLOR_WHITE, Con_DrawInput(), Con_DrawText(), con_fontHeight, con_fontShift, con_fontWidth, CONSOLE_CHAR_ALIGN, viddef_t::context, console_t::currentLine, console_t::displayLine, g_color_table, viddefContext_t::height, i, cvar_s::integer, it_pic, len, console_t::lineWidth, R_DrawChar(), R_DrawStretchImage(), R_FindImage(), console_t::text, console_t::totalLines, UFO_VERSION, viddef, viddef_t::virtualHeight, viddef_t::virtualWidth, console_t::visLines, and viddefContext_t::width.
Referenced by SCR_DrawConsole().
The input line scrolls horizontally if typing goes beyond the right edge.
Definition at line 402 of file cl_console.cpp.
References ca_active, CL_Milliseconds(), cls, CON_COLOR_WHITE, Con_DrawText(), con_fontHeight, CONSOLE_CHAR_ALIGN, CONSOLE_CURSOR_CHAR, editLine, i, key_console, client_static_s::keyDest, keyLinePos, keyLines, lengthof, console_t::lineWidth, MAXCMDLINE, client_static_s::state, and console_t::visLines.
Referenced by Con_DrawConsole().
txt | The character buffer to draw |
x,y | The coordinates on the screen |
width | Characters to draw |
Definition at line 105 of file cl_console.cpp.
References ColorIndex, CON_COLOR_WHITE, Con_DrawText(), lengthof, Q_IsColorString, and Sys_Error().
Referenced by SCR_DrawString().
text | The character buffer to draw - color encoded |
x,y | The coordinates on the screen |
width | Characters to draw |
Definition at line 92 of file cl_console.cpp.
References con_fontShift, g_color_table, and R_DrawChar().
Referenced by Con_DrawConsole(), Con_DrawInput(), and Con_DrawString().
Definition at line 276 of file cl_console.cpp.
References Cmd_AddCommand(), Com_Printf(), Con_Clear_f(), con_fontWidth, Con_LoadConsoleHistory(), Con_ToggleChat_f(), Con_ToggleConsole_f(), CVAR_ARCHIVE, Cvar_Get(), console_t::initialized, lengthof, console_t::lineWidth, N_, OBJZERO, console_t::text, console_t::totalLines, and VID_NORM_WIDTH.
Referenced by CL_Init().
Definition at line 301 of file cl_console.cpp.
References CON_COLOR_WHITE, console_t::currentLine, console_t::displayLine, i, console_t::lineWidth, console_t::pos, console_t::text, and console_t::totalLines.
Referenced by Con_Print().
Load the console history.
Definition at line 223 of file cl_console.cpp.
References CONSOLE_HISTORY_FILENAME, editLine, f, FILE_READ, FS_OpenFile(), ScopedFile::getFile(), historyLine, cvar_s::integer, keyLines, MAXCMDLINE, MAXKEYLINES, and Q_strncpyz().
Referenced by Con_Init().
void Con_Print | ( | const char * | txt | ) |
Handles cursor positioning, line wrapping, etc All console printing must go through this in order to be logged to disk If no console is visible, the text will appear at the top of the game window.
Definition at line 318 of file cl_console.cpp.
References ColorIndex, CON_COLOR_WHITE, Con_Linefeed(), console_t::currentLine, console_t::initialized, len, console_t::lineWidth, console_t::pos, Q_IsColorString, console_t::text, console_t::totalLines, and UTF8_char_len().
Referenced by Com_vPrintf().
Stores the console history.
Definition at line 250 of file cl_console.cpp.
References Com_Printf(), CONSOLE_HISTORY_FILENAME, f, ScopedFile::file(), FILE_WRITE, FS_OpenFile(), FS_Write(), historyLine, i, cvar_s::integer, keyLines, and MAXCMDLINE.
Referenced by CL_Shutdown().
Scrolls the console.
[in] | scroll | Lines to scroll |
Definition at line 172 of file cl_console.cpp.
References console_t::currentLine, and console_t::displayLine.
Referenced by Key_Console().
Definition at line 149 of file cl_console.cpp.
References ca_active, cls, Key_ClearTyping(), key_console, key_game, Key_SetDest(), client_static_s::keyDest, and client_static_s::state.
Referenced by Con_Init().
Definition at line 138 of file cl_console.cpp.
References cls, Key_ClearTyping(), key_console, key_game, Key_SetDest(), and client_static_s::keyDest.
Referenced by Con_Init(), IN_Frame(), and Key_Event().
Definition at line 132 of file cl_console.cpp.
References editLine, keyLinePos, and keyLines.
Referenced by Con_ToggleChat_f(), and Con_ToggleConsole_f().
|
static |
Definition at line 71 of file cl_console.cpp.
|
static |
Definition at line 74 of file cl_console.cpp.
const int con_fontHeight = 12 |
Definition at line 75 of file cl_console.cpp.
Referenced by Con_DrawConsole(), Con_DrawInput(), R_DrawChar(), and SCR_UpdateScreen().
const int con_fontShift = 3 |
Definition at line 77 of file cl_console.cpp.
Referenced by Con_CheckResize(), Con_DrawConsole(), and Con_DrawText().
const int con_fontWidth = 10 |
Definition at line 76 of file cl_console.cpp.
Referenced by Con_DrawConsole(), Con_Init(), R_DrawChar(), and SCR_UpdateScreen().
|
static |
Definition at line 73 of file cl_console.cpp.
|
static |
Definition at line 72 of file cl_console.cpp.
|
static |
Definition at line 39 of file cl_console.cpp.
Referenced by Con_DrawConsole(), and Con_DrawText().