PopUp Menu now response on Mouse Up instead on Click.

Renamed singleton.hpp to tsingleton.hpp for consistency.
Fixed GLES rendering.
This commit is contained in:
spartanj
2010-12-13 23:13:05 -03:00
parent fae20a1e0e
commit 2ab8e3eedd
20 changed files with 253 additions and 121 deletions

View File

@@ -499,7 +499,7 @@
<Unit filename="src/system/ctimer.hpp" />
<Unit filename="src/system/czip.cpp" />
<Unit filename="src/system/czip.hpp" />
<Unit filename="src/system/singleton.hpp" />
<Unit filename="src/system/tsingleton.hpp" />
<Unit filename="src/system/tcontainer.hpp" />
<Unit filename="src/system/tresourcemanager.hpp" />
<Unit filename="src/test/ee.cpp" />

View File

@@ -503,7 +503,7 @@
<Unit filename="src\system\ctimer.hpp" />
<Unit filename="src\system\czip.cpp" />
<Unit filename="src\system\czip.hpp" />
<Unit filename="src\system\singleton.hpp" />
<Unit filename="src\system\tsingleton.hpp" />
<Unit filename="src\system\tcontainer.hpp" />
<Unit filename="src\system\tresourcemanager.hpp" />
<Unit filename="src\test\ee.cpp" />

View File

@@ -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"

View File

@@ -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"

View File

@@ -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

View File

@@ -120,7 +120,14 @@ void cBatchRenderer::Flush() {
glTexCoordPointer(2, GL_FLOAT, sizeof(eeVertex), reinterpret_cast<char*> ( &mVertex[0] ) + sizeof(eeVector2f) );
glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(eeVertex), reinterpret_cast<char*> ( &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() {

View File

@@ -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<eeVertexCoords>& RenderCoords = TextCache.VertextCoords();
std::vector<eeColorA>& 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<char*>( &Colors[0] ) );
glTexCoordPointer( 2, GL_FLOAT, sizeof(eeVertexCoords), reinterpret_cast<char*>( &RenderCoords[ numvert - 4 ] ) );
glVertexPointer( 2, GL_FLOAT, sizeof(eeVertexCoords), reinterpret_cast<char*>( &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<char*>( &Colors[0] ) );
glTexCoordPointer( 2, GL_FLOAT, sizeof(eeVertexCoords), reinterpret_cast<char*>( &RenderCoords[0] ) );
glVertexPointer( 2, GL_FLOAT, sizeof(eeVertexCoords), reinterpret_cast<char*>( &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<char*>( &mColors[0] ) );
glTexCoordPointer( 2, GL_FLOAT, sizeof(eeVertexCoords), reinterpret_cast<char*>( &mRenderCoords[ numvert - 4 ] ) );
glVertexPointer( 2, GL_FLOAT, sizeof(eeVertexCoords), reinterpret_cast<char*>( &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<char*>( &mColors[0] ) );
glTexCoordPointer( 2, GL_FLOAT, sizeof(eeVertexCoords), reinterpret_cast<char*>( &mRenderCoords[0] ) );
glVertexPointer( 2, GL_FLOAT, sizeof(eeVertexCoords), reinterpret_cast<char*>( &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 )

View File

@@ -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 );
}
}

View File

@@ -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);
}

View File

@@ -2,7 +2,7 @@
#define EECLOG_H
#include "base.hpp"
#include "singleton.hpp"
#include "tsingleton.hpp"
namespace EE { namespace System {

View File

@@ -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<cUIMenuCheckBox*> ( 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 );

View File

@@ -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"

View File

@@ -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() );

View File

@@ -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 );
}

View File

@@ -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();

View File

@@ -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();
};

View File

@@ -15,6 +15,7 @@ class EE_API cUIMessage {
MsgDoubleClick,
MsgMouseEnter,
MsgMouseExit,
MsgMouseUp,
MsgWindowResize,
MsgFocus,
MsgFocusLoss,

View File

@@ -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 );

View File

@@ -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;