summaryrefslogtreecommitdiff
path: root/src/ui/ui_shared.h
blob: 9654fe5a53c4c5e361d90cd9653b9a7b3f2f349a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
/*
===========================================================================
Copyright (C) 1999-2005 Id Software, Inc.
Copyright (C) 2000-2009 Darklegion Development
 
This file is part of Tremulous.
 
Tremulous 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.
 
Tremulous 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 Tremulous; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
===========================================================================
*/

#ifndef __UI_SHARED_H
#define __UI_SHARED_H


#include "../qcommon/q_shared.h"
#include "../renderer/tr_types.h"
#include "../client/keycodes.h"

#include "../../assets/ui/menudef.h"

// thanks for defining MAX_EMOTICONS in q_shared...
#undef MAX_EMOTICONS
#define MAX_EMOTICONS 1024

#define MAX_MENUNAME 32
#define MAX_ITEMTEXT 64
#define MAX_ITEMACTION 64
#define MAX_MENUDEFFILE 4096
#define MAX_MENUFILE 32768
#define MAX_MENUS 256
#define MAX_MENUITEMS 128
#define MAX_COLOR_RANGES 10
#define MAX_OPEN_MENUS 16

#define WINDOW_MOUSEOVER      0x00000001  // mouse is over it, non exclusive
#define WINDOW_HASFOCUS       0x00000002  // has cursor focus, exclusive
#define WINDOW_VISIBLE        0x00000004  // is visible
#define WINDOW_GREY           0x00000008  // is visible but grey ( non-active )
#define WINDOW_DECORATION     0x00000010  // for decoration only, no mouse, keyboard, etc..
#define WINDOW_FADINGOUT      0x00000020  // fading out, non-active
#define WINDOW_FADINGIN       0x00000040  // fading in
#define WINDOW_MOUSEOVERTEXT  0x00000080  // mouse is over it, non exclusive
#define WINDOW_INTRANSITION   0x00000100  // window is in transition
#define WINDOW_FORECOLORSET   0x00000200  // forecolor was explicitly set ( used to color alpha images or not )
#define WINDOW_HORIZONTAL     0x00000400  // for list boxes and sliders, vertical is default this is set of horizontal
#define WINDOW_LB_UPARROW     0x00000800  // mouse is over up arrow
#define WINDOW_LB_DOWNARROW   0x00001000  // mouse is over down arrow
#define WINDOW_LB_THUMB       0x00002000  // mouse is over thumb
#define WINDOW_LB_PGUP        0x00004000  // mouse is over page up
#define WINDOW_LB_PGDN        0x00008000  // mouse is over page down
#define WINDOW_ORBITING       0x00010000  // item is in orbit
#define WINDOW_OOB_CLICK      0x00020000  // close on out of bounds click
#define WINDOW_WRAPPED        0x00080000  // wrap text
#define WINDOW_FORCED         0x00100000  // forced open
#define WINDOW_POPUP          0x00200000  // popup
#define WINDOW_BACKCOLORSET   0x00400000  // backcolor was explicitly set
#define WINDOW_TIMEDVISIBLE   0x00800000  // visibility timing ( NOT implemented )


// CGAME cursor type bits
#define CURSOR_NONE           0x00000001
#define CURSOR_ARROW          0x00000002
#define CURSOR_SIZER          0x00000004

#ifdef CGAME
#define STRING_POOL_SIZE 128*1024
#else
#define STRING_POOL_SIZE 384*1024
#endif
#define MAX_STRING_HANDLES 4096

#define MAX_SCRIPT_ARGS 12
#define MAX_EDITFIELD 256
#define ITEM_VALUE_OFFSET 8

#define ART_FX_BASE       "menu/art/fx_base"
#define ART_FX_BLUE       "menu/art/fx_blue"
#define ART_FX_CYAN       "menu/art/fx_cyan"
#define ART_FX_GREEN      "menu/art/fx_grn"
#define ART_FX_RED        "menu/art/fx_red"
#define ART_FX_TEAL       "menu/art/fx_teal"
#define ART_FX_WHITE      "menu/art/fx_white"
#define ART_FX_YELLOW     "menu/art/fx_yel"

#define ASSET_GRADIENTBAR           "ui/assets/gradientbar2.tga"
#define ASSET_SCROLLBAR             "ui/assets/scrollbar.tga"
#define ASSET_SCROLLBAR_ARROWDOWN   "ui/assets/scrollbar_arrow_dwn_a.tga"
#define ASSET_SCROLLBAR_ARROWUP     "ui/assets/scrollbar_arrow_up_a.tga"
#define ASSET_SCROLLBAR_ARROWLEFT   "ui/assets/scrollbar_arrow_left.tga"
#define ASSET_SCROLLBAR_ARROWRIGHT  "ui/assets/scrollbar_arrow_right.tga"
#define ASSET_SCROLL_THUMB          "ui/assets/scrollbar_thumb.tga"
#define ASSET_SLIDER_BAR            "ui/assets/slider2.tga"
#define ASSET_SLIDER_THUMB          "ui/assets/sliderbutt_1.tga"

#define SCROLLBAR_ARROW_SIZE 16.0f
#define SCROLLBAR_ARROW_WIDTH (SCROLLBAR_ARROW_SIZE*DC->aspectScale)
#define SCROLLBAR_ARROW_HEIGHT SCROLLBAR_ARROW_SIZE
#define SCROLLBAR_SLIDER_X(_item)       (_item->window.rect.x+_item->window.rect.w- \
                                         SCROLLBAR_ARROW_WIDTH-DC->aspectScale)
#define SCROLLBAR_SLIDER_Y(_item)       (SCROLLBAR_Y(_item)+SCROLLBAR_ARROW_HEIGHT)
#define SCROLLBAR_SLIDER_HEIGHT(_item)  (_item->window.rect.h-(SCROLLBAR_ARROW_HEIGHT*2.0f)-2.0f)
#define SCROLLBAR_X(_item)              (_item->window.rect.x+DC->aspectScale)
#define SCROLLBAR_Y(_item)              (_item->window.rect.y+1.0f)
#define SCROLLBAR_W(_item)              (SCROLLBAR_SLIDER_X(_item)-SCROLLBAR_X(_item))
#define SCROLLBAR_H(_item)              (_item->window.rect.h-2.0f)

#define SLIDER_WIDTH (96.0f*DC->aspectScale)
#define SLIDER_HEIGHT 16.0f
#define SLIDER_THUMB_WIDTH (12.0f*DC->aspectScale)
#define SLIDER_THUMB_HEIGHT 20.0f
#define NUM_CROSSHAIRS      10

typedef struct
{
  const char *command;
  const char *args[MAX_SCRIPT_ARGS];
}
scriptDef_t;


typedef struct
{
  float x;    // horiz position
  float y;    // vert position
  float w;    // width
  float h;    // height;
}
rectDef_t;

typedef rectDef_t Rectangle;

// FIXME: do something to separate text vs window stuff

typedef struct
{
  Rectangle rect;                 // client coord rectangle
  int aspectBias;                 // direction in which to aspect compensate
  Rectangle rectClient;           // screen coord rectangle
  const char *name;               //
  const char *group;              // if it belongs to a group
  const char *cinematicName;      // cinematic name
  int cinematic;                  // cinematic handle
  int style;                      //
  int border;                     //
  int ownerDraw;                  // ownerDraw style
  int ownerDrawFlags;             // show flags for ownerdraw items
  float borderSize;               //
  int flags;                      // visible, focus, mouseover, cursor
  Rectangle rectEffects;          // for various effects
  Rectangle rectEffects2;         // for various effects
  int offsetTime;                 // time based value for various effects
  int nextTime;                   // time next effect should cycle
  vec4_t foreColor;               // text color
  vec4_t backColor;               // border color
  vec4_t borderColor;             // border color
  vec4_t outlineColor;            // border color
  qhandle_t background;           // background asset
}
windowDef_t;

typedef windowDef_t Window;

typedef struct
{
  vec4_t  color;
  float    low;
  float    high;
}
colorRangeDef_t;

// FIXME: combine flags into bitfields to save space
// FIXME: consolidate all of the common stuff in one structure for menus and items
// THINKABOUTME: is there any compelling reason not to have items contain items
// and do away with a menu per say.. major issue is not being able to dynamically allocate
// and destroy stuff.. Another point to consider is adding an alloc free call for vm's and have
// the engine just allocate the pool for it based on a cvar
// many of the vars are re-used for different item types, as such they are not always named appropriately
// the benefits of c++ in DOOM will greatly help crap like this
// FIXME: need to put a type ptr that points to specific type info per type
//
#define MAX_LB_COLUMNS 16

typedef struct columnInfo_s
{
  int pos;
  int width;
  int align;
}
columnInfo_t;

typedef struct listBoxDef_s
{
  int startPos;
  int endPos;
  int cursorPos;

  float elementWidth;
  float elementHeight;
  int elementStyle;
  int dropItems;

  int numColumns;
  columnInfo_t columnInfo[MAX_LB_COLUMNS];

  const char *doubleClick;

  qboolean notselectable;
  qboolean noscrollbar;

  qboolean resetonfeederchange;
  int lastFeederCount;
}
listBoxDef_t;

typedef struct cycleDef_s
{
  int cursorPos;
}
cycleDef_t;

typedef struct editFieldDef_s
{
  float minVal;                  //  edit field limits
  float maxVal;                  //
  float defVal;                  //
  float range;                   //
  int maxChars;                  // for edit fields
  int maxPaintChars;             // for edit fields
  int maxFieldWidth;             // for edit fields
  int paintOffset;               //
}
editFieldDef_t;

#define MAX_MULTI_CVARS 32

typedef struct multiDef_s
{
  const char *cvarList[MAX_MULTI_CVARS];
  const char *cvarStr[MAX_MULTI_CVARS];
  float cvarValue[MAX_MULTI_CVARS];
  int count;
  qboolean strDef;
}
multiDef_t;

typedef struct modelDef_s
{
  int angle;
  vec3_t origin;
  float fov_x;
  float fov_y;
  int rotationSpeed;
}
modelDef_t;

#define CVAR_ENABLE    0x00000001
#define CVAR_DISABLE  0x00000002
#define CVAR_SHOW      0x00000004
#define CVAR_HIDE      0x00000008

typedef enum
{
  TYPE_ANY = -1,
  TYPE_NONE,
  TYPE_LIST,
  TYPE_EDIT,
  TYPE_MULTI,
  TYPE_COMBO,
  TYPE_MODEL
} itemDataType_t;

typedef struct itemDef_s
{
  Window window;                 // common positional, border, style, layout info
  Rectangle textRect;            // rectangle the text ( if any ) consumes
  int type;                      // text, button, radiobutton, checkbox, textfield, listbox, combo
  int alignment;                 // left center right
  int textalignment;             // ( optional ) alignment for text within rect based on text width
  int textvalignment;            // ( optional ) alignment for text within rect based on text width
  float textalignx;              // ( optional ) text alignment x coord
  float textaligny;              // ( optional ) text alignment x coord
  float textscale;               // scale percentage from 72pts
  int textStyle;                 // ( optional ) style, normal and shadowed are it for now
  const char *text;              // display text
  void *parent;                  // menu owner
  qhandle_t asset;               // handle to asset
  const char *mouseEnterText;    // mouse enter script
  const char *mouseExitText;     // mouse exit script
  const char *mouseEnter;        // mouse enter script
  const char *mouseExit;         // mouse exit script
  const char *action;            // select script
  const char *onFocus;           // select script
  const char *leaveFocus;        // select script
  const char *onTextEntry;       // called when text entered
  const char *onCharEntry;       // called when text entered
  const char *cvar;              // associated cvar
  const char *cvarTest;          // associated cvar for enable actions
  const char *enableCvar;         // enable, disable, show, or hide based on value, this can contain a list
  int cvarFlags;                 //  what type of action to take on cvarenables
  sfxHandle_t focusSound;
  int numColors;                 // number of color ranges
  colorRangeDef_t colorRanges[MAX_COLOR_RANGES];
  int feederID;                  // where to get data for this item
  int cursorPos;                 // cursor position in characters
  union
  {
    void           *data;
    listBoxDef_t   *list;
    editFieldDef_t *edit;
    multiDef_t     *multi;
    cycleDef_t     *cycle;
    modelDef_t     *model;
  } typeData;                    // type specific data pointers
}
itemDef_t;

typedef struct
{
  Window window;
  const char  *font;                // font
  qboolean fullScreen;              // covers entire screen
  int itemCount;                    // number of items;
  int fontIndex;                    //
  int cursorItem;                    // which item as the cursor
  int fadeCycle;                    //
  float fadeClamp;                  //
  float fadeAmount;                  //
  const char *onOpen;                // run when the menu is first opened
  const char *onClose;              // run when the menu is closed
  const char *onESC;                // run when the menu is closed
  const char *soundName;            // background loop sound for menu

  vec4_t focusColor;                // focus color for items
  vec4_t disableColor;              // focus color for items
  itemDef_t *items[MAX_MENUITEMS];  // items this menu contains
}
menuDef_t;

typedef struct
{
  const char *fontStr;
  const char *cursorStr;
  const char *gradientStr;
  fontInfo_t textFont;
  fontInfo_t smallFont;
  fontInfo_t bigFont;
  qhandle_t cursor;
  qhandle_t gradientBar;
  qhandle_t scrollBarArrowUp;
  qhandle_t scrollBarArrowDown;
  qhandle_t scrollBarArrowLeft;
  qhandle_t scrollBarArrowRight;
  qhandle_t scrollBar;
  qhandle_t scrollBarThumb;
  qhandle_t buttonMiddle;
  qhandle_t buttonInside;
  qhandle_t solidBox;
  qhandle_t sliderBar;
  qhandle_t sliderThumb;
  sfxHandle_t menuEnterSound;
  sfxHandle_t menuExitSound;
  sfxHandle_t menuBuzzSound;
  sfxHandle_t itemFocusSound;
  float fadeClamp;
  int fadeCycle;
  float fadeAmount;
  float shadowX;
  float shadowY;
  vec4_t shadowColor;
  float shadowFadeClamp;
  qboolean fontRegistered;
  emoticon_t emoticons[ MAX_EMOTICONS ];
  int emoticonCount;
}
cachedAssets_t;

typedef struct
{
  const char *name;
  void ( *handler ) ( itemDef_t *item, char** args );
}
commandDef_t;

typedef struct
{
  qhandle_t ( *registerShaderNoMip ) ( const char *p );
  void ( *setColor ) ( const vec4_t v );
  void ( *drawHandlePic ) ( float x, float y, float w, float h, qhandle_t asset );
  void ( *drawStretchPic ) ( float x, float y, float w, float h, float s1, float t1, float s2, float t2, qhandle_t hShader );
  qhandle_t ( *registerModel ) ( const char *p );
  void ( *modelBounds ) ( qhandle_t model, vec3_t min, vec3_t max );
  void ( *fillRect ) ( float x, float y, float w, float h, const vec4_t color );
  void ( *drawRect ) ( float x, float y, float w, float h, float size, const vec4_t color );
  void ( *drawSides ) ( float x, float y, float w, float h, float size );
  void ( *drawTopBottom ) ( float x, float y, float w, float h, float size );
  void ( *clearScene ) ( void );
  void ( *addRefEntityToScene ) ( const refEntity_t *re );
  void ( *renderScene ) ( const refdef_t *fd );
  void ( *registerFont ) ( const char *pFontname, int pointSize, fontInfo_t *font );
  void ( *ownerDrawItem ) ( float x, float y, float w, float h, float text_x,
                            float text_y, int ownerDraw, int ownerDrawFlags,
                            int align, int textalign, int textvalign,
                            float borderSize, float scale, vec4_t foreColor,
                            vec4_t backColor, qhandle_t shader, int textStyle );
  float ( *getValue ) ( int ownerDraw );
  qboolean ( *ownerDrawVisible ) ( int flags );
  void ( *runScript )( char **p );
  void ( *getCVarString )( const char *cvar, char *buffer, int bufsize );
  float ( *getCVarValue )( const char *cvar );
  void ( *setCVar )( const char *cvar, const char *value );
  void ( *drawTextWithCursor )( float x, float y, float scale, vec4_t color, const char *text, int cursorPos, char cursor, int limit, int style );
  void ( *setOverstrikeMode )( qboolean b );
  qboolean ( *getOverstrikeMode )( void );
  void ( *startLocalSound )( sfxHandle_t sfx, int channelNum );
  qboolean ( *ownerDrawHandleKey )( int ownerDraw, int key );
  int ( *feederCount )( int feederID );
  const char *( *feederItemText )( int feederID, int index, int column, qhandle_t *handle );
  qhandle_t ( *feederItemImage )( int feederID, int index );
  void ( *feederSelection )( int feederID, int index );
  int ( *feederInitialise )( int feederID );
  void ( *keynumToStringBuf )( int keynum, char *buf, int buflen );
  void ( *getBindingBuf )( int keynum, char *buf, int buflen );
  void ( *setBinding )( int keynum, const char *binding );
  void ( *executeText )( int exec_when, const char *text );
  void ( *Error )( int level, const char *error, ... );
  void ( *Print )( const char *msg, ... );
  void ( *Pause )( qboolean b );
  int ( *ownerDrawWidth )( int ownerDraw, float scale );
  const char *( *ownerDrawText )( int ownerDraw );
  sfxHandle_t ( *registerSound )( const char *name, qboolean compressed );
  void ( *startBackgroundTrack )( const char *intro, const char *loop );
  void ( *stopBackgroundTrack )( void );
  int ( *playCinematic )( const char *name, float x, float y, float w, float h );
  void ( *stopCinematic )( int handle );
  void ( *drawCinematic )( int handle, float x, float y, float w, float h );
  void ( *runCinematicFrame )( int handle );

  float      yscale;
  float      xscale;
  float      aspectScale;
  int        realTime;
  int        frameTime;
  float      cursorx;
  float      cursory;
  float      smallFontScale;
  float      bigFontScale;
  qboolean  debug;

  cachedAssets_t Assets;

  glconfig_t glconfig;
  qhandle_t  whiteShader;
  qhandle_t gradientImage;
  qhandle_t cursor;
  float FPS;

}
displayContextDef_t;

const char *String_Alloc( const char *p );
void String_Init( void );
void String_Report( void );
void Init_Display( displayContextDef_t *dc );
void Display_ExpandMacros( char * buff );
void Menu_Init( menuDef_t *menu );
void Item_Init( itemDef_t *item );
void Menu_PostParse( menuDef_t *menu );
menuDef_t *Menu_GetFocused( void );
void Menu_HandleKey( menuDef_t *menu, int key, qboolean down );
void Menu_HandleMouseMove( menuDef_t *menu, float x, float y );
void Menu_ScrollFeeder( menuDef_t *menu, int feeder, qboolean down );
qboolean Float_Parse( char **p, float *f );
qboolean Color_Parse( char **p, vec4_t *c );
qboolean Int_Parse( char **p, int *i );
qboolean Rect_Parse( char **p, rectDef_t *r );
qboolean String_Parse( char **p, const char **out );
qboolean Script_Parse( char **p, const char **out );
qboolean PC_Float_Parse( int handle, float *f );
qboolean PC_Color_Parse( int handle, vec4_t *c );
qboolean PC_Int_Parse( int handle, int *i );
qboolean PC_Rect_Parse( int handle, rectDef_t *r );
qboolean PC_String_Parse( int handle, const char **out );
qboolean PC_Script_Parse( int handle, const char **out );
int Menu_Count( void );
void Menu_New( int handle );
void Menu_UpdateAll( void );
void Menu_PaintAll( void );
menuDef_t *Menus_ActivateByName( const char *p );
menuDef_t *Menus_ReplaceActiveByName( const char *p );
void Menu_Reset( void );
qboolean Menus_AnyFullScreenVisible( void );
void  Menus_Activate( menuDef_t *menu );
qboolean  Menus_ReplaceActive( menuDef_t *menu );

displayContextDef_t *Display_GetContext( void );
void *Display_CaptureItem( int x, int y );
qboolean Display_MouseMove( void *p, float x, float y );
int Display_CursorType( int x, int y );
qboolean Display_KeyBindPending( void );
menuDef_t *Menus_FindByName( const char *p );
void Menus_CloseByName( const char *p );
void Display_HandleKey( int key, qboolean down, int x, int y );
void LerpColor( vec4_t a, vec4_t b, vec4_t c, float t );
void Menus_CloseAll( void );
void Menu_Update( menuDef_t *menu );
void Menu_Paint( menuDef_t *menu, qboolean forcePaint );
void Menu_SetFeederSelection( menuDef_t *menu, int feeder, int index, const char *name );
void Display_CacheAll( void );

typedef void ( CaptureFunc ) ( void *p );

void UI_InstallCaptureFunc( CaptureFunc *f, void *data, int timeout );
void UI_RemoveCaptureFunc( void );

void *UI_Alloc( int size );
void UI_InitMemory( void );
qboolean UI_OutOfMemory( void );

void Controls_GetConfig( void );
void Controls_SetConfig( qboolean restart );
void Controls_SetDefaults( void );

void trap_R_SetClipRegion( const float *region );

//for cg_draw.c
void Item_Text_Wrapped_Paint( itemDef_t *item );
const char *Item_Text_Wrap( const char *text, float scale, float width );
void UI_DrawTextBlock( rectDef_t *rect, float text_x, float text_y, vec4_t color,
                       float scale, int textalign, int textvalign,
                       int textStyle, const char *text );
void UI_Text_Paint( float x, float y, float scale, vec4_t color, const char *text, float adjust, int limit, int style );
void UI_Text_Paint_Limit( float *maxX, float x, float y, float scale,
                          vec4_t color, const char* text, float adjust, int limit );
float UI_Text_Width( const char *text, float scale );
float UI_Text_Height( const char *text, float scale );
float UI_Text_EmWidth( float scale );
float UI_Text_EmHeight( float scale );
qboolean UI_Text_IsEmoticon( const char *s, qboolean *escaped, int *length, qhandle_t *h, int *width );
void UI_EscapeEmoticons( char *dest, const char *src, int destsize );

int      trap_Parse_AddGlobalDefine( char *define );
int      trap_Parse_LoadSource( const char *filename );
int      trap_Parse_FreeSource( int handle );
int      trap_Parse_ReadToken( int handle, pc_token_t *pc_token );
int      trap_Parse_SourceFileAndLine( int handle, char *filename, int *line );

void    BindingFromName( const char *cvar );
extern char g_nameBind1[ 32 ];
extern char g_nameBind2[ 32 ];
#endif