#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>
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< REAL > | sr_bigFontThresholdWidthConf ("FONT_BIG_THRESHOLD_WIDTH", sr_bigFontThresholdWidth) |
static tSettingItem< REAL > | sr_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< REAL > | sr_minRConf ("FONT_MIN_R", sr_minR) |
tSettingItem< REAL > | sr_minGConf ("FONT_MIN_G", sr_minG) |
tSettingItem< REAL > | sr_minBConf ("FONT_MIN_B", sr_minB) |
tSettingItem< REAL > | sr_minTotalConf ("FONT_MIN_TOTAL", sr_minTotal) |
static char | hex_array [] = "0123456789abcdef" |
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 }
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 }
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 }
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 }
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().
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] |
Referenced by rFontContainer::New().
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] |
tSettingItem< REAL > sr_bigFontThresholdWidthConf("FONT_BIG_THRESHOLD_WIDTH", sr_bigFontThresholdWidth) [static] |
float sr_fontSizeFactor = .9 [static] |
tConfItem< float > sr_fontSizeFactorConf("FONT_SIZE_FACTOR", sr_fontSizeFactor,&sr_ReloadFont) [static] |
int sr_fontType = sr_fontTexture |
tConfItem< int > sr_fontTypeConf("FONT_TYPE", sr_fontType,&sr_ReloadFont) [static] |
rFont sr_lowerPartFont("textures/font_extra.png") [static] |
tSettingItem< REAL > sr_minBConf("FONT_MIN_B", sr_minB) |
tSettingItem< REAL > sr_minGConf("FONT_MIN_G", sr_minG) |
tSettingItem< REAL > sr_minRConf("FONT_MIN_R", sr_minR) |
REAL sr_minTotal = .7 [static] |
tSettingItem< REAL > sr_minTotalConf("FONT_MIN_TOTAL", sr_minTotal) |
rCallbackBeforeScreenModeChange reloadft& sr_ReloadFont [static] |
int useCustomFont = 0 [static] |