src/render/rFont.h File Reference

#include "rSDL.h"
#include "defs.h"
#include "tString.h"
#include "tColor.h"
#include <map>

Include dependency graph for rFont.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  rTextField

Defines

#define rCWIDTH_NORMAL   (16/640.0)
#define rCHEIGHT_NORMAL   (32/480.0)

Enumerations

enum  sr_fontClass {
  sr_fontConsole = 00001, sr_fontMenu = 00002, sr_fontMenuTitle = 00004, sr_fontScoretable = 00010,
  sr_fontMenuHelp = 00020, sr_fontError = 00040, sr_fontCockpit = 00100, sr_fontCenterMessage = 00200,
  sr_fontServerBrowser = 00400, sr_fontCycleLabel = 01000, sr_fontServerDetails = 02000
}
 Different types of fonts, they might get different font files assigned. More...
enum  sr_fontTypes {
  sr_fontOld = 0, sr_fontPixmap = 1, sr_fontBitmap = 2, sr_fontTexture = 3,
  sr_fontPolygon = 4, sr_fontOutline = 5, sr_fontExtruded = 6
}
 Different ways to render fonts. More...

Functions

template<class T>
rTextFieldoperator<< (rTextField &c, const T &x)
void DisplayText (REAL x, REAL y, REAL h, const char *text, sr_fontClass type, int center=0, int cursor=0, int cursorPos=0, rTextField::ColorMode colorMode=rTextField::COLOR_USE)
void sr_ReloadFont (void)
 Reloads the font (in case the resolution or font type changes).

Variables

int sr_fontType


Define Documentation

#define rCHEIGHT_NORMAL   (32/480.0)

Definition at line 98 of file rFont.h.

Referenced by uMenu::OnEnter(), and gCycle::RenderName().

#define rCWIDTH_NORMAL   (16/640.0)

Definition at line 97 of file rFont.h.


Enumeration Type Documentation

enum sr_fontClass

Different types of fonts, they might get different font files assigned.

Enumerator:
sr_fontConsole  for the console
sr_fontMenu  for menu text
sr_fontMenuTitle  for the titles above menus
sr_fontScoretable  for the score table (the one that comes when you press TAB)
sr_fontMenuHelp  for the help that pops up if you idle in the menu
sr_fontError  for error messages like the one that pops up if you get kicked from the server
sr_fontCockpit  for all font in the cockpit
sr_fontCenterMessage  for CENTER_MESSAGEs
sr_fontServerBrowser  for the LAN and master server browser
sr_fontCycleLabel  for the player name displayed over cycles
sr_fontServerDetails  for the details displayed in the server browser (server description, player names etc)

Definition at line 41 of file rFont.h.

00041                   {
00042     sr_fontConsole       = 00001, 
00043     sr_fontMenu          = 00002, 
00044     sr_fontMenuTitle     = 00004, 
00045     sr_fontScoretable    = 00010, 
00046     sr_fontMenuHelp      = 00020, 
00047     sr_fontError         = 00040, 
00048     sr_fontCockpit       = 00100, 
00049     sr_fontCenterMessage = 00200, 
00050     sr_fontServerBrowser = 00400, 
00051     sr_fontCycleLabel    = 01000, 
00052     sr_fontServerDetails = 02000  
00053 };

enum sr_fontTypes

Different ways to render fonts.

Enumerator:
sr_fontOld  The old font, deprecated.
sr_fontPixmap  FTGLPixmapFont.
sr_fontBitmap  FTGLBitmapFont.
sr_fontTexture  FTGLTextureFont.
sr_fontPolygon  FTGLPolygonFont.
sr_fontOutline  FTGLOutlineFont.
sr_fontExtruded  FTGLExtrdFont (experimental).

Definition at line 56 of file rFont.h.

00056                   {
00057     sr_fontOld       = 0, 
00058     sr_fontPixmap    = 1, 
00059     sr_fontBitmap    = 2, 
00060     sr_fontTexture   = 3, 
00061     sr_fontPolygon   = 4, 
00062     sr_fontOutline   = 5, 
00063     sr_fontExtruded  = 6  
00064 };


Function Documentation

void DisplayText ( REAL  x,
REAL  y,
REAL  h,
const char *  text,
sr_fontClass  type,
int  center = 0,
int  cursor = 0,
int  cursorPos = 0,
rTextField::ColorMode  colorMode = rTextField::COLOR_USE 
)

Definition at line 718 of file rFont.cpp.

References c, rTextField::GetTextLength(), height, REAL, rTextField::SetCursor(), rTextField::SetIndent(), rTextField::SetWidth(), rTextField::StringOutput(), and rTextField::width.

Referenced by rViewportConfiguration::DemonstrateViewport(), uMenu::Message(), uMenu::OnEnter(), eTeam::RankingGraph(), uMenuItemInput::Render(), gServerMenu::Render(), rConsole::Render(), cWidget::VerticalBarGauge::RenderCaption(), cWidget::BarGauge::RenderCaption(), cWidget::NeedleGauge::RenderGraph(), cWidget::VerticalBarGauge::RenderGraph(), cWidget::BarGauge::RenderGraph(), cWidget::BarGauge::RenderMinMax(), gCycle::RenderName(), and welcome().

00718                                                                                                                                             {
00719 #ifndef DEDICATED
00720     float height;
00721     float width = rTextField::GetTextLength(tString(text), h, true, true, &height);
00722 
00723     // shrink fields that don't fit the screen
00724     REAL maxw = 1.95 - x;
00725     if ( width > maxw )
00726     {
00727         h *= maxw/(width);
00728         width=maxw;
00729     }
00730 
00731     rTextField c(x-(center+1)*width*.5,y+h*.5,h,type);
00732     if (center==-1)
00733         c.SetWidth(1.-x);
00734     else
00735         c.SetWidth(10000);
00736 
00737     c.SetIndent(5);
00738     if (cursor)
00739         c.SetCursor(cursor,cursorPos);
00740     c.StringOutput(text, colorMode );
00741 #endif
00742 }

Here is the call graph for this function:

Here is the caller graph for this function:

template<class T>
rTextField& operator<< ( rTextField c,
const T &  x 
) [inline]

Definition at line 185 of file rFont.h.

References rTextField::StringOutput().

00185                                                                    {
00186     tColoredString out;
00187     out << x;
00188     return c.StringOutput(out);
00189 }

Here is the call graph for this function:

void sr_ReloadFont ( void   ) 

Reloads the font (in case the resolution or font type changes).

Definition at line 359 of file rFont.cpp.

References rFontContainer::clear().

00359                          {
00360     sr_Font.clear();
00361 }

Here is the call graph for this function:


Variable Documentation

int sr_fontType

Definition at line 197 of file rFont.cpp.


Generated on Sat Mar 15 23:02:55 2008 for Armagetron Advanced by  doxygen 1.5.4