 |
Blamite Game Engine - blam!
00453.06.08.26.0624.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>
10 #include <Strings/components/classes/map/map.h>
11 #include <Strings/components/classes/vector/vector.h>
12 #include <Strings/components/diagnostics/errors/errors.h>
13 #include <Strings/components/resources/color/BlamColor.h>
19 #define FONT_TABLE_FILE "font_table.txt"
21 #define FONTINFO_FILENAME "fontinfo.xml"
22 #define FONT_PACKAGE_EXTENSION ".bin"
23 #define FONT_PACKAGE_VERSION 2
62 BlamVector4
uv = { 0, 0, 0, 0 };
95 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:1032
BLAM std::string GetDefaultEngineDataPath(BlamEngineDataFolder folder)
Retrieves a default value of a given engine data directory.
Definition: paths.cpp:142
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:1021
BLAM bool FontExists(std::string id)
Checks if a font package exists with a given name.
Definition: fonts.cpp:803
@ 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:102
Ogre::TextureGpu * glyph_texture
The texture for the glyph. Only used in non-atlas bitmap fonts.
Definition: fonts.h:66
std::string name
The name/ID of the font. Must be unique.
Definition: fonts.h:92
Class representing a Blamite font package.
Definition: fonts.h:89
uint16_t index_y
The Y index of the glyph within the font atlas texture.
Definition: fonts.h:60
Ogre::HlmsDatablock * glyph_datablock
The datablock for the glyph. Only used in non-atlas bitmap fonts.
Definition: fonts.h:67
@ Unknown
Indicates the font package has an unknown type. Should generally be considered an error.
#define BLAM
Definition: fonts.h:16
std::string file_path
The file path of the font information or package file.
Definition: fonts.h:93
bool UsingBgfx()
Definition: bgfx.cpp:63
BLAM BlamResult LoadFont(std::string font_name)
Definition: fonts.cpp:793
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:818
bool use_point_filtering
Whether or not this glyph should use point filtering.
Definition: fonts.h:54
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:95
BLAM BlamFontPackage * GetFont(std::string id)
Retrieves a font package from its name.
Definition: fonts.cpp:808
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:105
uint32_t height
The height of the glyph texture.
Definition: fonts.h:57
bgfx::TextureHandle glyph_texture_bgfx
Definition: fonts.h:64
int monospace_width
The monospaced width of each character. Only used when monospace is set to true.
Definition: fonts.h:98
uint32_t width
The width of the glyph texture.
Definition: fonts.h:56
BlamFontPackageType
Enumerator listing all possible font package types.
Definition: fonts.h:28
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
unsigned long long uint64_t
Definition: stdint.h:18
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:156
Ogre::HlmsDatablock * font_datablock
The font atlas datablock. Only used in fonts that use a texture atlas.
Definition: fonts.h:110
Class representing a font glyph.
Definition: fonts.h:44
BLAM bgfx::TextureHandle LoadTexture2D(std::string id, void *pixel_data, int width, int height, bgfx::TextureFormat::Enum format, int bytes_per_line, uint64_t flags=0)
Loads a 2D texture from data in memory.
Definition: bitmaps.cpp:515
BLAM BlamResult LoadFontPackage(std::string file)
Attempts to load a font package from a file.
Definition: fonts.cpp:162
#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:94
int line_height
The height of each line of text, in pixels.
Definition: fonts.h:100
Ogre::TextureGpu * font_atlas
The font atlas texture. Only used in fonts that use a texture atlas.
Definition: fonts.h:109
@ 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:798
char character
The character that this glyph represents.
Definition: fonts.h:47
unsigned int uint32_t
Definition: stdint.h:17
bool monospace
Whether or not the font is monospaced.
Definition: fonts.h:97
BlamVector4 uv
The UV coordinates of the font glyph.
Definition: fonts.h:62
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
bgfx::TextureHandle font_atlas_bgfx
Definition: fonts.h:107
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:59
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:167
@ Bitmap
Indicates that the font package stores glyphs in separate bitmaps.
Ogre::FontPtr ttf_font
Unused.
Definition: fonts.h:111
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:104
Namespace containing functions for interacting with font packages.
Definition: fonts.h:154
bool override_filtering
Whether or not to override the font package texture filtering mode.
Definition: fonts.h:49
int charspacing
The amount of spacing between each character, in pixels.
Definition: fonts.h:99
unsigned short uint16_t
Definition: stdint.h:16
io.Fonts->AddFontFromMemoryCompressedTTF(compressed_data, compressed_data_size, size_pixels,...) font
Definition: README.txt:86
int space_width
The width of the space character, in pixels. Only used when monospace is false.
Definition: fonts.h:101
#define FONTINFO_FILENAME
The default filename for XML (unpacked) font information.
Definition: fonts.h:21
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.