 |
Blamite Game Engine - blam!
00406.12.10.23.1457.blamite
The core library for the Blamite Game Engine.
|
Go to the documentation of this file.
7 #include <OGRE/OgreTextureGpu.h>
8 #include <OGRE/Overlay/OgreFont.h>
9 #include <Strings/components/classes/map/map.h>
10 #include <Strings/components/classes/vector/vector.h>
11 #include <Strings/components/diagnostics/errors/errors.h>
12 #include <Strings/components/resources/color/BlamColor.h>
18 #define FONT_TABLE_FILE "font_table.txt"
20 #define FONTINFO_FILENAME "fontinfo.xml"
21 #define FONT_PACKAGE_EXTENSION ".bin"
22 #define FONT_PACKAGE_VERSION 2
61 BlamVector4
uv = { 0, 0, 0, 0 };
92 BlamMap<char, BlamFontGlyph*>
glyphs = BlamMap<char, BlamFontGlyph*>();
BLAM Ogre::HlmsUnlitDatablock * CreateDefaultUnlitDatablockForPrimitives(std::string id)
Creates a default Unlit datablock for use with 2D and 3D primitives.
Definition: materials.cpp:966
BlamFontPackage()
Constructor.
Definition: BlamFontPackage.cpp:7
BLAM void LogEvent(std::string message)
Logs a message to the log and/or console.
Definition: aliases.cpp:130
BLAM Ogre::HlmsUnlitDatablock * CreateDefaultUnlitDatablock(std::string id)
Creates a default Unlit datablock.
Definition: materials.cpp:955
BLAM bool FontExists(std::string id)
Checks if a font package exists with a given name.
Definition: fonts.cpp:739
@ TrueType
Indicates that the font package stores a TrueType (or similar) font directly.
bool use_point_filtering
Whether or not glyphs in this font package should use point filtering or not.
Definition: fonts.h:99
Ogre::TextureGpu * glyph_texture
The texture for the glyph. Only used in non-atlas bitmap fonts.
Definition: fonts.h:63
ARPHIC PUBLIC LICENSE Ltd Yung Chi Taiwan All rights reserved except as specified below Everyone is permitted to copy and distribute verbatim copies of this license but changing it is forbidden Preamble The licenses for most software are designed to take away your freedom to share and change it By the ARPHIC PUBLIC LICENSE specifically permits and encourages you to use this provided that you give the recipients all the rights that we gave you and make sure they can get the modifications of this software Legal Terms Font means the TrueType fonts AR PL Mingti2L AR PL KaitiM AR PL KaitiM and the derivatives of those fonts created through any modification including modifying glyph
Definition: ARPHICPL.TXT:16
std::string name
The name/ID of the font. Must be unique.
Definition: fonts.h:89
Class representing a Blamite font package.
Definition: fonts.h:86
uint16_t index_y
The Y index of the glyph within the font atlas texture.
Definition: fonts.h:59
Ogre::HlmsDatablock * glyph_datablock
The datablock for the glyph. Only used in non-atlas bitmap fonts.
Definition: fonts.h:64
@ Unknown
Indicates the font package has an unknown type. Should generally be considered an error.
#define BLAM
Definition: fonts.h:15
std::string file_path
The file path of the font information or package file.
Definition: fonts.h:90
BLAM BlamResult LoadFont(std::string font_name)
Definition: fonts.cpp:729
BlamFontGlyph * GetGlyph(char character)
Retrieves font glyph information from a character.
Definition: BlamFontPackage.cpp:23
~BlamFontPackage()
Destructor.
Definition: BlamFontPackage.cpp:12
BLAM void Cleanup()
Releases all font package data from memory.
Definition: fonts.cpp:754
bool use_point_filtering
Whether or not this glyph should use point filtering.
Definition: fonts.h:53
int glyph_attribute_test_int(bool *out_result, std::string glyph_name, std::string font_name, std::string attribute_name, rapidxml::xml_attribute<> *attribute)
A helper function used to check if a glyph attribute's value is an integer or not.
Definition: fonts.cpp:73
float glyph_attribute_test_float(bool *out_result, std::string glyph_name, std::string font_name, std::string attribute_name, rapidxml::xml_attribute<> *attribute)
A helper function used to check if a glyph attribute's value is a float or not.
Definition: fonts.cpp:106
@ Fonts
Directory used for game engine fonts. Defaults to ./maps/fonts/
BlamMap< char, BlamFontGlyph * > glyphs
Map containing all glyphs within the font package.
Definition: fonts.h:92
BLAM BlamFontPackage * GetFont(std::string id)
Retrieves a font package from its name.
Definition: fonts.cpp:744
uint32_t glyphs_per_column
The number of glyphs per column within the texture atlas. Only used in fonts that use a texture atlas...
Definition: fonts.h:102
uint32_t height
The height of the glyph texture.
Definition: fonts.h:56
int monospace_width
The monospaced width of each character. Only used when monospace is set to true.
Definition: fonts.h:95
uint32_t width
The width of the glyph texture.
Definition: fonts.h:55
BlamFontPackageType
Enumerator listing all possible font package types.
Definition: fonts.h:27
Ogre::HlmsDatablock * CreateCopiedDatablock()
Creates a copy of this glyph's datablock, intended to allow for it to be recolored on a per-instance ...
Definition: BlamFontPackage.cpp:33
BLAM Ogre::TextureGpu * LoadTexture2D(std::string id, void *pixel_data, int width, int height, Ogre::PixelFormatGpu format, int bytes_per_line)
Loads a 2D texture from data in memory.
Definition: textures.cpp:140
Ogre::HlmsDatablock * font_datablock
The font atlas datablock. Only used in fonts that use a texture atlas.
Definition: fonts.h:105
Class representing a font glyph.
Definition: fonts.h:43
BLAM BlamResult LoadFontPackage(std::string file)
Attempts to load a font package from a file.
Definition: fonts.cpp:151
#define ENGINE_DATA_PATH(path)
Macro to quickly access a game engine data folder.
Definition: config.h:34
BlamMap< std::string, BlamFontPackage * > font_map
Definition: fonts.cpp:18
@ XMLBitmapAtlas
Identical to #BitmapAtlas, but indicates that the font package is unpacked.
BlamFontPackageType type
The format of the font pacakge. See BlamFontPackageType for details.
Definition: fonts.h:91
int line_height
The height of each line of text, in pixels.
Definition: fonts.h:97
Ogre::TextureGpu * font_atlas
The font atlas texture. Only used in fonts that use a texture atlas.
Definition: fonts.h:104
@ XMLBitmap
Identical to #Bitmap, but indicates that the font package is unpacked.
BLAM BlamMap< std::string, BlamFontPackage * > GetFontList()
Retrieves the map of all available fonts.
Definition: fonts.cpp:734
char character
The character that this glyph represents.
Definition: fonts.h:46
unsigned int uint32_t
Definition: stdint.h:17
bool monospace
Whether or not the font is monospaced.
Definition: fonts.h:94
BlamVector4 uv
The UV coordinates of the font glyph.
Definition: fonts.h:61
sock planetquake com All rights reserved Quake III Arena is a registered trademark of id Inc This level may be electronically distributed only at NO CHARGE to the recipient in its current MUST include this txt file
Definition: chiropteraDM.txt:95
Ogre::HlmsDatablock * CreateCopiedDatablock()
Creates a copy of this glyph's datablock, intended to allow for it to be recolored on a per-instance ...
Definition: BlamFontGlyph.cpp:7
uint16_t index_x
The X index of the glyph within the font atlas texture.
Definition: fonts.h:58
bool resolve_glyph_character(std::string xml_glyph, char *character)
Identify the character of the font glyph from the XML attribute.
Definition: fonts.cpp:28
@ XMLTruetype
Identical to #Truetype, but indicates that the font package is unpacked.
BLAM BlamResult LoadFontDirectory(std::string directory)
Attempts to load an unpackaged (XML) font from a directory.
Definition: fonts.cpp:156
@ Bitmap
Indicates that the font package stores glyphs in separate bitmaps.
Ogre::FontPtr ttf_font
Unused.
Definition: fonts.h:106
uint32_t glyphs_per_row
The number of glyphs per row within the texture atlas. Only used in fonts that use a texture atlas.
Definition: fonts.h:101
Namespace containing functions for interacting with font packages.
Definition: fonts.h:149
bool override_filtering
Whether or not to override the font package texture filtering mode.
Definition: fonts.h:48
int charspacing
The amount of spacing between each character, in pixels.
Definition: fonts.h:96
unsigned short uint16_t
Definition: stdint.h:16
int space_width
The width of the space character, in pixels. Only used when monospace is false.
Definition: fonts.h:98
#define FONTINFO_FILENAME
The default filename for XML (unpacked) font information.
Definition: fonts.h:20
BLAM void LoadAllFonts()
Loads all available font packages within the fonts directory.
Definition: fonts.cpp:127
@ BitmapAtlas
Indicates that the font package stores glyphs in a texture atlas bitmap.