-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTexture.h
55 lines (40 loc) · 1.01 KB
/
Texture.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
48
49
50
51
52
53
54
55
#pragma once
#include <SDL/SDL.h>
#include <SDL/SDL_opengl.h>
#include <string>
#include <vector>
void gen_texture( GLuint handle, SDL_Surface* surface );
class Texture
{
typedef std::string Key;
struct Item
{
Key key; // Can be filename.
GLuint glHandle;
unsigned int refCount;
Item( const Key& key, GLuint handle, unsigned int count )
: key( key ), glHandle( handle ), refCount( count )
{
}
};
typedef std::vector< Item > Registry;
static Registry registery;
typedef Registry::size_type Ref;
Ref get_ref();
Key key;
bool ok;
public:
Texture();
Texture( const std::string& filename );
~Texture();
// enum LoadError {
// NO_ERROR,
// WIDTH_NOT_SIZE_OF_2,
// HEIGHT_NOT_SIZE_OF_2,
// IMAGE_NOT_LOADED,
// }
// int state;
bool load( const std::string& filename );
void reset();
GLuint handle();
};