-
Notifications
You must be signed in to change notification settings - Fork 0
/
image_cache.h
47 lines (45 loc) · 1.81 KB
/
image_cache.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//
// Created by Bedroom1 on 30/05/2020.
//
#ifndef ABSTRACT_TERROR_STRIKE_IMAGE_CACHE_H
#define ABSTRACT_TERROR_STRIKE_IMAGE_CACHE_H
#include <unordered_map>
#include <memory>
#include <functional>
#include "gen_icons.h"
//
//namespace gltactics {
// typedef cmpIcon(*iconFunction)();
// struct hash_functionAndColor : public std::unary_function<std::tuple<iconFunction, Color>, std::size_t> {
// std::size_t operator()(const std::tuple<iconFunction, Color> &tup) const {
// Color color = std::get<1>(tup);
// std::uint32_t &colorInt = reinterpret_cast<uint32_t &>(color);
// return (size_t)std::get<0>(tup) ^ colorInt;
// }
// };
//
// struct hash_functionColorAndSize : public std::unary_function<std::tuple<iconFunction, Color, int, int>, std::size_t> {
// std::size_t operator()(const std::tuple<iconFunction, Color, int, int> &tup) const {
// auto &[fun, color, w, h] = tup;
// std::uint32_t const& colorInt = reinterpret_cast<uint32_t const&>(color);
// return (size_t)fun ^ colorInt ^ ((long long)w << 32LL) ^ h;
// }
// };
//
//
// class image_cache {
// static std::shared_ptr<image_cache> instance;
// std::unordered_map<iconFunction, cmpIcon> iconCache;
// std::unordered_map<std::tuple<iconFunction, Color>, Image, hash_functionAndColor> imageCache;
// std::unordered_map<std::tuple<iconFunction, Color, int, int>, Texture2D, hash_functionColorAndSize> textureCache;
// image_cache() = default;
// public:
// ~image_cache();
// Texture2D& operator()(iconFunction, Color, int, int);
// Image& operator()(iconFunction, Color);
// cmpIcon& operator()(iconFunction);
// static image_cache& getCache();
// };
//};
#endif
//ABSTRACT_TERROR_STRIKE_IMAGE_CACHE_H