____                _       __
    / __ )____  _____   | |     / /___ ___________
   / __  / __ \/ ___/   | | /| / / __ `/ ___/ ___/
  / /_/ / /_/ (__  )    | |/ |/ / /_/ / /  (__  )
 /_____/\____/____/     |__/|__/\__,_/_/  /____/

       A futuristic real-time strategy game.
          This file is part of Bos Wars.
(C) Copyright 2001-2007 by the Bos Wars and Stratagus Project. Distributed under the "GNU General Public License"

font.h File Reference

The font headerfile. More...

#include <string>
#include "SDL.h"
#include "guichan/font.h"

Go to the source code of this file.

Classes

class  CFont
 Font definition. More...
class  CFontColor

Defines

#define MaxFontColors   9
 Font color definition.
#define FontRed   "red"
#define FontGreen   "green"
#define FontYellow   "yellow"
#define FontWhite   "white"
#define FontGrey   "grey"

Functions

void SetDefaultTextColors (const std::string &normal, const std::string &reverse)
 < Set the default text colors for normal and reverse text
void GetDefaultTextColors (std::string &normalp, std::string &reversep)
 Draw text unclipped.
int VideoDrawText (int x, int y, CFont *font, const std::string &text)
 Draw text unclipped.
int VideoDrawTextClip (int x, int y, CFont *font, const std::string &text)
 Draw reverse text unclipped.
int VideoDrawReverseText (int x, int y, CFont *font, const std::string &text)
 Draw reverse text clipped.
int VideoDrawReverseTextClip (int x, int y, CFont *font, const std::string &text)
 Draw text centered and unclipped.
int VideoDrawTextCentered (int x, int y, CFont *font, const std::string &text)
 Draw number unclipped.
int VideoDrawNumber (int x, int y, CFont *font, int number)
 Draw number clipped.
int VideoDrawNumberClip (int x, int y, CFont *font, int number)
 Draw reverse number unclipped.
int VideoDrawReverseNumber (int x, int y, CFont *font, int number)
 Draw reverse number clipped.
int VideoDrawReverseNumberClip (int x, int y, CFont *font, int number)
 Get the hot key from a string.
int GetHotKey (const std::string &text)
 Load and initialize the fonts.
void LoadFonts ()
 Free OpenGL fonts.
void FreeOpenGLFonts ()
 Reload OpenGL fonts.
void ReloadFonts ()
 Cleanup the font module.
void CleanFonts ()

Variables

CFontSmallFont
 Small font used in stats.
CFontGameFont
 Normal font used in game.
CFontLargeFont
 Large font used in menus.


Detailed Description

The font headerfile.

Definition in file include/font.h.


Define Documentation

#define FontGreen   "green"

Definition at line 122 of file include/font.h.

Referenced by DrawInfoPanelNoneSelected().

#define FontGrey   "grey"

Definition at line 125 of file include/font.h.

#define FontRed   "red"

FIXME: should be moved to lua

Definition at line 121 of file include/font.h.

Referenced by DrawInfoPanelNoneSelected().

#define FontWhite   "white"

Definition at line 124 of file include/font.h.

Referenced by LoadGame(), main1(), and PreMenuSetup().

#define FontYellow   "yellow"

Definition at line 123 of file include/font.h.

Referenced by LoadGame(), main1(), and PreMenuSetup().

#define MaxFontColors   9


Function Documentation

void CleanFonts ( void   ) 

Clean up the font module.

Definition at line 902 of file font.cpp.

References AllFontColors, AllFonts, FontColorGraphics, FontColors, Fonts, int(), CGraphic::NumTextures, CGraphic::Textures, and UseOpenGL.

Referenced by CleanModules().

void FreeOpenGLFonts (  ) 

Reload OpenGL fonts.

Free OpenGL fonts

Definition at line 774 of file font.cpp.

References AllFontColors, AllFonts, FontColorGraphics, CFont::G, int(), CGraphic::NumTextures, and CGraphic::Textures.

Referenced by CVideo::ResizeScreen().

void GetDefaultTextColors ( std::string &  normalp,
std::string &  reversep 
)

Draw text unclipped.

Get the default text colors.

Parameters:
normalp Normal text color pointer.
reversep Reverse text color pointer.

Definition at line 161 of file font.cpp.

References DefaultNormalColorIndex, and DefaultReverseColorIndex.

Referenced by DrawInfoPanelNoneSelected(), DrawMenuButton(), DrawPopup(), StartEditor(), and StartMap().

int GetHotKey ( const std::string &  text  ) 

Load and initialize the fonts.

Get the hot key from a string

Definition at line 264 of file font.cpp.

References convertKey(), and GetUTF8().

Referenced by AddButton(), and ButtonWidget::ButtonWidget().

void LoadFonts (  ) 

Free OpenGL fonts.

Load all fonts.

Definition at line 750 of file font.cpp.

References AllFonts, CGraphic::File, CFont::G, CFont::Get(), int(), CGraphic::Load(), MakeFontColorTextures(), ShowLoadProgress(), and UseOpenGL.

Referenced by LoadGame(), LoadModules(), main1(), and PreMenuSetup().

void ReloadFonts ( void   ) 

Cleanup the font module.

Reload OpenGL fonts

Definition at line 790 of file font.cpp.

References AllFontColors, AllFonts, FontColorGraphics, CFont::G, int(), MakeFontColorTextures(), and CGraphic::Textures.

Referenced by ReloadOpenGL().

void SetDefaultTextColors ( const std::string &  normal,
const std::string &  reverse 
)

< Set the default text colors for normal and reverse text

Get the default text colors for normal and reverse text

Set the default text colors.

Parameters:
normal Normal text color.
reverse Reverse text color.

Definition at line 147 of file font.cpp.

References DefaultNormalColorIndex, DefaultReverseColorIndex, and CFontColor::Get().

Referenced by CreateGame(), DrawInfoPanelNoneSelected(), DrawMenuButton(), DrawPopup(), LoadGame(), LoadModules(), main1(), PreMenuSetup(), StartEditor(), and StartMap().

int VideoDrawNumber ( int  x,
int  y,
CFont font,
int  number 
)

Draw number clipped.

Draw number with font at x,y unclipped.

Parameters:
x X screen position
y Y screen position
font Font number
number Number to be displayed.
Returns:
The length of the printed text.

Definition at line 601 of file font.cpp.

References FormatNumber(), int(), and VideoDrawText().

Referenced by DrawCosts(), DrawInfoPanelNoneSelected(), and DrawPopup().

int VideoDrawNumberClip ( int  x,
int  y,
CFont font,
int  number 
)

Draw reverse number unclipped.

Draw number with font at x,y clipped.

Parameters:
x X screen position
y Y screen position
font Font number
number Number to be displayed.
Returns:
The length of the printed text.

Definition at line 619 of file font.cpp.

References FormatNumber(), int(), and VideoDrawTextClip().

Referenced by DrawDecoration(), and Missile::DrawMissile().

int VideoDrawReverseNumber ( int  x,
int  y,
CFont font,
int  number 
)

Draw reverse number clipped.

Draw reverse number with font at x,y unclipped.

Parameters:
x X screen position
y Y screen position
font Font number
number Number to be displayed.
Returns:
The length of the printed text.

Definition at line 637 of file font.cpp.

References FormatNumber(), int(), and VideoDrawReverseText().

int VideoDrawReverseNumberClip ( int  x,
int  y,
CFont font,
int  number 
)

Get the hot key from a string.

Draw reverse number with font at x,y clipped.

Parameters:
x X screen position
y Y screen position
font Font number
number Number to be displayed.
Returns:
The length of the printed text.

Definition at line 655 of file font.cpp.

References FormatNumber(), int(), and VideoDrawReverseTextClip().

int VideoDrawReverseText ( int  x,
int  y,
CFont font,
const std::string &  text 
)

Draw reverse text clipped.

Draw reverse text with font at x,y unclipped.

See also:
DoDrawText for full description.
Parameters:
x X screen position
y Y screen position
font Font number
text Text to be displayed.
Returns:
The length of the printed text.

Definition at line 511 of file font.cpp.

References VideoDrawText().

Referenced by VideoDrawReverseNumber().

int VideoDrawReverseTextClip ( int  x,
int  y,
CFont font,
const std::string &  text 
)

Draw text centered and unclipped.

Draw reverse text with font at x,y clipped.

See also:
DoDrawText for full description.
Parameters:
x X screen position
y Y screen position
font Font number
text Text to be displayed.
Returns:
The length of the printed text.

Definition at line 534 of file font.cpp.

References VideoDrawTextClip().

Referenced by VideoDrawReverseNumberClip().

int VideoDrawText ( int  x,
int  y,
CFont font,
const std::string &  text 
)

Draw text unclipped.

Draw text with font at x,y unclipped.

See also:
DoDrawText
Parameters:
x X screen position
y Y screen position
font Font number
text Text to be displayed.
Returns:
The length of the printed text.

Definition at line 477 of file font.cpp.

References DoDrawText().

Referenced by DrawInfoPanelMultipleSelected(), DrawInfoPanelNoneSelected(), DrawMenuButton(), DrawPlayers(), DrawPopup(), DrawResources(), DrawTimer(), DrawTrainingUnits(), DrawUnitStats(), ShowTitleImage(), VideoDrawNumber(), VideoDrawReverseText(), and VideoDrawTextCentered().

int VideoDrawTextCentered ( int  x,
int  y,
CFont font,
const std::string &  text 
)

Draw number unclipped.

Draw text with font at x,y centered.

See also:
DoDrawText for full description.
Parameters:
x X screen position
y Y screen position
font Font number
text Text to be displayed.
Returns:
The length of the printed text.

Definition at line 557 of file font.cpp.

References VideoDrawText(), and CFont::Width().

Referenced by DrawCoordinates(), DrawMenuButton(), DrawPlayers(), DrawTrainingUnits(), DrawUnitInfo(), DrawUnitStats(), and ShowLoadProgress().

int VideoDrawTextClip ( int  x,
int  y,
CFont font,
const std::string &  text 
)

Draw reverse text unclipped.

Draw text with font at x,y clipped.

See also:
DoDrawText.
Parameters:
x X screen position
y Y screen position
font Font number
text Text to be displayed.
Returns:
The length of the printed text.

Definition at line 494 of file font.cpp.

References DoDrawText().

Referenced by CStatusLine::Draw(), DrawInformations(), MessagesDisplay::DrawMessages(), DrawPieMenu(), CFont::drawString(), VideoDrawNumberClip(), and VideoDrawReverseTextClip().


Variable Documentation

Large font used in menus.

Definition at line 78 of file font.cpp.

Small font used in stats.

Font selector for the font functions. FIXME: should be moved to lua

Definition at line 76 of file font.cpp.

Referenced by DrawPlayers(), DrawPopup(), and DrawUnitInfo().


Generated on Sat Feb 21 00:28:16 2009 for Bos Wars by  doxygen 1.5.6