10 #ifndef FONT_CACHE_DEF
11 #define FONT_CACHE_DEF
15 #include <ST_util/bytell_hash_map.hpp>
16 #include <SDL_system.h>
21 typedef std::tuple<std::string, uint16_t> font_cache_tuple;
26 struct hash<font_cache_tuple> {
27 std::size_t operator()(
const font_cache_tuple &k)
const {
31 return ((hash<string>()(std::get<0>(k)) ^ (hash<uint16_t>()(std::get<1>(k)) << 1)) >> 1);
37 bool operator==(
const std::tuple<std::string, std::string, int> &tpl1,
38 const std::tuple<std::string, std::string, int> &tpl2);
41 typedef std::pair<font_cache_tuple, SDL_Texture *> key_pair;
42 typedef std::list<key_pair> cache_list;
43 typedef ska::bytell_hash_map<font_cache_tuple, cache_list::iterator> cache_hash;
52 namespace font_cache {
54 void move_to_front(std::list<key_pair> &list, std::list<key_pair>::iterator element);
56 void set_max(uint32_t max);
58 void cache_string(
const std::string &str, SDL_Texture *texture, uint16_t font);
60 SDL_Texture *get_cached_string(
const std::string &str, uint16_t font);
The renderer for the engine.