X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=examples%2Fcube-transition-effect%2Fcube-transition-effect-example.cpp;h=77592679c8397d8b712960da6159a5c4634d3a38;hb=1b19fd140ff139b5854a1a62447faf31b175d8f6;hp=59a8e0f44e9f30a27830896b7292654dd7b1f16b;hpb=7bdf3408ec2e54c70da008761538e8ef22f64976;p=platform%2Fcore%2Fuifw%2Fdali-demo.git diff --git a/examples/cube-transition-effect/cube-transition-effect-example.cpp b/examples/cube-transition-effect/cube-transition-effect-example.cpp old mode 100755 new mode 100644 index 59a8e0f..7759267 --- a/examples/cube-transition-effect/cube-transition-effect-example.cpp +++ b/examples/cube-transition-effect/cube-transition-effect-example.cpp @@ -19,17 +19,16 @@ #include // INTERNAL INCLUDES -#include "shared/view.h" #include "shared/utility.h" +#include "shared/view.h" -#include #include #include -#include #include +#include #include #include - +#include using namespace Dali; @@ -38,47 +37,46 @@ using Dali::Toolkit::TextLabel; // LOCAL STUFF namespace { - -const char * const TOOLBAR_IMAGE( DEMO_IMAGE_DIR "top-bar.png" ); -const char * const APPLICATION_TITLE_WAVE( "Cube Transition: Wave" ); -const char * const APPLICATION_TITLE_CROSS( "Cube Transition: Cross" ); -const char * const APPLICATION_TITLE_FOLD( "Cube Transition: Fold" ); -const char * const EFFECT_WAVE_IMAGE( DEMO_IMAGE_DIR "icon-effect-wave.png" ); -const char * const EFFECT_WAVE_IMAGE_SELECTED( DEMO_IMAGE_DIR "icon-effect-wave-selected.png" ); -const char * const EFFECT_CROSS_IMAGE( DEMO_IMAGE_DIR "icon-effect-cross.png" ); -const char * const EFFECT_CROSS_IMAGE_SELECTED( DEMO_IMAGE_DIR "icon-effect-cross-selected.png" ); -const char * const EFFECT_FOLD_IMAGE( DEMO_IMAGE_DIR "icon-effect-fold.png" ); -const char * const EFFECT_FOLD_IMAGE_SELECTED( DEMO_IMAGE_DIR "icon-effect-fold-selected.png" ); -const char * const SLIDE_SHOW_START_ICON( DEMO_IMAGE_DIR "icon-play.png" ); -const char * const SLIDE_SHOW_START_ICON_SELECTED( DEMO_IMAGE_DIR "icon-play-selected.png" ); -const char * const SLIDE_SHOW_STOP_ICON( DEMO_IMAGE_DIR "icon-stop.png" ); -const char * const SLIDE_SHOW_STOP_ICON_SELECTED( DEMO_IMAGE_DIR "icon-stop-selected.png" ); +const char* const TOOLBAR_IMAGE(DEMO_IMAGE_DIR "top-bar.png"); +const char* const APPLICATION_TITLE_WAVE("Cube Transition: Wave"); +const char* const APPLICATION_TITLE_CROSS("Cube Transition: Cross"); +const char* const APPLICATION_TITLE_FOLD("Cube Transition: Fold"); +const char* const EFFECT_WAVE_IMAGE(DEMO_IMAGE_DIR "icon-effect-wave.png"); +const char* const EFFECT_WAVE_IMAGE_SELECTED(DEMO_IMAGE_DIR "icon-effect-wave-selected.png"); +const char* const EFFECT_CROSS_IMAGE(DEMO_IMAGE_DIR "icon-effect-cross.png"); +const char* const EFFECT_CROSS_IMAGE_SELECTED(DEMO_IMAGE_DIR "icon-effect-cross-selected.png"); +const char* const EFFECT_FOLD_IMAGE(DEMO_IMAGE_DIR "icon-effect-fold.png"); +const char* const EFFECT_FOLD_IMAGE_SELECTED(DEMO_IMAGE_DIR "icon-effect-fold-selected.png"); +const char* const SLIDE_SHOW_START_ICON(DEMO_IMAGE_DIR "icon-play.png"); +const char* const SLIDE_SHOW_START_ICON_SELECTED(DEMO_IMAGE_DIR "icon-play-selected.png"); +const char* const SLIDE_SHOW_STOP_ICON(DEMO_IMAGE_DIR "icon-stop.png"); +const char* const SLIDE_SHOW_STOP_ICON_SELECTED(DEMO_IMAGE_DIR "icon-stop-selected.png"); const char* IMAGES[] = -{ - DEMO_IMAGE_DIR "gallery-large-1.jpg", - DEMO_IMAGE_DIR "gallery-large-2.jpg", - DEMO_IMAGE_DIR "gallery-large-3.jpg", - DEMO_IMAGE_DIR "gallery-large-4.jpg", - DEMO_IMAGE_DIR "gallery-large-5.jpg", - DEMO_IMAGE_DIR "gallery-large-6.jpg", - DEMO_IMAGE_DIR "gallery-large-7.jpg", - DEMO_IMAGE_DIR "gallery-large-8.jpg", - DEMO_IMAGE_DIR "gallery-large-9.jpg", - DEMO_IMAGE_DIR "gallery-large-10.jpg", - DEMO_IMAGE_DIR "gallery-large-11.jpg", - DEMO_IMAGE_DIR "gallery-large-12.jpg", - DEMO_IMAGE_DIR "gallery-large-13.jpg", - DEMO_IMAGE_DIR "gallery-large-14.jpg", - DEMO_IMAGE_DIR "gallery-large-15.jpg", - DEMO_IMAGE_DIR "gallery-large-16.jpg", - DEMO_IMAGE_DIR "gallery-large-17.jpg", - DEMO_IMAGE_DIR "gallery-large-18.jpg", - DEMO_IMAGE_DIR "gallery-large-19.jpg", - DEMO_IMAGE_DIR "gallery-large-20.jpg", - DEMO_IMAGE_DIR "gallery-large-21.jpg", + { + DEMO_IMAGE_DIR "gallery-large-1.jpg", + DEMO_IMAGE_DIR "gallery-large-2.jpg", + DEMO_IMAGE_DIR "gallery-large-3.jpg", + DEMO_IMAGE_DIR "gallery-large-4.jpg", + DEMO_IMAGE_DIR "gallery-large-5.jpg", + DEMO_IMAGE_DIR "gallery-large-6.jpg", + DEMO_IMAGE_DIR "gallery-large-7.jpg", + DEMO_IMAGE_DIR "gallery-large-8.jpg", + DEMO_IMAGE_DIR "gallery-large-9.jpg", + DEMO_IMAGE_DIR "gallery-large-10.jpg", + DEMO_IMAGE_DIR "gallery-large-11.jpg", + DEMO_IMAGE_DIR "gallery-large-12.jpg", + DEMO_IMAGE_DIR "gallery-large-13.jpg", + DEMO_IMAGE_DIR "gallery-large-14.jpg", + DEMO_IMAGE_DIR "gallery-large-15.jpg", + DEMO_IMAGE_DIR "gallery-large-16.jpg", + DEMO_IMAGE_DIR "gallery-large-17.jpg", + DEMO_IMAGE_DIR "gallery-large-18.jpg", + DEMO_IMAGE_DIR "gallery-large-19.jpg", + DEMO_IMAGE_DIR "gallery-large-20.jpg", + DEMO_IMAGE_DIR "gallery-large-21.jpg", }; -const int NUM_IMAGES( sizeof(IMAGES) / sizeof(IMAGES[0]) ); +const int NUM_IMAGES(sizeof(IMAGES) / sizeof(IMAGES[0])); // the number of cubes: NUM_COLUMNS*NUM_ROWS // better choose the numbers that can divide viewAreaSize.x @@ -105,27 +103,25 @@ const int VIEWINGTIME = 2000; // 2 seconds class CubeTransitionApp : public ConnectionTracker { public: - /** * Constructor * @param application class, stored as reference */ - CubeTransitionApp( Application& application ); + CubeTransitionApp(Application& application); ~CubeTransitionApp(); private: - /** * This method gets called once the main loop of application is up and running */ - void OnInit( Application& application ); + void OnInit(Application& application); /** * PanGesture callback. This method gets called when the pan gesture is detected. * @param[in] actor The actor receiving the pan gesture. * @param[in] gesture The detected pan gesture. */ - void OnPanGesture( Actor actor, const PanGesture& gesture ); + void OnPanGesture(Actor actor, const PanGesture& gesture); /** * Load the next image and start the transition; */ @@ -139,19 +135,19 @@ private: * Change the effect when the effect button is clicked * @param[in] button The handle of the clicked button */ - bool OnEffectButtonClicked( Toolkit::Button button ); + bool OnEffectButtonClicked(Toolkit::Button button); /** * Callback function of slideshow button * Start or stop the automatical image display when the slideshow button is clicked * @param[in] button The handle of the clicked button */ - bool OnSildeshowButtonClicked( Toolkit::Button button ); + bool OnSildeshowButtonClicked(Toolkit::Button button); /** * Callback function of cube transition completed signal * @param[in] effect The cube effect used for the transition * @param[in] texture The target Texture of the completed transition */ - void OnTransitionCompleted(Toolkit::CubeTransitionEffect effect, Texture image ); + void OnTransitionCompleted(Toolkit::CubeTransitionEffect effect, Texture image); /** * Callback function of timer tick * The timer is used to count the image display duration in slideshow, @@ -163,44 +159,44 @@ private: * @param[in] filepath Path to the image file * @return New texture object */ - Texture LoadWindowFillingTexture( const char* filepath ); + Texture LoadWindowFillingTexture(const char* filepath); private: - Application& mApplication; - Toolkit::Control mView; - Toolkit::ToolBar mToolBar; - Layer mContent; - Toolkit::TextLabel mTitle; + Application& mApplication; + Toolkit::Control mView; + Toolkit::ToolBar mToolBar; + Layer mContent; + Toolkit::TextLabel mTitle; - Vector2 mViewSize; + Vector2 mViewSize; - Texture mCurrentTexture; - Texture mNextTexture; - unsigned int mIndex; - bool mIsImageLoading; + Texture mCurrentTexture; + Texture mNextTexture; + unsigned int mIndex; + bool mIsImageLoading; - PanGestureDetector mPanGestureDetector; + PanGestureDetector mPanGestureDetector; - Toolkit::CubeTransitionEffect mCubeWaveEffect; - Toolkit::CubeTransitionEffect mCubeCrossEffect; - Toolkit::CubeTransitionEffect mCubeFoldEffect; - Toolkit::CubeTransitionEffect mCurrentEffect; + Toolkit::CubeTransitionEffect mCubeWaveEffect; + Toolkit::CubeTransitionEffect mCubeCrossEffect; + Toolkit::CubeTransitionEffect mCubeFoldEffect; + Toolkit::CubeTransitionEffect mCurrentEffect; - bool mSlideshow; - Timer mViewTimer; - Toolkit::PushButton mSlideshowButton; + bool mSlideshow; + Timer mViewTimer; + Toolkit::PushButton mSlideshowButton; - Vector2 mPanPosition; - Vector2 mPanDisplacement; + Vector2 mPanPosition; + Vector2 mPanDisplacement; }; -CubeTransitionApp::CubeTransitionApp( Application& application ) -: mApplication( application ), - mIndex( 0 ), - mIsImageLoading( false ), - mSlideshow( false ) +CubeTransitionApp::CubeTransitionApp(Application& application) +: mApplication(application), + mIndex(0), + mIsImageLoading(false), + mSlideshow(false) { - mApplication.InitSignal().Connect( this, &CubeTransitionApp::OnInit ); + mApplication.InitSignal().Connect(this, &CubeTransitionApp::OnInit); } CubeTransitionApp::~CubeTransitionApp() @@ -208,107 +204,104 @@ CubeTransitionApp::~CubeTransitionApp() //Nothing to do } -void CubeTransitionApp::OnInit( Application& application ) +void CubeTransitionApp::OnInit(Application& application) { application.GetWindow().KeyEventSignal().Connect(this, &CubeTransitionApp::OnKeyEvent); // Creates a default view with a default tool bar, the view is added to the window. - mContent = DemoHelper::CreateView( application, mView, mToolBar, "", TOOLBAR_IMAGE, "" ); - mContent.SetProperty( Layer::Property::BEHAVIOR, Layer::LAYER_3D ); - + mContent = DemoHelper::CreateView(application, mView, mToolBar, "", TOOLBAR_IMAGE, ""); + mContent.SetProperty(Layer::Property::BEHAVIOR, Layer::LAYER_3D); // Add an effect changing toggle button Toolkit::ToggleButton effectChangeToggleButton = Toolkit::ToggleButton::ToggleButton::New(); - effectChangeToggleButton.SetProperty( Toolkit::ToggleButton::Property::STATE_VISUALS, - Property::Array{ EFFECT_WAVE_IMAGE, - EFFECT_CROSS_IMAGE, - EFFECT_FOLD_IMAGE } - ); + effectChangeToggleButton.SetProperty(Toolkit::ToggleButton::Property::STATE_VISUALS, + Property::Array{EFFECT_WAVE_IMAGE, + EFFECT_CROSS_IMAGE, + EFFECT_FOLD_IMAGE}); - effectChangeToggleButton.ClickedSignal().Connect( this, &CubeTransitionApp::OnEffectButtonClicked ); - mToolBar.AddControl( effectChangeToggleButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HORIZONTAL_RIGHT, DemoHelper::DEFAULT_MODE_SWITCH_PADDING ); + effectChangeToggleButton.ClickedSignal().Connect(this, &CubeTransitionApp::OnEffectButtonClicked); + mToolBar.AddControl(effectChangeToggleButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HORIZONTAL_RIGHT, DemoHelper::DEFAULT_MODE_SWITCH_PADDING); // Add title to the tool bar. - mTitle = DemoHelper::CreateToolBarLabel( APPLICATION_TITLE_WAVE ); - mToolBar.AddControl( mTitle, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarTitlePercentage, Toolkit::Alignment::HORIZONTAL_CENTER ); + mTitle = DemoHelper::CreateToolBarLabel(APPLICATION_TITLE_WAVE); + mToolBar.AddControl(mTitle, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarTitlePercentage, Toolkit::Alignment::HORIZONTAL_CENTER); //Add an slideshow icon on the right of the title mSlideshowButton = Toolkit::PushButton::New(); - mSlideshowButton.SetProperty( Toolkit::Button::Property::UNSELECTED_BACKGROUND_VISUAL, SLIDE_SHOW_START_ICON ); - mSlideshowButton.SetProperty( Toolkit::Button::Property::SELECTED_BACKGROUND_VISUAL, SLIDE_SHOW_START_ICON_SELECTED ); - mSlideshowButton.ClickedSignal().Connect( this, &CubeTransitionApp::OnSildeshowButtonClicked ); - mToolBar.AddControl( mSlideshowButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HORIZONTAL_CENTER, DemoHelper::DEFAULT_PLAY_PADDING ); + mSlideshowButton.SetProperty(Toolkit::Button::Property::UNSELECTED_BACKGROUND_VISUAL, SLIDE_SHOW_START_ICON); + mSlideshowButton.SetProperty(Toolkit::Button::Property::SELECTED_BACKGROUND_VISUAL, SLIDE_SHOW_START_ICON_SELECTED); + mSlideshowButton.ClickedSignal().Connect(this, &CubeTransitionApp::OnSildeshowButtonClicked); + mToolBar.AddControl(mSlideshowButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HORIZONTAL_CENTER, DemoHelper::DEFAULT_PLAY_PADDING); // Set size to window size to avoid seeing a black border on transition mViewSize = application.GetWindow().GetSize(); // show the first image - mCurrentTexture = LoadWindowFillingTexture( IMAGES[mIndex] ); + mCurrentTexture = LoadWindowFillingTexture(IMAGES[mIndex]); //use small cubes - mCubeWaveEffect = Toolkit::CubeTransitionWaveEffect::New( NUM_ROWS_WAVE, NUM_COLUMNS_WAVE ); - mCubeWaveEffect.SetTransitionDuration( ANIMATION_DURATION_WAVE ); - mCubeWaveEffect.SetCubeDisplacement( CUBE_DISPLACEMENT_WAVE ); + mCubeWaveEffect = Toolkit::CubeTransitionWaveEffect::New(NUM_ROWS_WAVE, NUM_COLUMNS_WAVE); + mCubeWaveEffect.SetTransitionDuration(ANIMATION_DURATION_WAVE); + mCubeWaveEffect.SetCubeDisplacement(CUBE_DISPLACEMENT_WAVE); mCubeWaveEffect.TransitionCompletedSignal().Connect(this, &CubeTransitionApp::OnTransitionCompleted); - mCubeWaveEffect.SetProperty( Actor::Property::SIZE, mViewSize ); - mCubeWaveEffect.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); - mCubeWaveEffect.SetCurrentTexture( mCurrentTexture ); + mCubeWaveEffect.SetProperty(Actor::Property::SIZE, mViewSize); + mCubeWaveEffect.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); + mCubeWaveEffect.SetCurrentTexture(mCurrentTexture); // use big cubes - mCubeCrossEffect = Toolkit::CubeTransitionCrossEffect::New(NUM_ROWS_CROSS, NUM_COLUMNS_CROSS ); - mCubeCrossEffect.SetTransitionDuration( ANIMATION_DURATION_CROSS ); - mCubeCrossEffect.SetCubeDisplacement( CUBE_DISPLACEMENT_CROSS ); + mCubeCrossEffect = Toolkit::CubeTransitionCrossEffect::New(NUM_ROWS_CROSS, NUM_COLUMNS_CROSS); + mCubeCrossEffect.SetTransitionDuration(ANIMATION_DURATION_CROSS); + mCubeCrossEffect.SetCubeDisplacement(CUBE_DISPLACEMENT_CROSS); mCubeCrossEffect.TransitionCompletedSignal().Connect(this, &CubeTransitionApp::OnTransitionCompleted); - mCubeCrossEffect.SetProperty( Actor::Property::SIZE, mViewSize ); - mCubeCrossEffect.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); - mCubeCrossEffect.SetCurrentTexture( mCurrentTexture ); + mCubeCrossEffect.SetProperty(Actor::Property::SIZE, mViewSize); + mCubeCrossEffect.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); + mCubeCrossEffect.SetCurrentTexture(mCurrentTexture); - mCubeFoldEffect = Toolkit::CubeTransitionFoldEffect::New( NUM_ROWS_FOLD, NUM_COLUMNS_FOLD ); - mCubeFoldEffect.SetTransitionDuration( ANIMATION_DURATION_FOLD ); + mCubeFoldEffect = Toolkit::CubeTransitionFoldEffect::New(NUM_ROWS_FOLD, NUM_COLUMNS_FOLD); + mCubeFoldEffect.SetTransitionDuration(ANIMATION_DURATION_FOLD); mCubeFoldEffect.TransitionCompletedSignal().Connect(this, &CubeTransitionApp::OnTransitionCompleted); - mCubeFoldEffect.SetProperty( Actor::Property::SIZE, mViewSize ); - mCubeFoldEffect.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); - mCubeFoldEffect.SetCurrentTexture( mCurrentTexture ); - - mViewTimer = Timer::New( VIEWINGTIME ); - mViewTimer.TickSignal().Connect( this, &CubeTransitionApp::OnTimerTick ); + mCubeFoldEffect.SetProperty(Actor::Property::SIZE, mViewSize); + mCubeFoldEffect.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER); + mCubeFoldEffect.SetCurrentTexture(mCurrentTexture); + mViewTimer = Timer::New(VIEWINGTIME); + mViewTimer.TickSignal().Connect(this, &CubeTransitionApp::OnTimerTick); mCurrentEffect = mCubeWaveEffect; - mContent.Add( mCurrentEffect ); + mContent.Add(mCurrentEffect); // use pan gesture to detect the cursor or finger movement mPanGestureDetector = PanGestureDetector::New(); - mPanGestureDetector.DetectedSignal().Connect( this, &CubeTransitionApp::OnPanGesture ); - mPanGestureDetector.Attach( mContent ); + mPanGestureDetector.DetectedSignal().Connect(this, &CubeTransitionApp::OnPanGesture); + mPanGestureDetector.Attach(mContent); } // signal handler, called when the pan gesture is detected -void CubeTransitionApp::OnPanGesture( Actor actor, const PanGesture& gesture ) +void CubeTransitionApp::OnPanGesture(Actor actor, const PanGesture& gesture) { // does not response when the transition has not finished - if( mIsImageLoading || mCubeWaveEffect.IsTransitioning() || mCubeCrossEffect.IsTransitioning() || mCubeFoldEffect.IsTransitioning() || mSlideshow ) + if(mIsImageLoading || mCubeWaveEffect.IsTransitioning() || mCubeCrossEffect.IsTransitioning() || mCubeFoldEffect.IsTransitioning() || mSlideshow) { return; } - if( gesture.GetState() == GestureState::CONTINUING ) + if(gesture.GetState() == GestureState::CONTINUING) { const Vector2& displacement = gesture.GetDisplacement(); - if( displacement.x < 0) + if(displacement.x < 0) { - mIndex = (mIndex + 1)%NUM_IMAGES; + mIndex = (mIndex + 1) % NUM_IMAGES; } else { - mIndex = (mIndex + NUM_IMAGES -1)%NUM_IMAGES; + mIndex = (mIndex + NUM_IMAGES - 1) % NUM_IMAGES; } - mPanPosition = gesture.GetPosition(); + mPanPosition = gesture.GetPosition(); mPanDisplacement = displacement; GoToNextImage(); } @@ -316,64 +309,64 @@ void CubeTransitionApp::OnPanGesture( Actor actor, const PanGesture& gesture ) void CubeTransitionApp::GoToNextImage() { - mNextTexture = LoadWindowFillingTexture( IMAGES[ mIndex ] ); - mCurrentEffect.SetTargetTexture( mNextTexture ); + mNextTexture = LoadWindowFillingTexture(IMAGES[mIndex]); + mCurrentEffect.SetTargetTexture(mNextTexture); mIsImageLoading = false; - mCurrentEffect.StartTransition( mPanPosition, mPanDisplacement ); + mCurrentEffect.StartTransition(mPanPosition, mPanDisplacement); mCurrentTexture = mNextTexture; } -bool CubeTransitionApp::OnEffectButtonClicked( Toolkit::Button button ) +bool CubeTransitionApp::OnEffectButtonClicked(Toolkit::Button button) { - mContent.Remove( mCurrentEffect ); + mContent.Remove(mCurrentEffect); if(mCurrentEffect == mCubeWaveEffect) { mCurrentEffect = mCubeCrossEffect; - mTitle.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_CROSS) ); + mTitle.SetProperty(TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_CROSS)); } else if(mCurrentEffect == mCubeCrossEffect) { mCurrentEffect = mCubeFoldEffect; - mTitle.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_FOLD) ); + mTitle.SetProperty(TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_FOLD)); } else { mCurrentEffect = mCubeWaveEffect; - mTitle.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_WAVE) ); + mTitle.SetProperty(TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_WAVE)); } - mContent.Add( mCurrentEffect ); + mContent.Add(mCurrentEffect); // Set the current image to cube transition effect // only need to set at beginning or change from another effect - mCurrentEffect.SetCurrentTexture( mCurrentTexture ); + mCurrentEffect.SetCurrentTexture(mCurrentTexture); return true; } -bool CubeTransitionApp::OnSildeshowButtonClicked( Toolkit::Button button ) +bool CubeTransitionApp::OnSildeshowButtonClicked(Toolkit::Button button) { mSlideshow = !mSlideshow; - if( mSlideshow ) + if(mSlideshow) { - mPanGestureDetector.Detach( mContent ); - mSlideshowButton.SetProperty( Toolkit::Button::Property::UNSELECTED_BACKGROUND_VISUAL, SLIDE_SHOW_STOP_ICON ); - mSlideshowButton.SetProperty( Toolkit::Button::Property::SELECTED_BACKGROUND_VISUAL, SLIDE_SHOW_STOP_ICON_SELECTED ); - mPanPosition = Vector2( mViewSize.width, mViewSize.height*0.5f ); - mPanDisplacement = Vector2( -10.f, 0.f ); + mPanGestureDetector.Detach(mContent); + mSlideshowButton.SetProperty(Toolkit::Button::Property::UNSELECTED_BACKGROUND_VISUAL, SLIDE_SHOW_STOP_ICON); + mSlideshowButton.SetProperty(Toolkit::Button::Property::SELECTED_BACKGROUND_VISUAL, SLIDE_SHOW_STOP_ICON_SELECTED); + mPanPosition = Vector2(mViewSize.width, mViewSize.height * 0.5f); + mPanDisplacement = Vector2(-10.f, 0.f); mViewTimer.Start(); } else { - mPanGestureDetector.Attach( mContent ); - mSlideshowButton.SetProperty( Toolkit::Button::Property::UNSELECTED_BACKGROUND_VISUAL, SLIDE_SHOW_START_ICON ); - mSlideshowButton.SetProperty( Toolkit::Button::Property::SELECTED_BACKGROUND_VISUAL, SLIDE_SHOW_START_ICON_SELECTED ); + mPanGestureDetector.Attach(mContent); + mSlideshowButton.SetProperty(Toolkit::Button::Property::UNSELECTED_BACKGROUND_VISUAL, SLIDE_SHOW_START_ICON); + mSlideshowButton.SetProperty(Toolkit::Button::Property::SELECTED_BACKGROUND_VISUAL, SLIDE_SHOW_START_ICON_SELECTED); mViewTimer.Stop(); } return true; } -void CubeTransitionApp::OnTransitionCompleted(Toolkit::CubeTransitionEffect effect, Texture texture ) +void CubeTransitionApp::OnTransitionCompleted(Toolkit::CubeTransitionEffect effect, Texture texture) { - if( mSlideshow ) + if(mSlideshow) { mViewTimer.Start(); } @@ -383,7 +376,7 @@ bool CubeTransitionApp::OnTimerTick() { if(mSlideshow) { - mIndex = (mIndex + 1)%NUM_IMAGES; + mIndex = (mIndex + 1) % NUM_IMAGES; GoToNextImage(); } @@ -391,14 +384,14 @@ bool CubeTransitionApp::OnTimerTick() return false; } -Texture CubeTransitionApp::LoadWindowFillingTexture( const char* filepath ) +Texture CubeTransitionApp::LoadWindowFillingTexture(const char* filepath) { - ImageDimensions dimensions( mApplication.GetWindow().GetSize() ); - Devel::PixelBuffer pixelBuffer = LoadImageFromFile( filepath, dimensions, FittingMode::SCALE_TO_FILL ); - PixelData pixelData = Devel::PixelBuffer::Convert(pixelBuffer); + ImageDimensions dimensions(mApplication.GetWindow().GetSize()); + Devel::PixelBuffer pixelBuffer = LoadImageFromFile(filepath, dimensions, FittingMode::SCALE_TO_FILL); + PixelData pixelData = Devel::PixelBuffer::Convert(pixelBuffer); - Texture texture = Texture::New( TextureType::TEXTURE_2D, pixelData.GetPixelFormat(), pixelData.GetWidth(), pixelData.GetHeight() ); - texture.Upload( pixelData ); + Texture texture = Texture::New(TextureType::TEXTURE_2D, pixelData.GetPixelFormat(), pixelData.GetWidth(), pixelData.GetHeight()); + texture.Upload(pixelData); return texture; } @@ -406,17 +399,17 @@ void CubeTransitionApp::OnKeyEvent(const KeyEvent& event) { if(event.GetState() == KeyEvent::DOWN) { - if( IsKey( event, Dali::DALI_KEY_ESCAPE) || IsKey( event, Dali::DALI_KEY_BACK) ) + if(IsKey(event, Dali::DALI_KEY_ESCAPE) || IsKey(event, Dali::DALI_KEY_BACK)) { mApplication.Quit(); } } } -int DALI_EXPORT_API main( int argc, char **argv ) +int DALI_EXPORT_API main(int argc, char** argv) { - Application application = Application::New( &argc, &argv, DEMO_THEME_PATH ); - CubeTransitionApp test( application ); + Application application = Application::New(&argc, &argv, DEMO_THEME_PATH); + CubeTransitionApp test(application); application.MainLoop(); return 0;