/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
bool OnTimerTick();
/**
- * Loads image, resizes it to the size of stage and creates a textue out of it
+ * Loads image, resizes it to the size of window and creates a textue out of it
* @param[in] filepath Path to the image file
* @return New texture object
*/
- Texture LoadStageFillingTexture( const char* filepath );
+ Texture LoadWindowFillingTexture( const char* filepath );
private:
Application& mApplication;
void CubeTransitionApp::OnInit( Application& application )
{
- Stage::GetCurrent().KeyEventSignal().Connect(this, &CubeTransitionApp::OnKeyEvent);
+ application.GetWindow().KeyEventSignal().Connect(this, &CubeTransitionApp::OnKeyEvent);
- // Creates a default view with a default tool bar, the view is added to the stage.
+ // 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.SetBehavior( Layer::LAYER_3D );
+ mContent.SetProperty( Layer::Property::BEHAVIOR, Layer::LAYER_3D );
// Add an effect changing toggle button
);
effectChangeToggleButton.ClickedSignal().Connect( this, &CubeTransitionApp::OnEffectButtonClicked );
- mToolBar.AddControl( effectChangeToggleButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight, DemoHelper::DEFAULT_MODE_SWITCH_PADDING );
+ 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::HorizontalCenter );
+ 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::HorizontalCenter, DemoHelper::DEFAULT_PLAY_PADDING );
+ mToolBar.AddControl( mSlideshowButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HORIZONTAL_CENTER, DemoHelper::DEFAULT_PLAY_PADDING );
- // Set size to stage size to avoid seeing a black border on transition
- mViewSize = Stage::GetCurrent().GetSize();
+ // Set size to window size to avoid seeing a black border on transition
+ mViewSize = application.GetWindow().GetSize();
// show the first image
- mCurrentTexture = LoadStageFillingTexture( IMAGES[mIndex] );
+ mCurrentTexture = LoadWindowFillingTexture( IMAGES[mIndex] );
//use small cubes
mCubeWaveEffect = Toolkit::CubeTransitionWaveEffect::New( NUM_ROWS_WAVE, NUM_COLUMNS_WAVE );
return;
}
- if( gesture.state == Gesture::Continuing )
+ if( gesture.GetState() == GestureState::CONTINUING )
{
- if( gesture.displacement.x < 0)
+ const Vector2& displacement = gesture.GetDisplacement();
+ if( displacement.x < 0)
{
mIndex = (mIndex + 1)%NUM_IMAGES;
}
mIndex = (mIndex + NUM_IMAGES -1)%NUM_IMAGES;
}
- mPanPosition = gesture.position;
- mPanDisplacement = gesture.displacement;
+ mPanPosition = gesture.GetPosition();
+ mPanDisplacement = displacement;
GoToNextImage();
}
}
void CubeTransitionApp::GoToNextImage()
{
- mNextTexture = LoadStageFillingTexture( IMAGES[ mIndex ] );
+ mNextTexture = LoadWindowFillingTexture( IMAGES[ mIndex ] );
mCurrentEffect.SetTargetTexture( mNextTexture );
mIsImageLoading = false;
mCurrentEffect.StartTransition( mPanPosition, mPanDisplacement );
return false;
}
-Texture CubeTransitionApp::LoadStageFillingTexture( const char* filepath )
+Texture CubeTransitionApp::LoadWindowFillingTexture( const char* filepath )
{
- ImageDimensions dimensions( Stage::GetCurrent().GetSize().x, Stage::GetCurrent().GetSize().y );
+ ImageDimensions dimensions( mApplication.GetWindow().GetSize() );
Devel::PixelBuffer pixelBuffer = LoadImageFromFile( filepath, dimensions, FittingMode::SCALE_TO_FILL );
PixelData pixelData = Devel::PixelBuffer::Convert(pixelBuffer);
void CubeTransitionApp::OnKeyEvent(const KeyEvent& event)
{
- if(event.state == KeyEvent::Down)
+ if(event.GetState() == KeyEvent::DOWN)
{
if( IsKey( event, Dali::DALI_KEY_ESCAPE) || IsKey( event, Dali::DALI_KEY_BACK) )
{