-
Notifications
You must be signed in to change notification settings - Fork 0
/
bitmaps.hpp
executable file
·50 lines (38 loc) · 928 Bytes
/
bitmaps.hpp
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
48
49
50
#ifndef BITMAPS_HPP
#define BITMAPS_HPP
#include <map>
#include <vector>
#include "util.hpp"
#include "glcanvas.hpp"
typedef int Id;
class Bitmaps
{
public:
static Bitmaps& inst()
{
static Bitmaps b;
return b;
}
int size (Id id) const;
size_t getWindowSize() const { return windowSize; }
void setWindowSize (size_t size) { windowSize = size; }
float getScale() const { return windowSize / DEFAULT_WINDOW_SIZE; }
void draw (Id id, int frame, int x, int y) const;
void load();
private:
Bitmaps() {}
Bitmaps (const Bitmaps&) {}
Bitmaps& operator= (const Bitmaps&);
size_t windowSize;
std::vector<cnv::Image*> find (Id id) const;
std::map< Id, std::vector<cnv::Image*> > bitmaps_;
};
namespace bitmaps {
void load ();
void draw (Id id, int frame, int x, int y);
int size (Id id);
size_t getWindowSize();
void setWindowSize (size_t size);
float getScale();
} // namespace bitmaps
#endif // BITMAPS_HPP