src/render/rFont.cpp File Reference

#include "rFont.h"
#include "rScreen.h"
#include "tConfiguration.h"
#include "tDirectories.h"
#include "tCoord.h"
#include "rTexture.h"
#include <ctype.h>
#include "rRender.h"
#include <FTGLPixmapFont.h>
#include <FTGLBitmapFont.h>
#include <FTGLTextureFont.h>
#include <FTGLPolygonFont.h>
#include <FTGLOutlineFont.h>
#include <FTGLExtrdFont.h>

Include dependency graph for rFont.cpp:

Go to the source code of this file.

Classes

class  rFont
class  rFontContainer

Functions

void sr_ReloadFont (void)
 Reloads the font (in case the resolution or font type changes).
static REAL CTR (int x)
char int_to_hex (int i)
int hex_to_int (char c)
void DisplayText (REAL x, REAL y, REAL h, const char *text, sr_fontClass type, int center, int cursor, int cursorPos, rTextField::ColorMode colorMode)

Variables

static REAL sr_bigFontThresholdWidth = 12
static REAL sr_bigFontThresholdHeight = 24
static tSettingItem< REALsr_bigFontThresholdWidthConf ("FONT_BIG_THRESHOLD_WIDTH", sr_bigFontThresholdWidth)
static tSettingItem< REALsr_bigFontThresholdHeightConf ("FONT_BIG_THRESHOLD_HEIGHT", sr_bigFontThresholdHeight)
static rFont sr_lowerPartFont ("textures/font_extra.png")
int sr_fontType = sr_fontTexture
static tConfItem< int > sr_fontTypeConf ("FONT_TYPE", sr_fontType,&sr_ReloadFont)
static float sr_fontSizeFactor = .9
static tConfItem< float > sr_fontSizeFactorConf ("FONT_SIZE_FACTOR", sr_fontSizeFactor,&sr_ReloadFont)
tString fontFile ("Armagetronad.ttf")
static tConfItemLine ff ("FONT_FILE", fontFile,&sr_ReloadFont)
static tString customFont ("")
static tConfItemLine ffc ("FONT_FILE_CUSTOM", customFont,&sr_ReloadFont)
static int useCustomFont = 0
static tConfItem< int > ufc ("USE_CUSTOM_FONT", useCustomFont,&sr_ReloadFont)
static
rCallbackBeforeScreenModeChange
reloadft & 
sr_ReloadFont
rFontContainer sr_Font
static REAL sr_minR = .5
static REAL sr_minG = .5
static REAL sr_minB = .5
static REAL sr_minTotal = .7
tSettingItem< REALsr_minRConf ("FONT_MIN_R", sr_minR)
tSettingItem< REALsr_minGConf ("FONT_MIN_G", sr_minG)
tSettingItem< REALsr_minBConf ("FONT_MIN_B", sr_minB)
tSettingItem< REALsr_minTotalConf ("FONT_MIN_TOTAL", sr_minTotal)
static char hex_array [] = "0123456789abcdef"


Function Documentation

static REAL CTR ( int  x  )  [static]

Definition at line 554 of file rFont.cpp.

Referenced by rTextField::StringOutput().

00554                       {
00555     return x/255.0;
00556 }

Here is the caller graph for this function:

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

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:

int hex_to_int ( char  c  ) 

Definition at line 568 of file rFont.cpp.

Referenced by rTextField::StringOutput().

00568                       {
00569     int ret=0;
00570     for (int i=15;i>=0;i--)
00571         if (hex_array[i]==c)
00572             ret=i;
00573     return ret;
00574 }

Here is the caller graph for this function:

char int_to_hex ( int  i  ) 

Definition at line 561 of file rFont.cpp.

Referenced by operator<<().

00561                       {
00562     if (i<0 || i >15)
00563         return 'Q';
00564     else
00565         return hex_array[i];
00566 }

Here is the caller 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

tString customFont("") [static]

Referenced by rFontContainer::New().

tConfItemLine ff("FONT_FILE", fontFile,&sr_ReloadFont) [static]

Referenced by eCamera::Timestep().

tConfItemLine ffc("FONT_FILE_CUSTOM", customFont,&sr_ReloadFont) [static]

tString fontFile("Armagetronad.ttf")

Referenced by rFontContainer::New().

char hex_array[] = "0123456789abcdef" [static]

Definition at line 559 of file rFont.cpp.

REAL sr_bigFontThresholdHeight = 24 [static]

Definition at line 49 of file rFont.cpp.

Referenced by rFontContainer::GetWidth(), and rFontContainer::Render().

tSettingItem< REAL > sr_bigFontThresholdHeightConf("FONT_BIG_THRESHOLD_HEIGHT", sr_bigFontThresholdHeight) [static]

REAL sr_bigFontThresholdWidth = 12 [static]

Definition at line 48 of file rFont.cpp.

tSettingItem< REAL > sr_bigFontThresholdWidthConf("FONT_BIG_THRESHOLD_WIDTH", sr_bigFontThresholdWidth) [static]

rFontContainer sr_Font

Definition at line 357 of file rFont.cpp.

float sr_fontSizeFactor = .9 [static]

Definition at line 200 of file rFont.cpp.

tConfItem< float > sr_fontSizeFactorConf("FONT_SIZE_FACTOR", sr_fontSizeFactor,&sr_ReloadFont) [static]

int sr_fontType = sr_fontTexture

Definition at line 197 of file rFont.cpp.

tConfItem< int > sr_fontTypeConf("FONT_TYPE", sr_fontType,&sr_ReloadFont) [static]

rFont sr_lowerPartFont("textures/font_extra.png") [static]

REAL sr_minB = .5 [static]

Definition at line 409 of file rFont.cpp.

tSettingItem< REAL > sr_minBConf("FONT_MIN_B", sr_minB)

REAL sr_minG = .5 [static]

Definition at line 409 of file rFont.cpp.

Referenced by rTextField::FlushLine().

tSettingItem< REAL > sr_minGConf("FONT_MIN_G", sr_minG)

REAL sr_minR = .5 [static]

Definition at line 409 of file rFont.cpp.

tSettingItem< REAL > sr_minRConf("FONT_MIN_R", sr_minR)

REAL sr_minTotal = .7 [static]

Definition at line 409 of file rFont.cpp.

Referenced by rTextField::FlushLine().

tSettingItem< REAL > sr_minTotalConf("FONT_MIN_TOTAL", sr_minTotal)

rCallbackBeforeScreenModeChange reloadft& sr_ReloadFont [static]

Definition at line 307 of file rFont.cpp.

tConfItem<int> ufc("USE_CUSTOM_FONT", useCustomFont,&sr_ReloadFont) [static]

int useCustomFont = 0 [static]

Definition at line 304 of file rFont.cpp.


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