mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
WinGl: Updated to the latest CtrlCore changes, renamed Texture to TextureResource and Atlas to AtlasResource, switched to the Color with alpha (requires manual changes in Color)
git-svn-id: svn://ultimatepp.org/upp/trunk@6279 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
36f9f3c962
commit
6fb33bb0e2
11 changed files with 161 additions and 128 deletions
|
|
@ -10,7 +10,7 @@ uniform float blurSize; // This should usually be equal to
|
|||
|
||||
uniform sampler2D blurSampler; // Texture that will be blurred by this shader
|
||||
|
||||
const float numBlurPixelsPerSide = 3;
|
||||
const float numBlurPixelsPerSide = 3.0f;
|
||||
// 9x9 - 4
|
||||
// 7x7 - 3
|
||||
// 5x5 - 2
|
||||
|
|
@ -24,7 +24,7 @@ uniform float blurStrength;
|
|||
void main() {
|
||||
|
||||
vec4 v = texture2D(blurSampler, gl_TexCoord[0].xy);
|
||||
if(blurStrength > 0)
|
||||
if(blurStrength > 0.0f)
|
||||
{
|
||||
vec4 avgValue = vec4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
float coefficientSum = 0.0f;
|
||||
|
|
@ -38,7 +38,7 @@ void main() {
|
|||
vec2 pos = i * blurSize * blurMultiplyVec;
|
||||
avgValue += texture2D(blurSampler, gl_TexCoord[0].xy - pos) * incGaussian.x;
|
||||
avgValue += texture2D(blurSampler, gl_TexCoord[0].xy + pos) * incGaussian.x;
|
||||
coefficientSum += 2 * incGaussian.x;
|
||||
coefficientSum += 2.0f * incGaussian.x;
|
||||
incGaussian.xy *= incGaussian.yz;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,19 +6,17 @@ NAMESPACE_UPP
|
|||
|
||||
void Console::Paint(Draw& w)
|
||||
{
|
||||
SystemDraw& sw = (SystemDraw&) w;
|
||||
Size sz = GetSize();
|
||||
sw.alpha = 100.f;
|
||||
w.DrawRect(sz, Black);
|
||||
w.DrawRect(0, 0, sz.cx, 1, Yellow);
|
||||
w.DrawRect(sz.cx - 1, 1, 1, sz.cy - 1, Yellow);
|
||||
w.DrawRect(0, 1, 1, sz.cy, Yellow);
|
||||
w.DrawRect(1, sz.cy - 1, sz.cx - 2, 1, Yellow);
|
||||
Color frame = Yellow().Alpha(100);
|
||||
w.DrawRect(sz, Black().Alpha(100));
|
||||
w.DrawRect(0, 0, sz.cx, 1, frame);
|
||||
w.DrawRect(sz.cx - 1, 1, 1, sz.cy - 1, frame);
|
||||
w.DrawRect(0, 1, 1, sz.cy, frame);
|
||||
w.DrawRect(1, sz.cy - 1, sz.cx - 2, 1, frame);
|
||||
//DrawFrame(w, sz, Yellow);
|
||||
//w.DrawImage(sz.cx - 18, sz.cy - 21, WinGlImg::ResizeMarker());
|
||||
w.DrawRect(1, sz.cy - 22, sz.cx - 2, 1, Yellow);
|
||||
w.DrawRect(1, sz.cy - 22, sz.cx - 2, 1, frame);
|
||||
w.Clip(5, 5, sz.cx - 10, sz.cy - 5 - 21);
|
||||
sw.alpha = 255.f;
|
||||
int y = 5;
|
||||
int ty = Draw::GetStdFontCy() + 2;
|
||||
for(int i = 0; i < fixedText.GetCount(); i++)
|
||||
|
|
@ -29,10 +27,8 @@ void Console::Paint(Draw& w)
|
|||
|
||||
if(fixedText.GetCount() > 0 && floatText.GetCount() > 0)
|
||||
{
|
||||
sw.alpha = 150.f;
|
||||
w.DrawRect(5, y, sz.cx - 10, 1, Yellow);
|
||||
w.DrawRect(5, y, sz.cx - 10, 1, frame);
|
||||
y += 2;
|
||||
sw.alpha = 255.f;
|
||||
}
|
||||
|
||||
int lines = (sz.cy - y - 22) / ty;
|
||||
|
|
|
|||
|
|
@ -172,12 +172,14 @@ void SystemDraw::EndOp()
|
|||
|
||||
void SystemDraw::OffsetOp(Point p)
|
||||
{
|
||||
GuiLock __;
|
||||
BeginOp();
|
||||
drawing_offset += p;
|
||||
}
|
||||
|
||||
bool SystemDraw::ClipOp(const Rect& r)
|
||||
{
|
||||
GuiLock __;
|
||||
BeginOp();
|
||||
cloff[ci - 1].clipping = true;
|
||||
drawing_clip = r + drawing_offset;
|
||||
|
|
@ -187,6 +189,7 @@ bool SystemDraw::ClipOp(const Rect& r)
|
|||
|
||||
bool SystemDraw::ClipoffOp(const Rect& r)
|
||||
{
|
||||
GuiLock __;
|
||||
BeginOp();
|
||||
cloff[ci - 1].clipping = true;
|
||||
drawing_clip = r + drawing_offset;
|
||||
|
|
@ -197,6 +200,7 @@ bool SystemDraw::ClipoffOp(const Rect& r)
|
|||
|
||||
bool SystemDraw::ExcludeClipOp(const Rect& r)
|
||||
{
|
||||
GuiLock __;
|
||||
ASSERT(ci > 0);
|
||||
cloff[ci - 1].clipping = true;
|
||||
cloff[ci - 1].exclude = true;
|
||||
|
|
@ -207,6 +211,7 @@ bool SystemDraw::ExcludeClipOp(const Rect& r)
|
|||
|
||||
bool SystemDraw::IntersectClipOp(const Rect& r)
|
||||
{
|
||||
GuiLock __;
|
||||
Cloff& w = cloff[ci];
|
||||
drawing_clip = r + drawing_offset;
|
||||
SetClip(drawing_clip);
|
||||
|
|
@ -220,11 +225,13 @@ bool SystemDraw::IsPaintingOp(const Rect& r) const
|
|||
|
||||
Rect SystemDraw::GetPaintRect() const
|
||||
{
|
||||
GuiLock __;
|
||||
return drawing_clip;
|
||||
}
|
||||
|
||||
void SystemDraw::DrawRectOp(int x, int y, int cx, int cy, Color color)
|
||||
{
|
||||
GuiLock __;
|
||||
if(IsNull(color))
|
||||
return;
|
||||
|
||||
|
|
@ -256,8 +263,7 @@ void SystemDraw::DrawRectOp(int x, int y, int cx, int cy, Color color)
|
|||
if(dy > cb)
|
||||
dy = cb;
|
||||
#endif
|
||||
|
||||
glColor4ub(color.GetR(), color.GetG(), color.GetB(), (int) alpha);
|
||||
glColor4ub(color.GetR(), color.GetG(), color.GetB(), color.GetA() >= 255 ? (int) alpha : color.GetA());
|
||||
|
||||
/* float vtx[] = {
|
||||
sx, dy,
|
||||
|
|
@ -271,11 +277,12 @@ void SystemDraw::DrawRectOp(int x, int y, int cx, int cy, Color color)
|
|||
glVertexPointer(projection_mode ? 3 : 2, GL_FLOAT, 0, vtx);
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||
|
||||
glColor4ub(255, 255, 255, (int) alpha);
|
||||
glColor4ub(255, 255, 255, /*(int) alpha*/255);
|
||||
}
|
||||
|
||||
void SystemDraw::DrawImageOp(int x, int y, int cx, int cy, const Image& img, const Rect& src, Color color)
|
||||
{
|
||||
GuiLock __;
|
||||
if(cx <= 0 || cy <= 0) return;
|
||||
|
||||
float sx = (float) x + drawing_offset.x;
|
||||
|
|
@ -334,7 +341,7 @@ void SystemDraw::DrawImageOp(int x, int y, int cx, int cy, const Image& img, con
|
|||
}
|
||||
#endif
|
||||
|
||||
const Texture& t = resources.Bind(img, Resources::AUTO_ATLAS | Resources::NEAREST_FILTERING);
|
||||
const TextureResource& t = resources.Bind(img, Resources::AUTO_ATLAS | Resources::NEAREST_FILTERING);
|
||||
|
||||
float tw = 1.f / (float) t.realWidth;
|
||||
float th = 1.f / (float) t.realHeight;
|
||||
|
|
@ -349,9 +356,11 @@ void SystemDraw::DrawImageOp(int x, int y, int cx, int cy, const Image& img, con
|
|||
if(IsNull(color))
|
||||
glColor4ub(255, 255, 255, (int) alpha);
|
||||
else
|
||||
glColor4ub(color.GetR(), color.GetG(), color.GetB(), (int) alpha);
|
||||
glColor4ub(color.GetR(), color.GetG(), color.GetB(), color.GetA() >= 255 ? (int) alpha : color.GetA());
|
||||
}
|
||||
|
||||
glColor4ub(255, 255, 255, 255);
|
||||
|
||||
float vtx[12];
|
||||
SetVtx(vtx, sx, sy, dx, dy);
|
||||
|
||||
|
|
@ -373,6 +382,7 @@ void SystemDraw::DrawImageOp(int x, int y, int cx, int cy, const Image& img, con
|
|||
|
||||
void SystemDraw::DrawTextureOp(const RectF& r, int textureId, int width, int height, const RectF& src)
|
||||
{
|
||||
GuiLock __;
|
||||
float sx = r.left + drawing_offset.x;
|
||||
float sy = r.top + drawing_offset.y;
|
||||
float dx = sx + r.GetWidth();
|
||||
|
|
@ -417,6 +427,7 @@ void SystemDraw::DrawTextureOp(const RectF& r, int textureId, int width, int hei
|
|||
|
||||
void SystemDraw::DrawImageOp(float x0, float y0, float z0, float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3, const Image& img, const Rect& src, Color color)
|
||||
{
|
||||
GuiLock __;
|
||||
float tl = (float) src.left;
|
||||
float tr = (float) src.right;
|
||||
float tt = (float) src.top;
|
||||
|
|
@ -425,7 +436,7 @@ void SystemDraw::DrawImageOp(float x0, float y0, float z0, float x1, float y1, f
|
|||
float sw = (float) src.GetWidth();
|
||||
float sh = (float) src.GetHeight();
|
||||
|
||||
const Texture& t = resources.Bind(img, Resources::AUTO_ATLAS | Resources::NEAREST_FILTERING);
|
||||
const TextureResource& t = resources.Bind(img, Resources::AUTO_ATLAS | Resources::NEAREST_FILTERING);
|
||||
|
||||
float tw = 1.f / (float) t.realWidth;
|
||||
float th = 1.f / (float) t.realHeight;
|
||||
|
|
@ -440,7 +451,7 @@ void SystemDraw::DrawImageOp(float x0, float y0, float z0, float x1, float y1, f
|
|||
if(IsNull(color))
|
||||
glColor4ub(255, 255, 255, (int) alpha);
|
||||
else
|
||||
glColor4ub(color.GetR(), color.GetG(), color.GetB(), (int) alpha);
|
||||
glColor4ub(color.GetR(), color.GetG(), color.GetB(), color.GetA());
|
||||
}
|
||||
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
|
|
@ -470,7 +481,8 @@ void SystemDraw::DrawImageOp(float x0, float y0, float z0, float x1, float y1, f
|
|||
|
||||
void SystemDraw::DrawLineOp(int x1, int y1, int x2, int y2, int width, Color color)
|
||||
{
|
||||
glColor4ub(color.GetR(), color.GetG(), color.GetB(), (int) alpha);
|
||||
GuiLock __;
|
||||
glColor4ub(color.GetR(), color.GetG(), color.GetB(), color.GetA());
|
||||
glLineWidth((GLfloat) width);
|
||||
glBegin(GL_LINES);
|
||||
glVertex2i(x1 + drawing_offset.x, y1 + drawing_offset.y);
|
||||
|
|
@ -480,32 +492,39 @@ void SystemDraw::DrawLineOp(int x1, int y1, int x2, int y2, int width, Color col
|
|||
|
||||
void SystemDraw::DrawPolyPolylineOp(const Point *vertices, int vertex_count, const int *counts, int count_count, int width, Color color, Color doxor)
|
||||
{
|
||||
GuiLock __;
|
||||
}
|
||||
|
||||
void SystemDraw::DrawPolyPolyPolygonOp(const Point *vertices, int vertex_count, const int *subpolygon_counts, int scc, const int *disjunct_polygon_counts, int dpcc, Color color, int width, Color outline, uint64 pattern, Color doxor)
|
||||
{
|
||||
GuiLock __;
|
||||
}
|
||||
|
||||
void SystemDraw::DrawArcOp(const Rect& rc, Point start, Point end, int width, Color color)
|
||||
{
|
||||
GuiLock __;
|
||||
}
|
||||
|
||||
void SystemDraw::DrawEllipseOp(const Rect& r, Color color, int pen, Color pencolor)
|
||||
{
|
||||
GuiLock __;
|
||||
}
|
||||
|
||||
void SystemDraw::SaveCurrentColor()
|
||||
{
|
||||
GuiLock __;
|
||||
glGetFloatv(GL_CURRENT_COLOR, current_color);
|
||||
}
|
||||
|
||||
void SystemDraw::RestoreLastColor()
|
||||
{
|
||||
GuiLock __;
|
||||
glColor4f(current_color[0], current_color[1], current_color[2], current_color[3]);
|
||||
}
|
||||
|
||||
RectF SystemDraw::UnProject(const RectF& r, float& depth)
|
||||
{
|
||||
GuiLock __;
|
||||
double projMat[16];
|
||||
double modelMat[16];
|
||||
int viewPort[4];
|
||||
|
|
@ -528,6 +547,7 @@ RectF SystemDraw::UnProject(const RectF& r, float& depth)
|
|||
|
||||
void SystemDraw::UnProject(float* vtx, float sx, float sy, float dx, float dy)
|
||||
{
|
||||
GuiLock __;
|
||||
double projMat[16];
|
||||
double modelMat[16] = {
|
||||
1, 0, 0, 0,
|
||||
|
|
@ -563,6 +583,7 @@ void SystemDraw::UnProject(float* vtx, float sx, float sy, float dx, float dy)
|
|||
|
||||
void SystemDraw::UnProject(float& x, float& y, float &z)
|
||||
{
|
||||
GuiLock __;
|
||||
double projMat[16];
|
||||
double modelMat[16] = {
|
||||
1, 0, 0, 0,
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ void OpenGLFont::Parse(const char* xml, bool parsePages)
|
|||
|
||||
for(int i = 0; i < images.GetCount(); i++)
|
||||
{
|
||||
const Texture& t = resources.Bind(images[i], Resources::LINEAR_FILTERING);
|
||||
const TextureResource& t = resources.Bind(images[i], Resources::LINEAR_FILTERING);
|
||||
pages[i] = t.serialId;
|
||||
}
|
||||
|
||||
|
|
@ -151,15 +151,14 @@ void SystemDraw::Text(int x, int y, int angle, const wchar *text, Font font, Col
|
|||
alphaMagProg.Start();
|
||||
|
||||
const float ic = 1.f / 255.f;
|
||||
float ac = alpha / 255.f;
|
||||
|
||||
float outlineCenter = ConvStrength(0.1f, 0.45f, (float) 100 - min(outlineStrength, 100));
|
||||
float glowCenter = ConvStrength(0.55f, 0.95f, (float) 100 - min(glowStrength, 100));
|
||||
|
||||
float a = alpha * ic;
|
||||
|
||||
alphaMagProg.Set("GlyphColor", ink.GetR() * ic, ink.GetG() * ic, ink.GetB() * ic, a);
|
||||
alphaMagProg.Set("OutlineColor", outlineColor.GetR() * ic, outlineColor.GetG() * ic, outlineColor.GetB() * ic, a);
|
||||
alphaMagProg.Set("GlowColor", glowColor.GetR() * ic, glowColor.GetG() * ic, glowColor.GetB() * ic, a);
|
||||
alphaMagProg.Set("GlyphColor", ink.GetR() * ic, ink.GetG() * ic, ink.GetB() * ic, ink.GetA() * ic * ac);
|
||||
alphaMagProg.Set("OutlineColor", outlineColor.GetR() * ic, outlineColor.GetG() * ic, outlineColor.GetB() * ic, outlineColor.GetA() * ic * ac);
|
||||
alphaMagProg.Set("GlowColor", glowColor.GetR() * ic, glowColor.GetG() * ic, glowColor.GetB() * ic, glowColor.GetA() * ic * ac);
|
||||
alphaMagProg.Set("Outline", outlineStrength > 0); //0.1 - 0.45
|
||||
alphaMagProg.Set("Glow", glowStrength > 0); //0.55 - 0.095
|
||||
alphaMagProg.Set("Shadow", false);
|
||||
|
|
|
|||
|
|
@ -11,6 +11,8 @@ K_RETURN = 13,
|
|||
K_ENTER = K_RETURN,
|
||||
|
||||
K_SHIFT_KEY = VK_SHIFT + K_DELTA,
|
||||
K_LSHIFT_KEY = VK_LSHIFT + K_DELTA,
|
||||
K_RSHIFT_KEY = VK_RSHIFT + K_DELTA,
|
||||
K_CTRL_KEY = VK_CONTROL + K_DELTA,
|
||||
K_ALT_KEY = VK_MENU + K_DELTA,
|
||||
K_CAPSLOCK = VK_CAPITAL + K_DELTA,
|
||||
|
|
@ -96,17 +98,29 @@ K_7 = '7' + K_DELTA,
|
|||
K_8 = '8' + K_DELTA,
|
||||
K_9 = '9' + K_DELTA,
|
||||
|
||||
K_CTRL_LBRACKET = K_CTRL|219|K_DELTA,
|
||||
K_CTRL_RBRACKET = K_CTRL|221|K_DELTA,
|
||||
K_CTRL_MINUS = K_CTRL|0xbd|K_DELTA,
|
||||
K_CTRL_GRAVE = K_CTRL|0xc0|K_DELTA,
|
||||
K_CTRL_SLASH = K_CTRL|0xbf|K_DELTA,
|
||||
K_CTRL_BACKSLASH = K_CTRL|0xdc|K_DELTA,
|
||||
K_CTRL_COMMA = K_CTRL|0xbc|K_DELTA,
|
||||
K_CTRL_PERIOD = K_CTRL|0xbe|K_DELTA,
|
||||
K_CTRL_SEMICOLON = K_CTRL|0xbe|K_DELTA,
|
||||
K_CTRL_EQUAL = K_CTRL|0xbb|K_DELTA,
|
||||
K_CTRL_APOSTROPHE= K_CTRL|0xde|K_DELTA,
|
||||
K_LBRACKET = 219|K_DELTA,
|
||||
K_RBRACKET = 221|K_DELTA,
|
||||
K_MINUS = 0xbd|K_DELTA,
|
||||
K_GRAVE = 0xc0|K_DELTA,
|
||||
K_SLASH = 0xbf|K_DELTA,
|
||||
K_BACKSLASH = 0xdc|K_DELTA,
|
||||
K_COMMA = 0xbc|K_DELTA,
|
||||
K_PERIOD = 0xbe|K_DELTA,
|
||||
K_SEMICOLON = 0xbe|K_DELTA,
|
||||
K_EQUAL = 0xbb|K_DELTA,
|
||||
K_APOSTROPHE = 0xde|K_DELTA,
|
||||
|
||||
K_CTRL_LBRACKET = K_CTRL|K_LBRACKET,
|
||||
K_CTRL_RBRACKET = K_CTRL|K_RBRACKET,
|
||||
K_CTRL_MINUS = K_CTRL|K_MINUS,
|
||||
K_CTRL_GRAVE = K_CTRL|K_GRAVE,
|
||||
K_CTRL_SLASH = K_CTRL|K_SLASH,
|
||||
K_CTRL_BACKSLASH = K_CTRL|K_BACKSLASH,
|
||||
K_CTRL_COMMA = K_CTRL|K_COMMA,
|
||||
K_CTRL_PERIOD = K_CTRL|K_PERIOD,
|
||||
K_CTRL_SEMICOLON = K_CTRL|K_SEMICOLON,
|
||||
K_CTRL_EQUAL = K_CTRL|K_EQUAL,
|
||||
K_CTRL_APOSTROPHE= K_CTRL|K_APOSTROPHE,
|
||||
|
||||
K_BREAK = VK_CANCEL + K_DELTA,
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef _WinGl_ResGl_h_
|
||||
#define _WinGl_ResGl_h_
|
||||
|
||||
struct Texture : Moveable<Texture>
|
||||
struct TextureResource : Moveable<TextureResource>
|
||||
{
|
||||
int64 serialId;
|
||||
int64 atlasSerialId;
|
||||
|
|
@ -12,7 +12,7 @@ struct Texture : Moveable<Texture>
|
|||
int x;
|
||||
int y;
|
||||
|
||||
Texture(int w = 0, int h = 0)
|
||||
TextureResource(int w = 0, int h = 0)
|
||||
{
|
||||
serialId = -1;
|
||||
atlasSerialId = -1;
|
||||
|
|
@ -30,13 +30,13 @@ struct Texture : Moveable<Texture>
|
|||
}
|
||||
};
|
||||
|
||||
struct Atlas : Moveable<Atlas>
|
||||
struct AtlasResource : Moveable<AtlasResource>
|
||||
{
|
||||
int width;
|
||||
int height;
|
||||
bool linear;
|
||||
Vector<Image> parts;
|
||||
Image Make(ArrayMap<int64, Texture>& textures);
|
||||
Image Make(ArrayMap<int64, TextureResource>& textures);
|
||||
};
|
||||
|
||||
struct ImageResource : Moveable<ImageResource>
|
||||
|
|
@ -64,10 +64,10 @@ struct Resources
|
|||
};
|
||||
|
||||
Vector<ImageResource> staticImages;
|
||||
VectorMap<String, Atlas> staticAtlases;
|
||||
VectorMap<String, AtlasResource> staticAtlases;
|
||||
Vector<Font> staticFonts;
|
||||
|
||||
Texture autoAtlas;
|
||||
TextureResource autoAtlas;
|
||||
ImageBuffer autoAtlasBuffer;
|
||||
Image autoAtlasImage;
|
||||
int px, py, maxh;
|
||||
|
|
@ -75,13 +75,13 @@ struct Resources
|
|||
int bindedTextures;
|
||||
|
||||
int64 currentSerialId;
|
||||
ArrayMap<int64, Texture> textures;
|
||||
ArrayMap<int64, TextureResource> 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 TextureResource& CreateTexture(const Image& img, int width = -1, int height = -1);
|
||||
void CreateSubTexture(const TextureResource& t, const Image& img, int x, int y);
|
||||
|
||||
const Texture& Bind(const Image& img, int opts = NEAREST_FILTERING);
|
||||
const TextureResource& 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);
|
||||
|
|
|
|||
|
|
@ -29,10 +29,10 @@ void Resources::SetTextureFiltring(int opts)
|
|||
}
|
||||
}
|
||||
|
||||
const Texture& Resources::CreateTexture(const Image& img, int width, int height)
|
||||
const TextureResource& Resources::CreateTexture(const Image& img, int width, int height)
|
||||
{
|
||||
int64 serialId = img.GetSerialId();
|
||||
Texture& t = textures.Add(serialId);
|
||||
TextureResource& t = textures.Add(serialId);
|
||||
t.serialId = serialId;
|
||||
t.atlasSerialId = -1;
|
||||
t.width = width > 0 ? width : img.GetWidth();
|
||||
|
|
@ -48,17 +48,17 @@ const Texture& Resources::CreateTexture(const Image& img, int width, int height)
|
|||
return t;
|
||||
}
|
||||
|
||||
void Resources::CreateSubTexture(const Texture& t, const Image& img, int x, int y)
|
||||
void Resources::CreateSubTexture(const TextureResource& t, const Image& img, int x, int y)
|
||||
{
|
||||
Bind(autoAtlas.serialId, 0);
|
||||
glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, img.GetWidth(), img.GetHeight(), GL_BGRA, GL_UNSIGNED_BYTE, img);
|
||||
}
|
||||
|
||||
const Texture& Resources::Bind(const Image& img, int opts)
|
||||
const TextureResource& Resources::Bind(const Image& img, int opts)
|
||||
{
|
||||
int64 serialId = img.GetSerialId();
|
||||
|
||||
const Texture* texture = textures.FindPtr(serialId);
|
||||
const TextureResource* texture = textures.FindPtr(serialId);
|
||||
if(texture)
|
||||
{
|
||||
if(texture->atlasSerialId >= 0)
|
||||
|
|
@ -93,7 +93,7 @@ void Resources::CreateSubTexture(const Texture& t, const Image& img, int x, int
|
|||
if(h > maxh)
|
||||
maxh = h;
|
||||
|
||||
Texture& t = textures.Add(img.GetSerialId());
|
||||
TextureResource& t = textures.Add(img.GetSerialId());
|
||||
t.atlasSerialId = autoAtlas.serialId;
|
||||
t.width = w;
|
||||
t.height = h;
|
||||
|
|
@ -192,20 +192,20 @@ void Resources::Add(Iml* images, bool linear)
|
|||
|
||||
void Resources::AddAtlas(const char* atlasName, const Image& img)
|
||||
{
|
||||
Atlas& atlas = staticAtlases.GetAdd(atlasName);
|
||||
AtlasResource& atlas = staticAtlases.GetAdd(atlasName);
|
||||
atlas.linear = false;
|
||||
atlas.parts.Add(img);
|
||||
}
|
||||
|
||||
void Resources::AddAtlas(const char* atlasName, Iml* images)
|
||||
{
|
||||
Atlas& atlas = staticAtlases.GetAdd(atlasName);
|
||||
AtlasResource& atlas = staticAtlases.GetAdd(atlasName);
|
||||
atlas.linear = false;
|
||||
for(int i = 0; i < images->GetCount(); i++)
|
||||
atlas.parts.Add(images->Get(i));
|
||||
}
|
||||
|
||||
Image Atlas::Make(ArrayMap<int64, Texture>& textures)
|
||||
Image AtlasResource::Make(ArrayMap<int64, TextureResource>& textures)
|
||||
{
|
||||
width = 512;
|
||||
height = 512;
|
||||
|
|
@ -241,7 +241,7 @@ Image Atlas::Make(ArrayMap<int64, Texture>& textures)
|
|||
if(h > maxh)
|
||||
maxh = h;
|
||||
|
||||
Texture& t = textures.Add(img.GetSerialId());
|
||||
TextureResource& t = textures.Add(img.GetSerialId());
|
||||
t.width = w;
|
||||
t.height = h;
|
||||
t.realWidth = width;
|
||||
|
|
|
|||
|
|
@ -172,10 +172,7 @@ void SlimScrollBar::Paint(Draw &w)
|
|||
Size rsz(int(size), IsVert() ? sz.cx : sz.cy);
|
||||
Fix(p);
|
||||
Fix(rsz);
|
||||
SystemDraw& sw = (SystemDraw&) w;
|
||||
sw.alpha = 150.f;
|
||||
w.DrawRect(p.x, p.y, rsz.cx, rsz.cy, White);
|
||||
sw.alpha = 255.f;
|
||||
w.DrawRect(p.x, p.y, rsz.cx, rsz.cy, White().Alpha(150));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,15 +24,15 @@ void TopWindow::GripResize()
|
|||
|
||||
void TopWindow::SyncSizeHints()
|
||||
{
|
||||
SyncCaption0();
|
||||
SyncCaption();
|
||||
}
|
||||
|
||||
void TopWindow::SyncTitle0()
|
||||
void TopWindow::SyncTitle()
|
||||
{
|
||||
SyncCaption0();
|
||||
SyncCaption();
|
||||
}
|
||||
|
||||
void TopWindow::SyncCaption0()
|
||||
void TopWindow::SyncCaption()
|
||||
{
|
||||
GuiLock __;
|
||||
frame->title = title.ToString();
|
||||
|
|
@ -49,7 +49,7 @@ void TopWindow::SyncCaption0()
|
|||
|
||||
void TopWindow::State(int reason)
|
||||
{
|
||||
SyncCaption0();
|
||||
SyncCaption();
|
||||
}
|
||||
|
||||
void TopWindow::SyncRect()
|
||||
|
|
@ -80,7 +80,7 @@ void TopWindow::Open(Ctrl *owner)
|
|||
PopUp(frame, false, true);
|
||||
popup = false;
|
||||
SetRect(frame->GetClient());
|
||||
SyncCaption0();
|
||||
SyncCaption();
|
||||
if(state == MAXIMIZED)
|
||||
frame->Maximize();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
uses
|
||||
Painter;
|
||||
|
||||
library(WIN32 GCC) "glaux glu32 opengl32";
|
||||
|
||||
library(LINUX) "GL GLU";
|
||||
library(WIN32 GCC) "glu32 opengl32";
|
||||
|
||||
options
|
||||
"-D_WIN32 -DGLEW_STATIC";
|
||||
|
|
@ -39,6 +37,9 @@ file
|
|||
Image.cpp,
|
||||
ChSysInit.cpp,
|
||||
Util.cpp,
|
||||
SceneGraph readonly separator,
|
||||
SceneGraph.h,
|
||||
SceneGraph.cpp,
|
||||
Glew readonly separator,
|
||||
glew.h,
|
||||
glxew.h,
|
||||
|
|
@ -52,5 +53,7 @@ file
|
|||
Blur.vert,
|
||||
AlphaMag.frag,
|
||||
AlphaMag.vert,
|
||||
Fonts\TahomaB_0.png,
|
||||
Fonts\TahomaN_0.png,
|
||||
WinGl.iml;
|
||||
|
||||
|
|
|
|||
|
|
@ -337,11 +337,6 @@ void Ctrl::DrawScreen()
|
|||
}
|
||||
}
|
||||
|
||||
void Ctrl::WndUpdate0r(const Rect& r)
|
||||
{
|
||||
GuiLock __;
|
||||
}
|
||||
|
||||
bool Ctrl::ProcessEvents(bool *quit)
|
||||
{
|
||||
if(!ProcessEvent(quit))
|
||||
|
|
@ -356,7 +351,7 @@ bool Ctrl::ProcessEvents(bool *quit)
|
|||
return true;
|
||||
}
|
||||
|
||||
void Ctrl::EventLoop0(Ctrl *ctrl)
|
||||
/*void Ctrl::EventLoop0(Ctrl *ctrl)
|
||||
{
|
||||
GuiLock __;
|
||||
ASSERT(IsMainThread());
|
||||
|
|
@ -383,16 +378,16 @@ void Ctrl::EventLoop0(Ctrl *ctrl)
|
|||
if(ctrl)
|
||||
LoopCtrl = ploop;
|
||||
LoopLevel--;
|
||||
}
|
||||
}*/
|
||||
|
||||
void Ctrl::GuiSleep0(int ms)
|
||||
/*void Ctrl::GuiSleep0(int ms)
|
||||
{
|
||||
GuiLock __;
|
||||
ASSERT(IsMainThread());
|
||||
int level = LeaveGuiMutexAll();
|
||||
GlSleep(ms);
|
||||
EnterGuiMutex(level);
|
||||
}
|
||||
}*/
|
||||
|
||||
Rect Ctrl::GetWndScreenRect() const
|
||||
{
|
||||
|
|
@ -400,7 +395,7 @@ Rect Ctrl::GetWndScreenRect() const
|
|||
return GetRect();
|
||||
}
|
||||
|
||||
void Ctrl::WndShow0(bool b)
|
||||
/*void Ctrl::WndShow0(bool b)
|
||||
{
|
||||
GuiLock __;
|
||||
}
|
||||
|
|
@ -409,7 +404,7 @@ void Ctrl::WndUpdate0()
|
|||
{
|
||||
GuiLock __;
|
||||
}
|
||||
|
||||
*/
|
||||
bool Ctrl::IsWndOpen() const {
|
||||
GuiLock __;
|
||||
return FindTopCtrl() >= 0 || this == desktop;
|
||||
|
|
@ -474,7 +469,7 @@ void Ctrl::DestroyWnd()
|
|||
{
|
||||
for(int i = 0; i < topctrl.GetCount(); i++)
|
||||
if(topctrl[i]->top && topctrl[i]->top->owner_window == this)
|
||||
topctrl[i]->WndDestroy0();
|
||||
topctrl[i]->WndDestroy();
|
||||
int q = FindTopCtrl();
|
||||
if(q >= 0) {
|
||||
topctrl.Remove(q);
|
||||
|
|
@ -489,12 +484,14 @@ void Ctrl::DestroyWnd()
|
|||
win->DestroyFrame();
|
||||
}
|
||||
|
||||
void Ctrl::WndDestroy0()
|
||||
{
|
||||
DestroyWnd();
|
||||
if(topctrl.GetCount())
|
||||
topctrl.Top()->ActivateWnd();
|
||||
}
|
||||
/*
|
||||
* void Ctrl::WndDestroy0()
|
||||
* {
|
||||
* DestroyWnd();
|
||||
* if(topctrl.GetCount())
|
||||
* topctrl.Top()->ActivateWnd();
|
||||
* }
|
||||
*/
|
||||
|
||||
void Ctrl::PutForeground()
|
||||
{
|
||||
|
|
@ -512,19 +509,21 @@ void Ctrl::PutForeground()
|
|||
fw[i]->PutForeground();
|
||||
}
|
||||
|
||||
void Ctrl::SetWndForeground0()
|
||||
{
|
||||
GuiLock __;
|
||||
ASSERT(IsOpen());
|
||||
if(IsWndForeground())
|
||||
return;
|
||||
Ctrl *to = this;
|
||||
while(to->top && to->top->owner_window)
|
||||
to = to->top->owner_window;
|
||||
to->PutForeground();
|
||||
if(this != focusCtrl)
|
||||
ActivateWnd();
|
||||
}
|
||||
/*
|
||||
* void Ctrl::SetWndForeground0()
|
||||
* {
|
||||
* GuiLock __;
|
||||
* ASSERT(IsOpen());
|
||||
* if(IsWndForeground())
|
||||
* return;
|
||||
* Ctrl *to = this;
|
||||
* while(to->top && to->top->owner_window)
|
||||
* to = to->top->owner_window;
|
||||
* to->PutForeground();
|
||||
* if(this != focusCtrl)
|
||||
* ActivateWnd();
|
||||
* }
|
||||
*/
|
||||
|
||||
bool Ctrl::IsWndForeground() const
|
||||
{
|
||||
|
|
@ -538,17 +537,19 @@ bool Ctrl::IsWndForeground() const
|
|||
return b;
|
||||
}
|
||||
|
||||
void Ctrl::WndEnable0(bool *b)
|
||||
{
|
||||
GuiLock __;
|
||||
*b = true;
|
||||
}
|
||||
|
||||
void Ctrl::SetWndFocus0(bool *b)
|
||||
{
|
||||
GuiLock __;
|
||||
*b = true;
|
||||
}
|
||||
/*
|
||||
* void Ctrl::WndEnable0(bool *b)
|
||||
* {
|
||||
* GuiLock __;
|
||||
* *b = true;
|
||||
* }
|
||||
*
|
||||
* void Ctrl::SetWndFocus0(bool *b)
|
||||
* {
|
||||
* GuiLock __;
|
||||
* *b = true;
|
||||
* }
|
||||
*/
|
||||
|
||||
bool Ctrl::HasWndFocus() const
|
||||
{
|
||||
|
|
@ -582,19 +583,21 @@ void Ctrl::WndInvalidateRect(const Rect& r)
|
|||
//::InvalidateRect(glHwnd, NULL, false);
|
||||
}
|
||||
|
||||
void Ctrl::WndSetPos0(const Rect& rect)
|
||||
{
|
||||
GuiLock __;
|
||||
TopWindow *w = dynamic_cast<TopWindow *>(this);
|
||||
if(w)
|
||||
w->SyncFrameRect(rect);
|
||||
SetWndRect(rect);
|
||||
}
|
||||
|
||||
void Ctrl::WndScrollView0(const Rect& r, int dx, int dy)
|
||||
{
|
||||
GuiLock __;
|
||||
}
|
||||
/*
|
||||
* void Ctrl::WndSetPos0(const Rect& rect)
|
||||
* {
|
||||
* GuiLock __;
|
||||
* TopWindow *w = dynamic_cast<TopWindow *>(this);
|
||||
* if(w)
|
||||
* w->SyncFrameRect(rect);
|
||||
* SetWndRect(rect);
|
||||
* }
|
||||
*
|
||||
* void Ctrl::WndScrollView0(const Rect& r, int dx, int dy)
|
||||
* {
|
||||
* GuiLock __;
|
||||
* }
|
||||
*/
|
||||
|
||||
void Ctrl::PopUp(Ctrl *owner, bool savebits, bool activate, bool dropshadow, bool topmost)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue