Some fixes to the UI.

This commit is contained in:
spartanj
2010-06-28 03:15:01 -03:00
parent dc93fa9638
commit b6502cd856
10 changed files with 288 additions and 197 deletions

View File

@@ -12,12 +12,8 @@
<Option type="1" />
<Option compiler="gcc" />
<Compiler>
<Add option="-pg" />
<Add option="-g" />
</Compiler>
<Linker>
<Add option="-pg" />
</Linker>
</Target>
<Target title="Release">
<Option output="eetest" prefix_auto="1" extension_auto="1" />

View File

@@ -8,6 +8,10 @@ cShaderProgramManager::cShaderProgramManager()
cShaderProgramManager::~cShaderProgramManager()
{
std::map<std::string, cShaderProgram*>::iterator it;
for ( it = mShaders.begin(); it != mShaders.end(); it++ )
delete it->second;
}
void cShaderProgramManager::Add( cShaderProgram * ShaderProgram ) {

View File

@@ -31,7 +31,7 @@ class cUITest : public cUIControlAnim {
class cUITest2 : public cUIControl {
public:
cUITest2( cUIControl::CreateParams& Params ) : cUIControl( Params ) { mOldColor = mBackground.Color(); }
cUITest2( cUIControl::CreateParams& Params ) : cUIControl( Params ) { mOldColor = mBackground.Color(); }
virtual Uint32 OnMouseEnter( const eeVector2i& Pos, const Uint32 Flags ) { mBackground.Color( eeColorA( mOldColor.R(), mOldColor.G(), mOldColor.B(), 200 ) ); return 1; }
virtual Uint32 OnMouseExit( const eeVector2i& Pos, const Uint32 Flags ) { mBackground.Color( mOldColor ); return 1; }
protected:
@@ -245,20 +245,18 @@ void cEETest::Init() {
cUIManager::instance()->Init();
cUIControl::CreateParams Params( cUIManager::instance()->MainControl(), eeVector2i(0,0), eeSize( 320, 240 ), UI_FILL_BACKGROUND );
Params.Background.Color( eeColorA( 0x66CC0000 ) );
Params.Flags |= UI_CLIP_ENABLE;
Params.Background.Color( eeColorA( 0x66CC0000 ) );
cUIControlAnim * C = new cUITest( Params );
C->Visible( true );
C->Enabled( true );
C->Pos( 320, 240 );
//C->Angle( 50.f );
//C->Scale( 2.f );
C->StartRotation( 0.f, 360.f * 10.f, 5000.f * 10.f );
C->DragEnable( true );
C->StartRotation( 0.f, 360.f, 2500.f );
Params.Flags &= ~UI_CLIP_ENABLE;
Params.Flags &= ~UI_BORDER;
Params.Background.Color( eeColorA( 0x7700FF00 ) );
Params.Parent( C );
Params.Size = eeSize( 50, 50 );
@@ -266,8 +264,6 @@ void cEETest::Init() {
Child->Pos( 25, 50 );
Child->Visible( true );
Child->Enabled( true );
Child->Angle( 150 );
Child->Scale( 2.f );
Child->StartRotation( 0.f, 360.f * 10.f, 5000.f * 10.f );
Params.Background.Color( eeColorA( 0x77FFFF00 ) );
@@ -277,7 +273,6 @@ void cEETest::Init() {
Child2->Pos( 15, 15 );
Child2->Visible( true );
Child2->Enabled( true );
Child2->Angle( 120 );
Child2->StartRotation( 0.f, 360.f * 10.f, 5000.f * 10.f );
cUIControl::CreateParams Params2;
@@ -286,13 +281,11 @@ void cEETest::Init() {
Params2.Border.Width( 4 );
Params2.Parent( C );
Params2.PosSet( 320 - 25, 240 - 45 );
Params2.Size = eeSize( 25, 25 );
cUITest2 * Ctrl = new cUITest2( Params2 );
Params2.Size = eeSize( 50, 50 );
cUITest * Ctrl = new cUITest( Params2 );
Ctrl->Visible( true );
Ctrl->Enabled( true );
C->DragEnable( true );
cUIGfx::CreateParams GfxParams;
GfxParams.Parent( C );
GfxParams.PosSet( 160, 100 );
@@ -300,13 +293,21 @@ void cEETest::Init() {
GfxParams.Size = eeSize( 64, 64 );
GfxParams.Shape = cShapeManager::instance()->Add( TN[2] );
cUIGfx * Gfx = new cUIGfx( GfxParams );
//Gfx->Scale( 2.f );
Gfx->Angle( 45.f );
Gfx->Visible( true );
Gfx->Enabled( true );
Gfx->StartAlphaAnim( 100.f, 255.f, 1000.f );
Gfx->AlphaInterpolation().Loop( true );
Gfx->AlphaInterpolation().SetTotalTime( 1000.f );
Gfx->AlphaInterpolation()->Loop( true );
Gfx->AlphaInterpolation()->SetTotalTime( 1000.f );
Params2.Parent( Gfx );
Params2.PosSet( -25, -25 );
Params2.Size = eeSize( 50, 50 );
Params2.Background.Color( eeColorA( 0x7700F0FF ) );
Params2.Flags &= ~UI_BORDER;
Ctrl = new cUITest( Params2 );
Ctrl->Visible( true );
Ctrl->Enabled( true );
cUITextBox::CreateParams TextParams;
TextParams.Parent( C );

View File

@@ -19,7 +19,7 @@ cUIControl::cUIControl( const CreateParams& Params ) :
mBlend( Params.Blend )
{
mType |= UI_TYPE_GET(UI_TYPE_CONTROL);
if ( NULL != mParentCtrl )
mParentCtrl->ChildAdd( this );
@@ -412,29 +412,75 @@ void cUIControl::CheckClose() {
}
}
void cUIControl::ClipTo() {
if ( !IsClipped() && NULL != Parent() ) {
cUIControl * parent = Parent();
while ( NULL != parent ) {
if ( parent->IsClipped() ) {
Parent()->ClipMe();
parent = NULL;
} else {
parent = Parent()->Parent();
}
}
}
}
void cUIControl::DrawChilds() {
cUIControl * ChildLoop = mChild;
while ( NULL != ChildLoop ) {
if ( ChildLoop->Visible() ) {
ChildLoop->InternalDraw();
}
ChildLoop = ChildLoop->NextGet();
}
}
void cUIControl::InternalDraw() {
if ( mVisible ) {
if ( IsClipped() ) {
eeVector2i Pos( mPos );
ControlToScreen( Pos );
cEngine::instance()->ClipEnable( Pos.x, Pos.y, mSize.Width(), mSize.Height() );
}
ClipTo();
MatrixSet();
ClipMe();
Draw();
cUIControl * ChildLoop = mChild;
while ( NULL != ChildLoop ) {
if ( ChildLoop->Visible() )
ChildLoop->InternalDraw();
DrawChilds();
ChildLoop = ChildLoop->NextGet();
}
ClipDisable();
if ( IsClipped() )
cEngine::instance()->ClipDisable();
MatrixUnset();
}
}
void cUIControl::ClipMe() {
if ( IsClipped() )
cUIManager::instance()->ClipEnable( mScreenPos.x, mScreenPos.y, mSize.Width(), mSize.Height() );
}
void cUIControl::ClipDisable() {
if ( IsClipped() )
cUIManager::instance()->ClipDisable();
}
void cUIControl::MatrixSet() {
if ( IsClipped() ) {
eeVector2i Pos( mPos );
ControlToScreen( Pos );
mScreenPos = Pos;
}
}
void cUIControl::MatrixUnset() {
}
void cUIControl::ChildDeleteAll() {
while( NULL != mChild )
delete mChild;

View File

@@ -131,31 +131,31 @@ class EE_API cUIControl {
void Parent( cUIControl * parent );
void CenterHorizontal();
void CenterVertical();
void Center();
void Close();
virtual void Draw();
virtual void Update();
virtual Uint32 OnKeyDown( const cUIEventKey& _Event );
virtual Uint32 OnKeyUp( const cUIEventKey& _Event );
virtual Uint32 OnMouseMove( const eeVector2i& Pos, const Uint32 Flags );
virtual Uint32 OnMouseDown( const eeVector2i& Pos, const Uint32 Flags );
virtual Uint32 OnMouseClick( const eeVector2i& Pos, const Uint32 Flags );
virtual Uint32 OnMouseDoubleClick( const eeVector2i& Pos, const Uint32 Flags );
virtual Uint32 OnMouseUp( const eeVector2i& Pos, const Uint32 Flags );
virtual Uint32 OnMouseEnter( const eeVector2i& Pos, const Uint32 Flags );
virtual Uint32 OnMouseExit( const eeVector2i& Pos, const Uint32 Flags );
@@ -213,6 +213,7 @@ class EE_API cUIControl {
bool mVisible;
bool mEnabled;
eeVector2i mPos;
eeVector2i mScreenPos;
eeSize mSize;
cUIControl * mParentCtrl;
Uint32 mFlags;
@@ -270,6 +271,18 @@ class EE_API cUIControl {
virtual cUIControl * OverFind( const eeVector2i& Point );
virtual void UpdateQuad();
void ClipMe();
void ClipDisable();
virtual void MatrixSet();
virtual void MatrixUnset();
virtual void ClipTo();
virtual void DrawChilds();
};
}}

View File

@@ -7,7 +7,11 @@ cUIControlAnim::cUIControlAnim( const CreateParams& Params ) :
cUIDragable( Params ),
mAngle(0.f),
mScale(1.f),
mAlpha(255.f)
mAlpha(255.f),
mAngleAnim(NULL),
mScaleAnim(NULL),
mAlphaAnim(NULL),
mMoveAnim(NULL)
{
mType |= UI_TYPE_GET(UI_TYPE_CONTROL_ANIM);
mControlFlags |= UI_CTRL_FLAG_ANIM;
@@ -15,6 +19,10 @@ cUIControlAnim::cUIControlAnim( const CreateParams& Params ) :
}
cUIControlAnim::~cUIControlAnim() {
eeSAFE_DELETE( mAlphaAnim );
eeSAFE_DELETE( mAngleAnim );
eeSAFE_DELETE( mScaleAnim );
eeSAFE_DELETE( mMoveAnim );
}
const eeFloat& cUIControlAnim::Angle() const {
@@ -53,7 +61,7 @@ cUIControl * cUIControlAnim::OverFind( const eeVector2i& Point ) {
UpdateQuad();
eeVector2f Localf( (eeFloat)Point.x, (eeFloat)Point.y );
if ( IntersectQuad2( mQuad, eeQuad2f( Localf, Localf, Localf, Localf ) ) ) {
cUIControl * ChildLoop = mChild;
@@ -74,109 +82,111 @@ cUIControl * cUIControlAnim::OverFind( const eeVector2i& Point ) {
return pOver;
}
void cUIControlAnim::InternalDraw() {
if ( mVisible ) {
eeVector2i Pos( mPos );
if ( mScale != 1.f || mAngle != 0.f || IsClipped() )
ControlToScreen( Pos );
if ( mScale != 1.f || mAngle != 0.f ) {
glPushMatrix();
eeVector2f Center( Pos.x + mSize.Width() * 0.5f, Pos.y + mSize.Height() * 0.5f );
glTranslatef( Center.x , Center.y, 0.f );
glRotatef( mAngle, 0.0f, 0.0f, 1.0f );
glScalef( mScale, mScale, 1.0f );
glTranslatef( -Center.x, -Center.y, 0.f );
}
if ( IsClipped() )
cUIManager::instance()->ClipEnable( Pos.x, Pos.y, mSize.x, mSize.y );
Draw();
cUIControl * ChildLoop = mChild;
while ( NULL != ChildLoop ) {
if ( ChildLoop->Visible() )
ChildLoop->InternalDraw();
void cUIControlAnim::MatrixSet() {
eeVector2i Pos( mPos );
ChildLoop = ChildLoop->NextGet();
}
if ( IsClipped() ) {
cUIManager::instance()->ClipDisable();
}
if ( mScale != 1.f || mAngle != 0.f )
glPopMatrix();
if ( mScale != 1.f || mAngle != 0.f || IsClipped() ) {
ControlToScreen( Pos );
mScreenPos = Pos;
}
if ( mScale != 1.f || mAngle != 0.f ) {
glPushMatrix();
eeVector2f Center( mScreenPos.x + mSize.Width() * 0.5f, mScreenPos.y + mSize.Height() * 0.5f );
glTranslatef( Center.x , Center.y, 0.f );
glRotatef( mAngle, 0.0f, 0.0f, 1.0f );
glScalef( mScale, mScale, 1.0f );
glTranslatef( -Center.x, -Center.y, 0.f );
}
}
void cUIControlAnim::MatrixUnset() {
if ( mScale != 1.f || mAngle != 0.f ) {
glPopMatrix();
}
}
void cUIControlAnim::Update() {
cUIDragable::Update();
if ( mMoveAnim.Enabled() ) {
mMoveAnim.Update( cUIManager::instance()->Elapsed() );
Pos( (Int32)mMoveAnim.GetPos().x, (Int32)mMoveAnim.GetPos().y );
if ( NULL != mMoveAnim && mMoveAnim->Enabled() ) {
mMoveAnim->Update( cUIManager::instance()->Elapsed() );
Pos( (eeInt)mMoveAnim->GetPos().x, (eeInt)mMoveAnim->GetPos().y );
}
if ( mAlphaAnim.Enabled() ) {
mAlphaAnim.Update( cUIManager::instance()->Elapsed() );
Alpha( mAlphaAnim.GetRealPos() );
if ( NULL != mAlphaAnim && mAlphaAnim->Enabled() ) {
mAlphaAnim->Update( cUIManager::instance()->Elapsed() );
Alpha( mAlphaAnim->GetRealPos() );
}
if ( mScaleAnim.Enabled() ) {
mScaleAnim.Update( cUIManager::instance()->Elapsed() );
Scale( mScaleAnim.GetRealPos() );
if ( NULL != mScaleAnim && mScaleAnim->Enabled() ) {
mScaleAnim->Update( cUIManager::instance()->Elapsed() );
Scale( mScaleAnim->GetRealPos() );
}
if ( mAngleAnim.Enabled() ) {
mAngleAnim.Update( cUIManager::instance()->Elapsed() );
Angle( mAngleAnim.GetRealPos() );
if ( NULL != mAngleAnim && mAngleAnim->Enabled() ) {
mAngleAnim->Update( cUIManager::instance()->Elapsed() );
Angle( mAngleAnim->GetRealPos() );
}
if ( ( mControlFlags & UI_CTRL_FLAG_CLOSE_FO ) && mAlphaAnim.Ended() )
if ( ( mControlFlags & UI_CTRL_FLAG_CLOSE_FO ) && ( NULL != mAlphaAnim && mAlphaAnim->Ended() ) )
Close();
}
bool cUIControlAnim::Animating() {
return mAlphaAnim.Enabled() || mAngleAnim.Enabled() || mScaleAnim.Enabled() || mMoveAnim.Enabled();
return ( NULL != mAlphaAnim && mAlphaAnim->Enabled() ) || ( NULL != mAngleAnim && mAngleAnim->Enabled() ) || ( NULL != mScaleAnim && mScaleAnim->Enabled() ) || ( NULL != mMoveAnim && mMoveAnim->Enabled() );
}
void cUIControlAnim::StartAlphaAnim( const eeFloat& From, const eeFloat& To, const eeFloat& TotalTime, cInterpolation::OnPathEndCallback PathEndCallback ) {
mAlphaAnim.ClearWaypoints();
mAlphaAnim.AddWaypoint( From );
mAlphaAnim.AddWaypoint( To );
mAlphaAnim.SetTotalTime( TotalTime );
mAlphaAnim.Start( PathEndCallback );
if ( NULL == mAlphaAnim )
mAlphaAnim = new cInterpolation();
mAlphaAnim->ClearWaypoints();
mAlphaAnim->AddWaypoint( From );
mAlphaAnim->AddWaypoint( To );
mAlphaAnim->SetTotalTime( TotalTime );
mAlphaAnim->Start( PathEndCallback );
Alpha( From );
}
void cUIControlAnim::StartScaleAnim( const eeFloat& From, const eeFloat& To, const eeFloat& TotalTime, cInterpolation::OnPathEndCallback PathEndCallback ) {
mScaleAnim.ClearWaypoints();
mScaleAnim.AddWaypoint( From );
mScaleAnim.AddWaypoint( To );
mScaleAnim.SetTotalTime( TotalTime );
mScaleAnim.Start( PathEndCallback );
if ( NULL == mScaleAnim )
mScaleAnim = new cInterpolation();
mScaleAnim->ClearWaypoints();
mScaleAnim->AddWaypoint( From );
mScaleAnim->AddWaypoint( To );
mScaleAnim->SetTotalTime( TotalTime );
mScaleAnim->Start( PathEndCallback );
Scale( From );
}
void cUIControlAnim::StartMovement( const eeVector2i& From, const eeVector2i& To, const eeFloat& TotalTime, cWaypoints::OnPathEndCallback PathEndCallback ) {
mMoveAnim.ClearWaypoints();
mMoveAnim.AddWaypoint( eeVector2f( (eeFloat)From.x, (eeFloat)From.y ) );
mMoveAnim.AddWaypoint( eeVector2f( (eeFloat)To.x, (eeFloat)To.y ) );
mMoveAnim.SetTotalTime( TotalTime );
mMoveAnim.Start( PathEndCallback );
if ( NULL == mMoveAnim )
mMoveAnim = new cWaypoints();
mMoveAnim->ClearWaypoints();
mMoveAnim->AddWaypoint( eeVector2f( (eeFloat)From.x, (eeFloat)From.y ) );
mMoveAnim->AddWaypoint( eeVector2f( (eeFloat)To.x, (eeFloat)To.y ) );
mMoveAnim->SetTotalTime( TotalTime );
mMoveAnim->Start( PathEndCallback );
Pos( From );
}
void cUIControlAnim::StartRotation( const eeFloat& From, const eeFloat& To, const eeFloat& TotalTime, cInterpolation::OnPathEndCallback PathEndCallback ) {
mAngleAnim.ClearWaypoints();
mAngleAnim.AddWaypoint( From );
mAngleAnim.AddWaypoint( To );
mAngleAnim.SetTotalTime( TotalTime );
mAngleAnim.Start( PathEndCallback );
if ( NULL == mAngleAnim )
mAngleAnim = new cInterpolation();
mAngleAnim->ClearWaypoints();
mAngleAnim->AddWaypoint( From );
mAngleAnim->AddWaypoint( To );
mAngleAnim->SetTotalTime( TotalTime );
mAngleAnim->Start( PathEndCallback );
Angle( From );
}
@@ -191,7 +201,7 @@ void cUIControlAnim::CreateFadeOut( const eeFloat& Time ) {
void cUIControlAnim::BackgroundDraw() {
eeVector2i Pos( mPos.x, mPos.y );
ControlToScreen( Pos );
cPrimitives P;
P.SetColor( GetColor( mBackground.Color() ) );
P.DrawRectangle( (eeFloat)Pos.x, (eeFloat)Pos.y, (eeFloat)mSize.Width(), (eeFloat)mSize.Height(), 0.f, 1.f, DRAW_FILL, mBackground.Blend() );
@@ -200,7 +210,7 @@ void cUIControlAnim::BackgroundDraw() {
void cUIControlAnim::BorderDraw() {
eeVector2i Pos( mPos.x, mPos.y );
ControlToScreen( Pos );
cPrimitives P;
P.SetColor( GetColor( mBorder.Color() ) );
P.DrawRectangle( (eeFloat)Pos.x, (eeFloat)Pos.y, (eeFloat)mSize.Width(), (eeFloat)mSize.Height(), 0.f, 1.f, DRAW_LINE, mBlend, (eeFloat)mBorder.Width() );
@@ -226,40 +236,52 @@ const eeVector2f& cUIControlAnim::GetQuadCenter() const {
void cUIControlAnim::UpdateQuad() {
eeVector2i Pos = mPos;
ControlToScreen( Pos );
mQuad = AABBtoQuad2( eeAABB( (eeFloat)Pos.x, (eeFloat)Pos.y, (eeFloat)Pos.x + mSize.Width(), (eeFloat)Pos.y + mSize.Height() ) );
mCenter = eeVector2f( (eeFloat)Pos.x + (eeFloat)mSize.Width() * 0.5f, (eeFloat)Pos.y + (eeFloat)mSize.Height() * 0.5f );
mQuad.Rotate( mAngle, mCenter );
mQuad.Scale( mScale, mCenter );
cUIControl * tParent = Parent();
while ( tParent ) {
if ( tParent->IsAnimated() ) {
cUIControlAnim * tP = reinterpret_cast<cUIControlAnim *> ( tParent );
mQuad.Rotate( tP->Angle(), tP->GetQuadCenter() );
mQuad.Scale( tP->Scale(), tP->GetQuadCenter() );
}
tParent = tParent->Parent();
};
}
cInterpolation& cUIControlAnim::AngleInterpolation() {
cInterpolation * cUIControlAnim::AngleInterpolation() {
if ( NULL == mAngleAnim )
mAngleAnim = new cInterpolation();
return mAngleAnim;
}
cInterpolation& cUIControlAnim::ScaleInterpolation() {
cInterpolation * cUIControlAnim::ScaleInterpolation() {
if ( NULL == mScaleAnim )
mScaleAnim = new cInterpolation();
return mScaleAnim;
}
cInterpolation& cUIControlAnim::AlphaInterpolation() {
cInterpolation * cUIControlAnim::AlphaInterpolation() {
if ( NULL == mAlphaAnim )
mAlphaAnim = new cInterpolation();
return mAlphaAnim;
}
cWaypoints& cUIControlAnim::MovementInterpolation() {
cWaypoints * cUIControlAnim::MovementInterpolation() {
if ( NULL == mMoveAnim )
mMoveAnim = new cWaypoints();
return mMoveAnim;
}

View File

@@ -10,79 +10,81 @@ namespace EE { namespace UI {
class EE_API cUIControlAnim : public cUIDragable {
public:
cUIControlAnim( const CreateParams& Params );
virtual ~cUIControlAnim();
virtual void Update();
const eeFloat& Angle() const;
void Angle( const eeFloat& angle );
const eeFloat& Scale() const;
void Scale( const eeFloat& scale );
const eeFloat& Alpha() const;
virtual void Alpha( const eeFloat& alpha );
bool Animating();
void StartAlphaAnim( const eeFloat& From, const eeFloat& To, const eeFloat& TotalTime, cInterpolation::OnPathEndCallback PathEndCallback = 0 );
void StartScaleAnim( const eeFloat& From, const eeFloat& To, const eeFloat& TotalTime, cInterpolation::OnPathEndCallback PathEndCallback = 0 );
void StartMovement( const eeVector2i& From, const eeVector2i& To, const eeFloat& TotalTime, cWaypoints::OnPathEndCallback PathEndCallback = 0 );
void StartRotation( const eeFloat& From, const eeFloat& To, const eeFloat& TotalTime, cInterpolation::OnPathEndCallback PathEndCallback = 0 );
void CreateFadeIn( const eeFloat& Time );
void CreateFadeOut( const eeFloat& Time );
void CloseFadeOut( const eeFloat& Time );
const eeQuad2f& GetQuad() const;
const eeVector2f& GetQuadCenter() const;
cInterpolation& AngleInterpolation();
cInterpolation& ScaleInterpolation();
cInterpolation& AlphaInterpolation();
cWaypoints& MovementInterpolation();
cInterpolation * AngleInterpolation();
cInterpolation * ScaleInterpolation();
cInterpolation * AlphaInterpolation();
cWaypoints * MovementInterpolation();
protected:
friend class cUIManager;
eeFloat mAngle;
eeFloat mScale;
eeFloat mAlpha;
cInterpolation mAngleAnim;
cInterpolation mScaleAnim;
cInterpolation mAlphaAnim;
cWaypoints mMoveAnim;
virtual void InternalDraw();
eeFloat mAngle;
eeFloat mScale;
eeFloat mAlpha;
cInterpolation * mAngleAnim;
cInterpolation * mScaleAnim;
cInterpolation * mAlphaAnim;
cWaypoints * mMoveAnim;
virtual cUIControl * OverFind( const eeVector2i& Point );
virtual void BackgroundDraw();
virtual void BorderDraw();
eeColorA GetColor( const eeColorA& Col );
virtual void UpdateQuad();
virtual void OnAngleChange();
virtual void OnScaleChange();
virtual void OnAlphaChange();
void MatrixSet();
void MatrixUnset();
};
}}

View File

@@ -110,16 +110,16 @@ void cUIManager::Update() {
if ( mKM->ReleaseTrigger() ) {
if ( NULL != mFocusControl ) {
mFocusControl->OnMouseUp( mKM->GetMousePos(), mKM->ReleaseTrigger() );
if ( mKM->ClickTrigger() ) {
mFocusControl->OnMouseClick( mKM->GetMousePos(), mKM->ClickTrigger() );
if ( mKM->DoubleClickTrigger() )
mFocusControl->OnMouseDoubleClick( mKM->GetMousePos(), mKM->DoubleClickTrigger() );
}
}
}
cUIControl * pOver = mControl->OverFind( mKM->GetMousePos() );
if ( pOver != mOverControl ) {
@@ -128,9 +128,9 @@ void cUIManager::Update() {
cUIMessage Msg( mOverControl, cUIMessage::MouseExit );
mOverControl->MessagePost( &Msg );
}
mOverControl = pOver;
if ( NULL != mOverControl ) {
mOverControl->OnMouseEnter( mKM->GetMousePos(), 0 );
cUIMessage Msg( mOverControl, cUIMessage::MouseEnter );
@@ -140,16 +140,16 @@ void cUIManager::Update() {
if ( NULL != mOverControl )
mOverControl->OnMouseMove( mKM->GetMousePos(), mKM->PressTrigger() );
}
if ( mKM->PressTrigger() ) {
if ( NULL != mOverControl ) {
if ( mOverControl != mFocusControl ) {
mOverControl->OnFocus();
mFocusControl->OnFocusLoss();
mFocusControl = mOverControl;
}
mOverControl->OnMouseDown( mKM->GetMousePos(), mKM->PressTrigger() );
}
}
@@ -175,28 +175,29 @@ void cUIManager::ClipEnable( const Int32& x, const Int32& y, const Int32& Width,
GLdouble tY = (GLdouble)y;
GLdouble tW = (GLdouble)Width;
GLdouble tH = (GLdouble)Height;
GLdouble clip_left[] = { 1.0, 0.0, 0.0, 0.0 };
clip_left[3] = -tX;
GLdouble clip_right[] = { -1.0, 0.0, 0.0, 0.0 };
clip_right[3] = tX + tW;
GLdouble clip_top[] = { 0.0, 1.0, 0.0, 0.0 };
clip_top[3] = -tY;
GLdouble clip_bottom[] = { 0.0, -1.0, 0.0, 0.0 };
clip_bottom[3] = tY + tH;
glClipPlane(GL_CLIP_PLANE0, clip_left);
glClipPlane(GL_CLIP_PLANE1, clip_right);
glClipPlane(GL_CLIP_PLANE2, clip_top);
glClipPlane(GL_CLIP_PLANE3, clip_bottom);
glEnable(GL_CLIP_PLANE0);
glEnable(GL_CLIP_PLANE1);
glEnable(GL_CLIP_PLANE2);
glEnable(GL_CLIP_PLANE3);
glClipPlane(GL_CLIP_PLANE0, clip_left);
glClipPlane(GL_CLIP_PLANE1, clip_right);
glClipPlane(GL_CLIP_PLANE2, clip_top);
glClipPlane(GL_CLIP_PLANE3, clip_bottom);
}
void cUIManager::ClipDisable() {

View File

@@ -33,9 +33,9 @@ class EE_API cUIManager : public cSingleton<cUIManager> {
void Draw();
const eeFloat& Elapsed() const;
void ClipEnable( const Int32& x, const Int32& y, const Int32& Width, const Int32& Height );
void ClipDisable();
void ResizeControl();

View File

@@ -80,6 +80,12 @@ cEngine::~cEngine() {
cGlobalBatchRenderer::DestroySingleton();
cTextureFactory::DestroySingleton();
#ifdef EE_SHADERS
cShaderProgramManager::DestroySingleton();
#endif
UI::cUIManager::DestroySingleton();
cInput::DestroySingleton();
SDL_Quit();
cLog::DestroySingleton();
@@ -133,7 +139,7 @@ bool cEngine::Init(const Uint32& Width, const Uint32& Height, const Uint8& BitCo
SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16 ); // Depth
SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, (mVideoInfo.DoubleBuffering ? 1 : 0) ); // Double Buffering
SDL_GL_SetAttribute( SDL_GL_STENCIL_SIZE, 1 );
SDL_GL_SetAttribute( SDL_GL_SWAP_CONTROL, (mVideoInfo.VSync ? 1 : 0) ); // VSync
Uint32 mTmpFlags = mVideoInfo.Flags;
@@ -189,7 +195,7 @@ bool cEngine::Init(const Uint32& Width, const Uint32& Height, const Uint8& BitCo
mVideoInfo.SupARB_point = ( GetExtension("GL_ARB_point_parameters") && GetExtension("GL_ARB_point_sprite") );
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT );
mDefaultView.SetView( 0, 0, mVideoInfo.Width, mVideoInfo.Height );
mCurrentView = &mDefaultView;