mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-10-25 23:57:53 +03:00
Added Scene Actions: Enable, Disable, Visible.
Removed all the start[ActionName] functions in UINode in favor of using runAction. --HG-- branch : dev-stateful-drawable
This commit is contained in:
+1
-11
@@ -1,17 +1,7 @@
|
||||
#ifndef EEPP_SCENE_HPP
|
||||
#define EEPP_SCENE_HPP
|
||||
|
||||
#include <eepp/scene/actions/actioninterpolation1d.hpp>
|
||||
#include <eepp/scene/actions/actioninterpolation2d.hpp>
|
||||
#include <eepp/scene/actions/move.hpp>
|
||||
#include <eepp/scene/actions/rotate.hpp>
|
||||
#include <eepp/scene/actions/scale.hpp>
|
||||
#include <eepp/scene/actions/fade.hpp>
|
||||
#include <eepp/scene/actions/marginmove.hpp>
|
||||
#include <eepp/scene/actions/sequence.hpp>
|
||||
#include <eepp/scene/actions/spawn.hpp>
|
||||
#include <eepp/scene/actions/delay.hpp>
|
||||
#include <eepp/scene/actions/close.hpp>
|
||||
#include <eepp/scene/actions/actions.hpp>
|
||||
#include <eepp/scene/action.hpp>
|
||||
#include <eepp/scene/actionmanager.hpp>
|
||||
#include <eepp/scene/event.hpp>
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
#ifndef EE_SCENE_ACTIONS_HPP
|
||||
#define EE_SCENE_ACTIONS_HPP
|
||||
|
||||
#include <eepp/scene/actions/actioninterpolation1d.hpp>
|
||||
#include <eepp/scene/actions/actioninterpolation2d.hpp>
|
||||
#include <eepp/scene/actions/move.hpp>
|
||||
#include <eepp/scene/actions/rotate.hpp>
|
||||
#include <eepp/scene/actions/scale.hpp>
|
||||
#include <eepp/scene/actions/fade.hpp>
|
||||
#include <eepp/scene/actions/marginmove.hpp>
|
||||
#include <eepp/scene/actions/sequence.hpp>
|
||||
#include <eepp/scene/actions/spawn.hpp>
|
||||
#include <eepp/scene/actions/delay.hpp>
|
||||
#include <eepp/scene/actions/close.hpp>
|
||||
#include <eepp/scene/actions/disable.hpp>
|
||||
#include <eepp/scene/actions/visible.hpp>
|
||||
|
||||
#endif
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace EE { namespace Scene { namespace Actions {
|
||||
|
||||
class EE_API Close : public Delay {
|
||||
public:
|
||||
static Close * New( const Time& time );
|
||||
static Close * New( const Time& time = Seconds(0) );
|
||||
|
||||
void update( const Time& time ) override;
|
||||
|
||||
@@ -16,7 +16,7 @@ class EE_API Close : public Delay {
|
||||
Action * reverse() const override;
|
||||
|
||||
protected:
|
||||
Close( const Time& time );
|
||||
explicit Close( const Time& time );
|
||||
|
||||
void onStart() override;
|
||||
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
#ifndef EE_SCENE_ACTION_DISABLE_HPP
|
||||
#define EE_SCENE_ACTION_DISABLE_HPP
|
||||
|
||||
#include <eepp/scene/actions/enable.hpp>
|
||||
|
||||
namespace EE { namespace Scene { namespace Actions {
|
||||
|
||||
class EE_API Disable : public Enable {
|
||||
public:
|
||||
static Disable * New( const Time& time = Seconds(0) );
|
||||
|
||||
Action * clone() const override;
|
||||
protected:
|
||||
explicit Disable( const Time& time );
|
||||
|
||||
};
|
||||
|
||||
}}}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,31 @@
|
||||
#ifndef EE_SCENE_ACTION_ENABLE_HPP
|
||||
#define EE_SCENE_ACTION_ENABLE_HPP
|
||||
|
||||
#include <eepp/scene/actions/delay.hpp>
|
||||
|
||||
namespace EE { namespace Scene { namespace Actions {
|
||||
|
||||
class EE_API Enable : public Delay {
|
||||
public:
|
||||
static Enable * New( const Time& time = Seconds(0) );
|
||||
|
||||
static Enable * New( bool enable, const Time& time = Seconds(0) );
|
||||
|
||||
void update( const Time& time ) override;
|
||||
|
||||
Action * clone() const override;
|
||||
|
||||
Action * reverse() const override;
|
||||
|
||||
protected:
|
||||
bool mEnable;
|
||||
|
||||
explicit Enable( bool enable, const Time& time );
|
||||
|
||||
void onStart() override;
|
||||
|
||||
};
|
||||
|
||||
}}}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,29 @@
|
||||
#ifndef EE_SCENE_ACTION_VISIBLE_HPP
|
||||
#define EE_SCENE_ACTION_VISIBLE_HPP
|
||||
|
||||
#include <eepp/scene/actions/delay.hpp>
|
||||
|
||||
namespace EE { namespace Scene { namespace Actions {
|
||||
|
||||
class EE_API Visible : public Delay {
|
||||
public:
|
||||
static Visible * New( bool visible, const Time& time = Seconds(0) );
|
||||
|
||||
void update( const Time& time ) override;
|
||||
|
||||
Action * clone() const override;
|
||||
|
||||
Action * reverse() const override;
|
||||
|
||||
protected:
|
||||
bool mVisible;
|
||||
|
||||
explicit Visible( bool visible, const Time& time );
|
||||
|
||||
void onStart() override;
|
||||
|
||||
};
|
||||
|
||||
}}}
|
||||
|
||||
#endif
|
||||
@@ -166,37 +166,7 @@ class EE_API UINode : public Node {
|
||||
|
||||
const Uint32& getDragButton() const;
|
||||
|
||||
bool isAnimating();
|
||||
|
||||
Interpolation1d * startAlphaAnim( const Float& From, const Float& To, const Time& TotalTime, const bool& alphaChilds = true, const Ease::Interpolation& type = Ease::Linear, Interpolation1d::OnPathEndCallback PathEndCallback = Interpolation1d::OnPathEndCallback() );
|
||||
|
||||
Interpolation2d * startScaleAnim( const Vector2f& From, const Vector2f& To, const Time& TotalTime, const Ease::Interpolation& type = Ease::Linear, Interpolation2d::OnPathEndCallback PathEndCallback = Interpolation2d::OnPathEndCallback() );
|
||||
|
||||
Interpolation2d * startScaleAnim( const Float& From, const Float& To, const Time& TotalTime, const Ease::Interpolation& type = Ease::Linear, Interpolation2d::OnPathEndCallback PathEndCallback = Interpolation2d::OnPathEndCallback() );
|
||||
|
||||
Interpolation2d * startTranslation( const Vector2f& From, const Vector2f& To, const Time& TotalTime, const Ease::Interpolation& type = Ease::Linear, Interpolation2d::OnPathEndCallback PathEndCallback = Interpolation2d::OnPathEndCallback() );
|
||||
|
||||
Interpolation1d * startRotation( const Float& From, const Float& To, const Time& TotalTime, const Ease::Interpolation& type = Ease::Linear, Interpolation1d::OnPathEndCallback PathEndCallback = Interpolation1d::OnPathEndCallback() );
|
||||
|
||||
Interpolation1d * startAlphaAnim( const Float& To, const Time& TotalTime, const bool& alphaChilds = true, const Ease::Interpolation& type = Ease::Linear, Interpolation1d::OnPathEndCallback PathEndCallback = Interpolation1d::OnPathEndCallback() );
|
||||
|
||||
Interpolation2d * startScaleAnim( const Vector2f& To, const Time& TotalTime, const Ease::Interpolation& type = Ease::Linear, Interpolation2d::OnPathEndCallback PathEndCallback = Interpolation2d::OnPathEndCallback() );
|
||||
|
||||
Interpolation2d * startScaleAnim( const Float& To, const Time& TotalTime, const Ease::Interpolation& type = Ease::Linear, Interpolation2d::OnPathEndCallback PathEndCallback = Interpolation2d::OnPathEndCallback() );
|
||||
|
||||
Interpolation2d * startTranslation( const Vector2f& To, const Time& TotalTime, const Ease::Interpolation& type = Ease::Linear, Interpolation2d::OnPathEndCallback PathEndCallback = Interpolation2d::OnPathEndCallback() );
|
||||
|
||||
Interpolation1d * startRotation( const Float& To, const Time& TotalTime, const Ease::Interpolation& type = Ease::Linear, Interpolation1d::OnPathEndCallback PathEndCallback = Interpolation1d::OnPathEndCallback() );
|
||||
|
||||
Interpolation1d * createFadeIn( const Time& Time, const bool& alphaChilds = true, const Ease::Interpolation& type = Ease::Linear );
|
||||
|
||||
Interpolation1d * createFadeOut( const Time& Time, const bool& alphaChilds = true, const Ease::Interpolation& type = Ease::Linear );
|
||||
|
||||
Interpolation1d * closeFadeOut( const Time& Time, const bool& alphaChilds = true, const Ease::Interpolation& type = Ease::Linear );
|
||||
|
||||
Interpolation1d * disableFadeOut( const Time & Time, const bool& alphaChilds = true, const Ease::Interpolation& type = Ease::Linear );
|
||||
|
||||
bool isFadingOut();
|
||||
bool isActionManagerActive();
|
||||
|
||||
virtual void setFocus();
|
||||
protected:
|
||||
|
||||
@@ -205,8 +205,11 @@
|
||||
../../include/eepp/scene/actionmanager.hpp
|
||||
../../include/eepp/scene/actions/actioninterpolation1d.hpp
|
||||
../../include/eepp/scene/actions/actioninterpolation2d.hpp
|
||||
../../include/eepp/scene/actions/actions.hpp
|
||||
../../include/eepp/scene/actions/close.hpp
|
||||
../../include/eepp/scene/actions/delay.hpp
|
||||
../../include/eepp/scene/actions/disable.hpp
|
||||
../../include/eepp/scene/actions/enable.hpp
|
||||
../../include/eepp/scene/actions/fade.hpp
|
||||
../../include/eepp/scene/actions/marginmove.hpp
|
||||
../../include/eepp/scene/actions/move.hpp
|
||||
@@ -214,6 +217,7 @@
|
||||
../../include/eepp/scene/actions/scale.hpp
|
||||
../../include/eepp/scene/actions/sequence.hpp
|
||||
../../include/eepp/scene/actions/spawn.hpp
|
||||
../../include/eepp/scene/actions/visible.hpp
|
||||
../../include/eepp/scene/event.hpp
|
||||
../../include/eepp/scene/eventdispatcher.hpp
|
||||
../../include/eepp/scene/keyevent.hpp
|
||||
@@ -616,6 +620,8 @@
|
||||
../../src/eepp/scene/actions/actioninterpolation2d.cpp
|
||||
../../src/eepp/scene/actions/close.cpp
|
||||
../../src/eepp/scene/actions/delay.cpp
|
||||
../../src/eepp/scene/actions/disable.cpp
|
||||
../../src/eepp/scene/actions/enable.cpp
|
||||
../../src/eepp/scene/actions/fade.cpp
|
||||
../../src/eepp/scene/actions/marginmove.cpp
|
||||
../../src/eepp/scene/actions/move.cpp
|
||||
@@ -623,6 +629,7 @@
|
||||
../../src/eepp/scene/actions/scale.cpp
|
||||
../../src/eepp/scene/actions/sequence.cpp
|
||||
../../src/eepp/scene/actions/spawn.cpp
|
||||
../../src/eepp/scene/actions/visible.cpp
|
||||
../../src/eepp/scene/event.cpp
|
||||
../../src/eepp/scene/eventdispatcher.cpp
|
||||
../../src/eepp/scene/keyevent.cpp
|
||||
|
||||
@@ -7,6 +7,5 @@
|
||||
../../src/eepp/audio
|
||||
../../include/eepp/audio
|
||||
/usr/include/freetype2/
|
||||
../../bin/assets/layouts
|
||||
../../include/eepp/graphics
|
||||
../../src/eepp/graphics
|
||||
../../include/eepp/scene/actions
|
||||
../../src/eepp/scene/actions
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
#include <eepp/scene/actions/disable.hpp>
|
||||
#include <eepp/scene/node.hpp>
|
||||
|
||||
namespace EE { namespace Scene { namespace Actions {
|
||||
|
||||
Disable * Disable::New(const Time & time) {
|
||||
return eeNew( Disable, ( time ) );
|
||||
}
|
||||
|
||||
Action *Disable::clone() const {
|
||||
return New( mTime );
|
||||
}
|
||||
|
||||
Disable::Disable(const Time & time) :
|
||||
Enable( false, time )
|
||||
{}
|
||||
|
||||
}}}
|
||||
@@ -0,0 +1,37 @@
|
||||
#include <eepp/scene/actions/enable.hpp>
|
||||
#include <eepp/scene/node.hpp>
|
||||
|
||||
namespace EE { namespace Scene { namespace Actions {
|
||||
|
||||
Enable * Enable::New( const Time & time ) {
|
||||
return eeNew( Enable, ( true, time ) );
|
||||
}
|
||||
|
||||
Enable * Enable::New( bool enable, const Time & time) {
|
||||
return eeNew( Enable, ( enable, time ) );
|
||||
}
|
||||
|
||||
void Enable::update(const Time & time) {
|
||||
if ( NULL != mNode && isDone() ) {
|
||||
mNode->setEnabled( mEnable );
|
||||
}
|
||||
}
|
||||
|
||||
Action * Enable::clone() const {
|
||||
return New( mEnable, mTime );
|
||||
}
|
||||
|
||||
Action * Enable::reverse() const {
|
||||
return NULL; // or a time machine
|
||||
}
|
||||
|
||||
Enable::Enable( bool enable, const Time & time) :
|
||||
Delay( time ),
|
||||
mEnable( enable )
|
||||
{}
|
||||
|
||||
void Enable::onStart() {
|
||||
update(Seconds(0));
|
||||
}
|
||||
|
||||
}}}
|
||||
@@ -0,0 +1,33 @@
|
||||
#include <eepp/scene/actions/visible.hpp>
|
||||
#include <eepp/scene/node.hpp>
|
||||
|
||||
namespace EE { namespace Scene { namespace Actions {
|
||||
|
||||
Visible * Visible::New( bool visible, const Time & time) {
|
||||
return eeNew( Visible, ( visible, time ) );
|
||||
}
|
||||
|
||||
void Visible::update(const Time & time) {
|
||||
if ( NULL != mNode && isDone() ) {
|
||||
mNode->setVisible( mVisible );
|
||||
}
|
||||
}
|
||||
|
||||
Action * Visible::clone() const {
|
||||
return New( mVisible, mTime );
|
||||
}
|
||||
|
||||
Action * Visible::reverse() const {
|
||||
return NULL; // or a time machine
|
||||
}
|
||||
|
||||
Visible::Visible( bool visible, const Time & time) :
|
||||
Delay( time ),
|
||||
mVisible( visible )
|
||||
{}
|
||||
|
||||
void Visible::onStart() {
|
||||
update(Seconds(0));
|
||||
}
|
||||
|
||||
}}}
|
||||
@@ -2,6 +2,7 @@
|
||||
#include <eepp/ui/uithememanager.hpp>
|
||||
#include <eepp/scene/scenemanager.hpp>
|
||||
#include <eepp/scene/scenenode.hpp>
|
||||
#include <eepp/scene/actions/actions.hpp>
|
||||
#include <pugixml/pugixml.hpp>
|
||||
|
||||
namespace EE { namespace UI {
|
||||
@@ -227,13 +228,16 @@ void UIDropDownList::show() {
|
||||
mListBox->setVisible( true );
|
||||
|
||||
if ( UIThemeManager::instance()->getDefaultEffectsEnabled() ) {
|
||||
mListBox->startAlphaAnim( 255.f == mListBox->getAlpha() ? 0.f : mListBox->getAlpha(), 255.f, UIThemeManager::instance()->getControlsFadeInTime() );
|
||||
mListBox->runAction( Actions::Sequence::New(
|
||||
Actions::Fade::New( 255.f == mListBox->getAlpha() ? 0.f : mListBox->getAlpha(), 255.f, UIThemeManager::instance()->getControlsFadeOutTime() ),
|
||||
Actions::Spawn::New( Actions::Enable::New(), Actions::Visible::New( true ) ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
void UIDropDownList::hide() {
|
||||
if ( UIThemeManager::instance()->getDefaultEffectsEnabled() ) {
|
||||
mListBox->disableFadeOut( UIThemeManager::instance()->getControlsFadeOutTime() );
|
||||
mListBox->runAction( Actions::Sequence::New( Actions::FadeOut::New( UIThemeManager::instance()->getControlsFadeOutTime() ),
|
||||
Actions::Spawn::New( Actions::Disable::New(), Actions::Visible::New( false ) ) ) );
|
||||
} else {
|
||||
mListBox->setEnabled( false );
|
||||
mListBox->setVisible( false );
|
||||
|
||||
+1
-108
@@ -850,117 +850,10 @@ const Uint32& UINode::getDragButton() const {
|
||||
return mDragButton;
|
||||
}
|
||||
|
||||
bool UINode::isFadingOut() {
|
||||
return 0 != ( mNodeFlags & NODE_FLAG_DISABLE_DELAYED );
|
||||
}
|
||||
|
||||
bool UINode::isAnimating() {
|
||||
bool UINode::isActionManagerActive() {
|
||||
return NULL != mActionManager && !mActionManager->isEmpty();
|
||||
}
|
||||
|
||||
static void UINode_onFadeDone( Action * action, const Action::ActionType& actionType ) {
|
||||
Node * node = action->getTarget();
|
||||
|
||||
if ( NULL != node ) {
|
||||
if ( ( node->getNodeFlags() & NODE_FLAG_CLOSE_DELAYED ) )
|
||||
node->close();
|
||||
|
||||
if ( ( node->getNodeFlags() & NODE_FLAG_DISABLE_DELAYED ) ) {
|
||||
node->setNodeFlags( node->getNodeFlags() & ~NODE_FLAG_DISABLE_DELAYED );
|
||||
|
||||
node->setVisible( false );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Interpolation1d * UINode::startAlphaAnim( const Float& From, const Float& To, const Time& TotalTime, const bool& AlphaChilds, const Ease::Interpolation& Type, Interpolation1d::OnPathEndCallback PathEndCallback ) {
|
||||
Actions::Fade * action = Actions::Fade::New( From, To, TotalTime, Type, AlphaChilds );
|
||||
|
||||
action->getInterpolation()->setPathEndCallback( PathEndCallback );
|
||||
|
||||
action->addEventListener( Action::ActionType::OnDone, cb::Make2( &UINode_onFadeDone ) );
|
||||
|
||||
runAction( action );
|
||||
|
||||
return action->getInterpolation();
|
||||
}
|
||||
|
||||
Interpolation2d * UINode::startScaleAnim( const Vector2f& From, const Vector2f& To, const Time& TotalTime, const Ease::Interpolation& Type, Interpolation2d::OnPathEndCallback PathEndCallback ) {
|
||||
Actions::Scale * action = Actions::Scale::New( From, To, TotalTime, Type );
|
||||
|
||||
action->getInterpolation()->setPathEndCallback( PathEndCallback );
|
||||
|
||||
runAction( action );
|
||||
|
||||
return action->getInterpolation();
|
||||
}
|
||||
|
||||
Interpolation2d * UINode::startScaleAnim( const Float& From, const Float& To, const Time& TotalTime, const Ease::Interpolation& Type, Interpolation2d::OnPathEndCallback PathEndCallback ) {
|
||||
return startScaleAnim( Vector2f( From, From ), Vector2f( To, To ), TotalTime, Type, PathEndCallback );
|
||||
}
|
||||
|
||||
Interpolation2d * UINode::startTranslation( const Vector2f& From, const Vector2f& To, const Time& TotalTime, const Ease::Interpolation& Type, Interpolation2d::OnPathEndCallback PathEndCallback ) {
|
||||
Actions::Move * action = Actions::Move::New( From, To, TotalTime, Type );
|
||||
|
||||
action->getInterpolation()->setPathEndCallback( PathEndCallback );
|
||||
|
||||
runAction( action );
|
||||
|
||||
return action->getInterpolation();
|
||||
}
|
||||
|
||||
Interpolation1d * UINode::startRotation( const Float& From, const Float& To, const Time& TotalTime, const Ease::Interpolation& Type, Interpolation1d::OnPathEndCallback PathEndCallback ) {
|
||||
Actions::Rotate * action = Actions::Rotate::New( From, To, TotalTime, Type );
|
||||
|
||||
action->getInterpolation()->setPathEndCallback( PathEndCallback );
|
||||
|
||||
runAction( action );
|
||||
|
||||
return action->getInterpolation();
|
||||
}
|
||||
|
||||
Interpolation1d * UINode::startAlphaAnim(const Float & To, const Time & TotalTime, const bool & alphaChilds, const Ease::Interpolation & type, Interpolation1d::OnPathEndCallback PathEndCallback) {
|
||||
return startAlphaAnim( mAlpha, To, TotalTime, alphaChilds, type, PathEndCallback );
|
||||
}
|
||||
|
||||
Interpolation2d * UINode::startScaleAnim(const Vector2f & To, const Time & TotalTime, const Ease::Interpolation & type, Interpolation2d::OnPathEndCallback PathEndCallback) {
|
||||
return startScaleAnim( getScale(), To, TotalTime, type, PathEndCallback );
|
||||
}
|
||||
|
||||
Interpolation2d * UINode::startScaleAnim(const Float & To, const Time & TotalTime, const Ease::Interpolation & type, Interpolation2d::OnPathEndCallback PathEndCallback) {
|
||||
return startScaleAnim( getScale(), Vector2f(To,To), TotalTime, type, PathEndCallback );
|
||||
}
|
||||
|
||||
Interpolation2d * UINode::startTranslation(const Vector2f& To, const Time & TotalTime, const Ease::Interpolation & type, Interpolation2d::OnPathEndCallback PathEndCallback) {
|
||||
return startTranslation( mDpPos, To, TotalTime, type, PathEndCallback );
|
||||
}
|
||||
|
||||
Interpolation1d * UINode::startRotation(const Float & To, const Time & TotalTime, const Ease::Interpolation & type, Interpolation1d::OnPathEndCallback PathEndCallback) {
|
||||
return startRotation( getRotation(), To, TotalTime, type, PathEndCallback );
|
||||
}
|
||||
|
||||
Interpolation1d * UINode::createFadeIn( const Time& time, const bool& AlphaChilds, const Ease::Interpolation& Type ) {
|
||||
return startAlphaAnim( mAlpha, 255.f, time, AlphaChilds, Type );
|
||||
}
|
||||
|
||||
Interpolation1d * UINode::createFadeOut( const Time& time, const bool& AlphaChilds, const Ease::Interpolation& Type ) {
|
||||
return startAlphaAnim( 255.f, mAlpha, time, AlphaChilds, Type );
|
||||
}
|
||||
|
||||
Interpolation1d * UINode::closeFadeOut( const Time& time, const bool& AlphaChilds, const Ease::Interpolation& Type ) {
|
||||
mNodeFlags |= NODE_FLAG_CLOSE_DELAYED;
|
||||
|
||||
return startAlphaAnim( mAlpha, 0.f, time, AlphaChilds, Type );
|
||||
}
|
||||
|
||||
Interpolation1d * UINode::disableFadeOut( const Time& time, const bool& AlphaChilds, const Ease::Interpolation& Type ) {
|
||||
setEnabled( false );
|
||||
|
||||
mNodeFlags |= NODE_FLAG_DISABLE_DELAYED;
|
||||
|
||||
return startAlphaAnim( mAlpha, 0.f, time, AlphaChilds, Type );
|
||||
}
|
||||
|
||||
void UINode::onWidgetFocusLoss() {
|
||||
sendCommonEvent( Event::OnWidgetFocusLoss );
|
||||
invalidateDraw();
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include <eepp/ui/uipopupmenu.hpp>
|
||||
#include <eepp/ui/uithememanager.hpp>
|
||||
#include <eepp/scene/scenenode.hpp>
|
||||
#include <eepp/scene/actions/actions.hpp>
|
||||
|
||||
namespace EE { namespace UI {
|
||||
|
||||
@@ -46,7 +47,8 @@ bool UIPopUpMenu::show() {
|
||||
toFront();
|
||||
|
||||
if ( UIThemeManager::instance()->getDefaultEffectsEnabled() ) {
|
||||
startAlphaAnim( 255.f == mAlpha ? 0.f : mAlpha, 255.f, UIThemeManager::instance()->getControlsFadeInTime() );
|
||||
runAction( Actions::Sequence::New( Actions::Fade::New( 255.f == mAlpha ? 0.f : mAlpha, 255.f, UIThemeManager::instance()->getControlsFadeOutTime() ),
|
||||
Actions::Spawn::New( Actions::Enable::New(), Actions::Visible::New( true ) ) ) );
|
||||
}
|
||||
|
||||
setFocus();
|
||||
@@ -59,7 +61,7 @@ bool UIPopUpMenu::show() {
|
||||
|
||||
bool UIPopUpMenu::hide() {
|
||||
if ( isVisible() ) {
|
||||
if ( !isFadingOut() ) {
|
||||
if ( !isActionManagerActive() ) {
|
||||
if ( NULL != mItemSelected )
|
||||
mItemSelected->unsetSkinState( UISkinState::StateSelected );
|
||||
|
||||
@@ -67,7 +69,8 @@ bool UIPopUpMenu::hide() {
|
||||
mItemSelectedIndex = eeINDEX_NOT_FOUND;
|
||||
|
||||
if ( UIThemeManager::instance()->getDefaultEffectsEnabled() ) {
|
||||
disableFadeOut( UIThemeManager::instance()->getControlsFadeOutTime() );
|
||||
runAction( Actions::Sequence::New( Actions::FadeOut::New( UIThemeManager::instance()->getControlsFadeOutTime() ),
|
||||
Actions::Spawn::New( Actions::Disable::New(), Actions::Visible::New( false ) ) ) );
|
||||
} else {
|
||||
setEnabled( false );
|
||||
setVisible( false );
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include <eepp/ui/uiwidget.hpp>
|
||||
#include <eepp/graphics/text.hpp>
|
||||
#include <eepp/ui/uithememanager.hpp>
|
||||
#include <eepp/scene/actions/actions.hpp>
|
||||
|
||||
namespace EE { namespace UI {
|
||||
|
||||
@@ -72,7 +73,8 @@ void UITooltip::show() {
|
||||
setVisible( true );
|
||||
|
||||
if ( UIThemeManager::instance()->getDefaultEffectsEnabled() ) {
|
||||
startAlphaAnim( 255.f == mAlpha ? 0.f : mAlpha, 255.f, UIThemeManager::instance()->getControlsFadeInTime() );
|
||||
runAction( Actions::Sequence::New( Actions::Fade::New( 255.f == mAlpha ? 0.f : mAlpha, 255.f, UIThemeManager::instance()->getControlsFadeOutTime() ),
|
||||
Actions::Spawn::New( Actions::Enable::New(), Actions::Visible::New( true ) ) ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -80,7 +82,7 @@ void UITooltip::show() {
|
||||
void UITooltip::hide() {
|
||||
if ( isVisible() ) {
|
||||
if ( UIThemeManager::instance()->getDefaultEffectsEnabled() ) {
|
||||
disableFadeOut( UIThemeManager::instance()->getControlsFadeOutTime() );
|
||||
runAction( Actions::Sequence::New( Actions::FadeOut::New( UIThemeManager::instance()->getControlsFadeOutTime() ), Actions::Spawn::New( Actions::Disable::New(), Actions::Visible::New( false ) ) ) );
|
||||
} else {
|
||||
setVisible( false );
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include <eepp/ui/uiscenenode.hpp>
|
||||
#include <pugixml/pugixml.hpp>
|
||||
#include <eepp/scene/scenemanager.hpp>
|
||||
#include <eepp/scene/actions/actions.hpp>
|
||||
|
||||
namespace EE { namespace UI {
|
||||
|
||||
@@ -442,7 +443,7 @@ void UIWindow::closeWindow() {
|
||||
}
|
||||
|
||||
if ( Time::Zero != UIThemeManager::instance()->getControlsFadeOutTime() )
|
||||
closeFadeOut( UIThemeManager::instance()->getControlsFadeOutTime() );
|
||||
runAction( Actions::Sequence::New( Actions::FadeOut::New( UIThemeManager::instance()->getControlsFadeOutTime() ), Actions::Close::New() ) );
|
||||
else
|
||||
close();
|
||||
}
|
||||
@@ -977,7 +978,7 @@ bool UIWindow::show() {
|
||||
|
||||
setFocus();
|
||||
|
||||
startAlphaAnim( mStyleConfig.BaseAlpha == getAlpha() ? 0.f : mAlpha, mStyleConfig.BaseAlpha, UIThemeManager::instance()->getControlsFadeInTime() );
|
||||
runAction( Actions::Fade::New( mStyleConfig.BaseAlpha == getAlpha() ? 0.f : mAlpha, mStyleConfig.BaseAlpha, UIThemeManager::instance()->getControlsFadeOutTime() ) );
|
||||
|
||||
if ( isModal() ) {
|
||||
createModalControl();
|
||||
@@ -998,7 +999,7 @@ bool UIWindow::show() {
|
||||
bool UIWindow::hide() {
|
||||
if ( isVisible() ) {
|
||||
if ( UIThemeManager::instance()->getDefaultEffectsEnabled() ) {
|
||||
disableFadeOut( UIThemeManager::instance()->getControlsFadeOutTime() );
|
||||
runAction( Actions::Sequence::New( Actions::FadeOut::New( UIThemeManager::instance()->getControlsFadeOutTime() ), Actions::Spawn::New( Actions::Disable::New(), Actions::Visible::New( false ) ) ) );
|
||||
} else {
|
||||
setEnabled( false );
|
||||
setVisible( false );
|
||||
|
||||
+22
-14
@@ -951,13 +951,13 @@ void EETest::createCommonDialog() {
|
||||
static void onWinDragStart( const Event * event ) {
|
||||
UINode * ctrl = static_cast<UINode*>( event->getNode() );
|
||||
UIWindow * window = ctrl->isType(UI_TYPE_WINDOW) ? static_cast<UIWindow*>( ctrl ) : static_cast<UIWindow*>( ctrl->getWindowContainer()->getParent() );
|
||||
window->startAlphaAnim( window->getAlpha(), 100, Seconds(0.2f) );
|
||||
window->runAction( Actions::Fade::New( window->getAlpha(), 100, Seconds(0.2f) ) );
|
||||
}
|
||||
|
||||
static void onWinDragStop( const Event * event ) {
|
||||
UINode * ctrl = static_cast<UINode*>( event->getNode() );
|
||||
UIWindow * window = ctrl->isType(UI_TYPE_WINDOW) ? static_cast<UIWindow*>( ctrl ) : static_cast<UIWindow*>( ctrl->getWindowContainer()->getParent() );
|
||||
window->startAlphaAnim( window->getAlpha(), 255, Seconds(0.2f) );
|
||||
window->runAction( Actions::Fade::New( window->getAlpha(), 255, Seconds(0.2f) ) );
|
||||
}
|
||||
|
||||
void EETest::createDecoratedWindow() {
|
||||
@@ -1008,7 +1008,7 @@ void EETest::createDecoratedWindow() {
|
||||
win->setWinFlags( win->getWinFlags() & ~UI_WIN_NO_BORDER );
|
||||
menuItem->setText( "Hide Border" );
|
||||
} else if ( "Close" == txt ) {
|
||||
win->closeFadeOut( Milliseconds(250) );
|
||||
win->closeWindow();
|
||||
}
|
||||
} );
|
||||
|
||||
@@ -1094,13 +1094,20 @@ void EETest::onItemClick( const Event * Event ) {
|
||||
|
||||
if ( Chk->isActive() ) {
|
||||
if ( C->getScale() == 1.f ) C->setScale( 0.f );
|
||||
C->startScaleAnim( C->getScale(), Vector2f::One, Milliseconds( 500.f ), Ease::SineOut );
|
||||
C->startAlphaAnim( C->getAlpha(), 255.f, Milliseconds( 500.f ) );
|
||||
C->startRotation( 0, 360, Milliseconds( 500.f ), Ease::SineOut );
|
||||
|
||||
C->runAction( Actions::Spawn::New(
|
||||
Actions::Scale::New( C->getScale(), Vector2f::One, Milliseconds( 500.f ), Ease::SineOut ),
|
||||
Actions::Fade::New( C->getAlpha(), 255.f, Milliseconds( 500.f ) ),
|
||||
Actions::Rotate::New( 0, 360, Milliseconds( 500.f ), Ease::SineOut )
|
||||
)
|
||||
);
|
||||
} else {
|
||||
C->startScaleAnim( C->getScale(), Vector2f::Zero, Milliseconds( 500.f ), Ease::SineIn );
|
||||
C->disableFadeOut( Milliseconds( 500.f ) );
|
||||
C->startRotation( 0, 360, Milliseconds( 500.f ), Ease::SineIn );
|
||||
C->runAction( Actions::Spawn::New(
|
||||
Actions::Scale::New( C->getScale(), Vector2f::Zero, Milliseconds( 500.f ), Ease::SineIn ),
|
||||
Actions::Sequence::New( Actions::FadeOut::New( Milliseconds( 500 ) ), Actions::Disable::New() ),
|
||||
Actions::Rotate::New( 0, 360, Milliseconds( 500.f ), Ease::SineIn )
|
||||
)
|
||||
);
|
||||
}
|
||||
} else if ( "Show Window 2" == txt ) {
|
||||
if ( NULL == mUIWindow ) {
|
||||
@@ -1168,12 +1175,13 @@ void EETest::onButtonClick( const Event * event ) {
|
||||
UIImage * Gfx = UIImage::New();
|
||||
Gfx->setDrawable( mTheme->getIconByName( "ok" ) );
|
||||
Gfx->setEnabled( false );
|
||||
Gfx->runAction( Sequence::New( Scale::New( Vector2f(1.f,1.f), Vector2f(2.f,2.f), Seconds( 0.5f ) ),
|
||||
Scale::New( Vector2f(2.f,2.f), Vector2f(1.f,1.f), Seconds( 0.5f ) )
|
||||
|
||||
Gfx->runAction( Spawn::New(
|
||||
Move::New( Vector2f( Math::randi( 0, mWindow->getWidth() ), -64 ), Vector2f( Math::randi( 0, mWindow->getWidth() ), mWindow->getHeight() + 64 ), Milliseconds( 2500 ) ),
|
||||
Rotate::New( 0.f, 2500.f, Milliseconds( 2500 ) ),
|
||||
Sequence::New( Scale::New( Vector2f(1.f,1.f), Vector2f(2.f,2.f), Seconds( 0.5f ) ), Scale::New( Vector2f(2.f,2.f), Vector2f(1.f,1.f), Seconds( 0.5f ) ) ),
|
||||
Sequence::New( FadeOut::New( Milliseconds( 3500 ) ), Close::New() )
|
||||
) );
|
||||
Gfx->startRotation( 0.f, 2500.f, Milliseconds( 2500 ) );
|
||||
Gfx->startTranslation( Vector2f( Math::randi( 0, mWindow->getWidth() ), -64 ), Vector2f( Math::randi( 0, mWindow->getWidth() ), mWindow->getHeight() + 64 ), Milliseconds( 2500 ) );
|
||||
Gfx->closeFadeOut( Milliseconds( 3500 ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user