2001-02-21 19:35:06 +00:00
|
|
|
/*
|
|
|
|
console.h
|
|
|
|
|
|
|
|
Console definitions and prototypes
|
|
|
|
|
|
|
|
Copyright (C) 1996-1997 Id Software, Inc.
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to:
|
|
|
|
|
|
|
|
Free Software Foundation, Inc.
|
|
|
|
59 Temple Place - Suite 330
|
|
|
|
Boston, MA 02111-1307, USA
|
|
|
|
|
|
|
|
$Id$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __console_h
|
|
|
|
#define __console_h
|
2001-09-21 04:22:46 +00:00
|
|
|
|
|
|
|
#include <stdarg.h>
|
2001-02-21 19:35:06 +00:00
|
|
|
|
2002-01-16 21:53:42 +00:00
|
|
|
#include "QF/keys.h"
|
2001-03-27 23:36:02 +00:00
|
|
|
#include "QF/qtypes.h"
|
2001-02-21 19:35:06 +00:00
|
|
|
|
2001-06-09 16:34:13 +00:00
|
|
|
#define CON_TEXTSIZE 32764
|
2001-02-21 19:35:06 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
char text[CON_TEXTSIZE];
|
|
|
|
int current; // line where next message will be printed
|
|
|
|
int x; // offset in current line for next print
|
|
|
|
int display; // bottom of console displays this line
|
|
|
|
int numlines; // number of non-blank text lines, used for backscroling
|
2001-09-29 04:24:04 +00:00
|
|
|
} old_console_t;
|
2001-02-21 19:35:06 +00:00
|
|
|
|
2001-07-17 16:46:51 +00:00
|
|
|
typedef struct inputline_s
|
|
|
|
{
|
|
|
|
char **lines; // array of lines for input history
|
|
|
|
int num_lines; // number of lines in arry. 1 == no history
|
2003-04-17 00:01:48 +00:00
|
|
|
size_t line_size; // space available in each line. includes \0
|
2001-07-17 16:46:51 +00:00
|
|
|
char prompt_char; // char placed at the beginning of the line
|
|
|
|
int edit_line; // current line being edited
|
|
|
|
int history_line; // current history line
|
2003-04-17 00:01:48 +00:00
|
|
|
size_t linepos; // cursor position within the current edit line
|
|
|
|
size_t scroll; // beginning of displayed line
|
|
|
|
size_t width; // viewable widht for horizontal scrolling
|
2001-09-26 16:31:36 +00:00
|
|
|
void *user_data; // eg: window pointer
|
2001-07-17 16:46:51 +00:00
|
|
|
void (*complete)(struct inputline_s *); // tab key pressed
|
|
|
|
void (*enter)(const char *line); // enter key pressed
|
2001-09-26 16:31:36 +00:00
|
|
|
void (*draw)(struct inputline_s *); // draw input line to screen
|
2001-07-17 16:46:51 +00:00
|
|
|
} inputline_t;
|
|
|
|
|
2001-09-30 05:59:33 +00:00
|
|
|
typedef struct {
|
|
|
|
byte *text;
|
|
|
|
size_t len;
|
|
|
|
} con_line_t;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
byte *buffer;
|
|
|
|
size_t buffer_size;
|
|
|
|
con_line_t *lines;
|
|
|
|
int max_lines; // size of lines array
|
|
|
|
int num_lines; // number of lines used
|
|
|
|
int cur_line; // current line
|
|
|
|
} con_buffer_t;
|
|
|
|
|
2001-10-28 04:23:37 +00:00
|
|
|
extern int con_linewidth;
|
2002-01-16 21:53:42 +00:00
|
|
|
extern struct plugin_s *con_module;
|
2002-01-18 19:19:33 +00:00
|
|
|
extern struct console_data_s con_data;
|
2001-02-21 19:35:06 +00:00
|
|
|
|
2002-01-16 21:53:42 +00:00
|
|
|
//extern int con_totallines;
|
|
|
|
//extern qboolean con_initialized;
|
|
|
|
//extern byte *con_chars;
|
2001-02-21 19:35:06 +00:00
|
|
|
|
|
|
|
void Con_CheckResize (void);
|
2003-07-25 22:21:47 +00:00
|
|
|
void Con_DrawConsole (void);
|
2001-09-16 05:41:28 +00:00
|
|
|
|
2001-09-21 04:22:46 +00:00
|
|
|
void Con_Print (const char *fmt, va_list args);
|
2001-07-15 07:04:17 +00:00
|
|
|
void Con_Printf (const char *fmt, ...) __attribute__((format(printf,1,2)));
|
|
|
|
void Con_DPrintf (const char *fmt, ...) __attribute__((format(printf,1,2)));
|
2001-02-21 19:35:06 +00:00
|
|
|
void Con_ToggleConsole_f (void);
|
|
|
|
|
2001-06-28 04:05:14 +00:00
|
|
|
// wrapper function to attempt to either complete the command line
|
|
|
|
// or to list possible matches grouped by type
|
|
|
|
// (i.e. will display possible variables, aliases, commands
|
|
|
|
// that match what they've typed so far)
|
2001-09-16 05:41:28 +00:00
|
|
|
void Con_BasicCompleteCommandLine (inputline_t *il);
|
2001-06-28 04:05:14 +00:00
|
|
|
|
|
|
|
// Generic libs/util/console.c function to display a list
|
|
|
|
// formatted in columns on the console
|
2001-07-15 07:04:17 +00:00
|
|
|
void Con_DisplayList(const char **list, int con_linewidth);
|
2002-09-04 18:56:53 +00:00
|
|
|
extern void (*con_list_print)(const char *fmt, ...);
|
2001-06-28 04:05:14 +00:00
|
|
|
|
2002-01-30 21:23:46 +00:00
|
|
|
inputline_t *Con_CreateInputLine (int lines, int lsize, char prompt);
|
2001-07-17 16:46:51 +00:00
|
|
|
void Con_DestroyInputLine (inputline_t *inputline);
|
2002-08-28 16:02:43 +00:00
|
|
|
void Con_ClearTyping (inputline_t *il, int save);
|
2001-09-30 05:59:33 +00:00
|
|
|
void Con_ProcessInputLine (inputline_t *il, int ch);
|
|
|
|
|
|
|
|
con_buffer_t *Con_CreateBuffer (size_t buffer_size, int max_lines);
|
|
|
|
void Con_DestroyBuffer (con_buffer_t *buffer);
|
|
|
|
void Con_BufferAddText (con_buffer_t *buf, const char *text);
|
|
|
|
#define Con_BufferLine(b,l) ((b)->lines + ((l) + (b)->max_lines) % (b)->max_lines)
|
2001-07-17 16:46:51 +00:00
|
|
|
|
2001-09-16 05:41:28 +00:00
|
|
|
// init/shutdown functions
|
|
|
|
void Con_Init (const char *plugin_name);
|
|
|
|
void Con_Init_Cvars (void);
|
|
|
|
void Con_Shutdown (void);
|
|
|
|
|
|
|
|
void Con_ProcessInput (void);
|
2002-01-16 21:53:42 +00:00
|
|
|
void Con_KeyEvent (knum_t key, short unicode, qboolean down);
|
|
|
|
void Con_SetOrMask (int mask);
|
2002-01-18 19:19:33 +00:00
|
|
|
void Con_NewMap (void);
|
2001-09-16 05:41:28 +00:00
|
|
|
|
2001-11-05 22:24:16 +00:00
|
|
|
void Con_Maplist_f (void);
|
2001-11-06 07:14:29 +00:00
|
|
|
void Con_Skinlist_f (void);
|
|
|
|
void Con_Skyboxlist_f (void);
|
|
|
|
void Con_Demolist_QWD_f (void);
|
|
|
|
void Con_Demolist_DEM_f (void);
|
2001-11-05 22:24:16 +00:00
|
|
|
|
2003-01-06 18:28:13 +00:00
|
|
|
//FIXME need a better way to communicate this (bah, need a better menu system
|
|
|
|
// in general :P)
|
|
|
|
void C_DrawInputLine (inputline_t *il);
|
|
|
|
|
2003-05-06 02:19:13 +00:00
|
|
|
struct view_s;
|
2002-01-18 19:19:33 +00:00
|
|
|
void Menu_Init (void);
|
|
|
|
void Menu_Load (void);
|
2003-05-06 02:19:13 +00:00
|
|
|
void Menu_Draw (struct view_s *view);
|
2003-05-14 21:17:32 +00:00
|
|
|
void Menu_Draw_Hud (struct view_s *view);
|
2002-01-18 22:02:59 +00:00
|
|
|
void Menu_KeyEvent (knum_t key, short unicode, qboolean down);
|
2002-01-18 23:45:28 +00:00
|
|
|
void Menu_Enter (void);
|
|
|
|
void Menu_Leave (void);
|
2002-01-18 19:19:33 +00:00
|
|
|
|
2003-07-25 22:21:47 +00:00
|
|
|
extern struct cvar_s *con_size;
|
|
|
|
|
2001-02-21 19:35:06 +00:00
|
|
|
#endif // __console_h
|