void DissolveEffectApp::OnInit( Application& application )
{
  Stage::GetCurrent().KeyEventSignal().Connect(this, &DissolveEffectApp::OnKeyEvent);

  // Creates a default view with a default tool bar, the view is added to the stage.
  mContent = DemoHelper::CreateView( application, mView,mToolBar, "", TOOLBAR_IMAGE, "" );

  // Add an effect-changing button on the right of the tool bar.
  mEffectChangeButton = Toolkit::PushButton::New();
  mEffectChangeButton.SetProperty( Toolkit::Button::Property::UNSELECTED_STATE_IMAGE, EFFECT_HIGHP_IMAGE );
  mEffectChangeButton.SetProperty( Toolkit::Button::Property::SELECTED_STATE_IMAGE, EFFECT_HIGHP_IMAGE_SELECTED );
  mEffectChangeButton.ClickedSignal().Connect( this, &DissolveEffectApp::OnEffectButtonClicked );
  mToolBar.AddControl( mEffectChangeButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight, DemoHelper::DEFAULT_MODE_SWITCH_PADDING );

  // Add title to the tool bar.
  mTitleActor = DemoHelper::CreateToolBarLabel( APPLICATION_TITLE_HIGHP );
  mToolBar.AddControl( mTitleActor, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarTitlePercentage, Toolkit::Alignment::HorizontalCenter );

  // Add an slide-show button on the right of the title
  mPlayStopButton = Toolkit::PushButton::New();
  mPlayStopButton.SetProperty( Toolkit::Button::Property::UNSELECTED_STATE_IMAGE, PLAY_ICON );
  mPlayStopButton.SetProperty( Toolkit::Button::Property::SELECTED_STATE_IMAGE, PLAY_ICON_SELECTED );
  mPlayStopButton.ClickedSignal().Connect( this, &DissolveEffectApp::OnSildeshowButtonClicked );
  mToolBar.AddControl( mPlayStopButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalCenter, DemoHelper::DEFAULT_PLAY_PADDING );

  // use pan gesture to detect the cursor or finger movement
  mPanGestureDetector = PanGestureDetector::New();
  mPanGestureDetector.DetectedSignal().Connect( this, &DissolveEffectApp::OnPanGesture );

  mViewTimer = Timer::New( VIEWINGTIME );
  mViewTimer.TickSignal().Connect( this, &DissolveEffectApp::OnTimerTick );
  mTimerReady = true;

  // Set size to stage size to avoid seeing a black border on transition
  mParent = Actor::New();
  mParent.SetSize( Stage::GetCurrent().GetSize() );
  mParent.SetParentOrigin( ParentOrigin::CENTER );
  mContent.Add( mParent );

  // show the first image
  mCurrentImage = CreateStageFillingImageView( IMAGES[mIndex] );
  mCurrentImage.SetParentOrigin( ParentOrigin::CENTER );
  mCurrentImage.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
  mCurrentImage.SetSizeScalePolicy( SizeScalePolicy::FIT_WITH_ASPECT_RATIO );
  mParent.Add( mCurrentImage );

  mPanGestureDetector.Attach( mCurrentImage );

  mDissolveEffect = Dali::Toolkit::CreateDissolveEffect( mUseHighPrecision );
  Property::Map emptyShaderMap;
  mEmptyEffect.Insert( "shader", emptyShaderMap );
}
コード例 #2
0
void EffectsViewApp::SetTitle(int effectSize)
{
  std::ostringstream title;
  title<<TITLE<< effectSize;

  if(!mTitleActor)
  {
    mTitleActor = DemoHelper::CreateToolBarLabel( title.str() );
    // Add title to the tool bar.
    mToolBar.AddControl( mTitleActor, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarTitlePercentage, Toolkit::Alignment::HorizontalCenter );
  }
  mTitleActor.SetProperty( Toolkit::TextLabel::Property::TEXT, title.str() );
}
コード例 #3
0
void EffectsViewApp::OnAppInitialize( Application& application )
{
  // The Init signal is received once (only) during the Application lifetime

  Stage stage = Stage::GetCurrent();
  stage.KeyEventSignal().Connect(this, &EffectsViewApp::OnKeyEvent);
  stage.SetBackgroundColor( Color::WHITE );

  mStageSize = stage.GetSize();

  // Creates a default view with a default tool bar.
  // The view is added to the stage.
  mContents = DemoHelper::CreateView( application, mView, mToolBar, "", TOOLBAR_IMAGE, "" );

  // Creates view change button.
  Toolkit::PushButton viewButton = Toolkit::PushButton::New();
  viewButton.SetUnselectedImage( VIEW_SWAP_IMAGE );
  viewButton.SetSelectedImage( VIEW_SWAP_SELECTED_IMAGE );
  // Connects the view change button clicked signal to the OnView method.
  viewButton.ClickedSignal().Connect( this, &EffectsViewApp::ChangeEffectSize );
  mToolBar.AddControl( viewButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight, DemoHelper::DEFAULT_MODE_SWITCH_PADDING  );

  Vector2 effectsViewSize( mStageSize.width, mStageSize.height * 0.25f );
  mDropShadowView = CreateEffectsView( EffectsView::DROP_SHADOW, effectsViewSize, mEffectSize );
  mDropShadowView.SetParentOrigin( ParentOrigin::CENTER );
  mDropShadowView.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER );
  mDropShadowView.SetZ( -mStageSize.height * 0.1f );
  mContents.Add( mDropShadowView );

  mEmbossView = CreateEffectsView( EffectsView::EMBOSS, effectsViewSize, mEffectSize );
  mEmbossView.SetParentOrigin( ParentOrigin::CENTER );
  mEmbossView.SetAnchorPoint( AnchorPoint::TOP_CENTER );
  mEmbossView.SetZ( mStageSize.height * 0.1f );
  mContents.Add( mEmbossView );

  SetTitle( mEffectSize );
}
コード例 #4
0
void CubeTransitionApp::OnInit( Application& application )
{
  Stage::GetCurrent().KeyEventSignal().Connect(this, &CubeTransitionApp::OnKeyEvent);

  // Creates a default view with a default tool bar, the view is added to the stage.
  mContent = DemoHelper::CreateView( application, mView, mToolBar, "", TOOLBAR_IMAGE, "" );
  mContent.SetBehavior( Layer::LAYER_3D );

  // Add an effect-changing button on the right of the tool bar.
  mEffectChangeButton = Toolkit::PushButton::New();
  mEffectChangeButton.SetUnselectedImage( EFFECT_WAVE_IMAGE );
  mEffectChangeButton.SetSelectedImage( EFFECT_WAVE_IMAGE_SELECTED );
  mEffectChangeButton.ClickedSignal().Connect( this, &CubeTransitionApp::OnEffectButtonClicked );
  mToolBar.AddControl( mEffectChangeButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight, 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 );

  //Add an slideshow icon on the right of the title
  mSlideshowButton = Toolkit::PushButton::New();
  mSlideshowButton.SetUnselectedImage( SLIDE_SHOW_START_ICON );
  mSlideshowButton.SetSelectedImage( 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 );

  // Set size to stage size to avoid seeing a black border on transition
  mViewSize = Stage::GetCurrent().GetSize();

  // show the first image
  mCurrentImage = LoadStageFillingImage( 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.TransitionCompletedSignal().Connect(this, &CubeTransitionApp::OnTransitionCompleted);

  mCubeWaveEffect.SetSize( mViewSize );
  mCubeWaveEffect.SetPositionInheritanceMode( USE_PARENT_POSITION );
  mCubeWaveEffect.SetCurrentImage( mCurrentImage );

  // use big cubes
  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.SetSize( mViewSize );
  mCubeCrossEffect.SetPositionInheritanceMode( USE_PARENT_POSITION );
  mCubeCrossEffect.SetCurrentImage( mCurrentImage );

  mCubeFoldEffect = Toolkit::CubeTransitionFoldEffect::New( NUM_ROWS_FOLD, NUM_COLUMNS_FOLD );
  mCubeFoldEffect.SetTransitionDuration( ANIMATION_DURATION_FOLD );
  mCubeFoldEffect.TransitionCompletedSignal().Connect(this, &CubeTransitionApp::OnTransitionCompleted);

  mCubeFoldEffect.SetSize( mViewSize );
  mCubeFoldEffect.SetPositionInheritanceMode( USE_PARENT_POSITION );
  mCubeFoldEffect.SetCurrentImage( mCurrentImage );

  mViewTimer = Timer::New( VIEWINGTIME );
  mViewTimer.TickSignal().Connect( this, &CubeTransitionApp::OnTimerTick );


  mCurrentEffect = mCubeWaveEffect;
  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 );
}