diff --git a/ee.linux.cbp b/ee.linux.cbp
index db690c321..28a1ee7a7 100644
--- a/ee.linux.cbp
+++ b/ee.linux.cbp
@@ -499,7 +499,7 @@
-
+
diff --git a/ee.win.cbp b/ee.win.cbp
index c1c27c995..eba75e435 100644
--- a/ee.win.cbp
+++ b/ee.win.cbp
@@ -503,7 +503,7 @@
-
+
diff --git a/src/base.hpp b/src/base.hpp
index cc943cea7..d7c83f434 100644
--- a/src/base.hpp
+++ b/src/base.hpp
@@ -143,10 +143,6 @@ namespace EE {
const eeFloat TwoPI = 6.283185308f;
const eeFloat PId180 = PI / 180.f;
const eeFloat d180PI = 180.f / PI;
-
- #ifdef EE_GLES
- const GLubyte EE_GLES_INDICES [] = {0, 3, 1, 2};
- #endif
}
#include "base/base.hpp"
diff --git a/src/ee.h b/src/ee.h
index 22a2c2dd7..510ce745e 100755
--- a/src/ee.h
+++ b/src/ee.h
@@ -48,7 +48,7 @@
using namespace EE::Math;
// System
- #include "system/singleton.hpp"
+ #include "system/tsingleton.hpp"
#include "system/cthread.hpp"
#include "system/cmutex.hpp"
#include "system/clog.hpp"
diff --git a/src/graphics/base.hpp b/src/graphics/base.hpp
index ce2ea9b15..bdfb85eaa 100644
--- a/src/graphics/base.hpp
+++ b/src/graphics/base.hpp
@@ -18,7 +18,7 @@ using namespace EE::Utils;
using namespace EE::Math;
#include "../system/ctimeelapsed.hpp"
-#include "../system/singleton.hpp"
+#include "../system/tsingleton.hpp"
#include "../system/clog.hpp"
#include "../system/cpack.hpp"
#include "../system/tresourcemanager.hpp"
@@ -27,4 +27,11 @@ using namespace EE::System;
#include "renders.hpp"
+#ifdef EE_GLES
+ const GLubyte EE_GLES_INDICES [] = {0, 3, 1, 2};
+ #define EE_QUAD_VERTEX 6
+#else
+ #define EE_QUAD_VERTEX 4
+#endif
+
#endif
diff --git a/src/graphics/cbatchrenderer.cpp b/src/graphics/cbatchrenderer.cpp
index 4152ff2f2..ebd15e129 100755
--- a/src/graphics/cbatchrenderer.cpp
+++ b/src/graphics/cbatchrenderer.cpp
@@ -120,7 +120,14 @@ void cBatchRenderer::Flush() {
glTexCoordPointer(2, GL_FLOAT, sizeof(eeVertex), reinterpret_cast ( &mVertex[0] ) + sizeof(eeVector2f) );
glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(eeVertex), reinterpret_cast ( &mVertex[0] ) + sizeof(eeVector2f) + sizeof(eeTexCoord) );
- glDrawArrays( mCurrentMode, 0, mNumVertex );
+ #ifdef EE_GLES
+ if ( DM_QUADS == mCurrentMode ) {
+ glDrawArrays( DM_TRIANGLES, 0, mNumVertex );
+ } else
+ #endif
+ {
+ glDrawArrays( mCurrentMode, 0, mNumVertex );
+ }
if ( CreateMatrix )
glPopMatrix();
@@ -136,8 +143,13 @@ void cBatchRenderer::Flush() {
}
void cBatchRenderer::BatchQuad( const eeFloat& x, const eeFloat& y, const eeFloat& width, const eeFloat& height, const eeFloat& angle ) {
+#ifndef EE_GLES
if ( mNumVertex + 3 >= mVertexSize )
return;
+#else
+ if ( mNumVertex + 5 >= mVertexSize )
+ return;
+#endif
eeVector2f center;
@@ -146,9 +158,9 @@ void cBatchRenderer::BatchQuad( const eeFloat& x, const eeFloat& y, const eeFloa
center.y = y + height * 0.5f;
}
-#ifndef EE_GLES
SetBlendMode( DM_QUADS, mForceBlendMode );
+#ifndef EE_GLES
mTVertex = &mVertex[ mNumVertex ];
mTVertex->pos.x = x;
mTVertex->pos.y = y;
@@ -177,43 +189,60 @@ void cBatchRenderer::BatchQuad( const eeFloat& x, const eeFloat& y, const eeFloa
mTVertex->color = mVerColor[3];
Rotate(center, &mTVertex->pos, angle);
#else
- SetBlendMode( DM_TRIANGLE_STRIP, mForceBlendMode );
-
mTVertex = &mVertex[ mNumVertex ];
mTVertex->pos.x = x;
- mTVertex->pos.y = y;
- mTVertex->tex = mTexCoord[0];
- mTVertex->color = mVerColor[0];
- Rotate(center, &mTVertex->pos, angle);
-
- mTVertex = &mVertex[ mNumVertex + 1 ];
- mTVertex->pos.x = x + width;
- mTVertex->pos.y = y;
- mTVertex->tex = mTexCoord[3];
- mTVertex->color = mVerColor[3];
- Rotate(center, &mTVertex->pos, angle);
-
- mTVertex = &mVertex[ mNumVertex + 2 ];
- mTVertex->pos.x = x;
mTVertex->pos.y = y + height;
mTVertex->tex = mTexCoord[1];
mTVertex->color = mVerColor[1];
Rotate(center, &mTVertex->pos, angle);
+ mTVertex = &mVertex[ mNumVertex + 1 ];
+ mTVertex->pos.x = x;
+ mTVertex->pos.y = y;
+ mTVertex->tex = mTexCoord[0];
+ mTVertex->color = mVerColor[0];
+ Rotate(center, &mTVertex->pos, angle);
+
+ mTVertex = &mVertex[ mNumVertex + 2 ];
+ mTVertex->pos.x = x + width;
+ mTVertex->pos.y = y;
+ mTVertex->tex = mTexCoord[3];
+ mTVertex->color = mVerColor[3];
+ Rotate(center, &mTVertex->pos, angle);
+
mTVertex = &mVertex[ mNumVertex + 3 ];
+ mTVertex->pos.x = x;
+ mTVertex->pos.y = y + height;
+ mTVertex->tex = mTexCoord[1];
+ mTVertex->color = mVerColor[1];
+ Rotate(center, &mTVertex->pos, angle);
+
+ mTVertex = &mVertex[ mNumVertex + 4 ];
mTVertex->pos.x = x + width;
mTVertex->pos.y = y + height;
mTVertex->tex = mTexCoord[2];
mTVertex->color = mVerColor[2];
Rotate(center, &mTVertex->pos, angle);
+
+ mTVertex = &mVertex[ mNumVertex + 5 ];
+ mTVertex->pos.x = x + width;
+ mTVertex->pos.y = y;
+ mTVertex->tex = mTexCoord[3];
+ mTVertex->color = mVerColor[3];
+ Rotate(center, &mTVertex->pos, angle);
#endif
- AddVertexs(4);
+ AddVertexs( EE_QUAD_VERTEX );
}
void cBatchRenderer::BatchQuadEx( const eeFloat& x, const eeFloat& y, const eeFloat& width, const eeFloat& height, const eeFloat& angle, const eeFloat& scale, const bool& scalefromcenter ) {
+#ifndef EE_GLES
if ( mNumVertex + 3 >= mVertexSize )
return;
+#else
+ if ( mNumVertex + 5 >= mVertexSize )
+ return;
+#endif
eeVector2f center;
eeFloat mx = x;
@@ -236,9 +265,9 @@ void cBatchRenderer::BatchQuadEx( const eeFloat& x, const eeFloat& y, const eeFl
center.x += x;
center.y += y;
-#ifndef EE_GLES
SetBlendMode( DM_QUADS, mForceBlendMode );
+#ifndef EE_GLES
mTVertex = &mVertex[ mNumVertex ];
mTVertex->pos.x = mx;
mTVertex->pos.y = my;
@@ -267,47 +296,64 @@ void cBatchRenderer::BatchQuadEx( const eeFloat& x, const eeFloat& y, const eeFl
mTVertex->color = mVerColor[3];
Rotate(center, &mTVertex->pos, angle);
#else
- SetBlendMode( DM_TRIANGLE_STRIP, mForceBlendMode );
-
mTVertex = &mVertex[ mNumVertex ];
mTVertex->pos.x = mx;
- mTVertex->pos.y = my;
- mTVertex->tex = mTexCoord[0];
- mTVertex->color = mVerColor[0];
- Rotate(center, &mTVertex->pos, angle);
-
- mTVertex = &mVertex[ mNumVertex + 1 ];
- mTVertex->pos.x = mx + mwidth;
- mTVertex->pos.y = my;
- mTVertex->tex = mTexCoord[3];
- mTVertex->color = mVerColor[3];
- Rotate(center, &mTVertex->pos, angle);
-
- mTVertex = &mVertex[ mNumVertex + 2 ];
- mTVertex->pos.x = mx;
mTVertex->pos.y = my + mheight;
mTVertex->tex = mTexCoord[1];
mTVertex->color = mVerColor[1];
Rotate(center, &mTVertex->pos, angle);
+ mTVertex = &mVertex[ mNumVertex + 1 ];
+ mTVertex->pos.x = mx;
+ mTVertex->pos.y = my;
+ mTVertex->tex = mTexCoord[0];
+ mTVertex->color = mVerColor[0];
+ Rotate(center, &mTVertex->pos, angle);
+
+ mTVertex = &mVertex[ mNumVertex + 2 ];
+ mTVertex->pos.x = mx + mwidth;
+ mTVertex->pos.y = my;
+ mTVertex->tex = mTexCoord[3];
+ mTVertex->color = mVerColor[3];
+ Rotate(center, &mTVertex->pos, angle);
+
mTVertex = &mVertex[ mNumVertex + 3 ];
+ mTVertex->pos.x = mx;
+ mTVertex->pos.y = my + mheight;
+ mTVertex->tex = mTexCoord[1];
+ mTVertex->color = mVerColor[1];
+ Rotate(center, &mTVertex->pos, angle);
+
+ mTVertex = &mVertex[ mNumVertex + 4 ];
mTVertex->pos.x = mx + mwidth;
mTVertex->pos.y = my + mheight;
mTVertex->tex = mTexCoord[2];
mTVertex->color = mVerColor[2];
Rotate(center, &mTVertex->pos, angle);
+
+ mTVertex = &mVertex[ mNumVertex + 5 ];
+ mTVertex->pos.x = mx + mwidth;
+ mTVertex->pos.y = my;
+ mTVertex->tex = mTexCoord[3];
+ mTVertex->color = mVerColor[3];
+ Rotate(center, &mTVertex->pos, angle);
#endif
- AddVertexs(4);
+ AddVertexs( EE_QUAD_VERTEX );
}
void cBatchRenderer::BatchQuadFree( const eeFloat& x0, const eeFloat& y0, const eeFloat& x1, const eeFloat& y1, const eeFloat& x2, const eeFloat& y2, const eeFloat& x3, const eeFloat& y3 ) {
+#ifndef EE_GLES
if ( mNumVertex + 3 >= mVertexSize )
return;
+#else
+ if ( mNumVertex + 5 >= mVertexSize )
+ return;
+#endif
-#ifndef EE_GLES
SetBlendMode( DM_QUADS, mForceBlendMode );
+#ifndef EE_GLES
mTVertex = &mVertex[ mNumVertex ];
mTVertex->pos.x = x0;
mTVertex->pos.y = y0;
@@ -332,39 +378,54 @@ void cBatchRenderer::BatchQuadFree( const eeFloat& x0, const eeFloat& y0, const
mTVertex->tex = mTexCoord[3];
mTVertex->color = mVerColor[3];
#else
- SetBlendMode( DM_TRIANGLE_STRIP, mForceBlendMode );
-
mTVertex = &mVertex[ mNumVertex ];
- mTVertex->pos.x = x0;
- mTVertex->pos.y = y0;
- mTVertex->tex = mTexCoord[0];
- mTVertex->color = mVerColor[0];
-
- mTVertex = &mVertex[ mNumVertex + 1 ];
- mTVertex->pos.x = x3;
- mTVertex->pos.y = y3;
- mTVertex->tex = mTexCoord[3];
- mTVertex->color = mVerColor[3];
-
- mTVertex = &mVertex[ mNumVertex + 2 ];
mTVertex->pos.x = x1;
mTVertex->pos.y = y1;
mTVertex->tex = mTexCoord[1];
mTVertex->color = mVerColor[1];
+ mTVertex = &mVertex[ mNumVertex + 1 ];
+ mTVertex->pos.x = x0;
+ mTVertex->pos.y = y0;
+ mTVertex->tex = mTexCoord[0];
+ mTVertex->color = mVerColor[0];
+
+ mTVertex = &mVertex[ mNumVertex + 2 ];
+ mTVertex->pos.x = x3;
+ mTVertex->pos.y = y3;
+ mTVertex->tex = mTexCoord[3];
+ mTVertex->color = mVerColor[3];
+
mTVertex = &mVertex[ mNumVertex + 3 ];
+ mTVertex->pos.x = x1;
+ mTVertex->pos.y = y1;
+ mTVertex->tex = mTexCoord[1];
+ mTVertex->color = mVerColor[1];
+
+ mTVertex = &mVertex[ mNumVertex + 4 ];
mTVertex->pos.x = x2;
mTVertex->pos.y = y2;
mTVertex->tex = mTexCoord[2];
mTVertex->color = mVerColor[2];
+
+ mTVertex = &mVertex[ mNumVertex + 5 ];
+ mTVertex->pos.x = x3;
+ mTVertex->pos.y = y3;
+ mTVertex->tex = mTexCoord[3];
+ mTVertex->color = mVerColor[3];
#endif
- AddVertexs(4);
+ AddVertexs( EE_QUAD_VERTEX );
}
void cBatchRenderer::BatchQuadFreeEx( const eeFloat& x0, const eeFloat& y0, const eeFloat& x1, const eeFloat& y1, const eeFloat& x2, const eeFloat& y2, const eeFloat& x3, const eeFloat& y3, const eeFloat& Angle, const eeFloat& Scale ) {
+ #ifndef EE_GLES
if ( mNumVertex + 3 >= mVertexSize )
return;
+ #else
+ if ( mNumVertex + 5 >= mVertexSize )
+ return;
+ #endif
eeQuad2f mQ;
mQ.V[0].x = x0; mQ.V[1].x = x1; mQ.V[2].x = x2; mQ.V[3].x = x3;
@@ -401,9 +462,9 @@ void cBatchRenderer::BatchQuadFreeEx( const eeFloat& x0, const eeFloat& y0, cons
if ( Angle != 0 )
mQ = RotateQuadCentered( mQ, Angle, QCenter );
-#ifndef EE_GLES
SetBlendMode( DM_QUADS, mForceBlendMode );
+#ifndef EE_GLES
mTVertex = &mVertex[ mNumVertex ];
mTVertex->pos.x = mQ[0].x;
mTVertex->pos.y = mQ[0].y;
@@ -428,34 +489,44 @@ void cBatchRenderer::BatchQuadFreeEx( const eeFloat& x0, const eeFloat& y0, cons
mTVertex->tex = mTexCoord[3];
mTVertex->color = mVerColor[3];
#else
- SetBlendMode( DM_TRIANGLE_STRIP, mForceBlendMode );
-
mTVertex = &mVertex[ mNumVertex ];
- mTVertex->pos.x = mQ[0].x;
- mTVertex->pos.y = mQ[0].y;
- mTVertex->tex = mTexCoord[0];
- mTVertex->color = mVerColor[0];
-
- mTVertex = &mVertex[ mNumVertex + 1 ];
- mTVertex->pos.x = mQ[3].x;
- mTVertex->pos.y = mQ[3].y;
- mTVertex->tex = mTexCoord[3];
- mTVertex->color = mVerColor[3];
-
- mTVertex = &mVertex[ mNumVertex + 2 ];
mTVertex->pos.x = mQ[1].x;
mTVertex->pos.y = mQ[1].y;
mTVertex->tex = mTexCoord[1];
mTVertex->color = mVerColor[1];
+ mTVertex = &mVertex[ mNumVertex + 1 ];
+ mTVertex->pos.x = mQ[0].x;
+ mTVertex->pos.y = mQ[0].y;
+ mTVertex->tex = mTexCoord[0];
+ mTVertex->color = mVerColor[0];
+
+ mTVertex = &mVertex[ mNumVertex + 2 ];
+ mTVertex->pos.x = mQ[3].x;
+ mTVertex->pos.y = mQ[3].y;
+ mTVertex->tex = mTexCoord[3];
+ mTVertex->color = mVerColor[3];
+
mTVertex = &mVertex[ mNumVertex + 3 ];
+ mTVertex->pos.x = mQ[1].x;
+ mTVertex->pos.y = mQ[1].y;
+ mTVertex->tex = mTexCoord[1];
+ mTVertex->color = mVerColor[1];
+
+ mTVertex = &mVertex[ mNumVertex + 4 ];
mTVertex->pos.x = mQ[2].x;
mTVertex->pos.y = mQ[2].y;
mTVertex->tex = mTexCoord[2];
mTVertex->color = mVerColor[2];
+
+ mTVertex = &mVertex[ mNumVertex + 5 ];
+ mTVertex->pos.x = mQ[3].x;
+ mTVertex->pos.y = mQ[3].y;
+ mTVertex->tex = mTexCoord[3];
+ mTVertex->color = mVerColor[3];
#endif
- AddVertexs(4);
+ AddVertexs( EE_QUAD_VERTEX );
}
void cBatchRenderer::QuadsBegin() {
diff --git a/src/graphics/cfont.cpp b/src/graphics/cfont.cpp
index bb75f2a20..326a62f77 100644
--- a/src/graphics/cfont.cpp
+++ b/src/graphics/cfont.cpp
@@ -25,8 +25,8 @@ cFont::~cFont() {
void cFont::SetText( const std::wstring& Text ) {
if ( mText.size() != Text.size() ) {
- mRenderCoords.resize( Text.size() * 4 );
- mColors.resize( Text.size() * 4, mColor );
+ mRenderCoords.resize( Text.size() * EE_QUAD_VERTEX );
+ mColors.resize( Text.size() * EE_QUAD_VERTEX, mColor );
}
mText = Text;
@@ -47,7 +47,7 @@ void cFont::Color(const eeColorA& Color) {
if ( mColor != Color ) {
mColor = Color;
- mColors.assign( mText.size() * 4, mColor );
+ mColors.assign( mText.size() * EE_QUAD_VERTEX, mColor );
}
}
@@ -167,11 +167,7 @@ void cFont::Draw( cTextCache& TextCache, const eeFloat& X, const eeFloat& Y, con
std::vector& RenderCoords = TextCache.VertextCoords();
std::vector& Colors = TextCache.Colors();
- #ifndef EE_GLES
if ( !TextCache.CachedCoords() ) {
- #else
- if ( true ) {
- #endif
switch ( FontHAlignGet( Flags ) ) {
case FONT_DRAW_CENTER:
nX = (eeFloat)( (Int32)( ( TextCache.GetTextWidth() - TextCache.LinesWidth()[ Line ] ) * 0.5f ) );
@@ -238,20 +234,50 @@ void cFont::Draw( cTextCache& TextCache, const eeFloat& X, const eeFloat& Y, con
}
default:
{
+ #ifndef EE_GLES
for ( Uint8 z = 0; z < 8; z+=2 ) {
- RenderCoords[ numvert ].TexCoords[0] = C->TexCoords[z];
- RenderCoords[ numvert ].TexCoords[1] = C->TexCoords[ z + 1 ];
- RenderCoords[ numvert ].Vertex[0] = cX + C->Vertex[z] + nX;
- RenderCoords[ numvert ].Vertex[1] = cY + C->Vertex[ z + 1 ] + nY;
+ RenderCoords[ numvert ].TexCoords[0] = C->TexCoords[z];
+ RenderCoords[ numvert ].TexCoords[1] = C->TexCoords[ z + 1 ];
+ RenderCoords[ numvert ].Vertex[0] = cX + C->Vertex[z] + nX;
+ RenderCoords[ numvert ].Vertex[1] = cY + C->Vertex[ z + 1 ] + nY;
numvert++;
}
+ #else
+ RenderCoords[ numvert ].TexCoords[0] = C->TexCoords[2];
+ RenderCoords[ numvert ].TexCoords[1] = C->TexCoords[ 2 + 1 ];
+ RenderCoords[ numvert ].Vertex[0] = cX + C->Vertex[2] + nX;
+ RenderCoords[ numvert ].Vertex[1] = cY + C->Vertex[ 2 + 1 ] + nY;
+ numvert++;
- #ifdef EE_GLES
- glColorPointer( 4, GL_UNSIGNED_BYTE, 0, reinterpret_cast( &Colors[0] ) );
- glTexCoordPointer( 2, GL_FLOAT, sizeof(eeVertexCoords), reinterpret_cast( &RenderCoords[ numvert - 4 ] ) );
- glVertexPointer( 2, GL_FLOAT, sizeof(eeVertexCoords), reinterpret_cast( &RenderCoords[ numvert - 4 ] ) + sizeof(eeFloat) * 2 );
+ RenderCoords[ numvert ].TexCoords[0] = C->TexCoords[0];
+ RenderCoords[ numvert ].TexCoords[1] = C->TexCoords[ 0 + 1 ];
+ RenderCoords[ numvert ].Vertex[0] = cX + C->Vertex[0] + nX;
+ RenderCoords[ numvert ].Vertex[1] = cY + C->Vertex[ 0 + 1 ] + nY;
+ numvert++;
- glDrawElements( GL_TRIANGLE_STRIP, 4, GL_UNSIGNED_BYTE, EE_GLES_INDICES );
+ RenderCoords[ numvert ].TexCoords[0] = C->TexCoords[6];
+ RenderCoords[ numvert ].TexCoords[1] = C->TexCoords[ 6 + 1 ];
+ RenderCoords[ numvert ].Vertex[0] = cX + C->Vertex[6] + nX;
+ RenderCoords[ numvert ].Vertex[1] = cY + C->Vertex[ 6 + 1 ] + nY;
+ numvert++;
+
+ RenderCoords[ numvert ].TexCoords[0] = C->TexCoords[2];
+ RenderCoords[ numvert ].TexCoords[1] = C->TexCoords[ 2 + 1 ];
+ RenderCoords[ numvert ].Vertex[0] = cX + C->Vertex[2] + nX;
+ RenderCoords[ numvert ].Vertex[1] = cY + C->Vertex[ 2 + 1 ] + nY;
+ numvert++;
+
+ RenderCoords[ numvert ].TexCoords[0] = C->TexCoords[4];
+ RenderCoords[ numvert ].TexCoords[1] = C->TexCoords[ 4 + 1 ];
+ RenderCoords[ numvert ].Vertex[0] = cX + C->Vertex[4] + nX;
+ RenderCoords[ numvert ].Vertex[1] = cY + C->Vertex[ 4 + 1 ] + nY;
+ numvert++;
+
+ RenderCoords[ numvert ].TexCoords[0] = C->TexCoords[6];
+ RenderCoords[ numvert ].TexCoords[1] = C->TexCoords[ 6 + 1 ];
+ RenderCoords[ numvert ].Vertex[0] = cX + C->Vertex[6] + nX;
+ RenderCoords[ numvert ].Vertex[1] = cY + C->Vertex[ 6 + 1 ] + nY;
+ numvert++;
#endif
if (mVerticalDraw)
@@ -269,12 +295,14 @@ void cFont::Draw( cTextCache& TextCache, const eeFloat& X, const eeFloat& Y, con
numvert = TextCache.CachedVerts();
}
- #ifndef EE_GLES
glColorPointer( 4, GL_UNSIGNED_BYTE, 0, reinterpret_cast( &Colors[0] ) );
glTexCoordPointer( 2, GL_FLOAT, sizeof(eeVertexCoords), reinterpret_cast( &RenderCoords[0] ) );
glVertexPointer( 2, GL_FLOAT, sizeof(eeVertexCoords), reinterpret_cast( &RenderCoords[0] ) + sizeof(eeFloat) * 2 );
+ #ifndef EE_GLES
glDrawArrays( GL_QUADS, 0, numvert );
+ #else
+ glDrawArrays( GL_TRIANGLES, 0, numvert );
#endif
if ( Angle != 0.0f || Scale != 1.0f ) {
@@ -382,6 +410,7 @@ void cFont::SubDraw( const std::wstring& Text, const eeFloat& X, const eeFloat&
break;
default:
+ #ifndef EE_GLES
for ( Uint8 z = 0; z < 8; z+=2 ) {
mRenderCoords[ numvert ].TexCoords[0] = C->TexCoords[z];
mRenderCoords[ numvert ].TexCoords[1] = C->TexCoords[ z + 1 ];
@@ -389,13 +418,42 @@ void cFont::SubDraw( const std::wstring& Text, const eeFloat& X, const eeFloat&
mRenderCoords[ numvert ].Vertex[1] = cY + C->Vertex[ z + 1 ] + nY;
numvert++;
}
+ #else
+ mRenderCoords[ numvert ].TexCoords[0] = C->TexCoords[2];
+ mRenderCoords[ numvert ].TexCoords[1] = C->TexCoords[ 2 + 1 ];
+ mRenderCoords[ numvert ].Vertex[0] = cX + C->Vertex[2] + nX;
+ mRenderCoords[ numvert ].Vertex[1] = cY + C->Vertex[ 2 + 1 ] + nY;
+ numvert++;
- #ifdef EE_GLES
- glColorPointer( 4, GL_UNSIGNED_BYTE, 0, reinterpret_cast( &mColors[0] ) );
- glTexCoordPointer( 2, GL_FLOAT, sizeof(eeVertexCoords), reinterpret_cast( &mRenderCoords[ numvert - 4 ] ) );
- glVertexPointer( 2, GL_FLOAT, sizeof(eeVertexCoords), reinterpret_cast( &mRenderCoords[ numvert - 4 ] ) + sizeof(eeFloat) * 2 );
+ mRenderCoords[ numvert ].TexCoords[0] = C->TexCoords[0];
+ mRenderCoords[ numvert ].TexCoords[1] = C->TexCoords[ 0 + 1 ];
+ mRenderCoords[ numvert ].Vertex[0] = cX + C->Vertex[0] + nX;
+ mRenderCoords[ numvert ].Vertex[1] = cY + C->Vertex[ 0 + 1 ] + nY;
+ numvert++;
- glDrawElements( GL_TRIANGLE_STRIP, 4, GL_UNSIGNED_BYTE, EE_GLES_INDICES );
+ mRenderCoords[ numvert ].TexCoords[0] = C->TexCoords[6];
+ mRenderCoords[ numvert ].TexCoords[1] = C->TexCoords[ 6 + 1 ];
+ mRenderCoords[ numvert ].Vertex[0] = cX + C->Vertex[6] + nX;
+ mRenderCoords[ numvert ].Vertex[1] = cY + C->Vertex[ 6 + 1 ] + nY;
+ numvert++;
+
+ mRenderCoords[ numvert ].TexCoords[0] = C->TexCoords[2];
+ mRenderCoords[ numvert ].TexCoords[1] = C->TexCoords[ 2 + 1 ];
+ mRenderCoords[ numvert ].Vertex[0] = cX + C->Vertex[2] + nX;
+ mRenderCoords[ numvert ].Vertex[1] = cY + C->Vertex[ 2 + 1 ] + nY;
+ numvert++;
+
+ mRenderCoords[ numvert ].TexCoords[0] = C->TexCoords[4];
+ mRenderCoords[ numvert ].TexCoords[1] = C->TexCoords[ 4 + 1 ];
+ mRenderCoords[ numvert ].Vertex[0] = cX + C->Vertex[4] + nX;
+ mRenderCoords[ numvert ].Vertex[1] = cY + C->Vertex[ 4 + 1 ] + nY;
+ numvert++;
+
+ mRenderCoords[ numvert ].TexCoords[0] = C->TexCoords[6];
+ mRenderCoords[ numvert ].TexCoords[1] = C->TexCoords[ 6 + 1 ];
+ mRenderCoords[ numvert ].Vertex[0] = cX + C->Vertex[6] + nX;
+ mRenderCoords[ numvert ].Vertex[1] = cY + C->Vertex[ 6 + 1 ] + nY;
+ numvert++;
#endif
if ( mVerticalDraw )
@@ -406,12 +464,14 @@ void cFont::SubDraw( const std::wstring& Text, const eeFloat& X, const eeFloat&
}
}
- #ifndef EE_GLES
glColorPointer( 4, GL_UNSIGNED_BYTE, 0, reinterpret_cast( &mColors[0] ) );
glTexCoordPointer( 2, GL_FLOAT, sizeof(eeVertexCoords), reinterpret_cast( &mRenderCoords[0] ) );
glVertexPointer( 2, GL_FLOAT, sizeof(eeVertexCoords), reinterpret_cast( &mRenderCoords[0] ) + sizeof(eeFloat) * 2 );
+ #ifndef EE_GLES
glDrawArrays( GL_QUADS, 0, numvert );
+ #else
+ glDrawArrays( GL_TRIANGLES, 0, numvert );
#endif
if ( Angle != 0.0f || Scale != 1.0f )
diff --git a/src/graphics/ctextcache.cpp b/src/graphics/ctextcache.cpp
index d47287136..20fb6dacf 100644
--- a/src/graphics/ctextcache.cpp
+++ b/src/graphics/ctextcache.cpp
@@ -52,7 +52,7 @@ std::wstring& cTextCache::Text() {
}
void cTextCache::UpdateCoords() {
- Uint32 size = (Uint32)mText.size() * 4;
+ Uint32 size = (Uint32)mText.size() * EE_QUAD_VERTEX;
mRenderCoords.resize( size );
mColors.resize( size, mFontColor );
@@ -80,7 +80,7 @@ void cTextCache::Color(const eeColorA& Color) {
if ( mFontColor != Color ) {
mFontColor = Color;
- mColors.assign( mText.size() * 4, mFontColor );
+ mColors.assign( mText.size() * EE_QUAD_VERTEX, mFontColor );
}
}
diff --git a/src/graphics/ctexturefactory.cpp b/src/graphics/ctexturefactory.cpp
index 65698a375..7d61b2fdd 100755
--- a/src/graphics/ctexturefactory.cpp
+++ b/src/graphics/ctexturefactory.cpp
@@ -1,12 +1,9 @@
#include "ctexturefactory.hpp"
-#include "../window/cengine.hpp"
#include "ctextureloader.hpp"
#include "glhelper.hpp"
using namespace EE::Graphics::Private;
-using namespace EE::Window;
-
namespace EE { namespace Graphics {
cTextureFactory::cTextureFactory() :
@@ -194,14 +191,14 @@ void cTextureFactory::GrabTextures() {
Tex->Grabed(true);
}
}
-}
-
+}
+
void cTextureFactory::UngrabTextures() {
for ( Uint32 i = 1; i < mTextures.size(); i++ ) {
cTexture* Tex = GetTexture(i);
if ( NULL != Tex && Tex->Grabed() ) {
- Tex->Reload();
+ Tex->Reload();
Tex->Unlock();
Tex->Grabed(false);
}
diff --git a/src/system/clog.hpp b/src/system/clog.hpp
index 8726937bf..3f0185c5d 100755
--- a/src/system/clog.hpp
+++ b/src/system/clog.hpp
@@ -2,7 +2,7 @@
#define EECLOG_H
#include "base.hpp"
-#include "singleton.hpp"
+#include "tsingleton.hpp"
namespace EE { namespace System {
diff --git a/src/system/singleton.hpp b/src/system/tsingleton.hpp
similarity index 100%
rename from src/system/singleton.hpp
rename to src/system/tsingleton.hpp
diff --git a/src/test/ee.cpp b/src/test/ee.cpp
index f63644612..1cdb52453 100644
--- a/src/test/ee.cpp
+++ b/src/test/ee.cpp
@@ -387,14 +387,12 @@ void cEETest::CreateUI() {
cUIControl::CreateParams Params( cUIManager::instance()->MainControl(), eeVector2i(0,0), eeSize( 530, 240 ), UI_FILL_BACKGROUND | UI_CLIP_ENABLE | UI_BORDER );
- cUIThemeManager::instance()->Add( cUITheme::LoadFromPath( MyPath + "data/aqua/", "aqua", "aqua" ) );
+ //cUIThemeManager::instance()->Add( cUITheme::LoadFromPath( MyPath + "data/aqua/", "aqua", "aqua" ) );
CreateAquaTextureAtlas();
-/*
cTextureGroupLoader tgl( MyPath + "data/aqua.etg" );
TF->GetByName( "data/aqua.png" )->TextureFilter( TEX_FILTER_NEAREST );
cUIThemeManager::instance()->Add( cUITheme::LoadFromShapeGroup( cShapeGroupManager::instance()->GetByName( "aqua" ), "aqua", "aqua" ) );
-*/
cUIThemeManager::instance()->DefaultEffectsEnabled( true );
cUIThemeManager::instance()->DefaultFont( TTF );
@@ -689,7 +687,7 @@ void cEETest::ItemClick( const cUIEvent * Event ) {
} else if ( L"Show Window" == txt ) {
cUIMenuCheckBox * Chk = reinterpret_cast ( Event->Ctrl() );
- if ( !Chk->Active() ) {
+ if ( Chk->Active() ) {
C->StartScaleAnim( C->Scale(), 1.f, 500.f, SINEOUT );
C->StartAlphaAnim( C->Alpha(), 255.f, 500.f );
} else {
@@ -1159,6 +1157,7 @@ void cEETest::Render() {
EE->ClipDisable();
}
+
eeColorA ColRR1( 150, 150, 150, 220 );
eeColorA ColRR4( 150, 150, 150, 220 );
eeColorA ColRR2( 100, 100, 100, 220 );
diff --git a/src/ui/base.hpp b/src/ui/base.hpp
index 30b110447..018e4da7b 100644
--- a/src/ui/base.hpp
+++ b/src/ui/base.hpp
@@ -14,7 +14,7 @@ using namespace EE::Utils;
#include "../math/math.hpp"
using namespace EE::Math;
-#include "../system/singleton.hpp"
+#include "../system/tsingleton.hpp"
using namespace EE::System;
#include "../window/cengine.hpp"
diff --git a/src/ui/cuimanager.cpp b/src/ui/cuimanager.cpp
index 93b8def5a..3e3ef6d6d 100644
--- a/src/ui/cuimanager.cpp
+++ b/src/ui/cuimanager.cpp
@@ -147,6 +147,7 @@ void cUIManager::Update() {
if ( mKM->ReleaseTrigger() ) {
if ( NULL != mFocusControl ) {
mFocusControl->OnMouseUp( mKM->GetMousePos(), mKM->ReleaseTrigger() );
+ SendMsg( mFocusControl, cUIMessage::MsgMouseUp, mKM->ClickTrigger() );
if ( mDownControl == mOverControl && mKM->ClickTrigger() ) {
SendMsg( mFocusControl, cUIMessage::MsgClick, mKM->ClickTrigger() );
diff --git a/src/ui/cuimenu.cpp b/src/ui/cuimenu.cpp
index d1406232e..5b6252828 100644
--- a/src/ui/cuimenu.cpp
+++ b/src/ui/cuimenu.cpp
@@ -305,7 +305,7 @@ bool cUIMenu::IsSubMenu( cUIControl * Ctrl ) {
Uint32 cUIMenu::OnMessage( const cUIMessage * Msg ) {
switch ( Msg->Msg() ) {
- case cUIMessage::MsgClick:
+ case cUIMessage::MsgMouseUp:
{
cUIEvent ItemEvent( Msg->Sender(), cUIEvent::EventOnItemClicked );
SendEvent( &ItemEvent );
@@ -517,7 +517,7 @@ Uint32 cUIMenu::OnKeyDown( const cUIEventKey& Event ) {
if ( NULL != mItemSelected ) {
mItemSelected->SendMouseEvent(cUIEvent::EventMouseClick, cUIManager::instance()->GetMousePos(), 0xFFFFFFFF );
- cUIMessage Msg( mItemSelected, cUIMessage::MsgClick, 0xFFFFFFFF );
+ cUIMessage Msg( mItemSelected, cUIMessage::MsgMouseUp, 0xFFFFFFFF );
mItemSelected->MessagePost( &Msg );
}
diff --git a/src/ui/cuimenucheckbox.cpp b/src/ui/cuimenucheckbox.cpp
index c77f8e9f7..fe86e0d9c 100644
--- a/src/ui/cuimenucheckbox.cpp
+++ b/src/ui/cuimenucheckbox.cpp
@@ -75,8 +75,8 @@ void cUIMenuCheckBox::SwitchActive() {
Active( !mActive );
}
-Uint32 cUIMenuCheckBox::OnMouseClick( const eeVector2i &Pos, Uint32 Flags ) {
- cUIMenuItem::OnMouseClick( Pos, Flags );
+Uint32 cUIMenuCheckBox::OnMouseUp( const eeVector2i &Pos, Uint32 Flags ) {
+ cUIMenuItem::OnMouseUp( Pos, Flags );
SwitchActive();
diff --git a/src/ui/cuimenucheckbox.hpp b/src/ui/cuimenucheckbox.hpp
index aedf5c4bb..0542dd522 100644
--- a/src/ui/cuimenucheckbox.hpp
+++ b/src/ui/cuimenucheckbox.hpp
@@ -25,7 +25,7 @@ class cUIMenuCheckBox : public cUIMenuItem {
cUISkin * mSkinActive;
cUISkin * mSkinInactive;
- virtual Uint32 OnMouseClick( const eeVector2i &Pos, Uint32 Flags );
+ virtual Uint32 OnMouseUp( const eeVector2i &Pos, Uint32 Flags );
virtual void OnStateChange();
};
diff --git a/src/ui/cuimessage.hpp b/src/ui/cuimessage.hpp
index e30ef6c16..058955a0d 100644
--- a/src/ui/cuimessage.hpp
+++ b/src/ui/cuimessage.hpp
@@ -15,6 +15,7 @@ class EE_API cUIMessage {
MsgDoubleClick,
MsgMouseEnter,
MsgMouseExit,
+ MsgMouseUp,
MsgWindowResize,
MsgFocus,
MsgFocusLoss,
diff --git a/src/ui/cuipopupmenu.cpp b/src/ui/cuipopupmenu.cpp
index de463514c..9a418bdd3 100644
--- a/src/ui/cuipopupmenu.cpp
+++ b/src/ui/cuipopupmenu.cpp
@@ -62,7 +62,7 @@ void cUIPopUpMenu::OnComplexControlFocusLoss() {
Uint32 cUIPopUpMenu::OnMessage( const cUIMessage * Msg ) {
switch ( Msg->Msg() ) {
- case cUIMessage::MsgClick:
+ case cUIMessage::MsgMouseUp:
{
if ( !Msg->Sender()->IsType( UI_TYPE_MENUSUBMENU ) ) {
SendCommonEvent( cUIEvent::EventOnHideByClick );
diff --git a/src/window/base.hpp b/src/window/base.hpp
index 4381ab4c2..0b08121e0 100644
--- a/src/window/base.hpp
+++ b/src/window/base.hpp
@@ -26,7 +26,7 @@ typedef Window X11Window;
using namespace EE::Utils;
#include "../system/ctimeelapsed.hpp"
-#include "../system/singleton.hpp"
+#include "../system/tsingleton.hpp"
#include "../system/clog.hpp"
using namespace EE::System;