My favorites | Sign in
Project Home Downloads Source
Checkout   Browse   Changes    
 
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#ifndef _WinGl_ResGl_h_
#define _WinGl_ResGl_h_

struct Texture : Moveable<Texture>
{
int64 serialId;
int64 atlasSerialId;
int realWidth;
int realHeight;
int width;
int height;
int x;
int y;

Texture(int w = 0, int h = 0)
{
serialId = -1;
atlasSerialId = -1;
realWidth = w;
realHeight = h;
width = w;
height = h;
x = 0;
y = 0;
}

String ToString() const
{
return Format("x: %d, y: %d, w: %d, h:%d (%d, %d) - %ld", x, y, width, height, realWidth, realHeight, serialId);
}
};

struct Atlas : Moveable<Atlas>
{
int width;
int height;
bool linear;
Vector<Image> parts;
Image Make(ArrayMap<int64, Texture>& textures);
};

struct ImageResource : Moveable<ImageResource>
{
int type;
bool linear;

//direct image
Image img;
//brc image
const byte* data;
int length;
//disk image
String fileName;
};

struct Resources
{
enum {
NEAREST_FILTERING = 1,
LINEAR_FILTERING = 2,
FORCE_FILTERING = 4,
AUTO_ATLAS = 8,
FORCE_BIND = 16
};

Vector<ImageResource> staticImages;
VectorMap<String, Atlas> staticAtlases;
Vector<Font> staticFonts;

Texture autoAtlas;
ImageBuffer autoAtlasBuffer;
Image autoAtlasImage;
int px, py, maxh;

int bindedTextures;

int64 currentSerialId;
ArrayMap<int64, Texture> textures;
ArrayMap<String, OpenGLFont> fonts;

const Texture& CreateTexture(const Image& img, int width = -1, int height = -1);
void CreateSubTexture(const Texture& t, const Image& img, int x, int y);

const Texture& Bind(const Image& img, int opts = NEAREST_FILTERING);
bool Bind(int64 serialId, int opts = NEAREST_FILTERING);
void Add(const Image& img, bool linear = false);
void Add(Iml* images, bool linear = false);
void Add(const Font& fnt);
void AddAtlas(const char* atlasName, const Image& img);
void AddAtlas(const char* atlasName, Iml* images);
OpenGLFont& GetFont(const char* fontName, int fontHeight, bool preload = false, const byte* fontDef = NULL, const byte** imagesData = NULL, const int* imagesSize = NULL, int imagesCount = 0);
OpenGLFont& GetFont(const Font& font, bool preload = false);
void SetTextureFiltring(int opts);

void BindStatic();

Resources();
};

extern Resources resources;


#endif

Change log

r4365 by unodgs on Jan 6, 2012   Diff
WinGL: Added painting through fbo, added
blur shader, fixed children clipping,
optimized painting a bit
Go to: 
Project members, sign in to write a code review

Older revisions

r4204 by unodgs on Nov 26, 2011   Diff
WinGL: Added possibility to change
texture filtering mode in Bind. Made
top frame's title bar gradient
background smoother
r4188 by unodgs on Nov 22, 2011   Diff
WinGL: Added automatic atlas textures,
fixed some bugs
r3915 by unodgs on Sep 26, 2011   Diff
Rainbow: WinGL..
All revisions of this file

File info

Size: 2193 bytes, 103 lines

File properties

svn:eol-style
native
Powered by Google Project Hosting