$treeview $search $mathjax
Stratagus
2.2.6
$projectbrief
|
$projectbrief
|
$searchbox |
_________ __ __ / _____// |_____________ _/ |______ ____ __ __ ______ \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/ / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ \ /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ > \/ \/ \//_____/ \/ ______________________ ______________________ T H E W A R B E G I N S Stratagus - A free fantasy real time strategy game engine
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "stratagus.h"
#include <string>
#include <vector>
#include <map>
#include "video.h"
#include "font.h"
#include "script.h"
#include "intern_video.h"
font.cpp - The color fonts. | |
static std::vector< CFont * > | AllFonts |
static std::map< std::string, CFont * > | Fonts |
Vector of all fonts. | |
static std::vector< CFontColor * > | AllFontColors |
Font mappings. | |
std::map< std::string, CFontColor * > | FontColors |
Vector of all font colors. | |
static CFontColor * | FontColor |
Map of ident to font color. | |
static CFontColor * | LastTextColor |
Current font color. | |
static CFontColor * | DefaultTextColor |
Last text color. | |
static CFontColor * | ReverseTextColor |
Default text color. | |
static std::string | DefaultNormalColorIndex |
Reverse text color. | |
static std::string | DefaultReverseColorIndex |
Default normal color index. | |
static std::map< const CFont *, std::map< const CFontColor *, CGraphic * > > | FontColorGraphics |
Default reverse color index. | |
static CFont * | SmallFont |
static CFont * | GameFont |
Small font used in stats. | |
static int | FormatNumber (int number, char *buf) |
Normal font used in game. | |
CFont * | GetSmallFont () |
CFont * | GetGameFont () |
Small font used in stats. | |
static void | VideoDrawChar (const CGraphic *g, int gx, int gy, int w, int h, int x, int y, const CFontColor *fc) |
void | SetDefaultTextColors (const std::string &normal, const std::string &reverse) |
Normal font used in game. | |
void | GetDefaultTextColors (std::string &normalp, std::string &reversep) |
Get the default text colors for normal and reverse text. | |
static bool | GetUTF8 (const std::string &text, size_t &pos, int &utf8) |
static bool | GetUTF8 (const char text[], const size_t len, size_t &pos, int &utf8) |
int | convertKey (const char *key) |
int | GetHotKey (const std::string &text) |
Get the hot key from a string. | |
static void | VideoDrawCharClip (const CGraphic *g, int gx, int gy, int w, int h, int x, int y, const CFontColor *fc) |
static int | strchrlen (const std::string &s, char c, unsigned int maxlen, CFont *font) |
std::string | GetLineFont (unsigned int line, const std::string &s, unsigned int maxlen, CFont *font) |
Return the 'line' line of the string 's'. | |
void | LoadFonts () |
Load and initialize the fonts. | |
void | FreeOpenGLFonts () |
Free OpenGL fonts. | |
void | ReloadFonts () |
Reload OpenGL fonts. | |
void | CleanFonts () |
Cleanup the font module. |
void CleanFonts | ( | ) |
Cleanup the font module.
Clean up the font module.
int convertKey | ( | const char * | key | ) |
static int FormatNumber | ( | int | number, | |
char * | buf | |||
) | [static] |
Normal font used in game.
Format a number using commas
number | Number to be formatted | |
buf | Buffer to save the formatted number to |
void FreeOpenGLFonts | ( | ) |
Free OpenGL fonts.
Free OpenGL fonts
void GetDefaultTextColors | ( | std::string & | normalp, | |
std::string & | reversep | |||
) |
Get the default text colors for normal and reverse text.
Get the default text colors.
normalp | Normal text color pointer. | |
reversep | Reverse text color pointer. |
CFont* GetGameFont | ( | ) |
Small font used in stats.
int GetHotKey | ( | const std::string & | text | ) |
Get the hot key from a string.
Get the hot key from a string
std::string GetLineFont | ( | unsigned int | line, | |
const std::string & | s, | |||
unsigned int | maxlen, | |||
CFont * | font | |||
) |
Return the 'line' line of the string 's'.
Return the 'line' line of the string 's'.
line | line number. | |
s | multiline string. | |
maxlen | max length of the string (0 : unlimited) (in char if font == NULL else in pixels). | |
font | if specified use font->Width() instead of strlen. |
CFont* GetSmallFont | ( | ) |
Font selector for the font functions. FIXME: should be moved to lua
static bool GetUTF8 | ( | const char | text[], | |
const size_t | len, | |||
size_t & | pos, | |||
int & | utf8 | |||
) | [inline, static] |
Get the next utf8 character from a array of chars
static bool GetUTF8 | ( | const std::string & | text, | |
size_t & | pos, | |||
int & | utf8 | |||
) | [static] |
Get the next utf8 character from a string
void LoadFonts | ( | ) |
Load and initialize the fonts.
Load all fonts.
void ReloadFonts | ( | ) |
Reload OpenGL fonts.
Reload OpenGL fonts
void SetDefaultTextColors | ( | const std::string & | normal, | |
const std::string & | reverse | |||
) |
Normal font used in game.
Set the default text colors.
normal | Normal text color. | |
reverse | Reverse text color. |
static int strchrlen | ( | const std::string & | s, | |
char | c, | |||
unsigned int | maxlen, | |||
CFont * | font | |||
) | [static] |
Return the index of first occurance of c in [s- s + maxlen]
s | original string. | |
c | character to find. | |
maxlen | size limit of the search. (0 means unlimited). (in char if font == NULL else in pixels). | |
font | if specified use font->Width() instead of strlen. |
static void VideoDrawChar | ( | const CGraphic * | g, | |
int | gx, | |||
int | gy, | |||
int | w, | |||
int | h, | |||
int | x, | |||
int | y, | |||
const CFontColor * | fc | |||
) | [static] |
Draw character with current color.
g | Pointer to object | |
gx | X offset into object | |
gy | Y offset into object | |
w | width to display | |
h | height to display | |
x | X screen position | |
y | Y screen position |
static void VideoDrawCharClip | ( | const CGraphic * | g, | |
int | gx, | |||
int | gy, | |||
int | w, | |||
int | h, | |||
int | x, | |||
int | y, | |||
const CFontColor * | fc | |||
) | [static] |
Draw character with current color clipped into 8 bit framebuffer.
g | Pointer to object | |
gx | X offset into object | |
gy | Y offset into object | |
w | width to display | |
h | height to display | |
x | X screen position | |
y | Y screen position |
std::vector<CFontColor *> AllFontColors [static] |
Font mappings.
std::string DefaultNormalColorIndex [static] |
Reverse text color.
std::string DefaultReverseColorIndex [static] |
Default normal color index.
CFontColor* DefaultTextColor [static] |
Last text color.
CFontColor* FontColor [static] |
Map of ident to font color.
std::map< const CFont *, std::map<const CFontColor *, CGraphic *> > FontColorGraphics [static] |
Default reverse color index.
Font color graphics Usage: FontColorGraphics[CFont *font][CFontColor *color]
std::map<std::string, CFontColor *> FontColors |
Vector of all font colors.
CFontColor* LastTextColor [static] |
Current font color.
CFontColor* ReverseTextColor [static] |
Default text color.