mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-06-02 11:36:30 +03:00
A couple of minor changes on the UI.
This commit is contained in:
@@ -292,7 +292,7 @@ void cEETest::Init() {
|
||||
|
||||
if ( Mus.OpenFromPack( &PAK, "music.ogg" ) ) {
|
||||
Mus.Loop(true);
|
||||
Mus.Volume( 0.f );
|
||||
//Mus.Volume( 0.f );
|
||||
Mus.Play();
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,8 @@ cUIManager::cUIManager() :
|
||||
mControl( NULL ),
|
||||
mFocusControl( NULL ),
|
||||
mOverControl( NULL ),
|
||||
mDownControl( NULL ),
|
||||
mFirstPress( false ),
|
||||
mCbId(-1)
|
||||
{
|
||||
mEE = cEngine::instance();
|
||||
@@ -118,14 +120,33 @@ void cUIManager::SendMsg( cUIControl * Ctrl, const Uint32& Msg, const Uint32& Fl
|
||||
|
||||
void cUIManager::Update() {
|
||||
mElapsed = mEE->Elapsed();
|
||||
|
||||
|
||||
mControl->Update();
|
||||
|
||||
|
||||
if ( mKM->PressTrigger() ) {
|
||||
if ( NULL != mOverControl ) {
|
||||
if ( mOverControl != mFocusControl ) {
|
||||
mOverControl->OnFocus();
|
||||
mFocusControl->OnFocusLoss();
|
||||
|
||||
mFocusControl = mOverControl;
|
||||
}
|
||||
|
||||
mOverControl->OnMouseDown( mKM->GetMousePos(), mKM->PressTrigger() );
|
||||
}
|
||||
|
||||
if ( !mFirstPress ) {
|
||||
mDownControl = mOverControl;
|
||||
|
||||
mFirstPress = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ( mKM->ReleaseTrigger() ) {
|
||||
if ( NULL != mFocusControl ) {
|
||||
mFocusControl->OnMouseUp( mKM->GetMousePos(), mKM->ReleaseTrigger() );
|
||||
|
||||
if ( mKM->ClickTrigger() ) {
|
||||
if ( mDownControl == mOverControl && mKM->ClickTrigger() ) {
|
||||
SendMsg( mFocusControl, cUIMessage::MsgClick, mKM->ClickTrigger() );
|
||||
mFocusControl->OnMouseClick( mKM->GetMousePos(), mKM->ClickTrigger() );
|
||||
|
||||
@@ -135,6 +156,8 @@ void cUIManager::Update() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mFirstPress = false;
|
||||
}
|
||||
|
||||
cUIControl * pOver = mControl->OverFind( mKM->GetMousePos() );
|
||||
@@ -156,19 +179,6 @@ void cUIManager::Update() {
|
||||
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() );
|
||||
}
|
||||
}
|
||||
|
||||
mControl->CheckClose();
|
||||
}
|
||||
|
||||
|
||||
@@ -45,9 +45,9 @@ class EE_API cUIManager : public tSingleton<cUIManager> {
|
||||
void SetTheme( const std::string& Theme );
|
||||
|
||||
void SetTheme( cUITheme * Theme );
|
||||
|
||||
|
||||
eeVector2i GetMousePos();
|
||||
|
||||
|
||||
cInput * GetInput() const;
|
||||
protected:
|
||||
cEngine * mEE;
|
||||
@@ -57,6 +57,8 @@ class EE_API cUIManager : public tSingleton<cUIManager> {
|
||||
cUIControlAnim * mControl;
|
||||
cUIControl * mFocusControl;
|
||||
cUIControl * mOverControl;
|
||||
cUIControl * mDownControl;
|
||||
bool mFirstPress;
|
||||
|
||||
eeFloat mElapsed;
|
||||
|
||||
|
||||
@@ -76,12 +76,10 @@ void cUITextInput::Draw() {
|
||||
}
|
||||
}
|
||||
|
||||
Uint32 cUITextInput::OnFocus() {
|
||||
Uint32 cUITextInput::OnMouseClick( const eeVector2i& Pos, const Uint32 Flags ) {
|
||||
mTextBuffer.Active( true );
|
||||
ResetWaitCursor();
|
||||
|
||||
cUITextBox::OnFocus();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ class EE_API cUITextInput : public cUITextBox {
|
||||
|
||||
virtual void Draw();
|
||||
|
||||
virtual Uint32 OnFocus();
|
||||
virtual Uint32 OnMouseClick( const eeVector2i& Pos, const Uint32 Flags );
|
||||
|
||||
virtual Uint32 OnFocusLoss();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user