R:/projects/actioncube/_svn/trunk/ac/source/src/rendertext.cpp File Reference

#include "pch.h"
#include "cube.h"

Include dependency graph for rendertext.cpp:


Defines

#define TABALIGN(x)   ((((x)+PIXELTAB)/PIXELTAB)*PIXELTAB)
#define TEXTGETCOLUMN
#define TEXTSETCOLUMN
#define TEXTSKELETON
#define TEXTWORDSKELETON
#define TEXTINDEX(idx)
#define TEXTTAB(idx)   TEXTGETCOLUMN
#define TEXTWHITE(idx)   if(y+FONTH > hity && x >= hitx) return idx;
#define TEXTLINE(idx)   if(y+FONTH > hity) return idx;
#define TEXTCOLOR(idx)
#define TEXTCHAR(idx)   x += curfont->chars[c-curfont->skip].w+1; TEXTWHITE(idx)
#define TEXTWORD   TEXTWORDSKELETON
#define TEXTINDEX(idx)   if(idx == cursor) { cx = x; cy = y; break; }
#define TEXTTAB(idx)   TEXTGETCOLUMN
#define TEXTWHITE(idx)
#define TEXTLINE(idx)
#define TEXTCOLOR(idx)
#define TEXTCHAR(idx)   x += curfont->chars[c-curfont->skip].w + 1;
#define TEXTWORD   TEXTWORDSKELETON if(i >= cursor) break;
#define TEXTINDEX(idx)
#define TEXTTAB(idx)   TEXTSETCOLUMN
#define TEXTWHITE(idx)
#define TEXTLINE(idx)   if(x > width) width = x;
#define TEXTCOLOR(idx)
#define TEXTCHAR(idx)   x += curfont->chars[c-curfont->skip].w + 1;
#define TEXTWORD   x += w + 1;
#define TEXTINDEX(idx)   if(idx == cursor) { cx = x; cy = y; cc = str[idx]; }
#define TEXTTAB(idx)   TEXTGETCOLUMN
#define TEXTWHITE(idx)
#define TEXTLINE(idx)
#define TEXTCOLOR(idx)   text_color(str[idx], colorstack, sizeof(colorstack), colorpos, color, a);
#define TEXTCHAR(idx)   x += draw_char(c, left+x, top+y)+1;
#define TEXTWORD   TEXTWORDSKELETON

Functions

void newfont (char *name, char *tex, char *defaultw, char *defaulth, char *offsetx, char *offsety, char *offsetw, char *offseth)
void fontchar (int x, int y, int w, int h)
void fontskip (int n)
 COMMANDN (font, newfont, ARG_8STR)
 COMMAND (fontchar, ARG_4INT)
 COMMAND (fontskip, ARG_1INT)
bool setfont (const char *name)
void pushfont (const char *name)
void popfont ()
int text_width (const char *str)
void draw_textf (const char *fstr, int left, int top,...)
static int draw_char (int c, int x, int y)
static void text_color (char c, char *stack, int size, int &sp, bvec color, int a)
void text_startcolumns ()
void text_endcolumns ()
int text_visible (const char *str, int hitx, int hity, int maxwidth)
void text_pos (const char *str, int cursor, int &cx, int &cy, int maxwidth)
void text_bounds (const char *str, int &width, int &height, int maxwidth)
void draw_text (const char *str, int left, int top, int r, int g, int b, int a, int cursor, int maxwidth)
void reloadfonts ()

Variables

int VIRTW
static hashtable< const char
*, font > 
fonts
static font * fontdef = NULL
font * curfont = NULL
static vector< font * > fontstack
static vector< int > * columns = NULL

Define Documentation

#define TABALIGN ( x   )     ((((x)+PIXELTAB)/PIXELTAB)*PIXELTAB)

#define TEXTCHAR ( idx   )     x += draw_char(c, left+x, top+y)+1;

#define TEXTCHAR ( idx   )     x += curfont->chars[c-curfont->skip].w + 1;

#define TEXTCHAR ( idx   )     x += curfont->chars[c-curfont->skip].w + 1;

#define TEXTCHAR ( idx   )     x += curfont->chars[c-curfont->skip].w+1; TEXTWHITE(idx)

#define TEXTCOLOR ( idx   )     text_color(str[idx], colorstack, sizeof(colorstack), colorpos, color, a);

#define TEXTCOLOR ( idx   ) 

#define TEXTCOLOR ( idx   ) 

#define TEXTCOLOR ( idx   ) 

#define TEXTGETCOLUMN

Value:

if(columns && col<columns->length()) \
    { \
        colx += (*columns)[col++]; \
        x = colx; \
    } \
    else x = TABALIGN(x);

#define TEXTINDEX ( idx   )     if(idx == cursor) { cx = x; cy = y; cc = str[idx]; }

#define TEXTINDEX ( idx   ) 

#define TEXTINDEX ( idx   )     if(idx == cursor) { cx = x; cy = y; break; }

#define TEXTINDEX ( idx   ) 

#define TEXTLINE ( idx   ) 

#define TEXTLINE ( idx   )     if(x > width) width = x;

#define TEXTLINE ( idx   ) 

#define TEXTLINE ( idx   )     if(y+FONTH > hity) return idx;

#define TEXTSETCOLUMN

Value:

if(columns) \
    { \
        while(col>=columns->length()) columns->add(0); \
        int w = TABALIGN(x) - colx; \
        w = max(w, (*columns)[col]); \
        (*columns)[col] = w; \
        col++; \
        colx += w; \
        x = colx; \
    } \
    else x = TABALIGN(x);

#define TEXTSKELETON

#define TEXTTAB ( idx   )     TEXTGETCOLUMN

#define TEXTTAB ( idx   )     TEXTSETCOLUMN

#define TEXTTAB ( idx   )     TEXTGETCOLUMN

#define TEXTTAB ( idx   )     TEXTGETCOLUMN

#define TEXTWHITE ( idx   ) 

#define TEXTWHITE ( idx   ) 

#define TEXTWHITE ( idx   ) 

#define TEXTWHITE ( idx   )     if(y+FONTH > hity && x >= hitx) return idx;

#define TEXTWORD   TEXTWORDSKELETON

#define TEXTWORD   x += w + 1;

#define TEXTWORD   TEXTWORDSKELETON if(i >= cursor) break;

#define TEXTWORD   TEXTWORDSKELETON

#define TEXTWORDSKELETON

Value:

for(; j <= i; j++)\
                {\
                    TEXTINDEX(j)\
                    int c = str[j];\
                    if(c=='\f') { if(str[j+1]) { j++; TEXTCOLOR(j) }}\
                    else { TEXTCHAR(j) }\
                }


Function Documentation

COMMAND ( fontskip  ,
ARG_1INT   
)

COMMAND ( fontchar  ,
ARG_4INT   
)

COMMANDN ( font  ,
newfont  ,
ARG_8STR   
)

static int draw_char ( int  c,
int  x,
int  y 
) [static]

void draw_text ( const char *  str,
int  left,
int  top,
int  r,
int  g,
int  b,
int  a,
int  cursor,
int  maxwidth 
)

void draw_textf ( const char *  fstr,
int  left,
int  top,
  ... 
)

void fontchar ( int  x,
int  y,
int  w,
int  h 
)

void fontskip ( int  n  ) 

void newfont ( char *  name,
char *  tex,
char *  defaultw,
char *  defaulth,
char *  offsetx,
char *  offsety,
char *  offsetw,
char *  offseth 
)

void popfont (  ) 

void pushfont ( const char *  name  ) 

void reloadfonts (  ) 

bool setfont ( const char *  name  ) 

void text_bounds ( const char *  str,
int &  width,
int &  height,
int  maxwidth 
)

static void text_color ( char  c,
char *  stack,
int  size,
int &  sp,
bvec  color,
int  a 
) [static]

void text_endcolumns (  ) 

void text_pos ( const char *  str,
int  cursor,
int &  cx,
int &  cy,
int  maxwidth 
)

void text_startcolumns (  ) 

int text_visible ( const char *  str,
int  hitx,
int  hity,
int  maxwidth 
)

int text_width ( const char *  str  ) 


Variable Documentation

vector<int>* columns = NULL [static]

font* curfont = NULL

font* fontdef = NULL [static]

hashtable<const char *, font> fonts [static]

vector<font *> fontstack [static]

int VIRTW


Generated on Mon Dec 8 21:41:33 2008 for AssaultCube by  doxygen 1.5.7.1