mTimer.Start();
// Connect to key events in order to exit
- Stage::GetCurrent().KeyEventSignal().Connect(this, &ExampleApp::OnKeyEvent);
+ app.GetWindow().KeyEventSignal().Connect(this, &ExampleApp::OnKeyEvent);
}
private:
void ReloadJsonFile(Builder& builder, Layer& layer)
{
- Stage stage = Stage::GetCurrent();
- stage.SetBackgroundColor( Color::WHITE );
+ Window window = mApp.GetWindow();
+ window.SetBackgroundColor( Color::WHITE );
builder = Builder::New();
builder.QuitSignal().Connect( this, &ExampleApp::OnBuilderQuit );
layer = Layer::New();
layer.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::CENTER);
layer.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::CENTER);
- layer.SetProperty( Actor::Property::SIZE, stage.GetRootLayer().GetCurrentProperty< Vector3 >( Actor::Property::SIZE ) );
- stage.GetRootLayer().Add(layer);
+ layer.SetProperty( Actor::Property::SIZE, window.GetRootLayer().GetCurrentProperty< Vector3 >( Actor::Property::SIZE ) );
+ window.GetRootLayer().Add(layer);
// render tasks may have been setup last load so remove them
- RenderTaskList taskList = stage.GetRenderTaskList();
+ RenderTaskList taskList = window.GetRenderTaskList();
if( taskList.GetTaskCount() > 1 )
{
typedef std::vector<RenderTask> Collection;
}
RenderTask defaultTask = taskList.GetTask(0);
- defaultTask.SetSourceActor( stage.GetRootLayer() );
+ defaultTask.SetSourceActor( window.GetRootLayer() );
defaultTask.SetFrameBuffer( FrameBuffer() );
}
}
/*
- * Copyright (c) 2017 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.
// This creates an image view with one of 3 images, and one of 2 masks.
// Clicking the screen will cycle through each combination of mask and image.
- // Get a handle to the stage
- Stage stage = Stage::GetCurrent();
- stage.KeyEventSignal().Connect(this, &ImageViewAlphaBlendApp::OnKeyEvent);
- stage.SetBackgroundColor( Color::WHITE );
+ // Get a handle to the window
+ Window window = application.GetWindow();
+ window.KeyEventSignal().Connect(this, &ImageViewAlphaBlendApp::OnKeyEvent);
+ window.SetBackgroundColor( Color::WHITE );
mImageView = Toolkit::ImageView::New();
mImageView.SetProperty( Actor::Property::SIZE, Vector2(200, 200) );
mImageView.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
- stage.Add(mImageView);
+ window.Add(mImageView);
mImageLabel = Toolkit::TextLabel::New();
mImageLabel.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_CENTER );
mImageLabel.SetProperty( Actor::Property::ANCHOR_POINT, ParentOrigin::BOTTOM_CENTER );
mImageLabel.SetProperty( Actor::Property::POSITION, Vector3( 0.0f, -50.0f, 0.0f ) );
mImageLabel.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::BLACK );
- stage.Add(mImageLabel);
+ window.Add(mImageLabel);
mMaskLabel = Toolkit::TextLabel::New();
mMaskLabel.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_CENTER );
mMaskLabel.SetProperty( Actor::Property::ANCHOR_POINT, ParentOrigin::BOTTOM_CENTER );
mMaskLabel.SetProperty( Actor::Property::POSITION, Vector3( 0.0f, 0.0f, 0.0f ) );
mMaskLabel.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::BLACK );
- stage.Add(mMaskLabel);
+ window.Add(mMaskLabel);
LoadImages();
- stage.TouchSignal().Connect( this, &ImageViewAlphaBlendApp::OnTouched );
+ window.TouchSignal().Connect( this, &ImageViewAlphaBlendApp::OnTouched );
}
void OnTouched( const TouchData& touchData )
/*
-* 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.
{
// The value for scale-change between wearable-mobile
// Can be changed on App-Create time
-Vector2 STAGE_SIZE = Vector2( 360.0f, 360.0f );
-Vector2 SCALED_STAGE_SIZE = Vector2( 1.0f, 1.0f );
-Vector3 SCALED_STAGE_SIZE_3 = Vector3( 1.0f, 1.0f, 0.0f );
+Vector2 WINDOW_SIZE = Vector2( 360.0f, 360.0f );
+Vector2 SCALED_WINDOW_SIZE = Vector2( 1.0f, 1.0f );
+Vector3 SCALED_WINDOW_SIZE_3 = Vector3( 1.0f, 1.0f, 0.0f );
float SCALED_WIDTH = 1.0f;
float SCALED_HEIGHT = 1.0f;
float FONT_SCALE = 0.25f;
// The Init signal is received once (only) during the Application lifetime
void Create(Application& application)
{
- // Get a handle to the stage
- mStage = Stage::GetCurrent();
- mStage.KeyEventSignal().Connect( this, &CallController::OnKeyEvent );
+ // Get a handle to the main window
+ mWindow = application.GetWindow();
+ mWindow.KeyEventSignal().Connect( this, &CallController::OnKeyEvent );
// Apply custom style for background and button.
StyleManager::Get().ApplyTheme( BACKGROUND_STYLE_JSON );
// Get current device's width and height.
- STAGE_SIZE = mStage.GetSize();
- SCALED_STAGE_SIZE = STAGE_SIZE / 360.0f;
- SCALED_STAGE_SIZE_3 = Vector3( SCALED_STAGE_SIZE.x, SCALED_STAGE_SIZE.y, 0.0f );
- SCALED_WIDTH = SCALED_STAGE_SIZE.x < SCALED_STAGE_SIZE.y ? SCALED_STAGE_SIZE.x : SCALED_STAGE_SIZE.y;
+ const Window::WindowSize windowSize = mWindow.GetSize();
+ WINDOW_SIZE = Vector2(windowSize.GetWidth(), windowSize.GetHeight());
+ SCALED_WINDOW_SIZE = WINDOW_SIZE / 360.0f;
+ SCALED_WINDOW_SIZE_3 = Vector3( SCALED_WINDOW_SIZE.x, SCALED_WINDOW_SIZE.y, 0.0f );
+ SCALED_WIDTH = SCALED_WINDOW_SIZE.x < SCALED_WINDOW_SIZE.y ? SCALED_WINDOW_SIZE.x : SCALED_WINDOW_SIZE.y;
SCALED_HEIGHT = SCALED_WIDTH;
// Note that this is heuristic value
- FONT_SCALE = 0.25f * STAGE_SIZE.y / STAGE_SIZE.x;
+ FONT_SCALE = 0.25f * WINDOW_SIZE.y / WINDOW_SIZE.x;
mBackground = Control::New();
mBackground.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
mBackground.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
- mBackground.SetProperty( Actor::Property::SIZE, STAGE_SIZE );
+ mBackground.SetProperty( Actor::Property::SIZE, WINDOW_SIZE );
- mStage.Add( mBackground );
+ mWindow.Add( mBackground );
BuildParameter();
SetupActors();
SetupActiveActors();
}
- // Create and Add to stage when visible at call incomming
+ // Create and Add to window when visible at call incomming
void SetupComingActors()
{
mButtonIconDecall = ImageView::New();
mCallStartButton.SetProperty( Control::Property::BACKGROUND, ICON_CALL_IMAGE );
mCallStartButton.SetProperty( Button::Property::LABEL, "" );
- mStage.Add( mCallStartButton );
- mStage.Add( mButtonIconDecall );
- mStage.Add( mButtonIconBattery );
+ mWindow.Add( mCallStartButton );
+ mWindow.Add( mButtonIconDecall );
+ mWindow.Add( mButtonIconBattery );
mLabelIncoming = TextLabel::New( LABEL_INCOMING_STR );
mLabelIncoming.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
mLabelIncoming.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
- mLabelIncoming.SetProperty( Actor::Property::SIZE, LABEL_INCOMING_SIZE * SCALED_STAGE_SIZE );
- mLabelIncoming.SetProperty( Actor::Property::POSITION, LABEL_INCOMING_POSITION * SCALED_STAGE_SIZE_3 );
+ mLabelIncoming.SetProperty( Actor::Property::SIZE, LABEL_INCOMING_SIZE * SCALED_WINDOW_SIZE );
+ mLabelIncoming.SetProperty( Actor::Property::POSITION, LABEL_INCOMING_POSITION * SCALED_WINDOW_SIZE_3 );
mLabelIncoming.SetProperty( Actor::Property::VISIBLE, true );
mLabelIncoming.SetProperty( TextLabel::Property::TEXT_COLOR, LABEL_INCOMING_FONT_COLOR );
mLabelIncoming.SetProperty( TextLabel::Property::POINT_SIZE, LABEL_INCOMING_FONT_SIZE * FONT_SCALE );
mLabelName = TextLabel::New( LABEL_NAME_STR );
mLabelName.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
mLabelName.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
- mLabelName.SetProperty( Actor::Property::SIZE, LABEL_NAME_SIZE * SCALED_STAGE_SIZE );
- mLabelName.SetProperty( Actor::Property::POSITION, LABEL_NAME_POSITION * SCALED_STAGE_SIZE_3 );
+ mLabelName.SetProperty( Actor::Property::SIZE, LABEL_NAME_SIZE * SCALED_WINDOW_SIZE );
+ mLabelName.SetProperty( Actor::Property::POSITION, LABEL_NAME_POSITION * SCALED_WINDOW_SIZE_3 );
mLabelName.SetProperty( Actor::Property::VISIBLE, true );
mLabelName.SetProperty( TextLabel::Property::TEXT_COLOR, LABEL_NAME_FONT_COLOR );
mLabelName.SetProperty( TextLabel::Property::POINT_SIZE, LABEL_NAME_FONT_SIZE * FONT_SCALE );
mLabelNumber = TextLabel::New( LABEL_NUMBER_STR );
mLabelNumber.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
mLabelNumber.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
- mLabelNumber.SetProperty( Actor::Property::SIZE, LABEL_NUMBER_SIZE * SCALED_STAGE_SIZE );
- mLabelNumber.SetProperty( Actor::Property::POSITION, LABEL_NUMBER_POSITION * SCALED_STAGE_SIZE_3 );
+ mLabelNumber.SetProperty( Actor::Property::SIZE, LABEL_NUMBER_SIZE * SCALED_WINDOW_SIZE );
+ mLabelNumber.SetProperty( Actor::Property::POSITION, LABEL_NUMBER_POSITION * SCALED_WINDOW_SIZE_3 );
mLabelNumber.SetProperty( Actor::Property::VISIBLE, true );
mLabelNumber.SetProperty( TextLabel::Property::TEXT_COLOR, LABEL_NUMBER_FONT_COLOR );
mLabelNumber.SetProperty( TextLabel::Property::POINT_SIZE, LABEL_NUMBER_FONT_SIZE * FONT_SCALE );
mLabelDecline = TextLabel::New( LABEL_DECLINE_STR );
mLabelDecline.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_CENTER );
mLabelDecline.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_CENTER );
- mLabelDecline.SetProperty( Actor::Property::SIZE, LABEL_DECLINE_SIZE * SCALED_STAGE_SIZE );
+ mLabelDecline.SetProperty( Actor::Property::SIZE, LABEL_DECLINE_SIZE * SCALED_WINDOW_SIZE );
mLabelDecline.SetProperty( Actor::Property::POSITION, LABEL_DECLINE_POSITION * SCALED_WIDTH );
mLabelDecline.SetProperty( Actor::Property::VISIBLE, true );
mLabelDecline.SetProperty( TextLabel::Property::TEXT_COLOR, LABEL_DECLINE_FONT_COLOR );
mLabelDecline.SetProperty( TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
mLabelDecline.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
- mStage.Add( mLabelIncoming );
- mStage.Add( mLabelName );
- mStage.Add( mLabelNumber );
- mStage.Add( mLabelDecline );
+ mWindow.Add( mLabelIncoming );
+ mWindow.Add( mLabelName );
+ mWindow.Add( mLabelNumber );
+ mWindow.Add( mLabelDecline );
}
- // Create and Add to stage when visible at call active
+ // Create and Add to window when visible at call active
void SetupActiveActors()
{
mButtonClip = Control::New();
mLabelTime = TextLabel::New( LABEL_TIME_STR );
mLabelTime.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
mLabelTime.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
- mLabelTime.SetProperty( Actor::Property::SIZE, LABEL_TIME_SIZE * SCALED_STAGE_SIZE );
- mLabelTime.SetProperty( Actor::Property::POSITION, LABEL_TIME_POSITION * SCALED_STAGE_SIZE_3 );
+ mLabelTime.SetProperty( Actor::Property::SIZE, LABEL_TIME_SIZE * SCALED_WINDOW_SIZE );
+ mLabelTime.SetProperty( Actor::Property::POSITION, LABEL_TIME_POSITION * SCALED_WINDOW_SIZE_3 );
mLabelTime.SetProperty( Actor::Property::VISIBLE, false );
mLabelTime.SetProperty( TextLabel::Property::TEXT_COLOR, LABEL_TIME_FONT_COLOR );
mLabelTime.SetProperty( TextLabel::Property::POINT_SIZE, LABEL_TIME_FONT_SIZE * FONT_SCALE );
mLabelTime.SetProperty( TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
mLabelTime.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
- mStage.Add( mLabelTime );
+ mWindow.Add( mLabelTime );
}
void SetupAnimation()
if( button == mCallStartButton )
{
mBackground.SetStyleName( BACKGROUND_ACTIVE_STYLE_STR );
- mStage.Add( mButtonClip );
+ mWindow.Add( mButtonClip );
mMoveFront.Play();
}
else if( button == mCallEndButton )
private:
Application& mApplication;
- Stage mStage;
+ Window mWindow;
Control mBackground;
/*
-* Copyright (c) 2018 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.
{
// The value for scale-change between wearable-mobile
// Can be changed on App-Create time
-Vector2 STAGE_SIZE = Vector2( 360.0f, 360.0f );
-Vector2 SCALED_STAGE_SIZE = Vector2( 1.0f, 1.0f );
-Vector3 SCALED_STAGE_SIZE_3 = Vector3( 1.0f, 1.0f, 0.0f );
+Vector2 WINDOW_SIZE = Vector2( 360.0f, 360.0f );
+Vector2 SCALED_WINDOW_SIZE = Vector2( 1.0f, 1.0f );
+Vector3 SCALED_WINDOW_SIZE_3 = Vector3( 1.0f, 1.0f, 0.0f );
float SCALED_WIDTH = 1.0f;
float SCALED_HEIGHT = 1.0f;
float FONT_SCALE = 0.25f;
}
~CardManager() {}
- void Init(Stage& stage)
+ void Init(Window& window)
{
mSize = CARD_SIZE * SCALED_WIDTH;
mOffset = CARD_OFFSET * SCALED_WIDTH;
mCard[k].SetProperty( Actor::Property::SIZE, Vector2( mSize.x, mSize.y ) );
mCard[k].SetProperty( Actor::Property::POSITION, Vector2( mPosition[k].x, mPosition[k].y ));
- stage.Add( mCard[k] );
+ window.Add( mCard[k] );
}
}
// The Init signal is received once (only) during the Application lifetime
void Create(Application& application)
{
- // Get a handle to the stage
- mStage = Stage::GetCurrent();
- mStage.KeyEventSignal().Connect( this, &CardController::OnKeyEvent );
+ // Get a handle to the window
+ mWindow = application.GetWindow();
+ mWindow.KeyEventSignal().Connect( this, &CardController::OnKeyEvent );
// Get current device's width and height.
- STAGE_SIZE = mStage.GetSize();
- SCALED_STAGE_SIZE = STAGE_SIZE / 360.0f;
- SCALED_STAGE_SIZE_3 = Vector3( SCALED_STAGE_SIZE.x, SCALED_STAGE_SIZE.y, 0.0f );
- SCALED_WIDTH = SCALED_STAGE_SIZE.x < SCALED_STAGE_SIZE.y ? SCALED_STAGE_SIZE.x : SCALED_STAGE_SIZE.y;
+ const Window::WindowSize windowSize = mWindow.GetSize();
+ WINDOW_SIZE = Vector2(windowSize.GetWidth(), windowSize.GetHeight() );
+ SCALED_WINDOW_SIZE = WINDOW_SIZE / 360.0f;
+ SCALED_WINDOW_SIZE_3 = Vector3( SCALED_WINDOW_SIZE.x, SCALED_WINDOW_SIZE.y, 0.0f );
+ SCALED_WIDTH = SCALED_WINDOW_SIZE.x < SCALED_WINDOW_SIZE.y ? SCALED_WINDOW_SIZE.x : SCALED_WINDOW_SIZE.y;
SCALED_HEIGHT = SCALED_WIDTH;
// Note that this is heuristic value
- FONT_SCALE = 0.25f * STAGE_SIZE.y / STAGE_SIZE.x;
+ FONT_SCALE = 0.25f * WINDOW_SIZE.y / WINDOW_SIZE.x;
mBackground = Control::New();
mBackground.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
mBackground.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
- mBackground.SetProperty( Actor::Property::SIZE, STAGE_SIZE );
+ mBackground.SetProperty( Actor::Property::SIZE, WINDOW_SIZE );
- mStage.Add( mBackground );
+ mWindow.Add( mBackground );
BuildParameter();
InitMap();
SetupActors();
SetupAnimation();
- mStage.GetRootLayer().TouchSignal().Connect( this, &CardController::OnTouchLayer );
+ mWindow.GetRootLayer().TouchSignal().Connect( this, &CardController::OnTouchLayer );
Reset();
}
{
Vector2 diff = (mLastTouchPos - mFirstTouchPos);
float offset = PSEUDO_SCROLL_OFFSET;
+ const float windowWidth = mWindow.GetSize().GetWidth();
// Scroll to right
- if( diff.x > mStage.GetSize().x * offset )
+ if( diff.x > windowWidth * offset )
{
mCards.mCurState = 2;
MoveRight();
mCardChanger.Start();
}
// Scroll to left
- else if( diff.x < -mStage.GetSize().x * offset )
+ else if( diff.x < -windowWidth * offset )
{
mCards.mCurState = 2;
MoveLeft();
void SetupCards()
{
- mCards.Init( mStage );
+ mCards.Init( mWindow );
for( int k = 0; k < CARD_NUM; k++ )
{
mCards[k].TouchSignal().Connect( this, &CardController::OnTouchCards );
mNormalEndColor = mCards.GetColorBackground( mCards.mCurIndex );
}
- // Create and Add to stage
+ // Create and Add to window
void SetupActors()
{
mAddButton = ImageView::New();
mLabel3.SetProperty( TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
mLabel3.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
- mStage.Add( mAddButton );
- mStage.Add( mLabel1 );
- mStage.Add( mLabel2 );
- mStage.Add( mLabel3 );
+ mWindow.Add( mAddButton );
+ mWindow.Add( mLabel1 );
+ mWindow.Add( mLabel2 );
+ mWindow.Add( mLabel3 );
}
void SetupAnimation()
private:
Application& mApplication;
- Stage mStage;
+ Window mWindow;
CardManager mCards;
/*
- * 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.
*/
void Create( Application& application )
{
- // Set the stage background color and connect to the stage's key signal to allow Back and Escape to exit.
- Stage stage = Stage::GetCurrent();
- stage.SetBackgroundColor( Color::WHITE );
- stage.KeyEventSignal().Connect( this, &AnimatedImageController::OnKeyEvent );
+ // Set the window background color and connect to the window's key signal to allow Back and Escape to exit.
+ Window window = application.GetWindow();
+ window.SetBackgroundColor( Color::WHITE );
+ window.KeyEventSignal().Connect( this, &AnimatedImageController::OnKeyEvent );
// Create the animated image-views
- CreateAnimatedImageViews();
+ CreateAnimatedImageViews(window);
// Create radio buttons to change between Animated images and Image Arrays
- CreateRadioButtonLayout();
+ CreateRadioButtonLayout(window);
// Create a tap gesture detector to use to pause the animated images
mTapDetector = TapGestureDetector::New();
/**
* @brief Creates and lays out radio buttons to allow changing between the different image types.
*/
- void CreateRadioButtonLayout()
+ void CreateRadioButtonLayout(Window& window)
{
mAnimatedImageButton = CreateRadioButton( ANIMATION_RADIO_BUTTON_NAME, true );
mArrayButton = CreateRadioButton( ARRAY_RADIO_BUTTON_NAME, false );
VerticalAlignment::CENTER );
radioButtonLayout.SetProperty( Actor::Property::POSITION_Y, -10.0f );
- Stage::GetCurrent().Add( radioButtonLayout );
+ window.Add( radioButtonLayout );
}
/**
/**
* @brief Creates the required animated image views.
*/
- void CreateAnimatedImageViews()
+ void CreateAnimatedImageViews(Window window)
{
for( unsigned int index = 0; index < ANIMATED_IMAGE_COUNT; ++index )
{
- Stage stage = Stage::GetCurrent();
-
Control& control = ( index == 0 ) ? mActorDog : mActorLogo;
if( control )
{
- // Remove the previous control from the stage, it's resources (and children) will be deleted automatically
+ // Remove the previous control from the window, it's resources (and children) will be deleted automatically
control.Unparent();
}
control.SetProperty( Actor::Property::SIZE, Vector2(300, 300) );
- // We do not want the animated image playing when it's added to the stage.
+ // We do not want the animated image playing when it's added to the window.
PauseAnimatedImage( control );
- stage.Add( control );
+ window.Add( control );
}
}
{
mImageType = ( button == mAnimatedImageButton ) ? ImageType::ANIMATED_IMAGE : ImageType::IMAGE_ARRAY;
- CreateAnimatedImageViews();
+ CreateAnimatedImageViews(mApplication.GetWindow());
return true;
}
AnimatedShapesExample( Application& application )
: mApplication( application )
{
- // Connect to the Application's Init signal
- mApplication.InitSignal().Connect( this, &AnimatedShapesExample::Create );
+ // Connect to the Application's Init signal
+ mApplication.InitSignal().Connect( this, &AnimatedShapesExample::Create );
}
- ~AnimatedShapesExample()
- {
- // Nothing to do here;
- }
+ ~AnimatedShapesExample() = default;
// The Init signal is received once (only) during the Application lifetime
void Create( Application& application )
{
- Stage stage = Stage::GetCurrent();
+ Window window = application.GetWindow();
+ const Vector2 windowSize = window.GetSize();
// Creates the background gradient
Toolkit::Control background = Dali::Toolkit::Control::New();
stopColors.PushBack( Vector4( 0.0f,0.0f,1.0f,1.0f ) );
stopColors.PushBack( Vector4( 1.0f,1.0f,1.0f,1.0f ) );
map.Insert( GradientVisual::Property::STOP_COLOR, stopColors );
- Vector2 halfStageSize = Stage::GetCurrent().GetSize()*0.5f;
- map.Insert( GradientVisual::Property::START_POSITION, Vector2(0.0f,-halfStageSize.y) );
- map.Insert( GradientVisual::Property::END_POSITION, Vector2(0.0f,halfStageSize.y) );
+ Vector2 halfWindowSize = windowSize * 0.5f;
+ map.Insert( GradientVisual::Property::START_POSITION, Vector2(0.0f,-halfWindowSize.y) );
+ map.Insert( GradientVisual::Property::END_POSITION, Vector2(0.0f,halfWindowSize.y) );
map.Insert( GradientVisual::Property::UNITS, GradientVisual::Units::USER_SPACE );
background.SetProperty( Dali::Toolkit::Control::Property::BACKGROUND, map );
- stage.Add( background );
+ window.Add( background );
// Create a TextLabel for the application title.
Toolkit::TextLabel label = Toolkit::TextLabel::New( APPLICATION_TITLE );
label.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
label.SetProperty( Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
label.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Vector4( 1.0f, 1.0f, 1.0f, 1.0f ) );
- stage.Add( label );
+ window.Add( label );
- CreateTriangleMorph(Vector3( stage.GetSize().x*0.5f, stage.GetSize().y*0.15f, 0.0f), 100.0f );
- CreateCircleMorph( Vector3( stage.GetSize().x*0.5f, stage.GetSize().y*0.5f, 0.0f), 55.0f );
- CreateQuadMorph( Vector3( stage.GetSize().x*0.5f, stage.GetSize().y*0.85f, 0.0f), 60.0f );
+ CreateTriangleMorph(Vector3( windowSize.x*0.5f, windowSize.y*0.15f, 0.0f), 100.0f );
+ CreateCircleMorph( Vector3( windowSize.x*0.5f, windowSize.y*0.5f, 0.0f), 55.0f );
+ CreateQuadMorph( Vector3( windowSize.x*0.5f, windowSize.y*0.85f, 0.0f), 60.0f );
- stage.KeyEventSignal().Connect( this, &AnimatedShapesExample::OnKeyEvent );
+ window.KeyEventSignal().Connect( this, &AnimatedShapesExample::OnKeyEvent );
}
void CreateTriangleMorph( Vector3 center, float side )
actor.SetProperty( Actor::Property::COLOR,Vector4(1.0f,1.0f,0.0f,1.0f) );
actor.AddRenderer( renderer );
- Stage stage = Stage::GetCurrent();
- stage.Add( actor );
+ Window window = mApplication.GetWindow();
+ window.Add( actor );
//Animation
Animation animation = Animation::New(5.0f);
actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
actor.AddRenderer( renderer );
- Stage stage = Stage::GetCurrent();
- stage.Add( actor );
+ Window window = mApplication.GetWindow();
+ window.Add( actor );
//Animation
Animation animation = Animation::New(5.0f);
actor.SetProperty( Actor::Property::COLOR,Vector4(1.0f,0.0f,0.0f,1.0f) );
actor.AddRenderer( renderer );
- Stage stage = Stage::GetCurrent();
- stage.Add( actor );
+ Window window = mApplication.GetWindow();
+ window.Add( actor );
//Animation
Animation animation = Animation::New( 5.0f );
/*
- * 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.
// The Init signal is received once (only) during the Application lifetime
// Creates a default view with a default tool bar.
- // The view is added to the stage.
+ // The view is added to the window.
mContentLayer = DemoHelper::CreateView( application,
mView,
mToolBar,
mTable.AddChild( mImageViews[x], TableView::CellPosition( CellPlacement::IMAGE, x ) );
}
- Stage::GetCurrent().KeyEventSignal().Connect(this, &AnimatedVectorImageViewController::OnKeyEvent);
+ application.GetWindow().KeyEventSignal().Connect(this, &AnimatedVectorImageViewController::OnKeyEvent);
}
private:
// The Init signal is received once (only) during the Application lifetime
void Create( Application& application )
{
- // Get a handle to the stage
- Stage stage = Stage::GetCurrent();
- stage.SetBackgroundColor( Color::WHITE );
+ // Get a handle to the window
+ Window window = application.GetWindow();
+ window.SetBackgroundColor( Color::WHITE );
mControl = Control::New();
mControl.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
mControl.SetProperty( Actor::Property::SIZE, Vector2( 300.0f, 300.0f ) );
mControl.SetProperty( Control::Property::BACKGROUND, BACKGROUND );
- stage.Add( mControl );
+ window.Add( mControl );
mStartAngleLabel = TextLabel::New( "1" );
mStartAngleLabel.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
mStartAngleLabel.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, ResizePolicy::USE_NATURAL_SIZE );
mStartAngleLabel.SetProperty( Control::Property::PADDING, Extents( 20.0f, 20.0f, 10.0f, 10.0f ) );
mStartAngleLabel.TouchSignal().Connect( this, &ArcVisualExample::OnButtonTouch );
- stage.Add( mStartAngleLabel );
+ window.Add( mStartAngleLabel );
mSweepAngleLabel = TextLabel::New( "2" );
mSweepAngleLabel.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
mSweepAngleLabel.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, ResizePolicy::USE_NATURAL_SIZE );
mSweepAngleLabel.SetProperty( Control::Property::PADDING, Extents( 20.0f, 20.0f, 10.0f, 10.0f ) );
mSweepAngleLabel.TouchSignal().Connect( this, &ArcVisualExample::OnButtonTouch );
- stage.Add( mSweepAngleLabel );
+ window.Add( mSweepAngleLabel );
mThicknessLabel = TextLabel::New( "3" );
mThicknessLabel.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
mThicknessLabel.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, ResizePolicy::USE_NATURAL_SIZE );
mThicknessLabel.SetProperty( Control::Property::PADDING, Extents( 20.0f, 20.0f, 10.0f, 10.0f ) );
mThicknessLabel.TouchSignal().Connect( this, &ArcVisualExample::OnButtonTouch );
- stage.Add( mThicknessLabel );
+ window.Add( mThicknessLabel );
mPlusTextLabel = TextLabel::New( "+" );
mPlusTextLabel.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
mPlusTextLabel.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, ResizePolicy::USE_NATURAL_SIZE );
mPlusTextLabel.SetProperty( Control::Property::PADDING, Extents( 20.0f, 20.0f, 10.0f, 10.0f ) );
mPlusTextLabel.TouchSignal().Connect( this, &ArcVisualExample::OnButtonTouch );
- stage.Add( mPlusTextLabel );
+ window.Add( mPlusTextLabel );
mMinusTextLabel = TextLabel::New( "-" );
mMinusTextLabel.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
mMinusTextLabel.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, ResizePolicy::USE_NATURAL_SIZE );
mMinusTextLabel.SetProperty( Control::Property::PADDING, Extents( 25.0f, 25.0f, 10.0f, 10.0f ) );
mMinusTextLabel.TouchSignal().Connect( this, &ArcVisualExample::OnButtonTouch );
- stage.Add( mMinusTextLabel );
+ window.Add( mMinusTextLabel );
- // Respond to a click anywhere on the stage
- stage.GetRootLayer().TouchSignal().Connect( this, &ArcVisualExample::OnTouch );
+ // Respond to a click anywhere on the window
+ window.GetRootLayer().TouchSignal().Connect( this, &ArcVisualExample::OnTouch );
// Respond to key events
- stage.KeyEventSignal().Connect( this, &ArcVisualExample::OnKeyEvent );
+ window.KeyEventSignal().Connect( this, &ArcVisualExample::OnKeyEvent );
}
bool OnButtonTouch( Actor actor, const TouchData& touch )
/*
- * Copyright (c) 2018 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.
public:
Benchmark( Application& application )
-: mApplication( application ),
- mRowsPerPage( gRowsPerPage ),
- mColumnsPerPage( gColumnsPerPage ),
- mPageCount( gPageCount )
-{
+ : mApplication( application ),
+ mRowsPerPage( gRowsPerPage ),
+ mColumnsPerPage( gColumnsPerPage ),
+ mPageCount( gPageCount )
+ {
// Connect to the Application's Init signal
mApplication.InitSignal().Connect( this, &Benchmark::Create );
-}
-
- ~Benchmark()
- {
- // Nothing to do here;
}
+ ~Benchmark() = default;
+
// The Init signal is received once (only) during the Application lifetime
void Create( Application& application )
{
- // Get a handle to the stage
- Stage stage = Stage::GetCurrent();
- stage.SetBackgroundColor( Color::WHITE );
- Vector2 stageSize = stage.GetSize();
+ // Get a handle to the window
+ Window window = application.GetWindow();
+ window.SetBackgroundColor( Color::WHITE );
+ Vector2 windowSize = window.GetSize();
- stage.GetRootLayer().SetProperty( Layer::Property::DEPTH_TEST, false );
+ window.GetRootLayer().SetProperty( Layer::Property::DEPTH_TEST, false );
- mSize = Vector3( stageSize.x / mColumnsPerPage, stageSize.y / mRowsPerPage, 0.0f );
+ mSize = Vector3( windowSize.x / mColumnsPerPage, windowSize.y / mRowsPerPage, 0.0f );
- // Respond to a click anywhere on the stage
- stage.GetRootLayer().TouchSignal().Connect( this, &Benchmark::OnTouch );
+ // Respond to a click anywhere on the window
+ window.GetRootLayer().TouchSignal().Connect( this, &Benchmark::OnTouch );
// Respond to key events
- stage.KeyEventSignal().Connect( this, &Benchmark::OnKeyEvent );
+ window.KeyEventSignal().Connect( this, &Benchmark::OnKeyEvent );
if( gUseMesh )
{
void CreateImageViews()
{
- Stage stage = Stage::GetCurrent();
+ Window window = mApplication.GetWindow();
unsigned int actorCount(mRowsPerPage*mColumnsPerPage * mPageCount);
mImageView.resize(actorCount);
mImageView[i] = ImageView::New(ImagePath(i));
mImageView[i].SetProperty( Actor::Property::SIZE, Vector3(0.0f,0.0f,0.0f) );
mImageView[i].SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
- stage.Add(mImageView[i]);
+ window.Add(mImageView[i]);
}
}
}
//Create the actors
- Stage stage = Stage::GetCurrent();
+ Window window = mApplication.GetWindow();
unsigned int actorCount(mRowsPerPage*mColumnsPerPage * mPageCount);
mActor.resize(actorCount);
for( size_t i(0); i<actorCount; ++i )
mActor[i] = Actor::New();
mActor[i].AddRenderer( renderers[i % numImages] );
mActor[i].SetProperty( Actor::Property::SIZE, Vector3(0.0f,0.0f,0.0f) );
- stage.Add(mActor[i]);
+ window.Add(mActor[i]);
}
}
void ShowAnimation()
{
- Stage stage = Stage::GetCurrent();
- Vector3 initialPosition( stage.GetSize().x * 0.5f, stage.GetSize().y*0.5f, 1000.0f );
+ Window window = mApplication.GetWindow();
+ const Vector2 windowSize(window.GetSize());
+ Vector3 initialPosition( windowSize.width * 0.5f, windowSize.height * 0.5f, 1000.0f );
unsigned int totalColumns = mColumnsPerPage * mPageCount;
void ScrollAnimation()
{
- Stage stage = Stage::GetCurrent();
- Vector3 stageSize( stage.GetSize() );
+ Window window = mApplication.GetWindow();
+ Vector3 windowSize( window.GetSize() );
mScroll = Animation::New(10.0f);
size_t actorCount( static_cast< size_t >( mRowsPerPage ) * mColumnsPerPage * mPageCount );
{
if( gUseMesh )
{
- mScroll.AnimateBy( Property( mActor[i], Actor::Property::POSITION), Vector3(-4.0f*stageSize.x,0.0f, 0.0f), AlphaFunction::EASE_OUT, TimePeriod(0.0f,3.0f));
- mScroll.AnimateBy( Property( mActor[i], Actor::Property::POSITION), Vector3(-4.0f*stageSize.x,0.0f, 0.0f), AlphaFunction::EASE_OUT, TimePeriod(3.0f,3.0f));
- mScroll.AnimateBy( Property( mActor[i], Actor::Property::POSITION), Vector3(-4.0f*stageSize.x,0.0f, 0.0f), AlphaFunction::EASE_OUT, TimePeriod(6.0f,2.0f));
- mScroll.AnimateBy( Property( mActor[i], Actor::Property::POSITION), Vector3( 12.0f*stageSize.x,0.0f, 0.0f), AlphaFunction::EASE_OUT, TimePeriod(8.0f,2.0f));
+ mScroll.AnimateBy( Property( mActor[i], Actor::Property::POSITION), Vector3(-4.0f*windowSize.x,0.0f, 0.0f), AlphaFunction::EASE_OUT, TimePeriod(0.0f,3.0f));
+ mScroll.AnimateBy( Property( mActor[i], Actor::Property::POSITION), Vector3(-4.0f*windowSize.x,0.0f, 0.0f), AlphaFunction::EASE_OUT, TimePeriod(3.0f,3.0f));
+ mScroll.AnimateBy( Property( mActor[i], Actor::Property::POSITION), Vector3(-4.0f*windowSize.x,0.0f, 0.0f), AlphaFunction::EASE_OUT, TimePeriod(6.0f,2.0f));
+ mScroll.AnimateBy( Property( mActor[i], Actor::Property::POSITION), Vector3( 12.0f*windowSize.x,0.0f, 0.0f), AlphaFunction::EASE_OUT, TimePeriod(8.0f,2.0f));
}
else
{
- mScroll.AnimateBy( Property( mImageView[i], Actor::Property::POSITION), Vector3(-4.0f*stageSize.x,0.0f, 0.0f), AlphaFunction::EASE_OUT, TimePeriod(0.0f,3.0f));
- mScroll.AnimateBy( Property( mImageView[i], Actor::Property::POSITION), Vector3(-4.0f*stageSize.x,0.0f, 0.0f), AlphaFunction::EASE_OUT, TimePeriod(3.0f,3.0f));
- mScroll.AnimateBy( Property( mImageView[i], Actor::Property::POSITION), Vector3(-4.0f*stageSize.x,0.0f, 0.0f), AlphaFunction::EASE_OUT, TimePeriod(6.0f,2.0f));
- mScroll.AnimateBy( Property( mImageView[i], Actor::Property::POSITION), Vector3( 12.0f*stageSize.x,0.0f, 0.0f), AlphaFunction::EASE_OUT, TimePeriod(8.0f,2.0f));
+ mScroll.AnimateBy( Property( mImageView[i], Actor::Property::POSITION), Vector3(-4.0f*windowSize.x,0.0f, 0.0f), AlphaFunction::EASE_OUT, TimePeriod(0.0f,3.0f));
+ mScroll.AnimateBy( Property( mImageView[i], Actor::Property::POSITION), Vector3(-4.0f*windowSize.x,0.0f, 0.0f), AlphaFunction::EASE_OUT, TimePeriod(3.0f,3.0f));
+ mScroll.AnimateBy( Property( mImageView[i], Actor::Property::POSITION), Vector3(-4.0f*windowSize.x,0.0f, 0.0f), AlphaFunction::EASE_OUT, TimePeriod(6.0f,2.0f));
+ mScroll.AnimateBy( Property( mImageView[i], Actor::Property::POSITION), Vector3( 12.0f*windowSize.x,0.0f, 0.0f), AlphaFunction::EASE_OUT, TimePeriod(8.0f,2.0f));
}
}
mScroll.Play();
unsigned int totalColumns = mColumnsPerPage * mPageCount;
- float finalZ = Dali::Stage::GetCurrent().GetRenderTaskList().GetTask(0).GetCameraActor().GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ).z;
+ float finalZ = mApplication.GetWindow().GetRenderTaskList().GetTask(0).GetCameraActor().GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ).z;
float totalDuration( 5.0f);
float durationPerActor( 0.5f );
float delayBetweenActors = ( totalDuration - durationPerActor) / (mRowsPerPage*mColumnsPerPage);
// The Init signal is received once (only) during the Application lifetime
void Create( Application& application )
{
- Stage stage = Stage::GetCurrent();
- stage.KeyEventSignal().Connect( this, &BezierCurveExample::OnKeyEvent );
+ Window window = mApplication.GetWindow();
+ window.KeyEventSignal().Connect( this, &BezierCurveExample::OnKeyEvent );
- CreateBackground(stage);
+ CreateBackground(window);
mControlPointScale = 0.5f;
mControlPointZoomScale = mControlPointScale * 2.0f;
mContentLayer.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
mContentLayer.TouchSignal().Connect(this, &BezierCurveExample::OnTouchLayer);
mContentLayer.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
- stage.Add( mContentLayer );
+ window.Add( mContentLayer );
// 6 rows: title, grid, coords, play, anim1, anim2
TableView contentLayout = TableView::New(5, 1);
UpdateCurve();
}
- void CreateBackground( Stage stage )
+ void CreateBackground( Window window )
{
Toolkit::Control background = Dali::Toolkit::Control::New();
background.SetProperty( Actor::Property::ANCHOR_POINT, Dali::AnchorPoint::CENTER );
map.Insert( Visual::Property::TYPE, Visual::COLOR );
map.Insert( ColorVisual::Property::MIX_COLOR, Vector4( 253/255.0f, 245/255.0f, 230/255.0f, 1.0f ) );
background.SetProperty( Dali::Toolkit::Control::Property::BACKGROUND, map );
- stage.Add( background );
+ window.Add( background );
}
void CreateCubic(Actor parent)
const std::string WOBBLE_PROPERTY_NAME("wobbleProperty"); ///< Wobble property name.
const std::string COLLISION_PROPERTY_NAME("collisionProperty"); ///< Collision property name.
-const Vector2 BRICK_SIZE(0.1f, 0.05f ); ///< Brick size relative to width of stage.
-const Vector2 BALL_SIZE( 0.05f, 0.05f ); ///< Ball size relative to width of stage.
-const Vector2 PADDLE_SIZE( 0.2f, 0.05f ); ///< Paddle size relative to width of stage.
-const Vector2 PADDLE_HANDLE_SIZE( 0.3f, 0.3f ); ///< Paddle handle size relative to width of stage.
-const Vector2 BALL_START_POSITION(0.5f, 0.8f); ///< Ball start position relative to stage size.
-const Vector2 PADDLE_START_POSITION(0.5f, 0.9f); ///< Paddler start position relative to stage size.
+const Vector2 BRICK_SIZE(0.1f, 0.05f ); ///< Brick size relative to width of window.
+const Vector2 BALL_SIZE( 0.05f, 0.05f ); ///< Ball size relative to width of window.
+const Vector2 PADDLE_SIZE( 0.2f, 0.05f ); ///< Paddle size relative to width of window.
+const Vector2 PADDLE_HANDLE_SIZE( 0.3f, 0.3f ); ///< Paddle handle size relative to width of window.
+const Vector2 BALL_START_POSITION(0.5f, 0.8f); ///< Ball start position relative to window size.
+const Vector2 PADDLE_START_POSITION(0.5f, 0.9f); ///< Paddler start position relative to window size.
const Vector2 PADDLE_HIT_MARGIN( 0.1, 0.15f ); ///< Extra hit Area for Paddle when touching.
const int TOTAL_LIVES(3); ///< Total lives in game before it's game over!
*/
void Create(Application& application)
{
- Stage::GetCurrent().KeyEventSignal().Connect(this, &ExampleController::OnKeyEvent);
+ application.GetWindow().KeyEventSignal().Connect(this, &ExampleController::OnKeyEvent);
// Creates a default view with a default tool bar.
- // The view is added to the stage.
+ // The view is added to the window.
Toolkit::ToolBar toolBar;
mContentLayer = DemoHelper::CreateView( application,
mView,
private:
/**
- * Adds a new layer to the stage, containing game actors.
+ * Adds a new layer to the window, containing game actors.
*/
void AddContentLayer()
{
- Stage stage = Stage::GetCurrent();
- const Vector3 stageSize(stage.GetSize());
+ Window window = mApplication.GetWindow();
+ const Vector3 windowSize(window.GetSize());
// Ball setup
- mBallStartPosition = stageSize * Vector3( BALL_START_POSITION );
+ mBallStartPosition = windowSize * Vector3( BALL_START_POSITION );
mBall = CreateImage(BALL_IMAGE);
mBall.SetProperty( Actor::Property::POSITION, mBallStartPosition );
- mBall.SetProperty( Actor::Property::SIZE, BALL_SIZE * stageSize.width );
+ mBall.SetProperty( Actor::Property::SIZE, BALL_SIZE * windowSize.width );
mContentLayer.Add(mBall);
mBallVelocity = Vector3::ZERO;
// Paddle setup
- mPaddleHitMargin = Vector2(stageSize) * PADDLE_HIT_MARGIN;
+ mPaddleHitMargin = Vector2(windowSize) * PADDLE_HIT_MARGIN;
mPaddle = Actor::New();
mPaddleHandle = CreateImage(PADDLE_HANDLE_IMAGE);
mPaddleImage = CreateImage(PADDLE_IMAGE);
mPaddle.Add( mPaddleImage );
mPaddleHandle.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_CENTER );
mPaddleHandle.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_CENTER );
- mPaddleHandle.SetProperty( Actor::Property::POSITION, Vector2( 0.0f, stageSize.width * 0.0125f ));
+ mPaddleHandle.SetProperty( Actor::Property::POSITION, Vector2( 0.0f, windowSize.width * 0.0125f ));
mPaddleImage.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_CENTER );
mPaddleImage.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_CENTER );
mPaddle.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
mPaddle.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
- mPaddleFullSize = PADDLE_SIZE * stageSize.width;
+ mPaddleFullSize = PADDLE_SIZE * windowSize.width;
mPaddle.SetProperty( Actor::Property::SIZE, mPaddleFullSize + mPaddleHitMargin );
- mPaddleHandle.SetProperty( Actor::Property::SIZE, PADDLE_HANDLE_SIZE * stageSize.width );
+ mPaddleHandle.SetProperty( Actor::Property::SIZE, PADDLE_HANDLE_SIZE * windowSize.width );
mPaddleImage.SetProperty( Actor::Property::SIZE, mPaddleFullSize );
mWobbleProperty = mPaddle.RegisterProperty(WOBBLE_PROPERTY_NAME, 0.0f);
wobbleConstraint.AddSource( LocalSource(mWobbleProperty) );
wobbleConstraint.Apply();
- mPaddle.SetProperty( Actor::Property::POSITION, stageSize * Vector3( PADDLE_START_POSITION ) );
+ mPaddle.SetProperty( Actor::Property::POSITION, windowSize * Vector3( PADDLE_START_POSITION ) );
mContentLayer.Add(mPaddle);
mPaddle.TouchSignal().Connect(this, &ExampleController::OnTouchPaddle);
mContentLayer.TouchSignal().Connect(this, &ExampleController::OnTouchLayer);
- const float margin(BALL_SIZE.width * stageSize.width * 0.5f);
+ const float margin(BALL_SIZE.width * windowSize.width * 0.5f);
// Set up notifications for ball's collisions against walls.
PropertyNotification leftNotification = mBall.AddPropertyNotification( Actor::Property::POSITION_X, LessThanCondition(margin) );
leftNotification.NotifySignal().Connect( this, &ExampleController::OnHitLeftWall );
- PropertyNotification rightNotification = mBall.AddPropertyNotification( Actor::Property::POSITION_X, GreaterThanCondition(stageSize.width - margin) );
+ PropertyNotification rightNotification = mBall.AddPropertyNotification( Actor::Property::POSITION_X, GreaterThanCondition(windowSize.width - margin) );
rightNotification.NotifySignal().Connect( this, &ExampleController::OnHitRightWall );
PropertyNotification topNotification = mBall.AddPropertyNotification( Actor::Property::POSITION_Y, LessThanCondition(margin) );
topNotification.NotifySignal().Connect( this, &ExampleController::OnHitTopWall );
- PropertyNotification bottomNotification = mBall.AddPropertyNotification( Actor::Property::POSITION_Y, GreaterThanCondition(stageSize.height + margin) );
+ PropertyNotification bottomNotification = mBall.AddPropertyNotification( Actor::Property::POSITION_Y, GreaterThanCondition(windowSize.height + margin) );
bottomNotification.NotifySignal().Connect( this, &ExampleController::OnHitBottomWall );
// Set up notification for ball colliding against paddle.
Actor delegate = Actor::New();
- stage.Add(delegate);
+ window.Add(delegate);
Property::Index property = delegate.RegisterProperty(COLLISION_PROPERTY_NAME, Vector3::ZERO);
Constraint constraint = Constraint::New<Vector3>( delegate, property, CollisionCircleRectangleConstraint( -Vector3(0.0f, mPaddleHitMargin.height * 0.575f, 0.0f),-Vector3(mPaddleHitMargin) ) );
constraint.AddSource( Source(mBall, Actor::Property::POSITION) );
if( mBrickImageMap.Empty() )
{
- Vector2 stageSize(Stage::GetCurrent().GetSize());
- const Vector2 brickSize(BRICK_SIZE * Vector2(stageSize.x, stageSize.x));
+ Vector2 windowSize(mApplication.GetWindow().GetSize());
+ const Vector2 brickSize(BRICK_SIZE * Vector2(windowSize.x, windowSize.x));
mBrickImageMap["desiredWidth"] = static_cast<int>( brickSize.width );
mBrickImageMap["desiredHeight"] = static_cast<int>( brickSize.height );
*/
void GenerateLevel0()
{
- Vector2 stageSize(Stage::GetCurrent().GetSize());
- const Vector2 brickSize(BRICK_SIZE * stageSize.width);
+ Vector2 windowSize(mApplication.GetWindow().GetSize());
+ const Vector2 brickSize(BRICK_SIZE * windowSize.width);
- const int columns = (0.85f * stageSize.width) / brickSize.width; // 85 percent of the width of the screen covered with bricks.
- const int rows = (0.3f * stageSize.height) / brickSize.height; // 30 percent of the height of the screen covered with bricks.
- const Vector2 offset( (stageSize.x - (columns * brickSize.width)) * 0.5f,
- stageSize.y * 0.125f );
+ const int columns = (0.85f * windowSize.width) / brickSize.width; // 85 percent of the width of the screen covered with bricks.
+ const int rows = (0.3f * windowSize.height) / brickSize.height; // 30 percent of the height of the screen covered with bricks.
+ const Vector2 offset( (windowSize.x - (columns * brickSize.width)) * 0.5f,
+ windowSize.y * 0.125f );
for(int j = 0; j < rows; j++)
{
*/
void GenerateLevel1()
{
- Vector2 stageSize(Stage::GetCurrent().GetSize());
- const Vector2 brickSize(BRICK_SIZE * stageSize.width);
+ Vector2 windowSize(mApplication.GetWindow().GetSize());
+ const Vector2 brickSize(BRICK_SIZE * windowSize.width);
- const int columns = (0.85f * stageSize.width) / brickSize.width; // 85 percent of the width of the screen covered with bricks.
- const int rows = (0.3f * stageSize.height) / brickSize.height; // 30 percent of the height of the screen covered with bricks.
- const Vector2 offset( (stageSize.x - (columns * brickSize.width)) * 0.5f,
- stageSize.y * 0.125f );
+ const int columns = (0.85f * windowSize.width) / brickSize.width; // 85 percent of the width of the screen covered with bricks.
+ const int rows = (0.3f * windowSize.height) / brickSize.height; // 30 percent of the height of the screen covered with bricks.
+ const Vector2 offset( (windowSize.x - (columns * brickSize.width)) * 0.5f,
+ windowSize.y * 0.125f );
for(int j = 0; j < rows; j++)
{
*/
void GenerateLevel2()
{
- Vector2 stageSize(Stage::GetCurrent().GetSize());
- const Vector2 brickSize(BRICK_SIZE * stageSize.width);
+ Vector2 windowSize(mApplication.GetWindow().GetSize());
+ const Vector2 brickSize(BRICK_SIZE * windowSize.width);
- const int columns = (0.85f * stageSize.width) / brickSize.width; // 85 percent of the width of the screen covered with bricks.
- const int rows = (0.3f * stageSize.height) / brickSize.height; // 30 percent of the height of the screen covered with bricks.
- const Vector2 offset( (stageSize.x - (columns * brickSize.width)) * 0.5f,
- stageSize.y * 0.125f );
+ const int columns = (0.85f * windowSize.width) / brickSize.width; // 85 percent of the width of the screen covered with bricks.
+ const int rows = (0.3f * windowSize.height) / brickSize.height; // 30 percent of the height of the screen covered with bricks.
+ const Vector2 offset( (windowSize.x - (columns * brickSize.width)) * 0.5f,
+ windowSize.y * 0.125f );
// lays down bricks in a spiral formation starting at i,j = (0,0) top left corner
// travelling right di,dj = (1,0) initially
/**
- * Creates a brick at a specified position on the stage
+ * Creates a brick at a specified position on the window
* @param[in] position the position for the brick
* @param[in] type the type of brick
* @return The Brick Actor is returned.
*/
void OnBrickDestroyed( Animation& source )
{
- // Remove brick from stage, it's constraint and property notification should also remove themselves.
+ // Remove brick from window, it's constraint and property notification should also remove themselves.
Actor brick = mDestroyAnimationMap[source];
mDestroyAnimationMap.erase(source);
brick.GetParent().Remove(brick);
/*
- * 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.
void Create( Application& application )
{
- Stage stage = Stage::GetCurrent();
- Vector2 stageSize = stage.GetSize();
- Vector2 viewSize( stageSize );
+ Window window = application.GetWindow();
+ Vector2 windowSize = window.GetSize();
+ Vector2 viewSize( windowSize );
mRootActor = Actor::New();
mRootActor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
- mRootActor.SetProperty( Actor::Property::SIZE, stageSize );
- stage.Add( mRootActor );
+ mRootActor.SetProperty( Actor::Property::SIZE, windowSize );
+ window.Add( mRootActor );
// Create the object that will perform the blooming work
mBloomView = Dali::Toolkit::BloomView::New();
imageView = ImageView::New( UI_DIFFUSE_IMAGE );
imageView.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
- imageView.SetProperty( Actor::Property::SIZE, stageSize * 0.5f );
+ imageView.SetProperty( Actor::Property::SIZE, windowSize * 0.5f );
imageView.SetProperty( Actor::Property::POSITION, Vector3( 0.0f, 0.0f, 100.0f ) );
mObjectRootActor.Add( imageView );
PulseBloomIntensity();
// Respond to key events
- stage.KeyEventSignal().Connect( this, &BloomExample::OnKeyEvent );
+ window.KeyEventSignal().Connect( this, &BloomExample::OnKeyEvent );
}
void OnKeyEvent( const KeyEvent& event )
/*
- * 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.
}// end LOCAL_STUFF
-// This example shows the usage of BubbleEmitter which displays lots of moving bubbles on the stage.
+// This example shows the usage of BubbleEmitter which displays lots of moving bubbles on the window.
class BubbleEffectExample : public ConnectionTracker
{
public:
// The Init signal is received once (only) during the Application lifetime
void Create(Application& app)
{
- Stage stage = Stage::GetCurrent();
- Vector2 stageSize = stage.GetSize();
+ Window window = app.GetWindow();
+ Vector2 windowSize = window.GetSize();
- stage.KeyEventSignal().Connect(this, &BubbleEffectExample::OnKeyEvent);
+ window.KeyEventSignal().Connect(this, &BubbleEffectExample::OnKeyEvent);
// Creates a default view with a default tool bar.
- // The view is added to the stage.
+ // The view is added to the window.
Toolkit::ToolBar toolBar;
Layer content = DemoHelper::CreateView( app,
mBackground,
DemoHelper::DEFAULT_MODE_SWITCH_PADDING );
// Create and initialize the BubbleEmitter object
- mBubbleEmitter = Toolkit::BubbleEmitter::New( stageSize,
+ mBubbleEmitter = Toolkit::BubbleEmitter::New( windowSize,
DemoHelper::LoadTexture( BUBBLE_SHAPE_IMAGES[mCurrentBubbleShapeImageId] ),
DEFAULT_NUMBER_OF_BUBBLES,
DEFAULT_BUBBLE_SIZE);
- mBubbleEmitter.SetBackground( DemoHelper::LoadStageFillingTexture( BACKGROUND_IMAGES[mCurrentBackgroundImageId] ), mHSVDelta );
+ mBubbleEmitter.SetBackground( DemoHelper::LoadWindowFillingTexture( window.GetSize(), BACKGROUND_IMAGES[mCurrentBackgroundImageId] ), mHSVDelta );
- // Get the root actor of all bubbles, and add it to stage.
+ // Get the root actor of all bubbles, and add it to window.
Actor bubbleRoot = mBubbleEmitter.GetRootActor();
bubbleRoot.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::CENTER);
bubbleRoot.SetProperty( Actor::Property::POSITION_Z, 0.1f); // Make sure the bubbles displayed on top og the background.
mCurrentBackgroundImageId = (mCurrentBackgroundImageId+1) % NUM_BACKGROUND_IMAGES;
//Update bubble emitter background
- mBubbleEmitter.SetBackground( DemoHelper::LoadStageFillingTexture( BACKGROUND_IMAGES[ mCurrentBackgroundImageId ] ), mHSVDelta );
+ mBubbleEmitter.SetBackground( DemoHelper::LoadWindowFillingTexture( mApp.GetWindow().GetSize(), BACKGROUND_IMAGES[ mCurrentBackgroundImageId ] ), mHSVDelta );
// Set the application background
mBackground.SetProperty( Toolkit::Control::Property::BACKGROUND, BACKGROUND_IMAGES[ mCurrentBackgroundImageId ] );
void SetUpItemView()
{
- Stage stage = Stage::GetCurrent();
+ Window window = mApp.GetWindow();
mTapDetector = TapGestureDetector::New();
mTapDetector.DetectedSignal().Connect( this, &ExampleApp::OnTap );
mItemView.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::CENTER);
mLayout = DefaultItemLayout::New( DefaultItemLayout::LIST );
- mLayout->SetItemSize( Vector3( stage.GetSize().width, 50, 1 ) );
+ mLayout->SetItemSize( Vector3( window.GetSize().GetWidth(), 50, 1 ) );
mItemView.AddLayout( *mLayout );
}
// Activate the layout
- Vector3 size(stage.GetSize());
+ Vector3 size(window.GetSize());
mItemView.ActivateLayout(0, size, 0.0f/*immediate*/);
}
void ReloadJsonFile(const std::string& filename, Builder& builder, Layer& layer)
{
- Stage stage = Stage::GetCurrent();
+ Window window = mApp.GetWindow();
builder = Builder::New();
builder.QuitSignal().Connect( this, &ExampleApp::OnQuitOrBack );
builder.AddConstants( defaultDirs );
// render tasks may have been setup last load so remove them
- RenderTaskList taskList = stage.GetRenderTaskList();
+ RenderTaskList taskList = window.GetRenderTaskList();
if( taskList.GetTaskCount() > 1 )
{
typedef std::vector<RenderTask> Collection;
}
RenderTask defaultTask = taskList.GetTask(0);
- defaultTask.SetSourceActor( stage.GetRootLayer() );
+ defaultTask.SetSourceActor( window.GetRootLayer() );
defaultTask.SetFrameBuffer( FrameBuffer() );
}
mBuilderLayer.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::BOTTOM_CENTER);
mBuilderLayer.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::BOTTOM_CENTER);
- Dali::Vector3 size = Stage::GetCurrent().GetRootLayer().GetCurrentProperty< Vector3 >( Actor::Property::SIZE );
+ Dali::Vector3 size = mApp.GetWindow().GetRootLayer().GetCurrentProperty< Vector3 >( Actor::Property::SIZE );
size.y -= DemoHelper::DEFAULT_VIEW_STYLE.mToolBarHeight;
mBuilderLayer.SetProperty( Actor::Property::SIZE, size );
void Create(Application& app)
{
- Stage stage = Stage::GetCurrent();
+ Window window = app.GetWindow();
- Stage::GetCurrent().KeyEventSignal().Connect(this, &ExampleApp::OnKeyEvent);
+ window.KeyEventSignal().Connect(this, &ExampleApp::OnKeyEvent);
Layer contents = DemoHelper::CreateView( app,
mView,
mNavigationView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
mNavigationView.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
- stage.Add( mNavigationView );
+ window.Add( mNavigationView );
// Set up the background gradient.
Property::Array stopOffsets;
Property::Array stopColors;
stopColors.PushBack( Color::WHITE );
stopColors.PushBack( Vector4( 0.45f, 0.70f, 0.80f, 1.0f ) ); // Medium bright, pastel blue
- const float percentageStageHeight = stage.GetSize().height * 0.6f;
+ const float percentageWindowHeight = window.GetSize().GetHeight() * 0.6f;
mNavigationView.SetProperty( Toolkit::Control::Property::BACKGROUND, Dali::Property::Map()
.Add( Toolkit::Visual::Property::TYPE, Dali::Toolkit::Visual::GRADIENT )
.Add( Toolkit::GradientVisual::Property::STOP_OFFSET, stopOffsets )
.Add( Toolkit::GradientVisual::Property::STOP_COLOR, stopColors )
- .Add( Toolkit::GradientVisual::Property::START_POSITION, Vector2( 0.0f, -percentageStageHeight ) )
- .Add( Toolkit::GradientVisual::Property::END_POSITION, Vector2( 0.0f, percentageStageHeight ) )
+ .Add( Toolkit::GradientVisual::Property::START_POSITION, Vector2( 0.0f, -percentageWindowHeight ) )
+ .Add( Toolkit::GradientVisual::Property::END_POSITION, Vector2( 0.0f, percentageWindowHeight ) )
.Add( Toolkit::GradientVisual::Property::UNITS, Toolkit::GradientVisual::Units::USER_SPACE ) );
SetUpItemView();
/*
- * Copyright (c) 2017 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.
// The Init signal is received once (only) during the Application lifetime
// Respond to key events
- Stage::GetCurrent().KeyEventSignal().Connect(this, &ButtonsController::OnKeyEvent);
+ application.GetWindow().KeyEventSignal().Connect(this, &ButtonsController::OnKeyEvent);
// Creates a default view with a default tool bar.
- // The view is added to the stage.
+ // The view is added to the window.
mContentLayer = DemoHelper::CreateView( application,
mView,
mToolBar,
/*
- * Copyright (c) 2017 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.
// The Init signal is received once (only) during the Application lifetime.
void Create( Application& application )
{
- // Get a handle to the stage
- Stage stage = Stage::GetCurrent();
- stage.SetBackgroundColor( Color::WHITE );
+ // Get a handle to the window
+ Window window = application.GetWindow();
+ window.SetBackgroundColor( Color::WHITE );
- // Connect to the stage's key signal to allow Back and Escape to exit.
- stage.KeyEventSignal().Connect( this, &ClippingDrawOrderVerification::OnKeyEvent );
+ // Connect to the window's key signal to allow Back and Escape to exit.
+ window.KeyEventSignal().Connect( this, &ClippingDrawOrderVerification::OnKeyEvent );
// Create the title label.
TextLabel title = TextLabel::New( "Clipping draw order verification" );
description.SetProperty( TextLabel::Property::MULTI_LINE, true );
description.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_CENTER );
description.SetProperty( Actor::Property::PARENT_ORIGIN, Vector3( 0.5f, 1.0f, 0.5f ) );
- stage.Add( description );
+ window.Add( description );
/*
* Create a 4-row TableView.
view.AddChild( container, TableView::CellPosition( 1u + tree, 0u ) );
}
- // Add the finished TableView to the stage.
- stage.Add( view );
+ // Add the finished TableView to the window.
+ window.Add( view );
- // Respond to a click anywhere on the stage
- stage.GetRootLayer().TouchSignal().Connect( this, &ClippingDrawOrderVerification::OnTouch );
+ // Respond to a click anywhere on the window
+ window.GetRootLayer().TouchSignal().Connect( this, &ClippingDrawOrderVerification::OnTouch );
}
bool OnTouch( Actor actor, const TouchData& touch )
*/
void Create( Application& application )
{
- // Connect to the stage's key signal to allow Back and Escape to exit.
- Stage stage = Dali::Stage::GetCurrent();
- stage.KeyEventSignal().Connect( this, &ClippingExample::OnKeyEvent );
+ // Connect to the window's key signal to allow Back and Escape to exit.
+ Window window = application.GetWindow();
+ window.KeyEventSignal().Connect( this, &ClippingExample::OnKeyEvent );
// Create a TextLabel for the application title.
Toolkit::TextLabel label = Toolkit::TextLabel::New( APPLICATION_TITLE );
label.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
label.SetProperty( Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
label.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
- stage.Add( label );
+ window.Add( label );
// Create an item-view which clips its children.
mItemView = ItemView::New( mClippingItemFactory );
mItemView.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
mItemView.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
mItemView.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN ); // Enable clipping. No need to create any renderers.
- stage.Add( mItemView );
+ window.Add( mItemView );
// Create a Spiral Layout and add it to the Item View.
mItemView.AddLayout( * DefaultItemLayout::New( DefaultItemLayout::SPIRAL ) );
- stage.GetRootLayer().SetProperty( Layer::Property::BEHAVIOR, Layer::LAYER_3D ); // The item-view spiral layout requires Layer 3D behaviour.
+ window.GetRootLayer().SetProperty( Layer::Property::BEHAVIOR, Layer::LAYER_3D ); // The item-view spiral layout requires Layer 3D behaviour.
// Calculate the size we would like our item-view layout to be, and then activate the layout.
- const Vector2 stageSize = stage.GetSize();
- const Vector3 itemViewLayoutSize( ITEM_VIEW_LAYOUT_SIZE_SCALE.x * stageSize.x, ITEM_VIEW_LAYOUT_SIZE_SCALE.y * stageSize.y, ITEM_VIEW_LAYOUT_SIZE_SCALE.z * stageSize.x );
+ const Vector2 windowSize = window.GetSize();
+ const Vector3 itemViewLayoutSize( ITEM_VIEW_LAYOUT_SIZE_SCALE.x * windowSize.x, ITEM_VIEW_LAYOUT_SIZE_SCALE.y * windowSize.y, ITEM_VIEW_LAYOUT_SIZE_SCALE.z * windowSize.x );
mItemView.ActivateLayout( 0, itemViewLayoutSize, 0.0f );
// Connect to the scroll started and completed signals to apply orientation constraints & animations.
.Add( BorderVisual::Property::SIZE, 2.0f )
.Add( BorderVisual::Property::ANTI_ALIASING, true ) );
border.SetProperty( Actor::Property::SIZE, Vector3( itemViewLayoutSize.x + ITEM_VIEW_BORDER_SIZE * 2.0f, itemViewLayoutSize.y + ITEM_VIEW_BORDER_SIZE * 2.0f, itemViewLayoutSize.z + ITEM_VIEW_BORDER_SIZE * 2.0f ) );
- stage.Add( border );
+ window.Add( border );
// Constrain the border's orientation to the orientation of item-view.
Constraint constraint = Constraint::New< Quaternion >( border, Actor::Property::ORIENTATION, EqualToConstraint() );
button.SetProperty( Actor::Property::DRAW_MODE, DrawMode::OVERLAY_2D );
button.SetProperty( Button::Property::LABEL, BUTTON_LABEL );
button.ClickedSignal().Connect( this, &ClippingExample::OnButtonClicked );
- stage.Add( button );
+ window.Add( button );
}
/**
// The Init signal is received once (only) during the Application lifetime
void Create( Application& application )
{
- // Get a handle to the stage
- Stage stage = Stage::GetCurrent();
- stage.SetBackgroundColor( Color::WHITE );
+ // Get a handle to the window
+ Window window = application.GetWindow();
+ window.SetBackgroundColor( Color::WHITE );
mImageView = ImageView::New( IMAGE_FILE );
mImageView.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
mImageView.SetProperty( Actor::Property::SIZE, Vector2( 200.0f, 200.0f ) );
mImageView.SetProperty( DevelControl::Property::SHADOW, SHADOW );
- stage.Add( mImageView );
+ window.Add( mImageView );
- // Respond to a click anywhere on the stage
- stage.GetRootLayer().TouchSignal().Connect( this, &ColorVisualExample::OnTouch );
+ // Respond to a click anywhere on the window
+ window.GetRootLayer().TouchSignal().Connect( this, &ColorVisualExample::OnTouch );
// Respond to key events
- stage.KeyEventSignal().Connect( this, &ColorVisualExample::OnKeyEvent );
+ window.KeyEventSignal().Connect( this, &ColorVisualExample::OnKeyEvent );
}
bool OnTouch( Actor actor, const TouchData& touch )
/*
- * Copyright (c) 2017 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.
// The Init signal is received once (only) during the Application lifetime
void Create( Application& application )
{
- // Get a handle to the stage
- Stage stage = Stage::GetCurrent();
- stage.SetBackgroundColor( Color::WHITE );
+ // Get a handle to the window
+ Window window = application.GetWindow();
+ window.SetBackgroundColor( Color::WHITE );
// Setup a TableView to hold a grid of images and labels.
Toolkit::TableView table = Toolkit::TableView::New( 3u, 2u );
table.AddChild( actor, Toolkit::TableView::CellPosition( 2u, 1u ) );
table.SetCellAlignment( Toolkit::TableView::CellPosition( 2u, 1u ), HorizontalAlignment::CENTER, VerticalAlignment::CENTER );
- stage.Add( table );
+ window.Add( table );
// Respond to touch and key signals
- stage.GetRootLayer().TouchSignal().Connect( this, &CompressedTextureFormatsController::OnTouch );
- stage.KeyEventSignal().Connect(this, &CompressedTextureFormatsController::OnKeyEvent);
+ window.GetRootLayer().TouchSignal().Connect( this, &CompressedTextureFormatsController::OnTouch );
+ window.KeyEventSignal().Connect(this, &CompressedTextureFormatsController::OnKeyEvent);
}
bool OnTouch( Actor actor, const TouchData& touch )
/*
- * Copyright (c) 2016 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.
// CLASS HEADER
#include "contact-card-layouter.h"
-// EXTERNAL INCLUDES
-#include <dali/public-api/common/stage.h>
-
// INTERNAL INCLUDES
#include "contact-card.h"
// Nothing to do as ContactCardContainer uses intrusive pointers so they will be automatically deleted
}
-void ContactCardLayouter::AddContact( const std::string& contactName, const std::string& contactAddress, const std::string& imagePath )
+void ContactCardLayouter::AddContact( Dali::Window window, const std::string& contactName, const std::string& contactAddress, const std::string& imagePath )
{
if( ! mInitialized )
{
// Set up the common layouting info shared between all contact cards when first called
mContactCardLayoutInfo.unfoldedPosition = mContactCardLayoutInfo.padding = Vector2( DEFAULT_PADDING, DEFAULT_PADDING );
- mContactCardLayoutInfo.unfoldedSize = Stage::GetCurrent().GetSize() - mContactCardLayoutInfo.padding * ( MINIMUM_ITEMS_PER_ROW_OR_COLUMN - 1.0f );
+ mContactCardLayoutInfo.unfoldedSize = Vector2( window.GetSize() ) - mContactCardLayoutInfo.padding * ( MINIMUM_ITEMS_PER_ROW_OR_COLUMN - 1.0f );
// Calculate the size of the folded card (use the minimum of width/height as size)
mContactCardLayoutInfo.foldedSize = ( mContactCardLayoutInfo.unfoldedSize - ( mContactCardLayoutInfo.padding * ( MINIMUM_ITEMS_PER_ROW_OR_COLUMN - 1.0f ) ) ) / MINIMUM_ITEMS_PER_ROW_OR_COLUMN;
}
// Create a new contact card and add to our container
- mContactCards.push_back( new ContactCard( mContactCardLayoutInfo, contactName, contactAddress, imagePath, NextCardPosition() ) );
+ mContactCards.push_back( new ContactCard( window, mContactCardLayoutInfo, contactName, contactAddress, imagePath, NextCardPosition() ) );
}
const Vector2& ContactCardLayouter::NextCardPosition()
#define CONTACT_CARD_LAYOUTER_H
/*
- * Copyright (c) 2016 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.
// EXTERNAL INCLUDES
#include <vector>
#include <string>
+#include <dali/public-api/adaptor-framework/window.h>
#include <dali/public-api/common/intrusive-ptr.h>
#include <dali/public-api/math/vector2.h>
/**
* @brief This class lays out contact cards on the screen appropriately.
*
- * The contact cards are added to the stage directly and it uses the stage size to figure out exactly how to layout them.
+ * The contact cards are added to the passed in window directly and it uses the window size to figure out exactly how to layout them.
* It supports a minimum of 3 items on each row or column.
*
* Relayouting is not supported.
/**
* @brief Creates a contact card with the given information.
+ * @param[in] window The window to add the contact to.
* @param[in] contactName The name of the contact to display.
* @param[in] contactAddress The address of the contact to display.
* @param[in] imagePath The path to the image to display.
*/
- void AddContact( const std::string& contactName, const std::string& contactAddress, const std::string& imagePath );
+ void AddContact( Dali::Window window, const std::string& contactName, const std::string& contactAddress, const std::string& imagePath );
private:
/*
- * 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.
} // unnamed namespace
ContactCard::ContactCard(
+ Dali::Window window,
const ContactCardLayoutInfo& contactCardLayoutInfo,
const std::string& contactName,
const std::string& contactAddress,
mClippedImagePropertyIndex( Property::INVALID_INDEX ),
mFolded( true )
{
- // Connect to the stage's key signal to allow Back and Escape to fold a contact card if it is unfolded
- Stage stage = Stage::GetCurrent();
- stage.KeyEventSignal().Connect( mSlotDelegate, &ContactCard::OnKeyEvent );
+ // Connect to the window's key signal to allow Back and Escape to fold a contact card if it is unfolded
+ window.KeyEventSignal().Connect( mSlotDelegate, &ContactCard::OnKeyEvent );
// Create a control which will be used for the background and to clip the contents
mContactCard = Control::New();
mContactCard.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
mContactCard.SetProperty( Actor::Property::POSITION, Vector2( foldedPosition.x, foldedPosition.y ));
mContactCard.SetProperty( Actor::Property::SIZE, mContactCardLayoutInfo.foldedSize );
- stage.Add( mContactCard );
+ window.Add( mContactCard );
// Create the header which will be shown only when the contact is unfolded
mHeader = Control::New();
#define CONTACT_CARD_H
/*
- * Copyright (c) 2018 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.
// EXTERNAL INCLUDES
#include <string>
#include <dali/public-api/actors/actor.h>
+#include <dali/public-api/adaptor-framework/window.h>
#include <dali/public-api/animation/animation.h>
#include <dali/public-api/events/tap-gesture-detector.h>
#include <dali/public-api/object/ref-object.h>
/**
* @brief Constructor.
*
- * This will create all the controls and add them to the stage so should only be called after the init-signal from the Application has been received.
+ * This will create all the controls and add them to the window so should only be called after the init-signal from the Application has been received.
*
+ * @param[in] window The window to add the contact card to.
* @param[in] contactCardLayoutInfo Reference to the common data used by all contact cards.
* @param[in] contactName The name of the contact to display.
* @param[in] contactAddress The address of the contact to display.
* @param[in] imagePath The path to the image to display.
* @param[in] position The unique folded position of this particular contact-card.
*/
- ContactCard( const ContactCardLayoutInfo& contactCardLayoutInfo, const std::string& contactName, const std::string& contactAddress, const std::string& imagePath, const Dali::Vector2& position );
+ ContactCard( Dali::Window window, const ContactCardLayoutInfo& contactCardLayoutInfo, const std::string& contactName, const std::string& contactAddress, const std::string& imagePath, const Dali::Vector2& position );
private:
/**
* @brief Private Destructor. Will only be deleted when ref-count goes to 0.
*
- * Unparent the created contact card (i.e. remove from stage).
+ * Unparent the created contact card (i.e. remove from window).
*/
~ContactCard();
#include <vector>
#include <dali/public-api/adaptor-framework/application.h>
#include <dali/public-api/adaptor-framework/key.h>
-#include <dali/public-api/common/stage.h>
#include <dali/public-api/events/key-event.h>
#include <dali-toolkit/devel-api/focus-manager/keyinput-focus-manager.h>
namespace
{
-const Vector4 STAGE_COLOR( 211.0f / 255.0f, 211.0f / 255.0f, 211.0f / 255.0f, 1.0f ); ///< The color of the stage
+const Vector4 WINDOW_COLOR( 211.0f / 255.0f, 211.0f / 255.0f, 211.0f / 255.0f, 1.0f ); ///< The color of the window
const char * const THEME_PATH( DEMO_STYLE_DIR "contact-cards-example-theme.json" ); ///< The theme used for this example
} // unnamed namespace
* Additionally, this also shows how to morph between two different geometries.
*
* ContactCardLayouter: This class is used to lay out the different contact cards on the screen.
- * This takes stage size into account but does not support relayouting.
+ * This takes window size into account but does not support relayouting.
* ContactCard: This class represents each contact card on the screen.
* Two animations are set up in this class which animate several properties with multiple start and stop times.
* An overview of the two animations can be found in contact-card.cpp.
*/
void Create( Application& application )
{
- // Set the stage background color and connect to the stage's key signal to allow Back and Escape to exit.
- Stage stage = Stage::GetCurrent();
- stage.SetBackgroundColor( STAGE_COLOR );
- stage.KeyEventSignal().Connect( this, &ContactCardController::OnKeyEvent );
+ // Set the window background color and connect to the window's key signal to allow Back and Escape to exit.
+ Window window = application.GetWindow();
+ window.SetBackgroundColor( WINDOW_COLOR );
+ window.KeyEventSignal().Connect( this, &ContactCardController::OnKeyEvent );
// Add all the contacts to the layouter
for( size_t i = 0; i < ContactData::TABLE_SIZE; ++i )
{
- mContactCardLayouter.AddContact( ContactData::TABLE[ i ].name, ContactData::TABLE[ i ].address, ContactData::TABLE[ i ].imagePath );
+ mContactCardLayouter.AddContact( window, ContactData::TABLE[ i ].name, ContactData::TABLE[ i ].address, ContactData::TABLE[ i ].imagePath );
}
}
/*
- * 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.SetProperty( Layer::Property::BEHAVIOR, Layer::LAYER_3D );
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();
+ // 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 );
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);
private:
void Create(Application& app)
{
- // Grab stage, configure layer
- Stage stage = Stage::GetCurrent();
- auto rootLayer = stage.GetRootLayer();
+ // Grab window, configure layer
+ Window window = app.GetWindow();
+ auto rootLayer = window.GetRootLayer();
rootLayer.SetProperty( Layer::Property::BEHAVIOR, Layer::LAYER_3D );
- auto stageSize = stage.GetSize();
- auto stageHalfSize = stageSize * .5f;
- auto invStageHalfSize = Vector2::ONE / stageHalfSize;
+ Vector2 windowSize = window.GetSize();
- float unit = stageSize.y / 24.f;
+ float unit = windowSize.y / 24.f;
// Get camera - we'll be re-using the same old camera in the two passes.
- RenderTaskList tasks = stage.GetRenderTaskList();
+ RenderTaskList tasks = window.GetRenderTaskList();
CameraActor camera = tasks.GetTask(0).GetCameraActor();
auto zCameraPos = camera.GetProperty(Actor::Property::POSITION_Z).Get<float>();
- camera.SetFarClippingPlane(zCameraPos + stageSize.y * .5f);
- camera.SetNearClippingPlane(zCameraPos - stageSize.y * .5f);
+ camera.SetFarClippingPlane(zCameraPos + windowSize.y * .5f);
+ camera.SetNearClippingPlane(zCameraPos - windowSize.y * .5f);
const float zNear = camera.GetNearClippingPlane();
const float zFar = camera.GetFarClippingPlane();
CenterActor(sceneRoot);
mSceneRoot = sceneRoot;
- stage.Add(sceneRoot);
+ window.Add(sceneRoot);
// Create an axis to spin our actors around.
auto axis = Actor::New();
Renderer meshRenderer = CreateRenderer(noTexturesThanks, mesh, preShader,
OPTION_DEPTH_TEST | OPTION_DEPTH_WRITE);
meshRenderer.SetProperty(Renderer::Property::FACE_CULLING_MODE, FaceCullingMode::BACK);
- meshRenderer.RegisterProperty("uInvStageHalfSize", invStageHalfSize);
RegisterDepthProperties(depth, zNear, meshRenderer);
float c = 1.f;
for (auto v: {
}
// Create off-screen textures, fbo and render task.
- uint32_t width = static_cast<uint32_t>(stageSize.x);
- uint32_t height = static_cast<uint32_t>(stageSize.y);
+ uint32_t width = static_cast<uint32_t>(windowSize.x);
+ uint32_t height = static_cast<uint32_t>(windowSize.y);
Texture rttNormal = Texture::New(TextureType::TEXTURE_2D, Pixel::Format::RGB888,
width, height);
fbo.AttachColorTexture(rttColor);
RenderTask sceneRender = tasks.CreateTask();
- sceneRender.SetViewportSize(stageSize);
+ sceneRender.SetViewportSize(windowSize);
sceneRender.SetFrameBuffer(fbo);
sceneRender.SetCameraActor(camera);
sceneRender.SetSourceActor(sceneRoot);
// Create final image for deferred shading
auto finalImage = Actor::New();
CenterActor(finalImage);
- finalImage.SetProperty( Actor::Property::SIZE, stageSize);
+ finalImage.SetProperty( Actor::Property::SIZE, windowSize);
TextureSet finalImageTextures = TextureSet::New();
finalImageTextures.SetTexture(0, rttNormal);
Shader shdMain = Shader::New(MAINPASS_VSH, MAINPASS_FSH);
Geometry finalImageGeom = CreateTexturedQuadGeometry(true);
Renderer finalImageRenderer = CreateRenderer(finalImageTextures, finalImageGeom, shdMain);
- finalImageRenderer.RegisterProperty("uStageHalfSize", stageHalfSize);
RegisterDepthProperties(depth, zNear, finalImageRenderer);
auto propInvProjection = finalImageRenderer.RegisterProperty("uInvProjection", Matrix::IDENTITY);
finalImage.AddRenderer(finalImageRenderer);
mFinalImage = finalImage;
- stage.Add(finalImage);
+ window.Add(finalImage);
// Create a node for our lights
auto lights = Actor::New();
animLights.Play();
// Event handling
- stage.KeyEventSignal().Connect(this, &DeferredShadingExample::OnKeyEvent);
+ window.KeyEventSignal().Connect(this, &DeferredShadingExample::OnKeyEvent);
mPanDetector = PanGestureDetector::New();
mPanDetector.DetectedSignal().Connect(this, &DeferredShadingExample::OnPan);
- mPanDetector.Attach(stage.GetRootLayer());
+ mPanDetector.Attach(window.GetRootLayer());
}
void Destroy(Application& app)
{
- Stage::GetCurrent().GetRenderTaskList().RemoveTask(mSceneRender);
+ app.GetWindow().GetRenderTaskList().RemoveTask(mSceneRender);
mSceneRender.Reset();
UnparentAndReset(mSceneRoot);
/*
- * 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.
const float INITIAL_DEPTH = 10.0f;
/**
- * @brief Create an image view with an image which would be scaled-down to no more than the stage dimensions.
+ * @brief Create an image view with an image which would be scaled-down to no more than the window dimensions.
*
* Uses image scaling mode SCALE_TO_FILL to resize the image at
- * load time to cover the entire stage with pixels with no borders,
+ * load time to cover the entire window with pixels with no borders,
* and filter mode BOX_THEN_LINEAR to sample the image with maximum quality.
*/
-Toolkit::ImageView CreateStageFillingImageView( const char * const imagePath )
+Toolkit::ImageView CreateWindowFillingImageView( const Vector2& windowSize, const char * const imagePath )
{
- Size stageSize = Stage::GetCurrent().GetSize();
Toolkit::ImageView imageView = Toolkit::ImageView::New();
Property::Map map;
map[Toolkit::Visual::Property::TYPE] = Toolkit::Visual::IMAGE;
map[Toolkit::ImageVisual::Property::URL] = imagePath;
- map[Toolkit::ImageVisual::Property::DESIRED_WIDTH] = stageSize.x;
- map[Toolkit::ImageVisual::Property::DESIRED_HEIGHT] = stageSize.y;
+ map[Toolkit::ImageVisual::Property::DESIRED_WIDTH] = windowSize.x;
+ map[Toolkit::ImageVisual::Property::DESIRED_HEIGHT] = windowSize.y;
map[Toolkit::ImageVisual::Property::FITTING_MODE] = FittingMode::SCALE_TO_FILL;
map[Toolkit::ImageVisual::Property::SAMPLING_MODE] = SamplingMode::BOX_THEN_LINEAR;
map[Toolkit::ImageVisual::Property::SYNCHRONOUS_LOADING] = true;
void DissolveEffectApp::OnInit( Application& application )
{
- Stage::GetCurrent().KeyEventSignal().Connect(this, &DissolveEffectApp::OnKeyEvent);
+ auto window = application.GetWindow();
+ Vector2 windowSize = window.GetSize();
+ window.KeyEventSignal().Connect(this, &DissolveEffectApp::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, "" );
// Add an effect-changing button on the right of the tool bar.
mViewTimer.TickSignal().Connect( this, &DissolveEffectApp::OnTimerTick );
mTimerReady = true;
- // Set size to stage size to avoid seeing a black border on transition
+ // Set size to window size to avoid seeing a black border on transition
mParent = Actor::New();
- mParent.SetProperty( Actor::Property::SIZE, Stage::GetCurrent().GetSize() );
+ mParent.SetProperty( Actor::Property::SIZE, windowSize );
mParent.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
mContent.Add( mParent );
// show the first image
- mCurrentImage = CreateStageFillingImageView( IMAGES[mIndex] );
+ mCurrentImage = CreateWindowFillingImageView( windowSize, IMAGES[mIndex] );
mCurrentImage.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
mCurrentImage.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
mCurrentImage.SetProperty( Actor::Property::SIZE_SCALE_POLICY, SizeScalePolicy::FIT_WITH_ASPECT_RATIO );
mIndex = (mIndex + NUM_IMAGES -1)%NUM_IMAGES;
}
- mNextImage = CreateStageFillingImageView( IMAGES[ mIndex ] );
+ mNextImage = CreateWindowFillingImageView( mApplication.GetWindow().GetSize(), IMAGES[ mIndex ] );
mNextImage.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
mNextImage.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
mNextImage.SetProperty( Actor::Property::SIZE_SCALE_POLICY, SizeScalePolicy::FIT_WITH_ASPECT_RATIO );
if(mSlideshow)
{
mIndex = (mIndex + 1)%NUM_IMAGES;
- mNextImage = CreateStageFillingImageView( IMAGES[ mIndex ] );
+ mNextImage = CreateWindowFillingImageView( mApplication.GetWindow().GetSize(), IMAGES[ mIndex ] );
mNextImage.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
mNextImage.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
mNextImage.SetProperty( Actor::Property::SIZE_SCALE_POLICY, SizeScalePolicy::FIT_WITH_ASPECT_RATIO );
/*
- * Copyright (c) 2018 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.
// The Init signal is received once (only) during the Application lifetime
void Create( Application& application )
{
- Stage stage = Stage::GetCurrent();
- stage.SetBackgroundColor( Color::WHITE );
+ auto window = application.GetWindow();
+ window.SetBackgroundColor( Color::WHITE );
mDragAndDropDetector = Dali::Toolkit::DragAndDropDetector::New();
// Respond to key events
- stage.KeyEventSignal().Connect( this, &DragAndDropExample::OnKeyEvent );
+ window.KeyEventSignal().Connect( this, &DragAndDropExample::OnKeyEvent );
TextLabel hintText = TextLabel::New("please drag one textlabel, move and drop on other textlabel");
hintText.SetProperty( Actor::Property::POSITION, Vector2(0.0f, 700.0f));
hintText.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::TOP_LEFT);
hintText.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
hintText.SetProperty(TextLabel::Property::MULTI_LINE, true);
- stage.Add(hintText);
+ window.Add(hintText);
for(unsigned int i = 0 ; i < TEXT_LABEL_NUM; i++)
{
mRect[i] = Rect<float>(TEXT_LABEL_POSITION_X, TEXT_LABEL_POSITION_START_Y + TEXT_LABEL_HEIGHT * i, TEXT_LABEL_WIDTH, TEXT_LABEL_HEIGHT);
mOrder[i] = i;
- stage.Add(mTextLabel[i]);
+ window.Add(mTextLabel[i]);
}
mDragAndDropDetector.StartedSignal().Connect(this, &DragAndDropExample::OnStart);
/*
- * 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.
EffectsView mDropShadowView;
EffectsView mEmbossView;
Toolkit::TextLabel mTitleActor; ///< The title on the toolbar
- Vector2 mStageSize;
+ Vector2 mWindowSize;
int mEffectSize;
};
{
// 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 );
+ auto window = application.GetWindow();
+ window.KeyEventSignal().Connect(this, &EffectsViewApp::OnKeyEvent);
+ window.SetBackgroundColor( Color::WHITE );
- mStageSize = stage.GetSize();
+ mWindowSize = window.GetSize();
// Creates a default view with a default tool bar.
- // The view is added to the stage.
+ // The view is added to the window.
mContents = DemoHelper::CreateView( application, mView, mToolBar, "", TOOLBAR_IMAGE, "" );
// Creates view change button.
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 );
+ Vector2 effectsViewSize( mWindowSize.width, mWindowSize.height * 0.25f );
mDropShadowView = CreateEffectsView( EffectsView::DROP_SHADOW, effectsViewSize, mEffectSize );
mDropShadowView.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
mDropShadowView.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_CENTER );
- mDropShadowView.SetProperty( Actor::Property::POSITION_Z, -mStageSize.height * 0.1f );
+ mDropShadowView.SetProperty( Actor::Property::POSITION_Z, -mWindowSize.height * 0.1f );
mContents.Add( mDropShadowView );
mEmbossView = CreateEffectsView( EffectsView::EMBOSS, effectsViewSize, mEffectSize );
mEmbossView.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
mEmbossView.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_CENTER );
- mEmbossView.SetProperty( Actor::Property::POSITION_Z, mStageSize.height * 0.1f );
+ mEmbossView.SetProperty( Actor::Property::POSITION_Z, mWindowSize.height * 0.1f );
mContents.Add( mEmbossView );
SetTitle( mEffectSize );
textActor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT );
textActor.SetProperty( Actor::Property::SIZE, viewSize );
textActor.SetProperty( Actor::Property::POSITION, Vector2( viewSize.width*0.4f, viewSize.height*0.3f ));
- textActor.SetProperty( TextLabel::Property::POINT_SIZE, DemoHelper::ScalePointSize(14.f) );
+ textActor.SetProperty( TextLabel::Property::POINT_SIZE, 14.f );
effectsView.Add( textActor );
// image
/*
- * 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.
*/
void OnInit(Application& app)
{
- Stage stage = Dali::Stage::GetCurrent();
- stage.KeyEventSignal().Connect(this, &FlexContainerExample::OnKeyEvent);
- stage.GetRootLayer().SetProperty( Layer::Property::BEHAVIOR,Layer::LAYER_3D );
+ auto window = app.GetWindow();
+ window.KeyEventSignal().Connect(this, &FlexContainerExample::OnKeyEvent);
+ window.GetRootLayer().SetProperty( Layer::Property::BEHAVIOR,Layer::LAYER_3D );
- Vector2 stageSize = Stage::GetCurrent().GetSize();
+ Vector2 windowSize = window.GetSize();
// Creates a default view with a default tool bar.
- // The view is added to the stage.
+ // The view is added to the window.
Layer contents = DemoHelper::CreateView( mApplication,
mView,
mToolBar,
mFlexContainer = FlexContainer::New();
mFlexContainer.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::TOP_LEFT);
mFlexContainer.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
- mFlexContainer.SetProperty( Actor::Property::SIZE, Vector2( stageSize.width, stageSize.height - VIEW_STYLE.mToolBarHeight ) );
+ mFlexContainer.SetProperty( Actor::Property::SIZE, Vector2( windowSize.width, windowSize.height - VIEW_STYLE.mToolBarHeight ) );
mFlexContainer.SetProperty( Actor::Property::POSITION_Y, VIEW_STYLE.mToolBarHeight);
mFlexContainer.SetProperty(FlexContainer::Property::FLEX_DIRECTION, FlexContainer::COLUMN); // column as main axis
contents.Add(mFlexContainer);
// flex properties that only work when there are multiple lines in the layout
flexItem.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
// Make sure there are still extra space in the line after wrapping
- flexItem.SetProperty( Actor::Property::SIZE, Vector2(stageSize.width / NUM_FLEX_ITEMS * 1.25f, (stageSize.height - VIEW_STYLE.mToolBarHeight) * 0.95f / NUM_FLEX_ITEMS * 1.25f) );
+ flexItem.SetProperty( Actor::Property::SIZE, Vector2(windowSize.width / NUM_FLEX_ITEMS * 1.25f, (windowSize.height - VIEW_STYLE.mToolBarHeight) * 0.95f / NUM_FLEX_ITEMS * 1.25f) );
mFlexItemContainer.Add( flexItem );
}
/*
- * Copyright (c) 2017 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.
void Create( Application& application )
{
- mStage = Stage::GetCurrent();
+ mWindow = application.GetWindow();
+ Vector2 windowSize = mWindow.GetSize();
mContentLayer = DemoHelper::CreateView( application,
mView,
mToolBar,
// Create label to display which control's KeyEvent callback is called
mEventLabel = TextLabel::New("Controls don't get KeyEvent yet");
- mEventLabel.SetProperty( Actor::Property::SIZE, Vector2( mStage.GetSize().width, mStage.GetSize().height*0.1f ) );
+ mEventLabel.SetProperty( Actor::Property::SIZE, Vector2( windowSize.width, windowSize.height*0.1f ) );
mEventLabel.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH);
mEventLabel.SetProperty( TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
mEventLabel.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
contentTable.Add( mEventLabel );
mContainer = TableView::New( 4, 3 );
- mContainer.SetProperty( Actor::Property::SIZE, Vector2( mStage.GetSize().width, mStage.GetSize().height*0.4f ) );
+ mContainer.SetProperty( Actor::Property::SIZE, Vector2( windowSize.width, windowSize.height*0.4f ) );
mContainer.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH);
mContainer.SetBackgroundColor( BACKGROUND_COLOUR );
mContainer.SetCellPadding( Size( MARGIN_SIZE, MARGIN_SIZE ) );
KeyboardFocusManager::Get().PreFocusChangeSignal().Connect( this, &FocusIntegrationExample::OnPreFocusChange );
// Respond to key events
- mStage.KeyEventSignal().Connect( this, &FocusIntegrationExample::OnKeyEvent );
+ mWindow.KeyEventSignal().Connect( this, &FocusIntegrationExample::OnKeyEvent );
}
// Callback for KeyboardFocusManager
private:
Application& mApplication;
- Stage mStage;
+ Window mWindow;
TableView mContainer;
TextLabel mEventLabel;
Toolkit::Control mView; ///< The View instance.
It contains following modules:
GameScene - responsible for loading and managing the scene data,
- it wraps around stage. Owns list of entities. Scene can be deserialised
+ it wraps around window. Owns list of entities. Scene can be deserialised
from json file ( see scene.json )
GameEntity - the renderable object that has also a transformation. It wraps DALi actors.
// The Init signal is received once (only) during the Application lifetime
void Create( Application& application )
{
- // Get a handle to the stage
- mStage = Stage::GetCurrent();
+ // Get a handle to the window
+ mWindow = application.GetWindow();
- mStage.SetBackgroundColor( Color::BLACK );
+ mWindow.SetBackgroundColor( Color::BLACK );
// Use 3D layer
- mStage.GetRootLayer().SetProperty( Layer::Property::BEHAVIOR, Layer::LAYER_3D );
+ mWindow.GetRootLayer().SetProperty( Layer::Property::BEHAVIOR, Layer::LAYER_3D );
// Load game scene
- mScene.Load( SCENE_URL );
+ mScene.Load( mWindow, SCENE_URL );
// Display tutorial
- mTutorialController.DisplayTutorial();
+ mTutorialController.DisplayTutorial( mWindow );
// Connect OnKeyEvent signal
- mStage.KeyEventSignal().Connect( this, &GameController::OnKeyEvent );
+ mWindow.KeyEventSignal().Connect( this, &GameController::OnKeyEvent );
}
// Handle a quit key event
Application& mApplication;
GameScene mScene;
- Stage mStage;
+ Window mWindow;
FppGameTutorialController mTutorialController;
};
/*
- * Copyright (c) 2017 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.
void FppGameTutorialController::OnTouch( const TouchData& touchEvent )
{
- Vector2 size( mStage.GetSize() );
+ Vector2 size( mWindow.GetSize() );
bool isLandscape( size.x > size.y );
}
}
-void FppGameTutorialController::DisplayTutorial()
+void FppGameTutorialController::DisplayTutorial( Dali::Window window )
{
- mStage = Stage::GetCurrent();
+ mWindow = window;
- Vector2 stageSize( mStage.GetSize() );
- bool isLandscape( stageSize.x > stageSize.y );
+ Vector2 windowSize( mWindow.GetSize() );
+ bool isLandscape( windowSize.x > windowSize.y );
if( !isLandscape )
{
- std::swap( stageSize.x, stageSize.y );
+ std::swap( windowSize.x, windowSize.y );
}
mUiRoot = Actor::New();
- mStage.Add( mUiRoot );
+ mWindow.Add( mUiRoot );
// left tutorial text label
mLeftLabel = Toolkit::TextLabel::New("Touch here to walk");
mLeftLabel.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
mLeftLabel.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
mLeftLabel.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
- mLeftLabel.SetProperty( Actor::Property::SIZE, Vector3( stageSize.x*0.5, stageSize.y, 1.0f ) );
+ mLeftLabel.SetProperty( Actor::Property::SIZE, Vector3( windowSize.x*0.5, windowSize.y, 1.0f ) );
mLeftLabel.SetProperty( Toolkit::Control::Property::BACKGROUND,
Property::Map().Add( Toolkit::Visual::Property::TYPE, Visual::COLOR )
.Add( ColorVisual::Property::MIX_COLOR, Vector4( 0.0, 0.0, 0.7, 0.2 ) ) );
mRightLabel.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
mRightLabel.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
mRightLabel.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
- mRightLabel.SetProperty( Actor::Property::SIZE, Vector3( stageSize.x*0.5, stageSize.y, 1.0f ) );
+ mRightLabel.SetProperty( Actor::Property::SIZE, Vector3( windowSize.x*0.5, windowSize.y, 1.0f ) );
mRightLabel.SetProperty( Toolkit::Control::Property::BACKGROUND,
Property::Map().Add( Toolkit::Visual::Property::TYPE, Visual::COLOR )
.Add( ColorVisual::Property::MIX_COLOR, Vector4( 0.5, 0.0, 0.0, 0.2 ) ) );
// create camera dedicated to be used with UI controls
CameraActor uiCamera = CameraActor::New();
- mTutorialRenderTask = mStage.GetRenderTaskList().CreateTask();
+ mTutorialRenderTask = mWindow.GetRenderTaskList().CreateTask();
mTutorialRenderTask.SetCameraActor( uiCamera );
mTutorialRenderTask.SetClearEnabled( false );
mTutorialRenderTask.SetSourceActor( mUiRoot );
uiCamera.RotateBy( Degree(90.0f), Vector3( 0.0f, 0.0f, 1.0f ));
}
- mLeftLabel.SetProperty( Actor::Property::POSITION, Vector3( -stageSize.x*0.25f, 0.0, 0.0 ) );
- mRightLabel.SetProperty( Actor::Property::POSITION, Vector3( stageSize.x*0.25f, 0.0, 0.0 ) );
+ mLeftLabel.SetProperty( Actor::Property::POSITION, Vector3( -windowSize.x*0.25f, 0.0, 0.0 ) );
+ mRightLabel.SetProperty( Actor::Property::POSITION, Vector3( windowSize.x*0.25f, 0.0, 0.0 ) );
mUiRoot.Add( mLeftLabel );
mUiRoot.Add( mRightLabel );
- mStage.Add( uiCamera );
+ mWindow.Add( uiCamera );
Animation animation = Animation::New( 1.0f );
animation.AnimateTo( Property( mLeftLabel, Actor::Property::COLOR_ALPHA ), 1.0f, AlphaFunction::EASE_OUT );
void FppGameTutorialController::OnTutorialAnimationFinished( Animation& animation )
{
// touch signal will wait for a single touch on each side of screen
- mStage.TouchSignal().Connect( this, &FppGameTutorialController::OnTouch );
+ mWindow.TouchSignal().Connect( this, &FppGameTutorialController::OnTouch );
}
void FppGameTutorialController::OnTutorialComplete( Animation& animation )
{
- mStage.Remove( mUiRoot );
+ mWindow.Remove( mUiRoot );
mUiRoot.Reset();
- mStage.GetRenderTaskList().RemoveTask( mTutorialRenderTask );
+ mWindow.GetRenderTaskList().RemoveTask( mTutorialRenderTask );
}
#define FPPGAMETUTORIAL_H
/*
- * Copyright (c) 2016 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.
#include <dali/public-api/actors/actor.h>
#include <dali/public-api/render-tasks/render-task.h>
-#include <dali/public-api/common/stage.h>
#include <dali/public-api/signals/connection-tracker.h>
+#include <dali/public-api/adaptor-framework/window.h>
#include <dali-toolkit/public-api/controls/text-controls/text-label.h>
class FppGameTutorialController : public Dali::ConnectionTracker
/**
* Displays UI with tutorial
+ * @param[in] window The window to display the tutorial on
*/
- void DisplayTutorial();
+ void DisplayTutorial( Dali::Window window );
/**
* Handles tutorial touch input
void OnTutorialAnimationFinished( Dali::Animation& animation );
/**
- * Handles tutorial completion stage
+ * Handles tutorial completion window
* @param animation Animation object
*/
void OnTutorialComplete( Dali::Animation& animation );
Dali::Toolkit::TextLabel mRightLabel; /// Text label displaying right message
bool mLeftTutorialComplete; /// Flag indicating the walk (left) tutorial action has been performed
bool mRightTutorialComplete; /// Flag indicating the look (right) tutorial action has been performed
- Dali::Stage mStage;
+ Dali::Window mWindow;
};
#endif // FPPGAMETUTORIAL_H
/*
- * Copyright (c) 2016 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.
#include "game-camera.h"
-#include <dali/public-api/common/stage.h>
#include <dali/public-api/render-tasks/render-task-list.h>
#include <dali/public-api/render-tasks/render-task.h>
#include <dali/public-api/events/touch-data.h>
mCameraActor.Remove( mInterceptorActor );
}
-void GameCamera::Initialise( float fovY, float near, float far )
+void GameCamera::Initialise( CameraActor defaultCamera, float fovY, float near, float far, const Vector2& sceneSize )
{
+ mCameraActor = defaultCamera;
+
mFovY = fovY;
mNear = near;
mFar = far;
- Vector2 stageSize = Stage::GetCurrent().GetSize();
- mPortraitMode = stageSize.x < stageSize.y ? true : false;
+ mSceneSize = sceneSize;
+ mPortraitMode = mSceneSize.x < mSceneSize.y ? true : false;
// Initialise default camera
InitialiseDefaultCamera();
bool GameCamera::OnTick()
{
- Vector2 stageSize = Stage::GetCurrent().GetSize();
-
// ---------------------------------------------------------------------
// update rotation
Vector2 tmp( mScreenLookDelta );
if( mPortraitMode )
{
- float yaw = ( (tmp.y / stageSize.y ) * CAMERA_SENSITIVITY );
- float pitch = ( (tmp.x / stageSize.x ) * CAMERA_SENSITIVITY );
+ float yaw = ( (tmp.y / mSceneSize.y ) * CAMERA_SENSITIVITY );
+ float pitch = ( (tmp.x / mSceneSize.x ) * CAMERA_SENSITIVITY );
mCameraYawPitch.y -= yaw;
mCameraYawPitch.x -= pitch;
if( abs( mCameraYawPitch.y ) > CAMERA_VERTICAL_LIMIT )
}
else
{
- float yaw = ( (tmp.y / stageSize.x ) * CAMERA_SENSITIVITY );
- float pitch = ( (tmp.x / stageSize.y ) * CAMERA_SENSITIVITY );
+ float yaw = ( (tmp.y / mSceneSize.x ) * CAMERA_SENSITIVITY );
+ float pitch = ( (tmp.x / mSceneSize.y ) * CAMERA_SENSITIVITY );
mCameraYawPitch.x -= yaw;
mCameraYawPitch.y -= pitch;
if( abs( mCameraYawPitch.x ) > CAMERA_VERTICAL_LIMIT )
sidewaysVector.Normalize();
- const float forwardSpeed( mScreenWalkDelta.y / stageSize.y );
- const float sidewaysSpeed( mScreenWalkDelta.x / stageSize.x );
+ const float forwardSpeed( mScreenWalkDelta.y / mSceneSize.y );
+ const float sidewaysSpeed( mScreenWalkDelta.x / mSceneSize.x );
// Adjust walking speed
if ( mPortraitMode )
void GameCamera::InitialiseDefaultCamera()
{
- Stage stage = Stage::GetCurrent();
- mCameraActor = stage.GetRenderTaskList().GetTask(0).GetCameraActor();
mCameraActor.SetProperty( Dali::Actor::Property::NAME, "GameCamera" );
mCameraActor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
mCameraActor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
void GameCamera::CreateInterceptorActor()
{
- Stage stage = Stage::GetCurrent();
-
mInterceptorActor = Actor::New();
mInterceptorActor.SetProperty( Dali::Actor::Property::NAME, "GameInputInterceptor" );
- mInterceptorActor.SetProperty( Actor::Property::SIZE, Vector3( stage.GetSize().x, stage.GetSize().y, 1 ) );
+ mInterceptorActor.SetProperty( Actor::Property::SIZE, Vector3( mSceneSize.x, mSceneSize.y, 1 ) );
mInterceptorActor.SetProperty( Actor::Property::POSITION, Vector3( 0.0, 0.0, 1.0 ) );
mInterceptorActor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
mInterceptorActor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
bool GameCamera::OnTouch( Actor actor, const TouchData& touch )
{
- Stage stage = Stage::GetCurrent();
-
for( int i = 0; i < (int)touch.GetPointCount() && i < 3; ++i )
{
int id = touch.GetDeviceId( i );
{
position.x = tmp.y;
position.y = tmp.x;
- halfWindowSize = stage.GetSize().y / 2;
+ halfWindowSize = mSceneSize.y / 2;
}
else
{
position.x = tmp.x;
position.y = tmp.y;
- halfWindowSize = stage.GetSize().x / 2;
+ halfWindowSize = mSceneSize.x / 2;
}
// touch started
#define GAME_CAMERA_H
/*
- * Copyright (c) 2016 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.
* Additionally it handles simple user input by attaching fullscreen
* sized 'interceptor' Actor to the front of the CameraActor ( to be always
* parallel to the view ). It is necessary, as with changing camera orientation
- * the the stage cannot be used as a touch signal receiver ( it will simply
+ * the the window cannot be used as a touch signal receiver ( it will simply
* go offscreen with camera rotation ).
*
* DALi camera uses left-handed coordinate system.
/**
* Initialise with given fovY, near, far
+ * @param[in] defaultCamera The default camera used by the scene
* @param[in] fovY Field of view in degrees
* @param[in] near Near plane
* @param[in] far Far Plane
+ * @param[in] sceneSize The size of the scene this is looking at
*/
- void Initialise( float fov, float near, float far );
-
- /**
- * Retrieves actor associated with camera object
- * @return Returns camera actor
- */
- Dali::CameraActor GetCameraActor();
+ void Initialise( Dali::CameraActor defaultCamera, float fov, float near, float far, const Dali::Vector2& sceneSize );
private:
int mLookingTouchId; /// Touch device id bound to the looking action
Dali::Vector3 mCameraPosition; /// Current camera position ( shadowing the actor position )
+ Dali::Vector2 mSceneSize; /// The size of the scene we are looking at
- bool mPortraitMode; /// flag if window is in portrait mode ( physically stage width < height )
+ bool mPortraitMode; /// flag if window is in portrait mode ( physically window width < height )
};
#endif
/*
- * Copyright (c) 2016 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 GameScene::Load(const char *filename)
+bool GameScene::Load(Window window, const char *filename)
{
ByteArray bytes;
if( !LoadFile( filename, bytes ) )
return false;
}
- // add all to the stage
- Stage stage = Stage::GetCurrent();
+ // add all to the window
mRootActor = Actor::New();
mRootActor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
mRootActor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
- stage.GetRootLayer().Add( mRootActor );
+ window.GetRootLayer().Add( mRootActor );
mRootActor.SetProperty( Actor::Property::SCALE, Vector3( -1.0, 1.0, 1.0 ) );
mRootActor.SetProperty( Actor::Property::POSITION, Vector3( 0.0, 0.0, 0.0 ) );
mRootActor.SetProperty( Actor::Property::ORIENTATION, Quaternion( Degree( 90 ), Vector3( 1.0, 0.0, 0.0 ) ) );
}
// update camera
- mCamera.Initialise( 60.0f, 0.1f, 100.0f );
+ mCamera.Initialise( window.GetRenderTaskList().GetTask(0).GetCameraActor(), 60.0f, 0.1f, 100.0f, window.GetSize() );
return true;
}
#define GAME_SCENE_H
/*
- * Copyright (c) 2016 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.
#include "game-camera.h"
#include <dali/public-api/actors/actor.h>
+#include <dali/public-api/adaptor-framework/window.h>
class GameCamera;
class GameEntity;
/**
* Loads scene from formatted JSON file, returns true on success
*
+ * @param[in] window The window to load the scene on
* @param[in] filename Path to the scene file
* @return true if suceess
*/
- bool Load( const char* filename );
+ bool Load( Dali::Window window, const char* filename );
/**
* Loads resource ( model or texture ) or gets if from cache if already loaded
*/
FrameCallbackController( Application& application )
: mApplication( application ),
- mStage(),
mFrameCallback(),
mTextLabel(),
mTapDetector(),
*
* Creates several image-views and places them appropriately.
* Animate all image-views.
- * Set the FrameCallbackInterface on the stage.
- * Tapping on the stage enables/disables the FrameCallback.
+ * Set the FrameCallbackInterface on the window.
+ * Tapping on the window enables/disables the FrameCallback.
*/
- void Create( Application& /* application */ )
+ void Create( Application& application )
{
- // Set the stage background color and connect to the stage's key signal to allow Back and Escape to exit.
- mStage = Stage::GetCurrent();
- mStage.SetBackgroundColor( Color::WHITE );
- mStage.KeyEventSignal().Connect( this, &FrameCallbackController::OnKeyEvent );
+ // Set the window background color and connect to the window's key signal to allow Back and Escape to exit.
+ Window window = application.GetWindow();
+ window.SetBackgroundColor( Color::WHITE );
+ window.KeyEventSignal().Connect( this, &FrameCallbackController::OnKeyEvent );
- // Notify mFrameCallback about the stage width.
- // Can call methods in mFrameCallback directly as we have not set it on the stage yet.
- Vector2 stageSize = mStage.GetSize();
- mFrameCallback.SetStageWidth( stageSize.width );
+ // Notify mFrameCallback about the window width.
+ // Can call methods in mFrameCallback directly as we have not set it on the window yet.
+ Vector2 windowSize = window.GetSize();
+ mFrameCallback.SetWindowWidth( windowSize.width );
// Detect taps on the root layer.
mTapDetector = TapGestureDetector::New();
- mTapDetector.Attach( mStage.GetRootLayer() );
+ mTapDetector.Attach( window.GetRootLayer() );
mTapDetector.DetectedSignal().Connect( this, &FrameCallbackController::OnTap );
// Create some key-frames to be used by all animations.
KeyFrames keyFrames = KeyFrames::New();
keyFrames.Add( 0.0f, 0.0f );
- keyFrames.Add( 0.25f, stageSize.width * 0.5f );
- keyFrames.Add( 0.75f, -stageSize.width * 0.5f );
+ keyFrames.Add( 0.25f, windowSize.width * 0.5f );
+ keyFrames.Add( 0.75f, -windowSize.width * 0.5f );
keyFrames.Add( 1.0f, 0.0f );
float yPos = 0.0f;
- for( int i = 0; yPos < stageSize.height; ++i )
+ for( int i = 0; yPos < windowSize.height; ++i )
{
ImageView imageView = ImageView::New( IMAGE_NAME );
imageView.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_CENTER );
yPos += imageView.GetNaturalSize().height;
// Add the ID of the created ImageView to mFrameCallback.
- // Again, can call methods in mFrameCallback directly as we have not set it on the stage yet.
+ // Again, can call methods in mFrameCallback directly as we have not set it on the window yet.
mFrameCallback.AddId( imageView.GetProperty< int >( Actor::Property::ID ) );
- mStage.Add( imageView );
+ window.Add( imageView );
// Create an animation and set the progress so that each image starts at a different point.
Animation animation = Animation::New( ANIMATION_TIME );
mTextLabel.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
mTextLabel.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
mTextLabel.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
- mStage.Add( mTextLabel );
+ window.Add( mTextLabel );
// Set the FrameCallbackInterface on the root layer.
- DevelStage::AddFrameCallback( mStage, mFrameCallback, mStage.GetRootLayer() );
+ DevelStage::AddFrameCallback( Stage::GetCurrent(), mFrameCallback, window.GetRootLayer() );
mFrameCallbackEnabled = true;
}
/**
- * @brief Called when a tap on the stage occurs.
+ * @brief Called when a tap on the window occurs.
*
* Toggle enabling/disabling of the FrameCallbackInterface
*/
- void OnTap( Actor /* actor */, const TapGesture& /* tap */ )
+ void OnTap( Actor actor, const TapGesture& /* tap */ )
{
if( mFrameCallbackEnabled )
{
- DevelStage::RemoveFrameCallback( mStage, mFrameCallback );
+ DevelStage::RemoveFrameCallback( Stage::GetCurrent(), mFrameCallback );
mTextLabel.SetProperty( TextLabel::Property::TEXT, TEXT_DISABLED );
mTextLabel.SetProperty( TextLabel::Property::TEXT_COLOR, TEXT_COLOR_DISABLED );
}
else
{
- DevelStage::AddFrameCallback( mStage, mFrameCallback, mStage.GetRootLayer() );
+ DevelStage::AddFrameCallback( Stage::GetCurrent(), mFrameCallback, actor );
mTextLabel.SetProperty( TextLabel::Property::TEXT, TEXT_ENABLED );
mTextLabel.SetProperty( TextLabel::Property::TEXT_COLOR, TEXT_COLOR_ENABLED );
}
private:
Application& mApplication; ///< A reference to the application instance.
- Stage mStage; ///< The stage we enable the FrameCallback on.
FrameCallback mFrameCallback; ///< An instance of our implementation of the FrameCallbackInterface.
TextLabel mTextLabel; ///< Text label which shows whether the frame-callback is enabled/disabled.
TapGestureDetector mTapDetector; ///< Tap detector to enable/disable the FrameCallbackInterface.
/*
- * Copyright (c) 2018 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.
FrameCallback::FrameCallback()
: mActorIdContainer(),
- stageHalfWidth( 0.0f )
+ windowHalfWidth( 0.0f )
{
}
-void FrameCallback::SetStageWidth( float stageWidth )
+void FrameCallback::SetWindowWidth( float windowWidth )
{
- stageHalfWidth = stageWidth * 0.5f;
+ windowHalfWidth = windowWidth * 0.5f;
}
void FrameCallback::AddId( uint32_t id )
Vector3 size;
if( updateProxy.GetPositionAndSize( i, position, size ) ) // Retrieve the position and size using the Actor ID.
{
- float halfWidthPoint = stageHalfWidth - size.width * 0.5f;
+ float halfWidthPoint = windowHalfWidth - size.width * 0.5f;
float xTranslation = abs( position.x );
if( xTranslation > halfWidthPoint )
{
#define DEMO_FRAME_CALLBACK_H
/*
- * Copyright (c) 2018 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.
FrameCallback();
/**
- * @brief Sets the stage width.
- * @param[in] stageWidth The stage width.
+ * @brief Sets the window width.
+ * @param[in] windowWidth The window width.
*/
- void SetStageWidth( float stageWidth );
+ void SetWindowWidth( float windowWidth );
/**
* @brief The actor with the specified ID will be changed when Update() is called.
private:
Dali::Vector< uint32_t > mActorIdContainer; ///< Container of Actor IDs.
- float stageHalfWidth; ///< Half the width of the stage. Center is 0,0 in the world matrix.
+ float windowHalfWidth; ///< Half the width of the window. Center is 0,0 in the world matrix.
constexpr static float SIZE_MULTIPLIER = 2.0f; ///< Multiplier for the size to set as the actors hit the edge.
};
void Create( Application& application )
{
- Stage stage = Stage::GetCurrent();
- Vector2 stageSize = stage.GetSize();
- stage.KeyEventSignal().Connect(this, &GaussianBlurViewExample::OnKeyEvent);
+ auto window = application.GetWindow();
+ Vector2 windowSize = window.GetSize();
+ window.KeyEventSignal().Connect(this, &GaussianBlurViewExample::OnKeyEvent);
mImageView = Toolkit::ImageView::New( BACKGROUND_IMAGE );
mImageView.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
mImageView.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
- float excessWidth = std::max( 0.0f, (BACKGROUND_IMAGE_WIDTH - stageSize.width) * 0.5f );
+ float excessWidth = std::max( 0.0f, (BACKGROUND_IMAGE_WIDTH - windowSize.width) * 0.5f );
if( excessWidth > 0.0f )
{
Layer onTop = Layer::New();
onTop.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
onTop.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
- onTop.SetProperty( Actor::Property::SIZE, stageSize );
- stage.Add( onTop );
+ onTop.SetProperty( Actor::Property::SIZE, windowSize );
+ window.Add( onTop );
onTop.RaiseToTop();
mOnLabel = TextLabel::New( "Blur ON" );
mGaussianBlurView = GaussianBlurView::New( 30, 8.0f, Pixel::RGBA8888, 0.5f, 0.5f, false );
mGaussianBlurView.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
mGaussianBlurView.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
- mGaussianBlurView.SetProperty( Actor::Property::SIZE, stage.GetSize() );
- stage.Add( mGaussianBlurView );
+ mGaussianBlurView.SetProperty( Actor::Property::SIZE, windowSize );
+ window.Add( mGaussianBlurView );
mGaussianBlurView.Add( mImageView );
mGaussianBlurView.SetProperty( mGaussianBlurView.GetBlurStrengthPropertyIndex(), mStrength );
- stage.GetRootLayer().TouchSignal().Connect( this, &GaussianBlurViewExample::OnTouch );
+ window.GetRootLayer().TouchSignal().Connect( this, &GaussianBlurViewExample::OnTouch );
}
bool OnTouch( Actor actor, const TouchData& touch )
/*
- * 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.
* @param[in] startTime When to start the animators
* @param[in] endTime When to end the animators
*/
-void AddHelpInfo( const std::string&& string, Actor parent, Animation animation, float startTime, float endTime )
+void AddHelpInfo( const std::string&& string, const Vector2& windowSize, Actor parent, Animation animation, float startTime, float endTime )
{
Actor text = TextLabel::New( std::move( string ) );
- Vector3 position( Stage::GetCurrent().GetSize() * HELP_TEXT_POSITION_MULTIPLIER );
+ Vector3 position( windowSize * HELP_TEXT_POSITION_MULTIPLIER );
text.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_CENTER );
text.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_CENTER );
*/
void Create( Application& application )
{
- // Get a handle to the stage & connect to the key event signal
- Stage stage = Stage::GetCurrent();
- stage.KeyEventSignal().Connect(this, &GestureExample::OnKeyEvent);
+ // Get a handle to the window & connect to the key event signal
+ auto window = application.GetWindow();
+ Vector2 windowSize = window.GetSize();
+ window.KeyEventSignal().Connect(this, &GestureExample::OnKeyEvent);
// Create a background with a linear gradient which matches parent size & is placed in the center.
Actor background = Control::New();
background.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
background.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
background.SetProperty( Control::Property::BACKGROUND, BACKGROUND );
- stage.Add( background );
+ window.Add( background );
- // Create a control with a circular gradient that we'll use for the gestures and be a quarter of the size of the stage.
+ // Create a control with a circular gradient that we'll use for the gestures and be a quarter of the size of the window.
Actor touchControl = Control::New();
- touchControl.SetProperty( Actor::Property::SIZE, stage.GetSize() * 0.25f );
+ touchControl.SetProperty( Actor::Property::SIZE, windowSize * 0.25f );
touchControl.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
touchControl.SetProperty( Control::Property::BACKGROUND, CONTROL_BACKGROUND );
background.Add( touchControl );
float startTime( 0.0f );
float endTime( startTime + HELP_ANIMATION_SEGMENT_TIME );
- AddHelpInfo( "Tap image for animation", background, helpAnimation, startTime, endTime );
- AddHelpInfo( "Press & Hold image to drag", background, helpAnimation, startTime += HELP_ANIMATION_SEGMENT_TIME, endTime += HELP_ANIMATION_SEGMENT_TIME );
- AddHelpInfo( "Pinch image to resize", background, helpAnimation, startTime += HELP_ANIMATION_SEGMENT_TIME, endTime += HELP_ANIMATION_SEGMENT_TIME );
- AddHelpInfo( "Move fingers in a circular motion on image to rotate", background, helpAnimation, startTime += HELP_ANIMATION_SEGMENT_TIME, endTime += HELP_ANIMATION_SEGMENT_TIME );
+ AddHelpInfo( "Tap image for animation", windowSize, background, helpAnimation, startTime, endTime );
+ AddHelpInfo( "Press & Hold image to drag", windowSize, background, helpAnimation, startTime += HELP_ANIMATION_SEGMENT_TIME, endTime += HELP_ANIMATION_SEGMENT_TIME );
+ AddHelpInfo( "Pinch image to resize", windowSize, background, helpAnimation, startTime += HELP_ANIMATION_SEGMENT_TIME, endTime += HELP_ANIMATION_SEGMENT_TIME );
+ AddHelpInfo( "Move fingers in a circular motion on image to rotate", windowSize, background, helpAnimation, startTime += HELP_ANIMATION_SEGMENT_TIME, endTime += HELP_ANIMATION_SEGMENT_TIME );
helpAnimation.SetLooping( true );
helpAnimation.Play();
}
anim.AnimateTo( Property( actor, Actor::Property::SCALE ), actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ) * PAN_MODE_END_ANIMATION_SCALE, AlphaFunction::BOUNCE );
// Move actor back to center if we're out of bounds
- Vector2 halfStageSize = Stage::GetCurrent().GetSize() * 0.5f;
- if( ( abs( newPosition.x ) > halfStageSize.width ) ||
- ( abs( newPosition.y ) > halfStageSize.height ) )
+ Vector2 halfWindowSize = Vector2(mApplication.GetWindow().GetSize()) * 0.5f;
+ if( ( abs( newPosition.x ) > halfWindowSize.width ) ||
+ ( abs( newPosition.y ) > halfWindowSize.height ) )
{
anim.AnimateTo( Property( actor, Actor::Property::POSITION ), Vector3::ZERO, AlphaFunction::EASE_IN );
}
// The Init signal is received once (only) during the Application lifetime
void Create( Application& application )
{
- // Get a handle to the stage
- Stage stage = Stage::GetCurrent();
- stage.KeyEventSignal().Connect(this, &GradientController::OnKeyEvent);
+ // Get a handle to the window
+ auto window = application.GetWindow();
+ window.KeyEventSignal().Connect(this, &GradientController::OnKeyEvent);
// Creates a default view with a default tool bar.
- // The view is added to the stage.
+ // The view is added to the window.
Toolkit::ToolBar toolBar;
Layer content = DemoHelper::CreateView( application,
mView,
}
case 1: // linear gradient with units as userSpaceOnUse
{
- Vector2 halfStageSize = Stage::GetCurrent().GetSize()*0.5f;
- gradientMap.Insert( GradientVisual::Property::START_POSITION, halfStageSize );
- gradientMap.Insert( GradientVisual::Property::END_POSITION, -halfStageSize );
+ Vector2 halfWindowSize = Vector2(mApplication.GetWindow().GetSize())*0.5f;
+ gradientMap.Insert( GradientVisual::Property::START_POSITION, halfWindowSize );
+ gradientMap.Insert( GradientVisual::Property::END_POSITION, -halfWindowSize );
gradientMap.Insert( GradientVisual::Property::UNITS, GradientVisual::Units::USER_SPACE );
break;
}
}
default: // radial gradient with units as userSpaceOnUse
{
- Vector2 stageSize = Stage::GetCurrent().GetSize();
- gradientMap.Insert( GradientVisual::Property::CENTER, stageSize * 0.5f );
- gradientMap.Insert( GradientVisual::Property::RADIUS, stageSize.Length());
+ Vector2 windowSize = mApplication.GetWindow().GetSize();
+ gradientMap.Insert( GradientVisual::Property::CENTER, windowSize * 0.5f );
+ gradientMap.Insert( GradientVisual::Property::RADIUS, windowSize.Length());
gradientMap.Insert( GradientVisual::Property::UNITS, GradientVisual::Units::USER_SPACE );
break;
}
/*
- * Copyright (c) 2018 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.
mApplication.InitSignal().Connect( this, &HelloWorldController::Create );
}
- ~HelloWorldController()
- {
- // Nothing to do here;
- }
+ ~HelloWorldController() = default; // Nothing to do in destructor
// The Init signal is received once (only) during the Application lifetime
void Create( Application& application )
{
- // Get a handle to the stage
- Stage stage = Stage::GetCurrent();
- stage.SetBackgroundColor( Color::WHITE );
+ // Get a handle to the window
+ Window window = application.GetWindow();
+ window.SetBackgroundColor( Color::WHITE );
TextLabel textLabel = TextLabel::New( "Hello World" );
textLabel.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
textLabel.SetProperty( Dali::Actor::Property::NAME, "helloWorldLabel" );
- stage.Add( textLabel );
+ window.Add( textLabel );
- // Respond to a click anywhere on the stage
- stage.GetRootLayer().TouchSignal().Connect( this, &HelloWorldController::OnTouch );
+ // Respond to a touch anywhere on the window
+ window.GetRootLayer().TouchSignal().Connect( this, &HelloWorldController::OnTouch );
// Respond to key events
- stage.KeyEventSignal().Connect( this, &HelloWorldController::OnKeyEvent );
+ window.KeyEventSignal().Connect( this, &HelloWorldController::OnKeyEvent );
}
bool OnTouch( Actor actor, const TouchData& touch )
/*
- * 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.
// Create benchmark script
CreateScript();
- // Get a handle to the stage
- Stage stage = Stage::GetCurrent();
+ // Get a handle to the window
+ Window window = application.GetWindow();
mScrollParent = Actor::New();
mScrollParent.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
// create background
Toolkit::ImageView background = Toolkit::ImageView::New( BACKGROUND_IMAGE );
- Stage::GetCurrent().Add( background );
+ window.Add( background );
background.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
background.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
background.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
PopulatePages();
- stage.Add( mScrollParent );
+ window.Add( mScrollParent );
- // Respond to a click anywhere on the stage.
- stage.GetRootLayer().TouchSignal().Connect( this, &HomescreenBenchmark::OnTouch );
+ // Respond to a click anywhere on the window.
+ window.GetRootLayer().TouchSignal().Connect( this, &HomescreenBenchmark::OnTouch );
// Respond to key events
- stage.KeyEventSignal().Connect( this, &HomescreenBenchmark::OnKeyEvent );
+ window.KeyEventSignal().Connect( this, &HomescreenBenchmark::OnKeyEvent );
}
bool OnTouch( Actor actor, const TouchData& touch )
void AddIconsToPage( Actor page, bool useTextLabel )
{
- Size stageSize( Stage::GetCurrent().GetSize() );
- const float scaledHeight = stageSize.y * PAGE_SCALE_FACTOR_Y;
- const float scaledWidth = stageSize.x * PAGE_SCALE_FACTOR_X;
- const float PADDING = stageSize.y / 64.0f;
+ Window window = mApplication.GetWindow();
+
+ Size windowSize( window.GetSize() );
+ const float scaledHeight = windowSize.y * PAGE_SCALE_FACTOR_Y;
+ const float scaledWidth = windowSize.x * PAGE_SCALE_FACTOR_X;
+ const float PADDING = windowSize.y / 64.0f;
const float ROW_HEIGHT = ( scaledHeight - (PADDING*2.0f) ) / static_cast<float>( mConfig.mRows );
const float COL_WIDTH = ( scaledWidth - (PADDING*2.0f) ) / static_cast<float>( mConfig.mCols );
- Vector2 dpi = Stage::GetCurrent().GetDpi();
+ Vector2 dpi = window.GetDpi();
static int currentIconIndex = 0;
void PopulatePages()
{
- Vector3 stageSize( Stage::GetCurrent().GetSize() );
+ Vector3 windowSize( mApplication.GetWindow().GetSize() );
for( int i = 0; i < mConfig.mPageCount; ++i )
{
// Move page 'a little bit up'.
page.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
page.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
- page.SetProperty( Actor::Property::POSITION, Vector3( stageSize.x * i, 0.0f, 0.0f ) );
+ page.SetProperty( Actor::Property::POSITION, Vector3( windowSize.x * i, 0.0f, 0.0f ) );
mScrollParent.Add( page );
}
void ScrollPages(int pages, float duration, bool flick)
{
duration *= PAGE_DURATION_SCALE_FACTOR;
- Vector3 stageSize( Stage::GetCurrent().GetSize() );
+ Vector3 windowSize( mApplication.GetWindow().GetSize() );
mScrollAnimation = Animation::New( duration );
if( flick )
{
- mScrollAnimation.AnimateBy( Property( mScrollParent, Actor::Property::POSITION ), Vector3( -stageSize.x * pages, 0.0f, 0.0f ), AlphaFunction::EASE_IN_OUT );
+ mScrollAnimation.AnimateBy( Property( mScrollParent, Actor::Property::POSITION ), Vector3( -windowSize.x * pages, 0.0f, 0.0f ), AlphaFunction::EASE_IN_OUT );
}
else
{
int totalPages = abs( pages );
for( int i = 0; i < totalPages; ++i )
{
- mScrollAnimation.AnimateBy( Property( mScrollParent, Actor::Property::POSITION ), Vector3( pages < 0 ? stageSize.x : -stageSize.x, 0.0f, 0.0f ), AlphaFunction::EASE_IN_OUT, TimePeriod( duration * i, duration ) );
+ mScrollAnimation.AnimateBy( Property( mScrollParent, Actor::Property::POSITION ), Vector3( pages < 0 ? windowSize.x : -windowSize.x, 0.0f, 0.0f ), AlphaFunction::EASE_IN_OUT, TimePeriod( duration * i, duration ) );
}
}
mScrollAnimation.FinishedSignal().Connect( this, &HomescreenBenchmark::OnAnimationEnd );
/*
- * 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.
/**
* Part One of the Immediate loading example, displays instructions on what will be shown and starts loading of the Immediate image before it
- * is staged.
+ * is windowd.
*/
void LoadPolicyImmediateExampleInstructions()
{
}
/**
- * Part Two of the Immediate loading example and here the Image is staged, shown to be instant (if previously step gave enough time to load).
+ * Part Two of the Immediate loading example and here the Image is windowd, shown to be instant (if previously step gave enough time to load).
*/
void LoadPolicyImmediateExample()
{
}
/**
- * Part two of the Destroyed example, the image is staged again but to the second column, it shows the loading takes the same amount of time as
+ * Part two of the Destroyed example, the image is windowd again but to the second column, it shows the loading takes the same amount of time as
* when first loaded.
*/
void LoadPolicyDestroyedExample02()
}
/**
- * Part two of the Detached example, the image is staged again but to the second column, it shows the loading takes the same amount of time as
+ * Part two of the Detached example, the image is windowd again but to the second column, it shows the loading takes the same amount of time as
* when first loaded.
*/
void ReleasePolicyDestroyedExample06()
Property::Map gradientBackground;
CreateGradient( gradientBackground );
- // Get a handle to the stage
- Stage stage = Stage::GetCurrent();
+ // Get a handle to the window
+ Window window = application.GetWindow();
// Create default View.
Toolkit::Control view = Toolkit::Control::New();
view.SetProperty( Actor::Property::PARENT_ORIGIN, Dali::ParentOrigin::CENTER );
view.SetResizePolicy( Dali::ResizePolicy::FILL_TO_PARENT, Dali::Dimension::ALL_DIMENSIONS );
view.SetProperty( Toolkit::Control::Property::BACKGROUND , gradientBackground );
- stage.Add( view );
+ window.Add( view );
// Create a table view to show a pair of buttons above each image.
mTable = TableView::New( TableRowPlacement::NUMBER_OF_ROWS, 1 );
mTable.AddChild( mNextButton, TableView::CellPosition( TableRowPlacement::NEXT_BUTTON, 0 ) );
mTable.SetCellPadding( Vector2( 2.0f, 2.0f ) );
- Stage::GetCurrent().KeyEventSignal().Connect(this, &ImagePolicies::OnKeyEvent);
+ window.KeyEventSignal().Connect(this, &ImagePolicies::OnKeyEvent);
// Outline Map for Labels
Property::Map outlineMap;
ImageScalingAndFilteringController( Application& application )
: mApplication( application ),
mLastPinchScale( 1.0f ),
- mImageStageScale( 0.5f, 0.5f ),
+ mImageWindowScale( 0.5f, 0.5f ),
mCurrentPath( 0 ),
mFittingMode( FittingMode::FIT_WIDTH ),
mSamplingMode( SamplingMode::BOX_THEN_LINEAR),
// The Init signal is received once (only) during the Application lifetime
void Create( Application& application )
{
- // Get a handle to the stage
- Stage stage = Stage::GetCurrent();
+ // Get a handle to the window
+ Window window = application.GetWindow();
+ Vector2 windowSize = window.GetSize();
// Background image:
Dali::Property::Map backgroundImage;
backgroundImage.Insert( Toolkit::Visual::Property::TYPE, Toolkit::Visual::IMAGE );
backgroundImage.Insert( Toolkit::ImageVisual::Property::URL, BACKGROUND_IMAGE );
- backgroundImage.Insert( Toolkit::ImageVisual::Property::DESIRED_WIDTH, stage.GetSize().width );
- backgroundImage.Insert( Toolkit::ImageVisual::Property::DESIRED_HEIGHT, stage.GetSize().height );
+ backgroundImage.Insert( Toolkit::ImageVisual::Property::DESIRED_WIDTH, windowSize.width );
+ backgroundImage.Insert( Toolkit::ImageVisual::Property::DESIRED_HEIGHT, windowSize.height );
backgroundImage.Insert( Toolkit::ImageVisual::Property::FITTING_MODE, FittingMode::SCALE_TO_FILL );
backgroundImage.Insert( Toolkit::ImageVisual::Property::SAMPLING_MODE, SamplingMode::BOX_THEN_NEAREST );
Toolkit::ImageView background = Toolkit::ImageView::New();
background.SetProperty( Toolkit::ImageView::Property::IMAGE, backgroundImage );
background.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
- background.SetProperty( Actor::Property::SIZE, stage.GetSize() );
- stage.Add( background );
+ background.SetProperty( Actor::Property::SIZE, windowSize );
+ window.Add( background );
mDesiredBox = Toolkit::ImageView::New( BORDER_IMAGE );
background.Add( mDesiredBox );
- mDesiredBox.SetProperty( Actor::Property::SIZE, stage.GetSize() * mImageStageScale );
+ mDesiredBox.SetProperty( Actor::Property::SIZE, windowSize * mImageWindowScale );
mDesiredBox.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
mDesiredBox.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
mImageView.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
mImageView.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
- // Display the actor on the stage
+ // Display the actor on the window
mDesiredBox.Add( mImageView );
- mImageView.SetProperty( Actor::Property::SIZE, stage.GetSize() * mImageStageScale );
+ mImageView.SetProperty( Actor::Property::SIZE, windowSize * mImageWindowScale );
// Setup the pinch detector for scaling the desired image load dimensions:
mPinchDetector = PinchGestureDetector::New();
mPanGestureDetector.DetectedSignal().Connect( this, &ImageScalingAndFilteringController::OnPan );
// Tie-in input event handlers:
- stage.KeyEventSignal().Connect( this, &ImageScalingAndFilteringController::OnKeyEvent );
+ window.KeyEventSignal().Connect( this, &ImageScalingAndFilteringController::OnKeyEvent );
CreateControls();
*/
void CreateControls()
{
- Stage stage = Stage::GetCurrent();
+ Window window = mApplication.GetWindow();
+ Vector2 windowSize = window.GetSize();
Dali::Layer controlsLayer = Dali::Layer::New();
controlsLayer.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS );
controlsLayer.SetProperty( Actor::Property::SIZE_MODE_FACTOR, Vector3( 1.0f, 1.0f, 1.0f ) );
controlsLayer.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
controlsLayer.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
- stage.Add( controlsLayer );
+ window.Add( controlsLayer );
- // Back and next image buttons in corners of stage:
- unsigned int playWidth = std::min( stage.GetSize().x * (1 / 5.0f), 58.0f );
+ // Back and next image buttons in corners of window:
+ unsigned int playWidth = std::min( windowSize.x * (1 / 5.0f), 58.0f );
Toolkit::ImageView imagePrevious = Toolkit::ImageView::New( DALI_ICON_PLAY, ImageDimensions( playWidth, playWidth ) );
// Last image button:
Toolkit::ImageView imageNext = Toolkit::ImageView::New( DALI_ICON_PLAY, ImageDimensions( playWidth, playWidth ) );
imageNext.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_RIGHT );
imageNext.SetProperty( Actor::Property::POSITION_Y, playWidth * 0.5f );
- imageNext.SetProperty( Actor::Property::POSITION_X, stage.GetSize().x - playWidth * 0.5f );
+ imageNext.SetProperty( Actor::Property::POSITION_X, windowSize.x - playWidth * 0.5f );
imageNext.SetProperty( Actor::Property::OPACITY, 0.6f );
controlsLayer.Add( imageNext );
imageNext.SetProperty( Dali::Actor::Property::NAME, NEXT_BUTTON_ID );
Toolkit::Popup CreatePopup()
{
- Stage stage = Stage::GetCurrent();
- const float POPUP_WIDTH_DP = stage.GetSize().width * 0.75f;
+ Window window = mApplication.GetWindow();
+ const float POPUP_WIDTH_DP = window.GetSize().GetWidth() * 0.75f;
Toolkit::Popup popup = Toolkit::Popup::New();
popup.SetProperty( Dali::Actor::Property::NAME, "POPUP" );
CreatePopupButton( fittingModes, StringFromScalingMode( FittingMode::FIT_HEIGHT ) );
mPopup.SetContent( fittingModes );
- Stage::GetCurrent().Add( mPopup );
+ mApplication.GetWindow().Add( mPopup );
mPopup.SetDisplayState( Toolkit::Popup::SHOWN );
}
else if( button.GetProperty< std::string >( Dali::Actor::Property::NAME ) == SAMPLING_BUTTON_ID )
CreatePopupButton( samplingModes, StringFromFilterMode( SamplingMode::NO_FILTER ) );
mPopup.SetContent( samplingModes );
- Stage::GetCurrent().Add( mPopup );
+ mApplication.GetWindow().Add( mPopup );
mPopup.SetDisplayState( Toolkit::Popup::SHOWN );
}
else if( CheckFittingModeButton( button, FittingMode::SCALE_TO_FILL) ||
{
if ( scale < mLastPinchScale )
{
- mImageStageScale.x = std::max( 0.05f, mImageStageScale.x * 0.9f );
- mImageStageScale.y = std::max( 0.05f, mImageStageScale.y * 0.9f );
+ mImageWindowScale.x = std::max( 0.05f, mImageWindowScale.x * 0.9f );
+ mImageWindowScale.y = std::max( 0.05f, mImageWindowScale.y * 0.9f );
}
else
{
- mImageStageScale.x = std::max( 0.05f, std::min( 1.0f, mImageStageScale.x * 1.1f ) );
- mImageStageScale.y = std::max( 0.05f, std::min( 1.0f, mImageStageScale.y * 1.1f ) );
+ mImageWindowScale.x = std::max( 0.05f, std::min( 1.0f, mImageWindowScale.x * 1.1f ) );
+ mImageWindowScale.y = std::max( 0.05f, std::min( 1.0f, mImageWindowScale.y * 1.1f ) );
}
ResizeImage();
}
void OnPan( Actor actor, const PanGesture& gesture )
{
- Stage stage = Stage::GetCurrent();
- // 1.0f and 0.75f are the maximum size caps of the resized image, as a factor of stage-size.
- mImageStageScale.x = std::max( 0.05f, std::min( 0.95f, mImageStageScale.x + ( gesture.displacement.x * 2.0f / stage.GetSize().width ) ) );
- mImageStageScale.y = std::max( 0.05f, std::min( 0.70f, mImageStageScale.y + ( gesture.displacement.y * 2.0f / stage.GetSize().height ) ) );
+ Window window = mApplication.GetWindow();
+ Vector2 windowSize = window.GetSize();
+ // 1.0f and 0.75f are the maximum size caps of the resized image, as a factor of window-size.
+ mImageWindowScale.x = std::max( 0.05f, std::min( 0.95f, mImageWindowScale.x + ( gesture.displacement.x * 2.0f / windowSize.width ) ) );
+ mImageWindowScale.y = std::max( 0.05f, std::min( 0.70f, mImageWindowScale.y + ( gesture.displacement.y * 2.0f / windowSize.height ) ) );
ResizeImage();
}
}
else if ( event.keyPressedName == "Right" )
{
- mImageStageScale.x = std::max( 0.05f, std::min( 1.0f, mImageStageScale.x * 1.1f ) );
+ mImageWindowScale.x = std::max( 0.05f, std::min( 1.0f, mImageWindowScale.x * 1.1f ) );
}
else if ( event.keyPressedName == "Left" )
{
- mImageStageScale.x = std::max( 0.05f, mImageStageScale.x * 0.9f );
+ mImageWindowScale.x = std::max( 0.05f, mImageWindowScale.x * 0.9f );
}
else if ( event.keyPressedName == "Up" )
{
- mImageStageScale.y = std::max( 0.05f, std::min( 1.0f, mImageStageScale.y * 1.1f ) );
+ mImageWindowScale.y = std::max( 0.05f, std::min( 1.0f, mImageWindowScale.y * 1.1f ) );
}
else if ( event.keyPressedName == "Down" )
{
- mImageStageScale.y = std::max( 0.05f, mImageStageScale.y * 0.9f );
+ mImageWindowScale.y = std::max( 0.05f, mImageWindowScale.y * 0.9f );
}
else if ( event.keyPressedName == "o" )
{
- mImageStageScale.x = std::max( 0.05f, mImageStageScale.x * 0.9f );
- mImageStageScale.y = std::max( 0.05f, mImageStageScale.y * 0.9f );
+ mImageWindowScale.x = std::max( 0.05f, mImageWindowScale.x * 0.9f );
+ mImageWindowScale.y = std::max( 0.05f, mImageWindowScale.y * 0.9f );
}
else if ( event.keyPressedName == "p" )
{
- mImageStageScale.x = std::max( 0.05f, std::min( 1.0f, mImageStageScale.x * 1.1f ) );
- mImageStageScale.y = std::max( 0.05f, std::min( 1.0f, mImageStageScale.y * 1.1f ) );
+ mImageWindowScale.x = std::max( 0.05f, std::min( 1.0f, mImageWindowScale.x * 1.1f ) );
+ mImageWindowScale.y = std::max( 0.05f, std::min( 1.0f, mImageWindowScale.y * 1.1f ) );
}
else if ( event.keyPressedName == "n" )
{
mImageLoading = true;
const char * const path = IMAGE_PATHS[ mCurrentPath ];
- Stage stage = Stage::GetCurrent();
- Size imageSize = stage.GetSize() * mImageStageScale;
+ Window window = mApplication.GetWindow();
+ Size imageSize = Vector2(window.GetSize()) * mImageWindowScale;
mImageView.SetProperty( Actor::Property::SIZE, imageSize );
Property::Map map;
void ResizeImage()
{
- Stage stage = Stage::GetCurrent();
- Size imageSize = stage.GetSize() * mImageStageScale;
+ Window window = mApplication.GetWindow();
+ Vector2 windowSize = window.GetSize();
+ Size imageSize = windowSize * mImageWindowScale;
LoadImage();
// Border size needs to be modified to take into account the width of the frame.
- Vector2 borderScale( ( imageSize + Vector2( BORDER_WIDTH * 2.0f, BORDER_WIDTH * 2.0f ) ) / stage.GetSize() );
- mDesiredBox.SetProperty( Actor::Property::SIZE, stage.GetSize() * borderScale );
+ Vector2 borderScale( ( imageSize + Vector2( BORDER_WIDTH * 2.0f, BORDER_WIDTH * 2.0f ) ) / windowSize );
+ mDesiredBox.SetProperty( Actor::Property::SIZE, windowSize * borderScale );
}
private:
Toolkit::ImageView mGrabCorner;
PanGestureDetector mPanGestureDetector;
Toolkit::ImageView mImageView;
- Vector2 mImageStageScale;
+ Vector2 mImageWindowScale;
int mCurrentPath;
FittingMode::Type mFittingMode;
SamplingMode::Type mSamplingMode;
void ResourceReadySignal( Toolkit::Control control )
{
mImagesLoaded++;
- // To allow fast startup, we only place a small number of ImageViews on stage first
+ // To allow fast startup, we only place a small number of ImageViews on window first
if ( mImagesLoaded == INITIAL_IMAGES_TO_LOAD )
{
- // Adding the ImageViews to the stage will trigger loading of the Images
- mGridActor.Add( mOffStageImageViews );
+ // Adding the ImageViews to the window will trigger loading of the Images
+ mGridActor.Add( mOffWindowImageViews );
}
}
{
std::cout << "ImageScalingIrregularGridController::Create" << std::endl;
- // Get a handle to the stage:
- Stage stage = Stage::GetCurrent();
+ // Get a handle to the window:
+ Window window = application.GetWindow();
// Connect to input event signals:
- stage.KeyEventSignal().Connect(this, &ImageScalingIrregularGridController::OnKeyEvent);
+ window.KeyEventSignal().Connect(this, &ImageScalingIrregularGridController::OnKeyEvent);
// Create a default view with a default tool bar:
mContentLayer = DemoHelper::CreateView( mApplication,
SetTitle( APPLICATION_TITLE );
- mOffStageImageViews = Actor::New();
- mOffStageImageViews.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
- mOffStageImageViews.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::CENTER);
- mOffStageImageViews.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
+ mOffWindowImageViews = Actor::New();
+ mOffWindowImageViews.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
+ mOffWindowImageViews.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::CENTER);
+ mOffWindowImageViews.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
// Build the main content of the widow:
PopulateContentLayer( DEFAULT_SCALING_MODE );
*/
void PopulateContentLayer( const Dali::FittingMode::Type fittingMode )
{
- Stage stage = Stage::GetCurrent();
- Vector2 stageSize = stage.GetSize();
+ Window window = mApplication.GetWindow();
+ Vector2 windowSize = window.GetSize();
float fieldHeight;
- Actor imageField = BuildImageField( stageSize.x, GRID_WIDTH, GRID_MAX_HEIGHT, fittingMode, fieldHeight );
+ Actor imageField = BuildImageField( windowSize.x, GRID_WIDTH, GRID_MAX_HEIGHT, fittingMode, fieldHeight );
mScrollView = ScrollView::New();
// Restrict scrolling to mostly vertical only, but with some horizontal wiggle-room:
- RulerPtr rulerX = new FixedRuler( stageSize.width ); //< Pull the view back to the grid's centre-line when touch is release using a snapping ruler.
- rulerX->SetDomain( RulerDomain( stageSize.width * -0.125f, stageSize.width * 1.125f ) ); //< Scroll slightly left/right of image field.
+ RulerPtr rulerX = new FixedRuler( windowSize.width ); //< Pull the view back to the grid's centre-line when touch is release using a snapping ruler.
+ rulerX->SetDomain( RulerDomain( windowSize.width * -0.125f, windowSize.width * 1.125f ) ); //< Scroll slightly left/right of image field.
mScrollView.SetRulerX ( rulerX );
- RulerPtr rulerY = new DefaultRuler(); //< Snap in multiples of a screen / stage height
- rulerY->SetDomain( RulerDomain( - fieldHeight * 0.5f + stageSize.height * 0.5f - GRID_CELL_PADDING, fieldHeight * 0.5f + stageSize.height * 0.5f + GRID_CELL_PADDING ) );
+ RulerPtr rulerY = new DefaultRuler(); //< Snap in multiples of a screen / window height
+ rulerY->SetDomain( RulerDomain( - fieldHeight * 0.5f + windowSize.height * 0.5f - GRID_CELL_PADDING, fieldHeight * 0.5f + windowSize.height * 0.5f + GRID_CELL_PADDING ) );
mScrollView.SetRulerY ( rulerY );
mContentLayer.Add( mScrollView );
}
else
{
- // Store the ImageView in an offstage actor until the inital batch of ImageViews have finished loading their images
+ // Store the ImageView in an offwindow actor until the inital batch of ImageViews have finished loading their images
// Required
- mOffStageImageViews.Add( image );
+ mOffWindowImageViews.Add( image );
}
}
Toolkit::ToolBar mToolBar; ///< The View's Toolbar.
TextLabel mTitleActor; ///< The Toolbar's Title.
Actor mGridActor; ///< The container for the grid of images
- Actor mOffStageImageViews; ///< ImageViews held off stage until the inital batch have loaded their images
+ Actor mOffWindowImageViews; ///< ImageViews held off window until the inital batch have loaded their images
ScrollView mScrollView; ///< ScrollView UI Component
ScrollBar mScrollBarVertical;
ScrollBar mScrollBarHorizontal;
/*
- * Copyright (c) 2018 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.
// The Init signal is received once (only) during the Application lifetime
void Create( Application& application )
{
- // Get a handle to the stage
- Stage stage = Stage::GetCurrent();
- stage.KeyEventSignal().Connect(this, &ImageViewAlphaBlendApp::OnKeyEvent);
+ // Get a handle to the window
+ Window window = application.GetWindow();
+ window.KeyEventSignal().Connect(this, &ImageViewAlphaBlendApp::OnKeyEvent);
auto green0 = Vector4( 0.f, 1.f, 0.f, 0.25f );
auto green1 = Vector4( 0.f, 0.25f, 0.f, 0.25f );
imageView0.SetProperty( Actor::Property::SIZE, Vector2(imageSize, imageSize) );
imageView0.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
imageView0.SetProperty( Actor::Property::POSITION_Y, -imageSize*0.5f );
- stage.Add(imageView0);
+ window.Add(imageView0);
Toolkit::ImageView imageView1 = CreateImageView( redGreen0 );
imageView1.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
imageView1.SetProperty( Actor::Property::SIZE, Vector2(imageSize, imageSize) );
imageView2.SetProperty( Actor::Property::SIZE, Vector2(imageSize, imageSize) );
imageView2.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
imageView2.SetProperty( Actor::Property::POSITION_Y, imageSize*0.5f );
- stage.Add(imageView2);
+ window.Add(imageView2);
Toolkit::ImageView imageView3 = CreateImageView( redGreen1);
imageView3.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
imageView3.SetProperty( Actor::Property::SIZE, Vector2(imageSize, imageSize) );
/*
- * 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.
// The Init signal is received once (only) during the Application lifetime
void Create( Application& application )
{
- // Get a handle to the stage
- Stage stage = Stage::GetCurrent();
- stage.KeyEventSignal().Connect(this, &ImageViewPixelAreaApp::OnKeyEvent);
+ // Get a handle to the window
+ Window window = application.GetWindow();
+ window.KeyEventSignal().Connect(this, &ImageViewPixelAreaApp::OnKeyEvent);
Toolkit::ToolBar toolBar;
Toolkit::Control background;
// The Init signal is received once (only) during the Application lifetime
void Create( Application& application )
{
- // Get a handle to the stage
- Stage stage = Stage::GetCurrent();
- stage.SetBackgroundColor( Color::WHITE );
- Vector2 stageSize = stage.GetSize();
- mActorSize = stageSize/2.f;
+ // Get a handle to the window
+ Window window = application.GetWindow();
+ window.SetBackgroundColor( Color::WHITE );
+ Vector2 windowSize = window.GetSize();
+ mActorSize = windowSize/2.f;
- stage.KeyEventSignal().Connect(this, &ImageSvgController::OnKeyEvent);
+ window.KeyEventSignal().Connect(this, &ImageSvgController::OnKeyEvent);
// Background, for receiving gestures
- mStageBackground = Actor::New();
- mStageBackground.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_CENTER );
- mStageBackground.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_CENTER );
- mStageBackground.SetProperty( Actor::Property::SIZE, Vector2( stageSize.x, stageSize.y ) );
- stage.Add(mStageBackground);
+ mWindowBackground = Actor::New();
+ mWindowBackground.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_CENTER );
+ mWindowBackground.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_CENTER );
+ mWindowBackground.SetProperty( Actor::Property::SIZE, Vector2( windowSize.x, windowSize.y ) );
+ window.Add(mWindowBackground);
// Push button, for changing the image set for displaying
Toolkit::PushButton changeButton = Toolkit::PushButton::New();
changeButton.SetProperty( Toolkit::Button::Property::LABEL, "Next" );
changeButton.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_RIGHT );
changeButton.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_RIGHT );
- stage.Add( changeButton );
+ window.Add( changeButton );
changeButton.ClickedSignal().Connect( this, &ImageSvgController::OnChangeButtonClicked );
// Push button, for resetting the actor size and position
resetButton.SetProperty( Toolkit::Button::Property::LABEL, "Reset" );
resetButton.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
resetButton.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
- stage.Add( resetButton );
+ window.Add( resetButton );
resetButton.ClickedSignal().Connect( this, &ImageSvgController::OnResetButtonClicked );
- // Create and put imageViews to stage
+ // Create and put imageViews to window
for( unsigned int i = 0; i < NUM_IMAGES_DISPLAYED; i++ )
{
mSvgActor[i] = Toolkit::ImageView::New(SVG_IMAGES[mIndex+i]);
mSvgActor[i].SetProperty( Actor::Property::SIZE, mActorSize );
- mSvgActor[i].TranslateBy( Vector3( 0.0, stageSize.height * 0.05, 0.0f ) );
- stage.Add( mSvgActor[i] );
+ mSvgActor[i].TranslateBy( Vector3( 0.0, windowSize.height * 0.05, 0.0f ) );
+ window.Add( mSvgActor[i] );
}
mSvgActor[0].SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
mSvgActor[0].SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT );
// Connect pan gesture for moving the actors
mPanGestureDetector = PanGestureDetector::New();
mPanGestureDetector.DetectedSignal().Connect( this, &ImageSvgController::OnPanGesture );
- mPanGestureDetector.Attach( mStageBackground );
+ mPanGestureDetector.Attach( mWindowBackground );
// Connect pinch gesture for resizing the actors
mPinchGestureDetector = PinchGestureDetector::New();
- mPinchGestureDetector.Attach( mStageBackground);
+ mPinchGestureDetector.Attach( mWindowBackground);
mPinchGestureDetector.DetectedSignal().Connect(this, &ImageSvgController::OnPinch);
changeButton.RaiseToTop();
private:
Application& mApplication;
- Actor mStageBackground;
+ Actor mWindowBackground;
PanGestureDetector mPanGestureDetector;
PinchGestureDetector mPinchGestureDetector;
/*
- * 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.
// The Init signal is received once (only) during the Application lifetime
void Create( Application& application )
{
- // Get a handle to the stage
- Stage stage = Stage::GetCurrent();
- stage.KeyEventSignal().Connect(this, &ImageViewUrlApp::OnKeyEvent);
+ // Get a handle to the window
+ Window window = application.GetWindow();
+ window.KeyEventSignal().Connect(this, &ImageViewUrlApp::OnKeyEvent);
Toolkit::ToolBar toolBar;
Toolkit::Control background;
void CreateRenderTask( const std::string& url )
{
- auto rootActor = Stage::GetCurrent().GetRootLayer();
+ auto rootActor = mApplication.GetWindow().GetRootLayer();
auto cameraActor = CameraActor::New(TARGET_SIZE);
cameraActor.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::CENTER);
rootActor.Add(mActorForInput);
- RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList();
+ RenderTaskList taskList = mApplication.GetWindow().GetRenderTaskList();
// perform a horizontal blur targeting the internal buffer
auto renderTask = taskList.CreateTask();
const unsigned int NUMBER_OF_RESOURCES = sizeof(IMAGE_PATH) / sizeof(char*);
std::string EXAMPLE_INSTRUCTIONS = "Instructions: Change button cycles through different image visuals, "
- "on/off takes the ImageView and it's current visual on or off stage.";
+ "on/off takes the ImageView and it's current visual on or off window.";
const float CORNER_RADIUS_VALUE( 20.0f );
// The Init signal is received once (only) during the Application lifetime
// Creates a default view with a default tool bar.
- // The view is added to the stage.
+ // The view is added to the window.
mContentLayer = DemoHelper::CreateView( application,
mView,
mToolBar,
button.SetProperty( Toolkit::Button::Property::LABEL, "on/off" );
button.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_CENTER );
button.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_CENTER );
- button.ClickedSignal().Connect( this, &ImageViewController::ToggleImageOnStage );
+ button.ClickedSignal().Connect( this, &ImageViewController::ToggleImageOnWindow );
button.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
button.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );
std::string s = std::to_string(x);
mImageViewRoundedCornerStatus[x] = false;
}
- Stage::GetCurrent().KeyEventSignal().Connect(this, &ImageViewController::OnKeyEvent);
+ application.GetWindow().KeyEventSignal().Connect(this, &ImageViewController::OnKeyEvent);
}
private:
visual.Reset();
}
- bool ToggleImageOnStage( Toolkit::Button button )
+ bool ToggleImageOnWindow( Toolkit::Button button )
{
unsigned int buttonIndex = GetButtonIndex( button );
/*
- * 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.
*/
void OnInit(Application& app)
{
- Stage stage = Dali::Stage::GetCurrent();
- stage.KeyEventSignal().Connect(this, &ItemViewExample::OnKeyEvent);
- stage.GetRootLayer().SetProperty( Layer::Property::BEHAVIOR, Layer::LAYER_3D );
+ Window window = app.GetWindow();
+ window.KeyEventSignal().Connect(this, &ItemViewExample::OnKeyEvent);
+ window.GetRootLayer().SetProperty( Layer::Property::BEHAVIOR, Layer::LAYER_3D );
- Vector2 stageSize = Stage::GetCurrent().GetSize();
+ Vector2 windowSize = window.GetSize();
// Creates a default view with a default tool bar.
- // The view is added to the stage.
+ // The view is added to the window.
Layer contents = DemoHelper::CreateView( mApplication,
mView,
mDeleteButton.SetProperty( Toolkit::Button::Property::UNSELECTED_BACKGROUND_VISUAL, DELETE_IMAGE );
mDeleteButton.SetProperty( Toolkit::Button::Property::SELECTED_BACKGROUND_VISUAL, DELETE_IMAGE_SELECTED );
mDeleteButton.SetProperty( Toolkit::Control::Property::BACKGROUND, TOOLBAR_IMAGE );
- mDeleteButton.SetProperty( Actor::Property::SIZE, Vector2( stageSize.width * 0.15f, stageSize.width * 0.15f ) );
+ mDeleteButton.SetProperty( Actor::Property::SIZE, Vector2( windowSize.width * 0.15f, windowSize.width * 0.15f ) );
mDeleteButton.ClickedSignal().Connect( this, &ItemViewExample::OnDeleteButtonClicked);
mDeleteButton.SetProperty( Actor::Property::LEAVE_REQUIRED, true );
mDeleteButton.SetProperty( Actor::Property::VISIBLE, false );
- stage.Add( mDeleteButton );
+ window.Add( mDeleteButton );
// Create an insert button (bottom right of screen)
mInsertButton = Toolkit::PushButton::New();
mInsertButton.SetProperty( Toolkit::Button::Property::UNSELECTED_BACKGROUND_VISUAL, INSERT_IMAGE );
mInsertButton.SetProperty( Toolkit::Button::Property::SELECTED_BACKGROUND_VISUAL, INSERT_IMAGE_SELECTED );
mInsertButton.SetProperty( Toolkit::Control::Property::BACKGROUND, TOOLBAR_IMAGE );
- mInsertButton.SetProperty( Actor::Property::SIZE, Vector2( stageSize.width * 0.15f, stageSize.width * 0.15f ) );
+ mInsertButton.SetProperty( Actor::Property::SIZE, Vector2( windowSize.width * 0.15f, windowSize.width * 0.15f ) );
mInsertButton.ClickedSignal().Connect( this, &ItemViewExample::OnInsertButtonClicked);
mInsertButton.SetProperty( Actor::Property::LEAVE_REQUIRED, true );
mInsertButton.SetProperty( Actor::Property::VISIBLE, false );
- stage.Add( mInsertButton );
+ window.Add( mInsertButton );
// Create an replace button (bottom right of screen)
mReplaceButton = Toolkit::PushButton::New();
mReplaceButton.SetProperty( Toolkit::Button::Property::UNSELECTED_BACKGROUND_VISUAL, REPLACE_IMAGE );
mReplaceButton.SetProperty( Toolkit::Button::Property::SELECTED_BACKGROUND_VISUAL, REPLACE_IMAGE_SELECTED );
mReplaceButton.SetProperty( Toolkit::Control::Property::BACKGROUND, TOOLBAR_IMAGE );
- mReplaceButton.SetProperty( Actor::Property::SIZE, Vector2( stageSize.width * 0.15f, stageSize.width * 0.15f ) );
+ mReplaceButton.SetProperty( Actor::Property::SIZE, Vector2( windowSize.width * 0.15f, windowSize.width * 0.15f ) );
mReplaceButton.ClickedSignal().Connect( this, &ItemViewExample::OnReplaceButtonClicked);
mReplaceButton.SetProperty( Actor::Property::LEAVE_REQUIRED, true );
mReplaceButton.SetProperty( Actor::Property::VISIBLE, false );
- stage.Add( mReplaceButton );
+ window.Add( mReplaceButton );
// Create the item view actor
mItemView = ItemView::New(*this);
mItemView.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::CENTER);
mItemView.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::CENTER);
- // Display item view on the stage
- stage.Add( mItemView );
- stage.GetRootLayer().SetProperty( Layer::Property::BEHAVIOR, Layer::LAYER_3D );
+ // Display item view on the window
+ window.Add( mItemView );
+ window.GetRootLayer().SetProperty( Layer::Property::BEHAVIOR, Layer::LAYER_3D );
// Create the layouts
mSpiralLayout = DefaultItemLayout::New( DefaultItemLayout::SPIRAL );
*/
void SetLayout( int layoutId )
{
- Stage stage = Dali::Stage::GetCurrent();
+ Window window = mApplication.GetWindow();
switch( mCurrentLayout )
{
case SPIRAL_LAYOUT:
case DEPTH_LAYOUT:
{
- stage.GetRootLayer().SetProperty( Layer::Property::BEHAVIOR, Layer::LAYER_3D );
+ window.GetRootLayer().SetProperty( Layer::Property::BEHAVIOR, Layer::LAYER_3D );
break;
}
case GRID_LAYOUT:
{
- stage.GetRootLayer().SetProperty( Layer::Property::BEHAVIOR, Layer::LAYER_UI );
+ window.GetRootLayer().SetProperty( Layer::Property::BEHAVIOR, Layer::LAYER_UI );
break;
}
}
// Set the new orientation to the layout
mItemView.GetLayout(layoutId)->SetOrientation(static_cast<ControlOrientation::Type>(mOrientation / 90));
- Vector2 stageSize = Stage::GetCurrent().GetSize();
+ Vector2 windowSize = window.GetSize();
if(layoutId == DEPTH_LAYOUT)
{
// Set up the depth layout according to the new orientation
if(Toolkit::IsVertical(mDepthLayout->GetOrientation()))
{
- mDepthLayout->SetItemSize( DepthLayoutItemSizeFunctionPortrait( stageSize.width ) );
+ mDepthLayout->SetItemSize( DepthLayoutItemSizeFunctionPortrait( windowSize.width ) );
}
else
{
- mDepthLayout->SetItemSize( DepthLayoutItemSizeFunctionLandscape( stageSize.height ) );
+ mDepthLayout->SetItemSize( DepthLayoutItemSizeFunctionLandscape( windowSize.height ) );
}
}
mItemView.SetAnchoring(layoutId == DEPTH_LAYOUT);
// Activate the layout
- mItemView.ActivateLayout( layoutId, Vector3(stageSize.x, stageSize.y, stageSize.x), 0.0f );
+ mItemView.ActivateLayout( layoutId, Vector3(windowSize.x, windowSize.y, windowSize.x), 0.0f );
}
bool OnLayoutButtonClicked( Toolkit::Button button )
{
case Gesture::Started:
{
- const Size& size = Stage::GetCurrent().GetSize();
+ const Size& size = mApplication.GetWindow().GetSize();
ItemRange range( 0u, 0u );
mItemView.GetItemsRange( range );
actor.SetProperty( Actor::Property::KEYBOARD_FOCUSABLE, true );
Vector3 spiralItemSize;
- static_cast<ItemLayout&>(*mSpiralLayout).GetItemSize( 0u, Vector3( Stage::GetCurrent().GetSize() ), spiralItemSize );
+ Vector2 windowSize = mApplication.GetWindow().GetSize();
+ static_cast<ItemLayout&>(*mSpiralLayout).GetItemSize( 0u, Vector3( windowSize ), spiralItemSize );
// Add a checkbox child actor; invisible until edit-mode is enabled
ImageView checkbox = ImageView::New();
*/
ExampleController( Application& application )
: mApplication( application ),
- mStageSize(),
+ mWindowSize(),
mShader(),
mGeometry(),
mRenderer(),
*/
void Create( Application& application )
{
- Stage stage = Stage::GetCurrent();
+ Window window = application.GetWindow();
// initial settings
mPrimitiveType = Geometry::LINES;
CreateRadioButtons();
- stage.KeyEventSignal().Connect(this, &ExampleController::OnKeyEvent);
+ window.KeyEventSignal().Connect(this, &ExampleController::OnKeyEvent);
- mStageSize = stage.GetSize();
+ mWindowSize = window.GetSize();
Initialise();
- stage.SetBackgroundColor(Vector4(0.0f, 0.2f, 0.2f, 1.0f));
+ window.SetBackgroundColor(Vector4(0.0f, 0.2f, 0.2f, 1.0f));
}
/**
*/
void Initialise()
{
- Stage stage = Stage::GetCurrent();
+ Window window = mApplication.GetWindow();
// destroy mesh actor and its resources if already exists
if( mMeshActor )
{
- stage.Remove( mMeshActor );
+ window.Remove( mMeshActor );
mMeshActor.Reset();
}
mMeshActor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
mMeshActor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
- stage.Add( mMeshActor );
+ window.Add( mMeshActor );
Animation animation = Animation::New(5);
KeyFrames keyFrames = KeyFrames::New();
*/
void CreateRadioButtons()
{
- Stage stage = Stage::GetCurrent();
+ Window window = mApplication.GetWindow();
Toolkit::TableView modeSelectTableView = Toolkit::TableView::New( 4, 1 );
modeSelectTableView.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
elementCountTableView.AddChild( mIndicesCountLabel, Toolkit::TableView::CellPosition( 0, 1 ) );
elementCountTableView.AddChild( mPlusButton, Toolkit::TableView::CellPosition( 0, 2 ) );
- stage.Add(modeSelectTableView);
- stage.Add(elementCountTableView);
+ window.Add(modeSelectTableView);
+ window.Add(elementCountTableView);
}
/**
private:
Application& mApplication; ///< Application instance
- Vector3 mStageSize; ///< The size of the stage
+ Vector3 mWindowSize; ///< The size of the window
Shader mShader;
Geometry mGeometry;
const char* BACKGROUND_IMAGE( DEMO_IMAGE_DIR "background-magnifier.jpg" );
const char* TOOLBAR_IMAGE( DEMO_IMAGE_DIR "top-bar.png" );
const char* APPLICATION_TITLE( "Magnifier Example" );
-const Vector3 MAGNIFIER_SIZE(0.25f, 0.25f, 0.0f); ///< Magnifier sides should be 25% of the width of the stage
+const Vector3 MAGNIFIER_SIZE(0.25f, 0.25f, 0.0f); ///< Magnifier sides should be 25% of the width of the window
const float ANIMATION_DURATION(60.0f); ///< Run animation for a minute before repeating.
const float MAGNIFIER_DISPLAY_DURATION(0.125f); ///< Duration in seconds for show/hide manual magnifier animation
const float MAGNIFICATION_FACTOR(2.0f); ///< Amount to magnify by.
-const float MAGNIFIER_INDENT(10.0f); ///< Indentation around edge of stage to define where magnifiers may move.
+const float MAGNIFIER_INDENT(10.0f); ///< Indentation around edge of window to define where magnifiers may move.
const float FINGER_RADIUS_INCHES(0.25f); ///< Average finger radius in inches from the center of index finger to edge.
/**
* MagnifierPathConstraint
* This constraint governs the position of the
* animating magnifier in a swirly pattern around
- * the stage.
+ * the window.
*/
struct MagnifierPathConstraint
{
/**
* Constraint constructor
- * @param[in] stageSize The stage size so that the constraint can create a path
- * within stage bounds.
+ * @param[in] windowSize The window size so that the constraint can create a path
+ * within window bounds.
*/
- MagnifierPathConstraint(const Vector3& stageSize,
+ MagnifierPathConstraint(const Vector3& windowSize,
Vector3 offset = Vector3::ZERO)
- : mStageSize(stageSize),
+ : mWindowSize(windowSize),
mOffset(offset)
{
}
current = mOffset;
- Vector3 range( mStageSize - size - Vector3::ONE * MAGNIFIER_INDENT * 2.0f );
+ Vector3 range( mWindowSize - size - Vector3::ONE * MAGNIFIER_INDENT * 2.0f );
current.x += 0.5f * sinf(time * 0.471f) * range.width;
current.y += 0.5f * sinf(time * 0.8739f) * range.height;
}
- Vector3 mStageSize; ///< Keep track of the stage size for determining path within stage bounds
+ Vector3 mWindowSize; ///< Keep track of the window size for determining path within window bounds
Vector3 mOffset; ///< Amount to offset magnifier path
};
*/
void Create( Application& application )
{
- Stage::GetCurrent().KeyEventSignal().Connect(this, &ExampleController::OnKeyEvent);
-
- mStageSize = Stage::GetCurrent().GetSize();
+ Window window = application.GetWindow();
+ window.KeyEventSignal().Connect(this, &ExampleController::OnKeyEvent);
+ mWindowSize = window.GetSize();
// The Init signal is received once (only) during the Application lifetime
// Creates a default view with a default tool bar.
- // The view is added to the stage.
+ // The view is added to the window.
Toolkit::ToolBar toolBar;
mContent = DemoHelper::CreateView( application,
mView,
Layer overlay = Layer::New();
overlay.SetProperty( Actor::Property::SENSITIVE,false);
overlay.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
- overlay.SetProperty( Actor::Property::SIZE, mStageSize);
- Stage::GetCurrent().Add(overlay);
+ overlay.SetProperty( Actor::Property::SIZE, mWindowSize);
+ window.Add(overlay);
mMagnifier = Toolkit::Magnifier::New();
mMagnifier.SetSourceActor( mView );
- mMagnifier.SetProperty( Actor::Property::SIZE, MAGNIFIER_SIZE * mStageSize.width ); // Size of magnifier is in relation to stage width
+ mMagnifier.SetProperty( Actor::Property::SIZE, MAGNIFIER_SIZE * mWindowSize.width ); // Size of magnifier is in relation to window width
mMagnifier.SetProperty( Toolkit::Magnifier::Property::MAGNIFICATION_FACTOR, MAGNIFICATION_FACTOR );
mMagnifier.SetProperty( Actor::Property::SCALE,Vector3::ZERO);
overlay.Add( mMagnifier );
// Create bouncing magnifier automatically bounces around screen.
mBouncingMagnifier = Toolkit::Magnifier::New();
mBouncingMagnifier.SetSourceActor( mView );
- mBouncingMagnifier.SetProperty( Actor::Property::SIZE, MAGNIFIER_SIZE * mStageSize.width ); // Size of magnifier is in relation to stage width
+ mBouncingMagnifier.SetProperty( Actor::Property::SIZE, MAGNIFIER_SIZE * mWindowSize.width ); // Size of magnifier is in relation to window width
mBouncingMagnifier.SetProperty( Toolkit::Magnifier::Property::MAGNIFICATION_FACTOR, MAGNIFICATION_FACTOR );
overlay.Add( mBouncingMagnifier );
ContinueAnimation();
// Apply constraint to animate the position of the magnifier.
- constraint = Constraint::New<Vector3>( mBouncingMagnifier, Actor::Property::POSITION, MagnifierPathConstraint(mStageSize, mStageSize * 0.5f) );
+ constraint = Constraint::New<Vector3>( mBouncingMagnifier, Actor::Property::POSITION, MagnifierPathConstraint(mWindowSize, mWindowSize * 0.5f) );
constraint.AddSource( LocalSource(Actor::Property::SIZE) );
constraint.AddSource( LocalSource(mAnimationTimeProperty) );
constraint.Apply();
// Apply constraint to animate the source of the magnifier.
- constraint = Constraint::New<Vector3>( mBouncingMagnifier, Toolkit::Magnifier::Property::SOURCE_POSITION, MagnifierPathConstraint(mStageSize) );
+ constraint = Constraint::New<Vector3>( mBouncingMagnifier, Toolkit::Magnifier::Property::SOURCE_POSITION, MagnifierPathConstraint(mWindowSize) );
constraint.AddSource( LocalSource(Actor::Property::SIZE) );
constraint.AddSource( LocalSource(mAnimationTimeProperty) );
constraint.Apply();
Vector3 touchPoint( event.GetScreenPosition( 0 ) );
- SetMagnifierPosition(touchPoint - mStageSize * 0.5f);
+ SetMagnifierPosition(touchPoint - mWindowSize * 0.5f);
}
return false;
/**
* Manually sets the magnifier position
- * @param[in] position The magnifier's position relative to center of stage
+ * @param[in] position The magnifier's position relative to center of window
*/
void SetMagnifierPosition(const Vector3 position)
{
// position magnifier glass such that bottom edge is touching/near top of finger.
Vector3 glassPosition(position);
- glassPosition.y -= mStageSize.width * MAGNIFIER_SIZE.height * 0.5f + Stage::GetCurrent().GetDpi().height * FINGER_RADIUS_INCHES;
+ glassPosition.y -= mWindowSize.width * MAGNIFIER_SIZE.height * 0.5f + mApplication.GetWindow().GetDpi().GetHeight() * FINGER_RADIUS_INCHES;
mMagnifier.SetProperty( Actor::Property::POSITION, glassPosition );
}
Layer mContent; ///< The content layer
Toolkit::Magnifier mMagnifier; ///< The manually controlled magnifier
Toolkit::Magnifier mBouncingMagnifier; ///< The animating magnifier (swirly animation)
- Vector3 mStageSize; ///< The size of the stage
+ Vector3 mWindowSize; ///< The size of the window
float mAnimationTime; ///< Keep track of start animation time.
Property::Index mAnimationTimeProperty; ///< Animation time property (responsible for swirly animation)
bool mMagnifierShown; ///< Flag indicating whether the magnifier is being shown or not.
*/
void Create( Application& application )
{
- Stage stage = Stage::GetCurrent();
- stage.KeyEventSignal().Connect(this, &ExampleController::OnKeyEvent);
+ Window window = application.GetWindow();
+ window.KeyEventSignal().Connect(this, &ExampleController::OnKeyEvent);
- mStageSize = stage.GetSize();
+ mWindowSize = window.GetSize();
// The Init signal is received once (only) during the Application lifetime
mMeshActor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
mMeshActor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
- stage.Add( mMeshActor );
+ window.Add( mMeshActor );
Animation animation = Animation::New(10);
animation.AnimateTo( Property( mMeshActor, morphDeltaIndex ), 1.f, StationarySin );
animation.SetLooping( true );
animation.Play();
- stage.SetBackgroundColor(Vector4(0.0f, 0.2f, 0.2f, 1.0f));
+ window.SetBackgroundColor(Vector4(0.0f, 0.2f, 0.2f, 1.0f));
}
/**
private:
Application& mApplication; ///< Application instance
- Vector3 mStageSize; ///< The size of the stage
+ Vector3 mWindowSize; ///< The size of the window
Shader mShader;
Geometry mGeometry;
const int LIGHT_TAG = 1;
const int LAYER_TAG = 2;
-const Vector4 STAGE_COLOR( 211.0f / 255.0f, 211.0f / 255.0f, 211.0f / 255.0f, 1.0f ); ///< The color of the stage
+const Vector4 WINDOW_COLOR( 211.0f / 255.0f, 211.0f / 255.0f, 211.0f / 255.0f, 1.0f ); ///< The color of the window
} // unnamed namespace
// The Init signal is received once (only) during the Application lifetime
void Create( Application& application )
{
- // Get a handle to the stage
- Stage stage = Stage::GetCurrent();
- stage.SetBackgroundColor( STAGE_COLOR );
+ // Get a handle to the window
+ Window window = application.GetWindow();
+ window.SetBackgroundColor( WINDOW_COLOR );
//Set up root layer to receive touch gestures.
- Layer rootLayer = stage.GetRootLayer();
+ Layer rootLayer = window.GetRootLayer();
rootLayer.RegisterProperty( "Tag", LAYER_TAG ); //Used to differentiate between different kinds of actor.
rootLayer.TouchSignal().Connect( this, &MeshVisualController::OnTouch );
SetupLight( rootLayer );
//Allow for exiting of the application via key presses.
- stage.KeyEventSignal().Connect( this, &MeshVisualController::OnKeyEvent );
+ window.KeyEventSignal().Connect( this, &MeshVisualController::OnKeyEvent );
}
//Loads and adds the models to the scene, inside containers for hit detection.
mLightSource.RegisterProperty( "Tag", LIGHT_TAG );
//Set size of control based on screen dimensions.
- Stage stage = Stage::GetCurrent();
- if( stage.GetSize().width < stage.GetSize().height )
+ Window window = mApplication.GetWindow();
+ Vector2 windowSize = window.GetSize();
+ if( windowSize.width < windowSize.height )
{
//Scale to width.
mLightSource.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::WIDTH );
//Set position relative to top left, as the light source property is also relative to the top left.
mLightSource.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
mLightSource.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
- mLightSource.SetProperty( Actor::Property::POSITION, Vector2( Stage::GetCurrent().GetSize().x * 0.85f, Stage::GetCurrent().GetSize().y * 0.125 ));
+ mLightSource.SetProperty( Actor::Property::POSITION, Vector2( windowSize.width * 0.85f, windowSize.height * 0.125 ));
//Supply an image to represent the light.
SetLightImage();
}
}
- //Make the models use a fixed, invisible light above the center of the stage.
+ //Make the models use a fixed, invisible light above the center of the window.
void UseFixedLight()
{
//Hide draggable source
mLightSource.SetProperty( Actor::Property::VISIBLE, false );
- //Use stage dimensions to place light at center, offset in z axis.
- Stage stage = Stage::GetCurrent();
- float width = stage.GetSize().width;
- float height = stage.GetSize().height;
+ //Use window dimensions to place light at center, offset in z axis.
+ Window window = mApplication.GetWindow();
+ float width = window.GetSize().GetWidth();
+ float height = window.GetSize().GetHeight();
Vector3 lightPosition = Vector3( width / 2.0f, height / 2.0f,
( mLightFront ? 1 : -1 ) * std::max( width, height ) * 5.0f );
//Set light position to the x and y of the light control, offset into/out of the screen.
Vector3 controlPosition = mLightSource.GetCurrentProperty< Vector3 >( Actor::Property::POSITION );
Vector3 lightPosition = Vector3( controlPosition.x, controlPosition.y,
- ( mLightFront ? 1 : -1 ) * Stage::GetCurrent().GetSize().x / 2.0f );
+ ( mLightFront ? 1 : -1 ) * mApplication.GetWindow().GetSize().GetWidth() / 2.0f );
for( int i = 0; i < NUM_MESHES; ++i )
{
/*
- * Copyright (c) 2018 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.
void MetaballExplosionController::Create( Application& app )
{
- Stage stage = Stage::GetCurrent();
+ Window window = app.GetWindow();
- stage.KeyEventSignal().Connect( this, &MetaballExplosionController::OnKeyEvent );
+ window.KeyEventSignal().Connect( this, &MetaballExplosionController::OnKeyEvent );
- mScreenSize = stage.GetSize();
+ mScreenSize = window.GetSize();
mTimeMultiplier = 1.0f;
- stage.SetBackgroundColor(Color::BLACK);
+ window.SetBackgroundColor(Color::BLACK);
// Load background texture
mBackgroundTexture = DemoHelper::LoadTexture( BACKGROUND_IMAGE );
mTimerDispersion.TickSignal().Connect( this, &MetaballExplosionController::OnTimerDispersionTick );
// Connect the callback to the touch signal on the mesh actor
- stage.GetRootLayer().TouchSignal().Connect( this, &MetaballExplosionController::OnTouch );
+ window.GetRootLayer().TouchSignal().Connect( this, &MetaballExplosionController::OnTouch );
}
Geometry MetaballExplosionController::CreateGeometry( bool aspectMappedTexture )
void MetaballExplosionController::CreateMetaballImage()
{
// Create an FBO and a render task to create to render the metaballs with a fragment shader
- Stage stage = Stage::GetCurrent();
+ Window window = mApplication.GetWindow();
mMetaballFBO = FrameBuffer::New( mScreenSize.x, mScreenSize.y );
- stage.Add(mMetaballRoot);
+ window.Add(mMetaballRoot);
// Create the render task used to render the metaballs
- RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList();
+ RenderTaskList taskList = window.GetRenderTaskList();
RenderTask task = taskList.CreateTask();
task.SetRefreshRate( RenderTask::REFRESH_ALWAYS );
task.SetSourceActor( mMetaballRoot );
mCompositionActor.SetProperty( Actor::Property::SIZE, Vector2(mScreenSize.x, mScreenSize.y) );
- Stage stage = Stage::GetCurrent();
- stage.Add( mCompositionActor );
+ Window window = mApplication.GetWindow();
+ window.Add( mCompositionActor );
}
void MetaballExplosionController::CreateAnimations()
/*
- * Copyright (c) 2018 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.
void MetaballRefracController::Create( Application& app )
{
- Stage stage = Stage::GetCurrent();
+ Window window = app.GetWindow();
- stage.KeyEventSignal().Connect( this, &MetaballRefracController::OnKeyEvent );
+ window.KeyEventSignal().Connect( this, &MetaballRefracController::OnKeyEvent );
- mScreenSize = stage.GetSize();
+ mScreenSize = window.GetSize();
- stage.SetBackgroundColor(Color::BLACK);
+ window.SetBackgroundColor(Color::BLACK);
// Load background texture
mBackgroundTexture = DemoHelper::LoadTexture( BACKGROUND_IMAGE );
CreateAnimations();
// Connect the callback to the touch signal on the mesh actor
- stage.GetRootLayer().TouchSignal().Connect( this, &MetaballRefracController::OnTouch );
+ window.GetRootLayer().TouchSignal().Connect( this, &MetaballRefracController::OnTouch );
}
Geometry MetaballRefracController::CreateGeometry( bool aspectMappedTexture )
void MetaballRefracController::CreateMetaballImage()
{
// Create an FBO and a render task to create to render the metaballs with a fragment shader
- Stage stage = Stage::GetCurrent();
+ Window window = mApplication.GetWindow();
mMetaballFBO = FrameBuffer::New( mScreenSize.x, mScreenSize.y );
- stage.Add(mMetaballRoot);
+ window.Add(mMetaballRoot);
//Creation of the render task used to render the metaballs
- RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList();
+ RenderTaskList taskList = window.GetRenderTaskList();
RenderTask task = taskList.CreateTask();
task.SetRefreshRate( RenderTask::REFRESH_ALWAYS );
task.SetSourceActor( mMetaballRoot );
mRendererRefraction.SetTextures( mTextureSetNormal );
mCompositionActor.AddRenderer( mRendererRefraction );
- Stage stage = Stage::GetCurrent();
- stage.Add( mCompositionActor );
+ Window window = mApplication.GetWindow();
+ window.Add( mCompositionActor );
}
void MetaballRefracController::CreateAnimations()
/*
- * Copyright (c) 2017 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.
// The Init signal is received once (only) during the Application lifetime
void Create( Application& application )
{
- // Get a handle to the stage
- Stage stage = Stage::GetCurrent();
- Vector2 screenSize = stage.GetSize();
+ // Get a handle to the window
+ Window window = application.GetWindow();
+ Vector2 screenSize = window.GetSize();
//Add background
Toolkit::ImageView backView = Toolkit::ImageView::New( BACKGROUND_IMAGE );
backView.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
backView.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
- stage.Add( backView );
+ window.Add( backView );
mModelCounter = 0;
mButtonLayer.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
mButtonLayer.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
mButtonLayer.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
- stage.Add(mButtonLayer);
+ window.Add(mButtonLayer);
// Create button for model changing
Toolkit::PushButton editButton = Toolkit::PushButton::New();
mPlaying = true;
mScaled = false;
- // Respond to a click anywhere on the stage
- stage.KeyEventSignal().Connect(this, &Model3dViewController::OnKeyEvent);
+ // Respond to a click anywhere on the window
+ window.KeyEventSignal().Connect(this, &Model3dViewController::OnKeyEvent);
//Create a tap gesture detector for zoom
mTapDetector = TapGestureDetector::New( 2 );
}
else
{
- Stage stage = Stage::GetCurrent();
- Vector2 screenSize = stage.GetSize();
+ Window window = mApplication.GetWindow();
+ Vector2 screenSize = window.GetSize();
Vector2 position;
position.x = tap.screenPoint.x - screenSize.x * 0.5;
void OnInit(Application& app)
{
// The Init signal is received once (only) during the Application lifetime
+ Window window = app.GetWindow();
- Stage::GetCurrent().KeyEventSignal().Connect(this, &MotionBlurExampleApp::OnKeyEvent);
+ window.KeyEventSignal().Connect(this, &MotionBlurExampleApp::OnKeyEvent);
// Creates a default view with a default tool bar.
- // The view is added to the stage.
+ // The view is added to the window.
mContentLayer = DemoHelper::CreateView( mApplication,
mView,
mToolBar,
APPLICATION_TITLE );
// Ensure the content layer is a square so the touch area works in all orientations
- Vector2 stageSize = Stage::GetCurrent().GetSize();
- float size = std::max( stageSize.width, stageSize.height );
+ Vector2 windowSize = window.GetSize();
+ float size = std::max( windowSize.width, windowSize.height );
mContentLayer.SetProperty( Actor::Property::SIZE, Vector2( size, size ) );
//Add an effects icon on the right of the title
//
// Scale down actor to fit on very low resolution screens with space to interact:
- mMotionBlurActorSize = Size( std::min( stageSize.x * 0.3f, MOTION_BLUR_ACTOR_WIDTH ), std::min( stageSize.y * 0.3f, MOTION_BLUR_ACTOR_HEIGHT ) );
+ mMotionBlurActorSize = Size( std::min( windowSize.x * 0.3f, MOTION_BLUR_ACTOR_WIDTH ), std::min( windowSize.y * 0.3f, MOTION_BLUR_ACTOR_HEIGHT ) );
mMotionBlurActorUpdateSize = Size( std::max( mMotionBlurActorSize.x, mMotionBlurActorSize.y ), std::max( mMotionBlurActorSize.x, mMotionBlurActorSize.y ) );
mMotionBlurActorSize = Size( std::min( mMotionBlurActorSize.x, mMotionBlurActorSize.y ), std::min( mMotionBlurActorSize.x, mMotionBlurActorSize.y ) );
void Rotate( DeviceOrientation orientation )
{
// Resize the root actor
- const Vector2 targetSize = Stage::GetCurrent().GetSize();
+ const Vector2 targetSize = mApplication.GetWindow().GetSize();
if( mOrientation != orientation )
{
mOrientation = orientation;
- // check if actor is on stage
+ // check if actor is on window
if( mView.GetParent() )
{
- // has parent so we expect it to be on stage, start animation
+ // has parent so we expect it to be on window, start animation
mRotateAnimation = Animation::New( ORIENTATION_DURATION );
mRotateAnimation.AnimateTo( Property( mView, Actor::Property::SIZE_WIDTH ), targetSize.width );
mRotateAnimation.AnimateTo( Property( mView, Actor::Property::SIZE_HEIGHT ), targetSize.height );
float originOffsetX, originOffsetY;
// rotate offset (from top left origin to centre) into actor space
- Vector2 stageSize = Dali::Stage::GetCurrent().GetSize();
- actor.ScreenToLocal(originOffsetX, originOffsetY, stageSize.width * 0.5f, stageSize.height * 0.5f);
+ Vector2 windowSize = mApplication.GetWindow().GetSize();
+ actor.ScreenToLocal(originOffsetX, originOffsetY, windowSize.width * 0.5f, windowSize.height * 0.5f);
// get dest point in local actor space
destPos.x = tapGesture.localPoint.x - originOffsetX;
void OnInit(Application& app)
{
// The Init signal is received once (only) during the Application lifetime
+ Window window = app.GetWindow();
- Stage::GetCurrent().KeyEventSignal().Connect(this, &MotionStretchExampleApp::OnKeyEvent);
+ window.KeyEventSignal().Connect(this, &MotionStretchExampleApp::OnKeyEvent);
// Creates a default view with a default tool bar.
- // The view is added to the stage.
+ // The view is added to the window.
mContentLayer = DemoHelper::CreateView( mApplication,
mView,
mToolBar,
APPLICATION_TITLE );
// Ensure the content layer is a square so the touch area works in all orientations
- Vector2 stageSize = Stage::GetCurrent().GetSize();
- float size = std::max( stageSize.width, stageSize.height );
+ Vector2 windowSize = window.GetSize();
+ float size = std::max( windowSize.width, windowSize.height );
mContentLayer.SetProperty( Actor::Property::SIZE, Vector2( size, size ) );
//Add an slideshow icon on the right of the title
void Rotate( DeviceOrientation orientation )
{
// Resize the root actor
- const Vector2 targetSize = Stage::GetCurrent().GetSize();
+ const Vector2 targetSize = mApplication.GetWindow().GetSize();
if( mOrientation != orientation )
{
mOrientation = orientation;
- // check if actor is on stage
+ // check if actor is on window
if( mView.GetParent() )
{
- // has parent so we expect it to be on stage, start animation
+ // has parent so we expect it to be on window, start animation
mRotateAnimation = Animation::New( ORIENTATION_DURATION );
mRotateAnimation.AnimateTo( Property( mView, Actor::Property::SIZE_WIDTH ), targetSize.width );
mRotateAnimation.AnimateTo( Property( mView, Actor::Property::SIZE_HEIGHT ), targetSize.height );
float originOffsetX, originOffsetY;
// rotate offset (from top left origin to centre) into actor space
- Vector2 stageSize = Dali::Stage::GetCurrent().GetSize();
- actor.ScreenToLocal(originOffsetX, originOffsetY, stageSize.width * 0.5f, stageSize.height * 0.5f);
+ Vector2 windowSize = mApplication.GetWindow().GetSize();
+ actor.ScreenToLocal(originOffsetX, originOffsetY, windowSize.width * 0.5f, windowSize.height * 0.5f);
// get dest point in local actor space
destPos.x = tapGesture.localPoint.x - originOffsetX;
// The Init signal is received once (only) during the Application lifetime
void Create( Application& application )
{
- // Get a handle to the stage
- Stage stage = Stage::GetCurrent();
- stage.SetBackgroundColor( Color::WHITE );
+ // Get a handle to the window
+ Window window = application.GetWindow();
+ window.SetBackgroundColor( Color::WHITE );
- stage.KeyEventSignal().Connect(this, &NativeImageSourceController::OnKeyEvent);
+ window.KeyEventSignal().Connect(this, &NativeImageSourceController::OnKeyEvent);
CreateButtonArea();
void CreateButtonArea()
{
- Stage stage = Stage::GetCurrent();
- Vector2 stageSize = stage.GetSize();
+ Window window = mApplication.GetWindow();
+ Vector2 windowSize = window.GetSize();
mButtonArea = Layer::New();
- mButtonArea.SetProperty( Actor::Property::SIZE, Vector2( stageSize.x, BUTTON_HEIGHT ) );
+ mButtonArea.SetProperty( Actor::Property::SIZE, Vector2( windowSize.x, BUTTON_HEIGHT ) );
mButtonArea.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_CENTER );
mButtonArea.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_CENTER );
- stage.Add( mButtonArea );
+ window.Add( mButtonArea );
mButtonShow = PushButton::New();
mButtonShow.SetProperty( Button::Property::TOGGLABLE, true );
mButtonShow.SetProperty( Toolkit::Button::Property::LABEL, "SHOW" );
mButtonShow.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
mButtonShow.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
- mButtonShow.SetProperty( Actor::Property::SIZE, Vector2( stageSize.x / BUTTON_COUNT, BUTTON_HEIGHT ) );
+ mButtonShow.SetProperty( Actor::Property::SIZE, Vector2( windowSize.x / BUTTON_COUNT, BUTTON_HEIGHT ) );
mButtonShow.ClickedSignal().Connect( this, &NativeImageSourceController::OnButtonSelected );
mButtonArea.Add( mButtonShow );
mButtonRefreshAlways.SetProperty( Toolkit::Button::Property::LABEL, "ALWAYS" );
mButtonRefreshAlways.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
mButtonRefreshAlways.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
- mButtonRefreshAlways.SetProperty( Actor::Property::SIZE, Vector2( stageSize.x / BUTTON_COUNT, BUTTON_HEIGHT ) );
- mButtonRefreshAlways.SetProperty( Actor::Property::POSITION, Vector2( (stageSize.x / BUTTON_COUNT)*1.0f, 0.0f ));
+ mButtonRefreshAlways.SetProperty( Actor::Property::SIZE, Vector2( windowSize.x / BUTTON_COUNT, BUTTON_HEIGHT ) );
+ mButtonRefreshAlways.SetProperty( Actor::Property::POSITION, Vector2( (windowSize.x / BUTTON_COUNT)*1.0f, 0.0f ));
mButtonRefreshAlways.StateChangedSignal().Connect( this, &NativeImageSourceController::OnButtonSelected );
mButtonArea.Add( mButtonRefreshAlways );
mButtonRefreshOnce.SetProperty( Toolkit::Button::Property::LABEL, "ONCE" );
mButtonRefreshOnce.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
mButtonRefreshOnce.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
- mButtonRefreshOnce.SetProperty( Actor::Property::SIZE, Vector2( stageSize.x / BUTTON_COUNT, BUTTON_HEIGHT ) );
- mButtonRefreshOnce.SetProperty( Actor::Property::POSITION, Vector2( (stageSize.x / BUTTON_COUNT)*2.0f, 0.0f ));
+ mButtonRefreshOnce.SetProperty( Actor::Property::SIZE, Vector2( windowSize.x / BUTTON_COUNT, BUTTON_HEIGHT ) );
+ mButtonRefreshOnce.SetProperty( Actor::Property::POSITION, Vector2( (windowSize.x / BUTTON_COUNT)*2.0f, 0.0f ));
mButtonRefreshOnce.ClickedSignal().Connect( this, &NativeImageSourceController::OnButtonSelected );
mButtonArea.Add( mButtonRefreshOnce );
mButtonCapture.SetProperty( Toolkit::Button::Property::LABEL, "CAPTURE" );
mButtonCapture.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
mButtonCapture.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
- mButtonCapture.SetProperty( Actor::Property::SIZE, Vector2( stageSize.x / BUTTON_COUNT, BUTTON_HEIGHT ) );
- mButtonCapture.SetProperty( Actor::Property::POSITION, Vector2( (stageSize.x / BUTTON_COUNT)*3.0f, 0.0f ));
+ mButtonCapture.SetProperty( Actor::Property::SIZE, Vector2( windowSize.x / BUTTON_COUNT, BUTTON_HEIGHT ) );
+ mButtonCapture.SetProperty( Actor::Property::POSITION, Vector2( (windowSize.x / BUTTON_COUNT)*3.0f, 0.0f ));
mButtonCapture.ClickedSignal().Connect( this, &NativeImageSourceController::OnButtonSelected );
mButtonArea.Add( mButtonCapture );
mButtonReset.SetProperty( Toolkit::Button::Property::LABEL, "RESET" );
mButtonReset.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
mButtonReset.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
- mButtonReset.SetProperty( Actor::Property::SIZE, Vector2( stageSize.x / BUTTON_COUNT, BUTTON_HEIGHT ) );
- mButtonReset.SetProperty( Actor::Property::POSITION, Vector2( (stageSize.x / BUTTON_COUNT)*4.0f, 0.0f ));
+ mButtonReset.SetProperty( Actor::Property::SIZE, Vector2( windowSize.x / BUTTON_COUNT, BUTTON_HEIGHT ) );
+ mButtonReset.SetProperty( Actor::Property::POSITION, Vector2( (windowSize.x / BUTTON_COUNT)*4.0f, 0.0f ));
mButtonReset.ClickedSignal().Connect( this, &NativeImageSourceController::OnButtonSelected );
mButtonArea.Add( mButtonReset );
}
void CreateContentAreas()
{
- Stage stage = Stage::GetCurrent();
- Vector2 stageSize = stage.GetSize();
+ Window window = mApplication.GetWindow();
+ Vector2 windowSize = window.GetSize();
- float contentHeight( (stageSize.y - BUTTON_HEIGHT)/2.0f );
+ float contentHeight( (windowSize.y - BUTTON_HEIGHT)/2.0f );
mTopContentArea = Actor::New();
- mTopContentArea.SetProperty( Actor::Property::SIZE, Vector2( stageSize.x, contentHeight ) );
+ mTopContentArea.SetProperty( Actor::Property::SIZE, Vector2( windowSize.x, contentHeight ) );
mTopContentArea.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_CENTER );
mTopContentArea.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_CENTER );
mTopContentArea.SetProperty( Actor::Property::POSITION_Y, BUTTON_HEIGHT );
- stage.Add( mTopContentArea );
+ window.Add( mTopContentArea );
mBottomContentArea = Actor::New();
- mBottomContentArea.SetProperty( Actor::Property::SIZE, Vector2( stageSize.x, contentHeight ) );
+ mBottomContentArea.SetProperty( Actor::Property::SIZE, Vector2( windowSize.x, contentHeight ) );
mBottomContentArea.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_CENTER );
mBottomContentArea.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_CENTER );
- stage.Add( mBottomContentArea );
+ window.Add( mBottomContentArea );
mSourceActor = ImageView::New(JPG_FILENAME);
mSourceActor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
{
if( ! mOffscreenRenderTask )
{
- Stage stage = Stage::GetCurrent();
- Vector2 stageSize = stage.GetSize();
+ Window window = mApplication.GetWindow();
+ Vector2 windowSize = window.GetSize();
- float contentHeight( (stageSize.y - BUTTON_HEIGHT)/2.0f );
- Vector2 imageSize( stageSize.x, contentHeight );
+ float contentHeight( (windowSize.y - BUTTON_HEIGHT)/2.0f );
+ Vector2 imageSize( windowSize.x, contentHeight );
mNativeImageSourcePtr = NativeImageSource::New( imageSize.width, imageSize.height, NativeImageSource::COLOR_DEPTH_DEFAULT );
mNativeTexture = Texture::New( *mNativeImageSourcePtr );
mCameraActor.SetProperty( Actor::Property::PARENT_ORIGIN, AnchorPoint::CENTER );
mTopContentArea.Add( mCameraActor );
- RenderTaskList taskList = stage.GetRenderTaskList();
+ RenderTaskList taskList = window.GetRenderTaskList();
mOffscreenRenderTask = taskList.CreateTask();
mOffscreenRenderTask.SetSourceActor( mSourceActor );
mOffscreenRenderTask.SetClearColor( Color::WHITE );
{
SetupDisplayActor( false );
- Stage stage = Stage::GetCurrent();
- RenderTaskList taskList = stage.GetRenderTaskList();
+ Window window = mApplication.GetWindow();
+ RenderTaskList taskList = window.GetRenderTaskList();
taskList.RemoveTask( mOffscreenRenderTask );
mOffscreenRenderTask.Reset();
mCameraActor.Reset();
*/
void PageTurnExample::OnInit( Application& app )
{
- Stage::GetCurrent().KeyEventSignal().Connect(this, &PageTurnExample::OnKeyEvent);
-
Window window = app.GetWindow();
+ window.KeyEventSignal().Connect(this, &PageTurnExample::OnKeyEvent);
+
window.AddAvailableOrientation( Window::PORTRAIT );
window.AddAvailableOrientation( Window::LANDSCAPE );
window.AddAvailableOrientation( Window::PORTRAIT_INVERSE );
void PageTurnExample::Rotate( DemoOrientation orientation )
{
- Stage stage = Stage::GetCurrent();
- Vector2 stageSize = stage.GetSize();
+ Window window = mApplication.GetWindow();
+ Vector2 windowSize = window.GetSize();
if( mOrientation != orientation )
{
{
if( !mPageTurnPortraitView )
{
- mPageTurnPortraitView = PageTurnPortraitView::New( mPortraitPageFactory, stageSize );
+ mPageTurnPortraitView = PageTurnPortraitView::New( mPortraitPageFactory, windowSize );
mPageTurnPortraitView.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
}
if( mPageTurnLandscapeView )
{
- stage.Remove( mPageTurnLandscapeView );
+ window.Remove( mPageTurnLandscapeView );
}
- stage.Add( mPageTurnPortraitView );
+ window.Add( mPageTurnPortraitView );
}
else if( LANDSCAPE == orientation )
{
if( !mPageTurnLandscapeView )
{
- mPageTurnLandscapeView = PageTurnLandscapeView::New( mLandscapePageFactory, Vector2(stageSize.x*0.5f, stageSize.y) );
+ mPageTurnLandscapeView = PageTurnLandscapeView::New( mLandscapePageFactory, Vector2(windowSize.x*0.5f, windowSize.y) );
mPageTurnLandscapeView.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
}
if( mPageTurnPortraitView )
{
- stage.Remove( mPageTurnPortraitView );
+ window.Remove( mPageTurnPortraitView );
}
- stage.Add( mPageTurnLandscapeView );
+ window.Add( mPageTurnLandscapeView );
}
}
}
/*
- * Copyright (c) 2018 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.
// The Init signal is received once (only) during the Application lifetime
void Create( Application& application )
{
- // Get a handle to the stage
- Stage stage = Stage::GetCurrent();
- stage.SetBackgroundColor( Color::WHITE );
- Vector2 stageSize = stage.GetSize();
+ // Get a handle to the window
+ Window window = application.GetWindow();
+ window.SetBackgroundColor( Color::WHITE );
+ Vector2 windowSize = window.GetSize();
- stage.GetRootLayer().SetProperty( Layer::Property::DEPTH_TEST, false );
+ window.GetRootLayer().SetProperty( Layer::Property::DEPTH_TEST, false );
- mSize = Vector3( stageSize.x / mColumnsPerPage, stageSize.y / mRowsPerPage, 0.0f );
+ mSize = Vector3( windowSize.x / mColumnsPerPage, windowSize.y / mRowsPerPage, 0.0f );
- // Respond to a click anywhere on the stage
- stage.GetRootLayer().TouchSignal().Connect( this, &PerfScroll::OnTouch );
+ // Respond to a click anywhere on the window
+ window.GetRootLayer().TouchSignal().Connect( this, &PerfScroll::OnTouch );
// Respond to key events
- stage.KeyEventSignal().Connect( this, &PerfScroll::OnKeyEvent );
+ window.KeyEventSignal().Connect( this, &PerfScroll::OnKeyEvent );
mParent = Actor::New();
mParent.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
- stage.Add(mParent);
+ window.Add(mParent);
if( gUseMesh )
{
void CreateImageViews()
{
- Stage stage = Stage::GetCurrent();
+ Window window = mApplication.GetWindow();
unsigned int actorCount( mRowsPerPage*mColumnsPerPage * mPageCount );
mImageView.resize( actorCount );
}
//Create the actors
- Stage stage = Stage::GetCurrent();
+ Window window = mApplication.GetWindow();
unsigned int actorCount(mRowsPerPage*mColumnsPerPage * mPageCount);
mActor.resize(actorCount);
for( size_t i(0); i<actorCount; ++i )
void ShowAnimation()
{
- Stage stage = Stage::GetCurrent();
- Vector3 initialPosition( stage.GetSize().x * 0.5f, stage.GetSize().y*0.5f, 1000.0f );
+ Window window = mApplication.GetWindow();
+ Vector3 initialPosition( window.GetSize().GetWidth() * 0.5f, window.GetSize().GetHeight() * 0.5f, 1000.0f );
unsigned int totalColumns = mColumnsPerPage * mPageCount;
void ScrollAnimation()
{
- Stage stage = Stage::GetCurrent();
- Vector3 stageSize( stage.GetSize() );
+ Window window = mApplication.GetWindow();
+ Vector3 windowSize( window.GetSize() );
mScroll = Animation::New( gDuration );
- mScroll.AnimateBy( Property( mParent, Actor::Property::POSITION ), Vector3( -(gPageCount-1.)*stageSize.x,0.0f, 0.0f) );
+ mScroll.AnimateBy( Property( mParent, Actor::Property::POSITION ), Vector3( -(gPageCount-1.)*windowSize.x,0.0f, 0.0f) );
mScroll.Play();
mScroll.FinishedSignal().Connect( this, &PerfScroll::OnAnimationEnd );
}
/*
- * Copyright (c) 2017 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.
/**
* @brief The Init signal is received once (only) during the Application lifetime.
*/
- void Create( Application& /* application */ )
+ void Create( Application& application )
{
- // Get a handle to the stage
- Stage stage = Stage::GetCurrent();
- stage.SetBackgroundColor( Color::WHITE );
- stage.KeyEventSignal().Connect( this, &PivotController::OnKeyEvent );
+ // Get a handle to the window
+ Window window = application.GetWindow();
+ window.SetBackgroundColor( Color::WHITE );
+ window.KeyEventSignal().Connect( this, &PivotController::OnKeyEvent );
// Create a table view.
TableView tableView = TableView::New( TABLE_VIEW_ROWS, TABLE_VIEW_COLUMNS );
tableView.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
tableView.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS );
tableView.SetProperty( Actor::Property::SIZE_MODE_FACTOR, TABLE_VIEW_SIZE_MODE_FACTOR );
- stage.Add( tableView );
+ window.Add( tableView );
// Create a tap detector - we are going to rotate an actor round our anchor-point (pivot) when one of our controls is tapped.
mTapDetector = TapGestureDetector::New();
*/
void Create( Application& application )
{
- Stage stage = Stage::GetCurrent();
- stage.KeyEventSignal().Connect(this, &ExampleController::OnKeyEvent);
+ Window window = application.GetWindow();
+ window.KeyEventSignal().Connect(this, &ExampleController::OnKeyEvent);
- mStageSize = stage.GetSize();
+ mWindowSize = window.GetSize();
// The Init signal is received once (only) during the Application lifetime
mMeshActor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
mMeshActor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
- stage.Add( mMeshActor );
+ window.Add( mMeshActor );
Animation animation = Animation::New(15);
KeyFrames keyFrames = KeyFrames::New();
animation.SetLooping(true);
animation.Play();
- stage.SetBackgroundColor(Vector4(0.0f, 0.2f, 0.2f, 1.0f));
+ window.SetBackgroundColor(Vector4(0.0f, 0.2f, 0.2f, 1.0f));
}
/**
private:
Application& mApplication; ///< Application instance
- Vector3 mStageSize; ///< The size of the stage
+ Vector3 mWindowSize; ///< The size of the window
Renderer mRenderer;
Actor mMeshActor;
/*
- * 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.
void Create( Application& application )
{
// The Init signal is received once (only) during the Application lifetime
- Stage stage = Stage::GetCurrent();
+ Window window = application.GetWindow();
// Respond to key events if not handled
- stage.KeyEventSignal().Connect( this, &PopupExample::OnKeyEvent );
+ window.KeyEventSignal().Connect( this, &PopupExample::OnKeyEvent );
// Creates a default view with a default tool bar.
- // The view is added to the stage.
+ // The view is added to the window.
mContentLayer = DemoHelper::CreateView( application,
mView,
mToolBar,
mItemView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
// Use a grid layout for tests
- Vector2 stageSize = stage.GetSize();
+ Vector2 windowSize = window.GetSize();
Toolkit::ItemLayoutPtr gridLayout = Toolkit::DefaultItemLayout::New( Toolkit::DefaultItemLayout::LIST );
Vector3 itemSize;
- gridLayout->GetItemSize( 0, Vector3( stageSize ), itemSize );
- itemSize.height = stageSize.y / 10;
+ gridLayout->GetItemSize( 0, Vector3( windowSize ), itemSize );
+ itemSize.height = windowSize.y / 10;
gridLayout->SetItemSize( itemSize );
mItemView.AddLayout( *gridLayout );
- mItemView.ActivateLayout( 0, Vector3(stageSize.x, stageSize.y, stageSize.x), 0.0f );
+ mItemView.ActivateLayout( 0, Vector3(windowSize.x, windowSize.y, windowSize.x), 0.0f );
mContentLayer.Add( mItemView );
}
*/
void SetupContextualResizePolicy( Toolkit::Popup& popup )
{
- Vector2 stageSize = Stage::GetCurrent().GetSize();
+ Vector2 windowSize = mApplication.GetWindow().GetSize();
// Some defaults when creating a new fixed size.
// This is NOT a Vector2 so we can modify each dimension in a for-loop.
- float newSize[ Dimension::DIMENSION_COUNT ] = { stageSize.x * 0.75f, stageSize.y * 0.75f };
+ float newSize[ Dimension::DIMENSION_COUNT ] = { windowSize.x * 0.75f, windowSize.y * 0.75f };
bool modifySize = false;
// Loop through each of two dimensions to process them.
for( unsigned int dimension = 0; dimension < 2; ++dimension )
{
- float stageDimensionSize, sizeModeFactor;
+ float windowDimensionSize, sizeModeFactor;
Dimension::Type policyDimension = dimension == 0 ? Dimension::WIDTH : Dimension::HEIGHT;
// Setup information related to the current dimension we are processing.
if( policyDimension == Dimension::WIDTH )
{
- stageDimensionSize = stageSize.x;
+ windowDimensionSize = windowSize.x;
sizeModeFactor = popup.GetProperty< Vector3 >( Actor::Property::SIZE_MODE_FACTOR ).x;
}
else
{
- stageDimensionSize = stageSize.y;
+ windowDimensionSize = windowSize.y;
sizeModeFactor = popup.GetProperty< Vector3 >( Actor::Property::SIZE_MODE_FACTOR ).y;
}
case ResizePolicy::FILL_TO_PARENT:
{
newPolicy = ResizePolicy::FIXED;
- newSize[ dimension ] = stageDimensionSize;
+ newSize[ dimension ] = windowDimensionSize;
modifyPolicy = true;
break;
}
case ResizePolicy::SIZE_RELATIVE_TO_PARENT:
{
newPolicy = ResizePolicy::FIXED;
- newSize[ dimension ] = stageDimensionSize * sizeModeFactor;
+ newSize[ dimension ] = windowDimensionSize * sizeModeFactor;
modifyPolicy = true;
break;
}
case ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT:
{
newPolicy = ResizePolicy::FIXED;
- newSize[ dimension ] = stageDimensionSize + sizeModeFactor;
+ newSize[ dimension ] = windowDimensionSize + sizeModeFactor;
modifyPolicy = true;
break;
}
}
else
{
- Stage::GetCurrent().Add( popup );
+ mApplication.GetWindow().Add( popup );
}
mPopup.SetDisplayState( Toolkit::Popup::SHOWN );
Toolkit::Popup CreatePopup()
{
- Stage stage = Stage::GetCurrent();
- const float POPUP_WIDTH_DP = stage.GetSize().width * 0.75f;
+ Window window = mApplication.GetWindow();
+ const float POPUP_WIDTH_DP = window.GetSize().GetWidth() * 0.75f;
Toolkit::Popup popup = Toolkit::Popup::New();
popup.SetProperty( Dali::Actor::Property::NAME, "popup" );
mPopup = Toolkit::Popup::DownCast( baseHandle );
mPopup.SetTitle( CreateTitle( "This is a Toast Popup.\nIt will auto-hide itself" ) );
- Stage::GetCurrent().Add( mPopup );
+ mApplication.GetWindow().Add( mPopup );
mPopup.SetDisplayState( Toolkit::Popup::SHOWN );
}
}
*/
PreRenderCallbackController ( Application& application )
: mApplication( application ),
- mStage(),
+ mWindow(),
mTapDetector(),
mKeepPreRender(false),
mRotateTextCharacter(0),
*/
void Create( Application& application )
{
- mStage = Stage::GetCurrent();
- mStage.SetBackgroundColor( Color::WHITE );
- mStage.KeyEventSignal().Connect( this, &PreRenderCallbackController::OnKeyEvent );
+ mWindow = application.GetWindow();
+ mWindow.SetBackgroundColor( Color::WHITE );
+ mWindow.KeyEventSignal().Connect( this, &PreRenderCallbackController::OnKeyEvent );
// Detect taps on the root layer.
mTapDetector = TapGestureDetector::New();
- mTapDetector.Attach( mStage.GetRootLayer() );
+ mTapDetector.Attach( mWindow.GetRootLayer() );
mTapDetector.DetectedSignal().Connect( this, &PreRenderCallbackController::OnTap );
CreateAnimatingScene();
mSpinner.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
mSpinner.SetProperty( Actor::Property::SIZE, Vector2(100,100) );
- mStage.Add(mSpinner);
- mStage.Add(textContainer);
+ mWindow.Add(mSpinner);
+ mWindow.Add(textContainer);
DevelApplication::AddIdleWithReturnValue( application, MakeCallback( this, &PreRenderCallbackController::OnIdle ) );
}
Quaternion q( Degree( 20.0f ), Vector3::YAXIS );
mSceneActor.SetProperty( Actor::Property::ORIENTATION, p * q );
- mStage.Add( mSceneActor );
+ mWindow.Add( mSceneActor );
}
void OnTap( Actor /* actor */, const TapGesture& /* tap */ )
private:
Application& mApplication;
- Stage mStage;
+ Window mWindow;
TapGestureDetector mTapDetector; ///< Tap detector to enable the PreRenderCallback
bool mKeepPreRender;
int mRotateTextCharacter;
// The Init signal is received once (only) during the Application lifetime
void Create( Application& application )
{
- // Get a handle to the stage
- Stage stage = Stage::GetCurrent();
- stage.SetBackgroundColor( Color::WHITE );
+ // Get a handle to the window
+ Window window = application.GetWindow();
+ window.SetBackgroundColor( Color::WHITE );
//Set up layer to place UI on.
Layer layer = Layer::New();
layer.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
layer.SetProperty( Layer::Property::BEHAVIOR, Layer::LAYER_UI ); //We use a 2D layer as this is closer to UI work than full 3D scene creation.
layer.SetProperty( Layer::Property::DEPTH_TEST, true ); //Enable depth testing, as otherwise the 2D layer would not do so.
- stage.Add( layer );
+ window.Add( layer );
//Set up model selection buttons.
SetupButtons( layer );
SetupModel( layer );
//Allow for exiting of the application via key presses.
- stage.KeyEventSignal().Connect( this, &PrimitiveShapesController::OnKeyEvent );
+ window.KeyEventSignal().Connect( this, &PrimitiveShapesController::OnKeyEvent );
}
//Place buttons on the top of the screen, which allow for selection of the shape to be displayed.
}
}
- //Adds a control to the centre of the stage to display the 3D shapes.
+ //Adds a control to the centre of the window to display the 3D shapes.
//The model is placed in the center of the screen, like so:
//
// +--------------------------------+
/*
- * Copyright (c) 2017 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.
// The Init signal is received once (only) during the Application lifetime
// Respond to key events
- Stage::GetCurrent().KeyEventSignal().Connect( this, &ProgressBarExample::OnKeyEvent );
+ application.GetWindow().KeyEventSignal().Connect( this, &ProgressBarExample::OnKeyEvent );
// Creates a default view with a default tool bar.
- // The view is added to the stage.
+ // The view is added to the window.
mContentLayer = DemoHelper::CreateView( application,
mView,
/*
- * Copyright (c) 2017 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.
*/
void Create( Application& application )
{
- // Set the stage background color and connect to the stage's key signal to allow Back and Escape to exit.
- Stage stage = Stage::GetCurrent();
- stage.SetBackgroundColor( Color::WHITE );
- stage.KeyEventSignal().Connect( this, &PropertyNotificationController::OnKeyEvent );
+ // Set the window background color and connect to the window's key signal to allow Back and Escape to exit.
+ Window window = application.GetWindow();
+ window.SetBackgroundColor( Color::WHITE );
+ window.KeyEventSignal().Connect( this, &PropertyNotificationController::OnKeyEvent );
// Create a text label and set the text color to black
mTextLabel = TextLabel::New( "Black to Red Animation\nNew opacity animation at 50% Red" );
mTextLabel.SetProperty( TextLabel::Property::MULTI_LINE, true );
mTextLabel.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
mTextLabel.SetProperty( TextLabel::Property::TEXT_COLOR, Color::BLACK );
- stage.Add( mTextLabel );
+ window.Add( mTextLabel );
// Create an animation and animate the text color to red
Animation animation = Animation::New( COLOR_ANIMATION_DURATION );
// The Init signal is received once (only) during the Application lifetime
void Create( Application& application )
{
- // Get a handle to the stage
- Stage stage = Stage::GetCurrent();
+ // Get a handle to the window
+ Window window = application.GetWindow();
- stage.GetRootLayer().TouchSignal().Connect( this, &RayMarchingExample::OnTouch );
+ window.GetRootLayer().TouchSignal().Connect( this, &RayMarchingExample::OnTouch );
- stage.KeyEventSignal().Connect(this, &RayMarchingExample::OnKeyEvent);
+ window.KeyEventSignal().Connect(this, &RayMarchingExample::OnKeyEvent);
- stage.SetBackgroundColor( Color::YELLOW );
+ window.SetBackgroundColor( Color::YELLOW );
// Creates a default view with a default tool bar.
- // The view is added to the stage.
+ // The view is added to the window.
mContentLayer = DemoHelper::CreateView( application,
mView,
mToolBar,
void AddContentLayer()
{
- Stage stage = Stage::GetCurrent();
+ Window window = mApplication.GetWindow();
//Create all the renderers
Renderer renderer = CreateQuadRenderer();
// The Init signal is received once (only) during the Application lifetime
void Create( Application& application )
{
- // Get a handle to the stage
- Stage stage = Stage::GetCurrent();
- uint32_t stageWidth = uint32_t(stage.GetSize().x);
- uint32_t stageHeight = uint32_t(stage.GetSize().y);
+ // Get a handle to the window
+ Window window = application.GetWindow();
+ uint32_t windowWidth = uint32_t(window.GetSize().GetWidth());
+ uint32_t windowHeight = uint32_t(window.GetSize().GetHeight());
- stage.GetRenderTaskList().GetTask(0).SetClearEnabled(false);
+ window.GetRenderTaskList().GetTask(0).SetClearEnabled(false);
mLayer3D = Layer::New();
- mLayer3D.SetProperty( Actor::Property::SIZE, Vector2( stageWidth, stageHeight ) );
- stage.Add(mLayer3D);
+ mLayer3D.SetProperty( Actor::Property::SIZE, Vector2( windowWidth, windowHeight ) );
+ window.Add(mLayer3D);
mLayer3D.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
mLayer3D.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
/**
* Create scene nodes
*/
- CreateSceneFromGLTF( stage, &gltf );
+ CreateSceneFromGLTF( window, &gltf );
auto planeActor = mLayer3D.FindChildByName( "Plane" );
auto solarActor = mLayer3D.FindChildByName( "solar_root" );
cameraRefActor.SetProperty( DevelCameraActor::Property::REFLECTION_PLANE, Vector4(0.0f, -1.0f, 0.0f, 0.0f));
mReflectionCamera3D = cameraRefActor;
- auto task3D = stage.GetRenderTaskList().CreateTask();
+ auto task3D = window.GetRenderTaskList().CreateTask();
task3D.SetSourceActor( mLayer3D );
- task3D.SetViewport( Rect<int>(0, 0, stageWidth, stageHeight ) );
+ task3D.SetViewport( Rect<int>(0, 0, windowWidth, windowHeight ) );
task3D.SetCameraActor( cameraActor );
task3D.SetClearColor( Color::BLACK );
task3D.SetClearEnabled( true );
* Change shader to textured
*/
Shader texShader = CreateShader( VERTEX_SHADER, TEX_FRAGMENT_SHADER );
- planeActor.RegisterProperty( "uScreenSize", Vector2(stageWidth, stageHeight) );
+ planeActor.RegisterProperty( "uScreenSize", Vector2(windowWidth, windowHeight) );
auto renderer = planeActor.GetRendererAt(0);
auto textureSet = renderer.GetTextures();
renderer.SetShader( texShader );
- Texture fbTexture = Texture::New(TextureType::TEXTURE_2D, Pixel::Format::RGBA8888, stageWidth, stageHeight );
+ Texture fbTexture = Texture::New(TextureType::TEXTURE_2D, Pixel::Format::RGBA8888, windowWidth, windowHeight );
textureSet.SetTexture( 1u, fbTexture );
- auto fb = FrameBuffer::New(stageWidth, stageHeight,
+ auto fb = FrameBuffer::New(windowWidth, windowHeight,
FrameBuffer::Attachment::DEPTH );
fb.AttachColorTexture( fbTexture );
- auto renderTask = stage.GetRenderTaskList().CreateTask();
+ auto renderTask = window.GetRenderTaskList().CreateTask();
renderTask.SetFrameBuffer( fb );
renderTask.SetSourceActor( renderTaskSourceActor );
- renderTask.SetViewport( Rect<int>(0, 0, stageWidth, stageHeight ) );
+ renderTask.SetViewport( Rect<int>(0, 0, windowWidth, windowHeight ) );
renderTask.SetCameraActor( cameraRefActor );
renderTask.SetClearColor( Color::BLACK );
renderTask.SetClearEnabled( true );
mAnimation.Play();
Actor panScreen = Actor::New();
- auto stageSize = stage.GetSize();
- panScreen.SetProperty( Actor::Property::SIZE, Vector2( stageSize.width, stageSize.height ) );
+ Vector2 windowSize = window.GetSize();
+ panScreen.SetProperty( Actor::Property::SIZE, windowSize );
panScreen.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
panScreen.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
- auto camera2d = stage.GetRenderTaskList().GetTask(0).GetCameraActor();
+ auto camera2d = window.GetRenderTaskList().GetTask(0).GetCameraActor();
panScreen.SetProperty( Actor::Property::POSITION, Vector3( 0, 0, camera2d.GetNearClippingPlane() ));
camera2d.Add(panScreen);
camera2d.RotateBy( Degree(180.0f), Vector3( 0.0, 1.0, 0.0 ) );
mPanGestureDetector.DetectedSignal().Connect( this, &ReflectionExample::OnPan );
// Respond to key events
- stage.KeyEventSignal().Connect( this, &ReflectionExample::OnKeyEvent );
+ window.KeyEventSignal().Connect( this, &ReflectionExample::OnKeyEvent );
mTickTimer.Start();
}
- void CreateSceneFromGLTF( Stage stage, glTF* gltf )
+ void CreateSceneFromGLTF( Window window, glTF* gltf )
{
const auto& nodes = gltf->GetNodes();
actors.reserve( nodes.size() );
for( const auto& node : nodes )
{
- auto actor = node.cameraId != 0xffffffff ? CameraActor::New( stage.GetSize() ) : Actor::New();
+ auto actor = node.cameraId != 0xffffffff ? CameraActor::New( window.GetSize() ) : Actor::New();
actor.SetProperty( Actor::Property::SIZE, Vector3( 1, 1, 1 ) );
actor.SetProperty( Dali::Actor::Property::NAME, node.name );
mActors = std::move(actors);
- // Add root actor to the stage
+ // Add root actor to the window
mLayer3D.Add( mActors[0] );
for( auto& actor : mActors )
/*
- * 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.
// The Init signal is received once (only) during the Application lifetime
void Create(Application& application)
{
- Stage stage = Stage::GetCurrent();
- Vector2 stageSize = stage.GetSize();
+ Window window = application.GetWindow();
+ Vector2 windowSize = window.GetSize();
- stage.KeyEventSignal().Connect(this, &RefractionEffectExample::OnKeyEvent);
+ window.KeyEventSignal().Connect(this, &RefractionEffectExample::OnKeyEvent);
// Creates a default view with a default tool bar.
- // The view is added to the stage.
+ // The view is added to the window.
Toolkit::ToolBar toolBar;
Toolkit::Control view;
mContent = DemoHelper::CreateView( application,
mShaderFlat = Shader::New( VERTEX_SHADER_FLAT, FRAGMENT_SHADER_FLAT );
mGeometry = CreateGeometry( MESH_FILES[mCurrentMeshId] );
- Texture texture = DemoHelper::LoadStageFillingTexture( TEXTURE_IMAGES[mCurrentTextureId] );
+ Texture texture = DemoHelper::LoadWindowFillingTexture( window.GetSize(), TEXTURE_IMAGES[mCurrentTextureId] );
mTextureSet = TextureSet::New();
mTextureSet.SetTexture( 0u, texture );
mMeshActor = Actor::New();
mMeshActor.AddRenderer( mRenderer );
- mMeshActor.SetProperty( Actor::Property::SIZE, stageSize );
+ mMeshActor.SetProperty( Actor::Property::SIZE, windowSize );
mMeshActor.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::CENTER);
mContent.Add( mMeshActor );
mEffectStrengthIndex = mMeshActor.RegisterProperty( "uEffectStrength", 0.f );
- Vector3 lightPosition( -stageSize.x*0.5f, -stageSize.y*0.5f, stageSize.x*0.5f ); // top_left
+ Vector3 lightPosition( -windowSize.x*0.5f, -windowSize.y*0.5f, windowSize.x*0.5f ); // top_left
mMeshActor.RegisterProperty( "uLightPosition", lightPosition );
Property::Index lightSpinOffsetIndex = mMeshActor.RegisterProperty( "uLightSpinOffset", Vector2::ZERO );
mSpinAngleIndex = mMeshActor.RegisterProperty("uSpinAngle", 0.f );
- Constraint constraint = Constraint::New<Vector2>( mMeshActor, lightSpinOffsetIndex, LightOffsetConstraint(stageSize.x*0.1f) );
+ Constraint constraint = Constraint::New<Vector2>( mMeshActor, lightSpinOffsetIndex, LightOffsetConstraint(windowSize.x*0.1f) );
constraint.AddSource( LocalSource(mSpinAngleIndex) );
constraint.Apply();
bool OnChangeTexture( Toolkit::Button button )
{
mCurrentTextureId = ( mCurrentTextureId + 1 ) % NUM_TEXTURE_IMAGES;
- Texture texture = DemoHelper::LoadStageFillingTexture( TEXTURE_IMAGES[mCurrentTextureId] );
+ Texture texture = DemoHelper::LoadWindowFillingTexture( mApplication.GetWindow().GetSize(), TEXTURE_IMAGES[mCurrentTextureId] );
mTextureSet.SetTexture( 0u, texture );
return true;
}
Vector3 bBoxSize( boundingBox[1] - boundingBox[0], boundingBox[3] - boundingBox[2], boundingBox[5] - boundingBox[4]);
Vector3 bBoxMinCorner( boundingBox[0], boundingBox[2], boundingBox[4] );
- Vector2 stageSize = Stage::GetCurrent().GetSize();
- Vector3 scale( stageSize.x / bBoxSize.x, stageSize.y / bBoxSize.y, 1.f );
+ Vector2 windowSize = mApplication.GetWindow().GetSize();
+ Vector3 scale( windowSize.x / bBoxSize.x, windowSize.y / bBoxSize.y, 1.f );
scale.z = (scale.x + scale.y)/2.f;
textureCoordinates.reserve(vertexPositions.size());
/*
- * Copyright (c) 2017 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.
// The Init signal is received once (only) during the Application lifetime
void Create(Application &application)
{
- stage = Stage::GetCurrent();
- stage.SetBackgroundColor(Color::BLACK);
- stage.KeyEventSignal().Connect(this, &MyTester::OnKey);
- stage.TouchSignal().Connect(this, &MyTester::OnTouch);
+ mWindow = application.GetWindow();
+ mWindow.SetBackgroundColor(Color::BLACK);
+ mWindow.KeyEventSignal().Connect(this, &MyTester::OnKey);
+ mWindow.TouchSignal().Connect(this, &MyTester::OnTouch);
TextLabel rubric = TextLabel::New( "You will need a working internet connection to see the images below");
rubric.SetProperty( TextLabel::Property::MULTI_LINE, true );
rubric.SetResizePolicy( ResizePolicy::DIMENSION_DEPENDENCY, Dimension::HEIGHT );
rubric.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_CENTER );
rubric.SetProperty( Actor::Property::ANCHOR_POINT, ParentOrigin::TOP_CENTER );
- stage.Add( rubric );
+ mWindow.Add( rubric );
mImageView1 = Toolkit::ImageView::New("http://static.midomi.com/s/s/images/000/000/000/000/293/259/19/520_000000000000293259191500x1500_72dpi_RGB_q70.jpg");
mImageView1.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false);
mImageView1.SetProperty( Actor::Property::POSITION, Vector2(0, 100));
mImageView1.SetBackgroundColor(Vector4(0.0f, 0.0f, 0.0f, 0.0f));
- stage.Add(mImageView1);
+ mWindow.Add(mImageView1);
mImageView2 = Toolkit::ImageView::New("http://static.midomi.com/s/s/images/000/000/000/000/212/651/88/520_000000000000212651881500x1500_72dpi_RGB_q70.jpg");
mImageView2.SetProperty( Dali::Actor::Property::NAME,"mImageView2");
mImageView2.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false);
mImageView2.SetProperty( Actor::Property::POSITION, Vector2(400, 100));
mImageView2.SetBackgroundColor(Vector4(0.0f, 0.0f, 0.0f, 0.0f));
- stage.Add(mImageView2);
+ mWindow.Add(mImageView2);
mImageView3 = Toolkit::ImageView::New("http://static.midomi.com/s/s/images/000/000/000/000/212/353/21/520_000000000000212353211500x1500_72dpi_RGB_q70.jpg");
mImageView3.SetProperty( Dali::Actor::Property::NAME,"mImageView3");
mImageView3.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false);
mImageView3.SetProperty( Actor::Property::POSITION, Vector2(0, 400));
mImageView3.SetBackgroundColor(Vector4(0.0f, 0.0f, 0.0f, 0.0f));
- stage.Add(mImageView3);
+ mWindow.Add(mImageView3);
mImageView4 = Toolkit::ImageView::New("http://d2k43l0oslhof9.cloudfront.net/platform/image/contents/vc/20/01/58/20170629100630071189_0bf6b911-a847-cba4-e518-be40fe2f579420170629192203240.jpg");
mImageView4.SetProperty( Dali::Actor::Property::NAME,"mImageView4");
mImageView4.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false);
mImageView4.SetProperty( Actor::Property::POSITION, Vector2(400, 400));
mImageView4.SetBackgroundColor(Vector4(0.0f, 0.0f, 0.0f, 0.0f));
- stage.Add(mImageView4);
+ mWindow.Add(mImageView4);
mImageView5 = Toolkit::ImageView::New("http://static.midomi.com/h/images/w/weather_sunny.png");
mImageView5.SetProperty( Dali::Actor::Property::NAME,"mImageView5");
mImageView5.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false);
mImageView5.SetProperty( Actor::Property::POSITION, Vector2(800, 100));
mImageView5.SetBackgroundColor(Vector4(0.0f, 0.0f, 0.0f, 0.0f));
- stage.Add(mImageView5);
+ mWindow.Add(mImageView5);
// Tie-in input event handlers:
- stage.KeyEventSignal().Connect( this, &MyTester::OnKeyEvent );
+ mWindow.KeyEventSignal().Connect( this, &MyTester::OnKeyEvent );
}
void OnAnimationEnd(Animation &source)
{
if (event.state == KeyEvent::Down)
{
- std::cout<<"Stage key : " << event.keyCode << std::endl;
+ std::cout<<"Window key : " << event.keyCode << std::endl;
}
}
{
if (touch.GetState(0) == PointState::DOWN)
{
- std::cout<<"Stage touch" << std::endl;
+ std::cout<<"Window touch" << std::endl;
}
}
}
private:
- Stage stage;
+ Window mWindow;
Application &mApplication;
Control mControl1;
const char * const CUBE_TEXTURE( DEMO_IMAGE_DIR "people-medium-1.jpg" );
const char * const FLOOR_TEXTURE( DEMO_IMAGE_DIR "wood.png" );
-// Scale dimensions: These values are relative to the stage size. EG. width = 0.32f * stageSize.
+// Scale dimensions: These values are relative to the window size. EG. width = 0.32f * windowSize.
const float CUBE_WIDTH_SCALE( 0.32f ); ///< The width (and height + depth) of the main and reflection cubes.
const Vector2 FLOOR_DIMENSION_SCALE( 0.67f, 0.017f ); ///< The width and height of the floor object.
*/
void Create( Application& application )
{
- Stage stage = Stage::GetCurrent();
+ Window window = application.GetWindow();
// Use a gradient visual to render the background gradient.
Toolkit::Control background = Dali::Toolkit::Control::New();
Property::Array stopColors;
stopColors.PushBack( Vector4( 0.17f, 0.24f, 0.35f, 1.0f ) ); // Dark, medium saturated blue ( top of screen)
stopColors.PushBack( Vector4( 0.45f, 0.70f, 0.80f, 1.0f ) ); // Medium bright, pastel blue (bottom of screen)
- const float percentageStageHeight = stage.GetSize().height * 0.7f;
+ const float percentageWindowHeight = window.GetSize().GetHeight() * 0.7f;
background.SetProperty( Toolkit::Control::Property::BACKGROUND, Dali::Property::Map()
.Add( Toolkit::Visual::Property::TYPE, Dali::Toolkit::Visual::GRADIENT )
.Add( Toolkit::GradientVisual::Property::STOP_OFFSET, stopOffsets )
.Add( Toolkit::GradientVisual::Property::STOP_COLOR, stopColors )
- .Add( Toolkit::GradientVisual::Property::START_POSITION, Vector2( 0.0f, -percentageStageHeight ) )
- .Add( Toolkit::GradientVisual::Property::END_POSITION, Vector2( 0.0f, percentageStageHeight ) )
+ .Add( Toolkit::GradientVisual::Property::START_POSITION, Vector2( 0.0f, -percentageWindowHeight ) )
+ .Add( Toolkit::GradientVisual::Property::END_POSITION, Vector2( 0.0f, percentageWindowHeight ) )
.Add( Toolkit::GradientVisual::Property::UNITS, Toolkit::GradientVisual::Units::USER_SPACE ) );
- stage.Add( background );
+ window.Add( background );
// Create a TextLabel for the application title.
Toolkit::TextLabel label = Toolkit::TextLabel::New( APPLICATION_TITLE );
label.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
label.SetProperty( Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
label.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, TEXT_COLOR );
- stage.Add( label );
+ window.Add( label );
// Layer to hold the 3D scene.
Layer layer = Layer::New();
layer.SetProperty( Actor::Property::PARENT_ORIGIN, Vector3( 0.5f, 0.58f, 0.5f ) );
layer.SetProperty( Layer::Property::BEHAVIOR, Layer::LAYER_UI );
layer.SetProperty( Layer::Property::DEPTH_TEST, true );
- stage.Add( layer );
+ window.Add( layer );
// Main cube:
// Make the demo scalable with different resolutions by basing
- // the cube size on a percentage of the stage size.
- float scaleSize( std::min( stage.GetSize().width, stage.GetSize().height ) );
+ // the cube size on a percentage of the window size.
+ Vector2 windowSize = window.GetSize();
+ float scaleSize( std::min( windowSize.width, windowSize.height ) );
float cubeWidth( scaleSize * CUBE_WIDTH_SCALE );
Vector3 cubeSize( cubeWidth, cubeWidth, cubeWidth );
// Create the geometry for the cube, and the texture.
mRotationAnimation.Play();
mBounceAnimation.Play();
- // Respond to a click anywhere on the stage
- stage.GetRootLayer().TouchSignal().Connect( this, &RendererStencilExample::OnTouch );
+ // Respond to a click anywhere on the window
+ window.GetRootLayer().TouchSignal().Connect( this, &RendererStencilExample::OnTouch );
// Connect signals to allow Back and Escape to exit.
- stage.KeyEventSignal().Connect( this, &RendererStencilExample::OnKeyEvent );
+ window.KeyEventSignal().Connect( this, &RendererStencilExample::OnKeyEvent );
}
private:
*/
Renderer CreateRenderer( Geometry geometry, Vector3 dimensions, bool textured, Vector4 color )
{
- Stage stage = Stage::GetCurrent();
+ Window window = mApplication.GetWindow();
+ Vector2 windowSize = window.GetSize();
Shader shader;
if( textured )
shader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER );
}
- // Here we modify the light position based on half the stage size as a pre-calculation step.
+ // Here we modify the light position based on half the window size as a pre-calculation step.
// This avoids the work having to be done in the shader.
- shader.RegisterProperty( LIGHT_POSITION_UNIFORM_NAME, Vector3( -stage.GetSize().width / 2.0f, -stage.GetSize().width / 2.0f, 1000.0f ) );
+ shader.RegisterProperty( LIGHT_POSITION_UNIFORM_NAME, Vector3( -windowSize.width / 2.0f, -windowSize.width / 2.0f, 1000.0f ) );
shader.RegisterProperty( COLOR_UNIFORM_NAME, color );
shader.RegisterProperty( OBJECT_DIMENSIONS_UNIFORM_NAME, dimensions );
#define DALI_DEMO_RENDERER_STENCIL_SHADERS_H
/*
- * Copyright (c) 2016 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.
// Shader uniforms:
const char * const COLOR_UNIFORM_NAME( "uColor" );
const char * const OBJECT_DIMENSIONS_UNIFORM_NAME( "uObjectDimensions" );
-const char * const STAGE_SIZE_UNIFORM_NAME( "uStageSize" );
const char * const LIGHT_POSITION_UNIFORM_NAME = "uLightPosition";
const char * const POSITION( "aPosition");
const char * const NORMAL( "aNormal" );
/*
- * Copyright (c) 2017 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.
// The Init signal is received once (only) during the Application lifetime
void Create( Application& application )
{
- // Get a handle to the stage
- Stage stage = Stage::GetCurrent();
- stage.SetBackgroundColor( Color::BLACK );
+ // Get a handle to the window
+ Window window = application.GetWindow();
+ window.SetBackgroundColor( Color::BLACK );
mLabel = TextLabel::New( material[MaterialID].name );
mLabel.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_CENTER );
mLabel.SetProperty( Actor::Property::PARENT_ORIGIN, Vector3( 0.5f, 0.0f, 0.5f ) );
- mLabel.SetProperty( Actor::Property::SIZE, Vector2( stage.GetSize().x * 0.5f, stage.GetSize().y * 0.083f ) );
+ mLabel.SetProperty( Actor::Property::SIZE, Vector2( window.GetSize().GetWidth() * 0.5f, window.GetSize().GetHeight() * 0.083f ) );
mLabel.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
mLabel.SetProperty( TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
mLabel.SetProperty( TextLabel::Property::TEXT_COLOR, Vector4( 1.0f, 1.0f, 1.0f, 1.0f ));
- stage.Add( mLabel );
+ window.Add( mLabel );
mButton = PushButton::New();
mButton.SetProperty( Button::Property::LABEL, "Exit" );
mButton.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
mButton.SetProperty( Actor::Property::PARENT_ORIGIN, Vector3( 0.5f, 0.1f, 0.5f ) );
mButton.SetStyleName(CUSTOM_BASIC_LIGHT_THEME);
mButton.SetProperty( Actor::Property::COLOR, Vector4( material[MaterialID].diffuse) + Vector4( 0.0f, 0.0f, 0.0f, 1.0f ) );
- stage.Add(mButton);
+ window.Add(mButton);
// Step 1. Create shader
CreateCubeShader();
// Step 5. Play animation to rotate the cube
PlayAnimation();
- // Respond to a click anywhere on the stage
- stage.GetRootLayer().TouchSignal().Connect( this, &BasicLightController::OnTouch );
+ // Respond to a click anywhere on the window
+ window.GetRootLayer().TouchSignal().Connect( this, &BasicLightController::OnTouch );
// Respond to key events
- stage.KeyEventSignal().Connect( this, &BasicLightController::OnKeyEvent );
+ window.KeyEventSignal().Connect( this, &BasicLightController::OnKeyEvent );
}
/**
*/
void CreateActor()
{
- Stage stage = Stage::GetCurrent();
+ Window window = mApplication.GetWindow();
- float quarterStageWidth = stage.GetSize().x * 0.25f;
+ float quarterWindowWidth = window.GetSize().GetWidth() * 0.25f;
mActor = Actor::New();
mActor.SetProperty( Actor::Property::COLOR, Vector4( 1.0f, 1.0f, 0.6f, 1.0f ) );
mActor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
mActor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
- mActor.SetProperty( Actor::Property::SIZE, Vector3( quarterStageWidth, quarterStageWidth, quarterStageWidth ) );
+ mActor.SetProperty( Actor::Property::SIZE, Vector3( quarterWindowWidth, quarterWindowWidth, quarterWindowWidth ) );
mActor.AddRenderer( mRenderer );
- stage.Add( mActor );
+ window.Add( mActor );
}
/**
// The Init signal is received once (only) during the Application lifetime
void Create( Application& application )
{
- // Get a handle to the stage
- Stage stage = Stage::GetCurrent();
- stage.SetBackgroundColor( Color::BLACK );
+ // Get a handle to the window
+ Window window = application.GetWindow();
+ window.SetBackgroundColor( Color::BLACK );
mAnimation = Animation::New( 1.0f );
mLabel = TextLabel::New( "R:1 M:0" );
mLabel.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_CENTER );
mLabel.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_CENTER );
- mLabel.SetProperty( Actor::Property::SIZE, Vector2( stage.GetSize().width * 0.5f, stage.GetSize().height * 0.083f ) );
+ mLabel.SetProperty( Actor::Property::SIZE, Vector2( window.GetSize().GetWidth() * 0.5f, window.GetSize().GetHeight() * 0.083f ) );
mLabel.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
mLabel.SetProperty( TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
mLabel.SetProperty( TextLabel::Property::TEXT_COLOR, Color::WHITE );
// Step 3. Initialise Main Actor
InitActors();
- // Respond to a click anywhere on the stage
- stage.GetRootLayer().TouchSignal().Connect( this, &BasicPbrController::OnTouch );
+ // Respond to a click anywhere on the window
+ window.GetRootLayer().TouchSignal().Connect( this, &BasicPbrController::OnTouch );
// Respond to key events
- stage.KeyEventSignal().Connect( this, &BasicPbrController::OnKeyEvent );
+ window.KeyEventSignal().Connect( this, &BasicPbrController::OnKeyEvent );
mDoubleTapTime = Timer::New(150);
mDoubleTapTime.TickSignal().Connect( this, &BasicPbrController::OnDoubleTapTime );
}
case PointState::MOTION:
{
- const Stage stage = Stage::GetCurrent();
- const Size size = stage.GetSize();
+ const Window window = mApplication.GetWindow();
+ const Size size = window.GetSize();
const float scaleX = size.width;
const float scaleY = size.height;
const Vector2 point = touch.GetScreenPosition(0);
*/
void InitActors()
{
- Stage stage = Stage::GetCurrent();
+ Window window = mApplication.GetWindow();
+ Vector2 windowSize = window.GetSize();
mSkybox.Init( SKYBOX_SCALE );
mModel[0].Init( mShader, SPHERE_URL, Vector3::ZERO, SPHERE_SCALE );
// Creating root and camera actor for rendertask for 3D Scene rendering
mUiRoot = Actor::New();
m3dRoot = Actor::New();
- CameraActor cameraUi = CameraActor::New(stage.GetSize());
+ CameraActor cameraUi = CameraActor::New(window.GetSize());
cameraUi.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::CENTER);
cameraUi.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::CENTER);
- RenderTask rendertask = Stage::GetCurrent().GetRenderTaskList().CreateTask();
+ RenderTask rendertask = window.GetRenderTaskList().CreateTask();
rendertask.SetCameraActor( cameraUi );
rendertask.SetSourceActor( mUiRoot );
- mUiRoot.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
- mUiRoot.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::TOP_LEFT);
- mUiRoot.SetProperty( Actor::Property::SIZE, stage.GetSize());
+ mUiRoot.SetProperty(Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ mUiRoot.SetProperty(Actor::Property::PARENT_ORIGIN,ParentOrigin::TOP_LEFT);
+ mUiRoot.SetProperty(Actor::Property::SIZE, Vector2(window.GetSize()) );
- m3dRoot.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::CENTER);
- m3dRoot.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::CENTER);
+ m3dRoot.SetProperty(Actor::Property::ANCHOR_POINT,AnchorPoint::CENTER);
+ m3dRoot.SetProperty(Actor::Property::PARENT_ORIGIN,ParentOrigin::CENTER);
// Setting camera parameters for 3D Scene
mSkybox.GetActor().SetProperty( Actor::Property::POSITION, CAMERA_DEFAULT_POSITION );
- CameraActor camera3d = stage.GetRenderTaskList().GetTask(0).GetCameraActor();
+ CameraActor camera3d = window.GetRenderTaskList().GetTask(0).GetCameraActor();
camera3d.SetInvertYAxis( true );
camera3d.SetProperty( Actor::Property::POSITION, CAMERA_DEFAULT_POSITION );
camera3d.SetNearClippingPlane( CAMERA_DEFAULT_NEAR );
camera3d.SetFarClippingPlane( CAMERA_DEFAULT_FAR );
camera3d.SetFieldOfView( Radian( Degree( CAMERA_DEFAULT_FOV ) ) );
- stage.Add( cameraUi );
- stage.Add( mUiRoot );
- stage.Add( m3dRoot );
+ window.Add( cameraUi );
+ window.Add( mUiRoot );
+ window.Add( m3dRoot );
m3dRoot.Add( mSkybox.GetActor() );
m3dRoot.Add( mModel[0].GetActor() );
m3dRoot.Add( mModel[1].GetActor() );
- if( (stage.GetSize().x > 360.0f) && (stage.GetSize().y > 360.0f) )
+ if( (windowSize.x > 360.0f) && (windowSize.y > 360.0f) )
{
mUiRoot.Add( mLabel );
}
/*
- * Copyright (c) 2017 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.
// The Init signal is received once (only) during the Application lifetime
void Create( Application& application )
{
- // Get a handle to the stage
- Stage stage = Stage::GetCurrent();
- stage.SetBackgroundColor( Color::WHITE );
+ // Get a handle to the window
+ Window window = application.GetWindow();
+ window.SetBackgroundColor( Color::WHITE );
// Step 1. Create shader
CreateCubeShader();
// Step 5. Play animation to rotate the cube
PlayAnimation();
- // Respond to a click anywhere on the stage
- stage.GetRootLayer().TouchSignal().Connect( this, &DrawCubeController::OnTouch );
+ // Respond to a click anywhere on the window
+ window.GetRootLayer().TouchSignal().Connect( this, &DrawCubeController::OnTouch );
// Respond to key events
- stage.KeyEventSignal().Connect( this, &DrawCubeController::OnKeyEvent );
+ window.KeyEventSignal().Connect( this, &DrawCubeController::OnKeyEvent );
}
bool OnTouch( Actor actor, const TouchData& touch )
*/
void CreateActor()
{
- Stage stage = Stage::GetCurrent();
+ Window window = mApplication.GetWindow();
- float quarterStageWidth = stage.GetSize().x * 0.25f;
+ float quarterWindowWidth = window.GetSize().GetWidth() * 0.25f;
mActor = Actor::New();
mActor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
mActor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
mActor.SetProperty( Actor::Property::POSITION, Vector3( 0.0f, 0.0f, 0.0f ) );
- mActor.SetProperty( Actor::Property::SIZE, Vector3( quarterStageWidth, quarterStageWidth, quarterStageWidth ) );
+ mActor.SetProperty( Actor::Property::SIZE, Vector3( quarterWindowWidth, quarterWindowWidth, quarterWindowWidth ) );
mActor.AddRenderer( mRenderer );
- stage.Add( mActor );
+ window.Add( mActor );
}
/**
/*
- * Copyright (c) 2017 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.
// The Init signal is received once (only) during the Application lifetime
void Create( Application& application )
{
- // Get a handle to the stage
- Stage stage = Stage::GetCurrent();
- stage.SetBackgroundColor( Color::WHITE );
+ // Get a handle to the window
+ Window window = application.GetWindow();
+ window.SetBackgroundColor( Color::WHITE );
// Step 1. Create shader
CreateLineShader();
// Step 4. Create an Actor
CreateActor();
- // Respond to a click anywhere on the stage
- stage.GetRootLayer().TouchSignal().Connect( this, &DrawLineController::OnTouch );
+ // Respond to a click anywhere on the window
+ window.GetRootLayer().TouchSignal().Connect( this, &DrawLineController::OnTouch );
// Respond to key events
- stage.KeyEventSignal().Connect( this, &DrawLineController::OnKeyEvent );
+ window.KeyEventSignal().Connect( this, &DrawLineController::OnKeyEvent );
}
bool OnTouch( Actor actor, const TouchData& touch )
*/
void CreateActor()
{
- Stage stage = Stage::GetCurrent();
- Size size = stage.GetSize() * 0.25f;
+ Window window = mApplication.GetWindow();
+ Size size = Vector2(window.GetSize()) * 0.25f;
mActor = Actor::New();
mActor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
mActor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
mActor.SetProperty( Actor::Property::COLOR, Color::BLACK );
mActor.SetProperty( Actor::Property::SIZE, Vector3( size.x, size.x, size.x ) );
mActor.AddRenderer( mRenderer );
- stage.Add( mActor );
+ window.Add( mActor );
}
private:
/*
- * Copyright (c) 2017 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.
// The Init signal is received once (only) during the Application lifetime
void Create( Application& application )
{
- Stage stage = Stage::GetCurrent();
- stage.SetBackgroundColor( Color::BLACK );
+ Window window = application.GetWindow();
+ window.SetBackgroundColor( Color::BLACK );
- // Connect to the stage's key signal to allow Back and Escape to exit.
- stage.KeyEventSignal().Connect( this, &RadialProgressController::OnKeyEvent );
+ // Connect to the window's key signal to allow Back and Escape to exit.
+ window.KeyEventSignal().Connect( this, &RadialProgressController::OnKeyEvent );
// 1. Create actor to show the effect
mActor = Actor::New();
mActor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
mActor.SetProperty( Actor::Property::SIZE, Vector2( TEXTURE_WIDTH, TEXTURE_HEIGHT ) );
mActor.RegisterProperty("uProgress", float(1.0f) );
- stage.Add( mActor );
+ window.Add( mActor );
// 1. Create stencil renderer i.e. a triangle fan in the shape of a circle
Renderer stencilRenderer = CreatePolygon( NUMBER_OF_SIDES );
animation.Play();
// 6. Exit the application when touched
- stage.GetRootLayer().TouchSignal().Connect( this, &RadialProgressController::OnTouch );
+ window.GetRootLayer().TouchSignal().Connect( this, &RadialProgressController::OnTouch );
}
bool OnTouch( Actor actor, const TouchData& touch )
/*
- * Copyright (c) 2017 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.
#include "look-camera.h"
-#include <dali/public-api/common/stage.h>
#include <dali/public-api/render-tasks/render-task-list.h>
#include <dali/public-api/render-tasks/render-task.h>
#include <dali/public-api/events/touch-data.h>
mCameraActor.Remove( mInterceptorActor );
}
-void LookCamera::Initialise( const Vector3& position, float fovY, float near, float far )
+void LookCamera::Initialise( Window window, const Vector3& position, float fovY, float near, float far )
{
+ mWindow = window;
+
mFovY = fovY;
mNear = near;
mFar = far;
bool LookCamera::OnTick()
{
- Vector2 stageSize = Stage::GetCurrent().GetSize();
+ Vector2 windowSize = mWindow.GetSize();
// ---------------------------------------------------------------------
// update rotation
Vector2 tmp( mScreenLookDelta );
mScreenLookDelta = Vector2::ZERO;
- float yaw = ( (tmp.y / stageSize.x ) * CAMERA_SENSITIVITY );
- float pitch = ( (tmp.x / stageSize.y ) * CAMERA_SENSITIVITY );
+ float yaw = ( (tmp.y / windowSize.x ) * CAMERA_SENSITIVITY );
+ float pitch = ( (tmp.x / windowSize.y ) * CAMERA_SENSITIVITY );
mCameraYawPitch.x -= yaw;
mCameraYawPitch.y -= pitch;
if( abs( mCameraYawPitch.x ) > CAMERA_VERTICAL_LIMIT )
void LookCamera::InitialiseDefaultCamera()
{
- Stage stage = Stage::GetCurrent();
- mCameraActor = stage.GetRenderTaskList().GetTask(0).GetCameraActor();
+ mCameraActor = mWindow.GetRenderTaskList().GetTask(0).GetCameraActor();
mCameraActor.SetProperty( Dali::Actor::Property::NAME, "LookCamera" );
mCameraActor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
mCameraActor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
void LookCamera::CreateInterceptorActor()
{
- Stage stage = Stage::GetCurrent();
+ Vector2 windowSize = mWindow.GetSize();
mInterceptorActor = Actor::New();
mInterceptorActor.SetProperty( Dali::Actor::Property::NAME, "InputInterceptor" );
- mInterceptorActor.SetProperty( Actor::Property::SIZE, Vector3( stage.GetSize().x, stage.GetSize().y, 1 ) );
+ mInterceptorActor.SetProperty( Actor::Property::SIZE, Vector3( windowSize.width, windowSize.height, 1 ) );
mInterceptorActor.SetProperty( Actor::Property::POSITION, Vector3( 0.0, 0.0, 1.0 ) );
mInterceptorActor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
mInterceptorActor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
bool LookCamera::OnTouch( Actor actor, const TouchData& touch )
{
- Stage stage = Stage::GetCurrent();
-
for( int i = 0; i < (int)touch.GetPointCount() && i < 3; ++i )
{
Vector2 position( touch.GetScreenPosition( i ) );
#define LOOK_CAMERA_H
/*
- * Copyright (c) 2017 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.
#include <dali/public-api/actors/camera-actor.h>
#include <dali/public-api/adaptor-framework/timer.h>
+#include <dali/public-api/adaptor-framework/window.h>
#include <dali/public-api/math/vector2.h>
/**
/**
* Initialise with given position, fovY, near, far
- * @param[in] position Position of the camera.
+ * @param[in] window The window the camera is for
+ * @param[in] position Position of the camera
* @param[in] fovY Field of view in degrees
* @param[in] near Near plane
* @param[in] far Far Plane
*/
- void Initialise( const Dali::Vector3& position, float fov, float near, float far );
+ void Initialise( Dali::Window window, const Dali::Vector3& position, float fov, float near, float far );
/**
* Retrieves actor associated with camera object
private:
+ Dali::Window mWindow; /// The window the camera belongs to
+
Dali::CameraActor mCameraActor; /// Camera actor
Dali::Actor mInterceptorActor; /// Actor intercepting user input
// The Init signal is received once (only) during the Application lifetime
void Create( Application& application )
{
- // Get a handle to the stage
- Stage stage = Stage::GetCurrent();
- stage.SetBackgroundColor( Color::WHITE );
+ // Get a handle to the window
+ Window window = application.GetWindow();
+ window.SetBackgroundColor( Color::WHITE );
// Step 1. Setup camera
SetupCamera();
PlayAnimation();
// Respond to key events
- stage.KeyEventSignal().Connect( this, &TexturedCubeController::OnKeyEvent );
+ window.KeyEventSignal().Connect( this, &TexturedCubeController::OnKeyEvent );
}
/**
*/
void SetupCamera()
{
- Stage stage = Stage::GetCurrent();
+ Window window = mApplication.GetWindow();
- RenderTask renderTask = stage.GetRenderTaskList().GetTask( 0 );
+ RenderTask renderTask = window.GetRenderTaskList().GetTask( 0 );
renderTask.SetCullMode( false ); // avoid frustum culling affecting the skybox
- mCamera.Initialise( CAMERA_DEFAULT_POSITION, CAMERA_DEFAULT_FOV, CAMERA_DEFAULT_NEAR, CAMERA_DEFAULT_FAR );
+ mCamera.Initialise( window, CAMERA_DEFAULT_POSITION, CAMERA_DEFAULT_FOV, CAMERA_DEFAULT_NEAR, CAMERA_DEFAULT_FAR );
}
/**
mActor.SetProperty( Actor::Property::SIZE, Vector3( 10.f, 10.f, 10.f ) );
- Stage stage = Stage::GetCurrent();
- stage.Add( mActor );
+ Window window = mApplication.GetWindow();
+ window.Add( mActor );
}
/**
// The fragment shader will run only is those pixels that have the max depth value.
mSkyboxRenderer.SetProperty( Renderer::Property::DEPTH_FUNCTION, DepthFunction::LESS_EQUAL );
- Stage stage = Stage::GetCurrent();
+ Window window = mApplication.GetWindow();
mSkyboxActor = Actor::New();
mSkyboxActor.SetProperty( Dali::Actor::Property::NAME, "SkyBox" );
mSkyboxActor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
mSkyboxActor.SetProperty( Actor::Property::POSITION, CAMERA_DEFAULT_POSITION );
mSkyboxActor.AddRenderer( mSkyboxRenderer );
- stage.Add( mSkyboxActor );
+ window.Add( mSkyboxActor );
}
/**
/*
- * Copyright (c) 2017 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.
// The Init signal is received once (only) during the Application lifetime
void Create( Application& application )
{
- // Get a handle to the stage
- Stage stage = Stage::GetCurrent();
- stage.SetBackgroundColor( Color::WHITE );
+ // Get a handle to the window
+ Window window = application.GetWindow();
+ window.SetBackgroundColor( Color::WHITE );
// Step 1. Create shader
CreateCubeShader();
// Step 6. Play animation to rotate the cube
PlayAnimation();
- // Respond to a click anywhere on the stage
- stage.GetRootLayer().TouchSignal().Connect( this, &TexturedCubeController::OnTouch );
+ // Respond to a click anywhere on the window
+ window.GetRootLayer().TouchSignal().Connect( this, &TexturedCubeController::OnTouch );
// Respond to key events
- stage.KeyEventSignal().Connect( this, &TexturedCubeController::OnKeyEvent );
+ window.KeyEventSignal().Connect( this, &TexturedCubeController::OnKeyEvent );
}
bool OnTouch( Actor actor, const TouchData& touch )
*/
void CreateActor()
{
- Stage stage = Stage::GetCurrent();
+ Window window = mApplication.GetWindow();
- float quarterStageWidth = stage.GetSize().x * 0.25f;
+ float quarterWindowWidth = window.GetSize().GetWidth() * 0.25f;
mActor = Actor::New();
mActor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
mActor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
mActor.SetProperty( Actor::Property::POSITION, Vector3( 0.0f, 0.0f, 0.0f ) );
- mActor.SetProperty( Actor::Property::SIZE, Vector3( quarterStageWidth, quarterStageWidth, quarterStageWidth ) );
+ mActor.SetProperty( Actor::Property::SIZE, Vector3( quarterWindowWidth, quarterWindowWidth, quarterWindowWidth ) );
mActor.AddRenderer( mRenderer );
- stage.Add( mActor );
+ window.Add( mActor );
}
/**
/*
- * Copyright (c) 2017 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.
// The Init signal is received once (only) during the Application lifetime
void Create( Application& application )
{
- // Get a handle to the stage
- Stage stage = Stage::GetCurrent();
- stage.SetBackgroundColor( Color::WHITE );
+ // Get a handle to the window
+ Window window = application.GetWindow();
+ window.SetBackgroundColor( Color::WHITE );
// Step 1. Create shader
CreateTriangleShader();
// Step 4. Create an Actor
CreateActor();
- // Respond to a click anywhere on the stage
- stage.GetRootLayer().TouchSignal().Connect( this, &DrawTriangleController::OnTouch );
+ // Respond to a click anywhere on the window
+ window.GetRootLayer().TouchSignal().Connect( this, &DrawTriangleController::OnTouch );
// Respond to key events
- stage.KeyEventSignal().Connect( this, &DrawTriangleController::OnKeyEvent );
+ window.KeyEventSignal().Connect( this, &DrawTriangleController::OnKeyEvent );
}
bool OnTouch( Actor actor, const TouchData& touch )
*/
void CreateActor()
{
- Stage stage = Stage::GetCurrent();
- Size size = stage.GetSize() * 0.25f;
+ Window window = mApplication.GetWindow();
+ Size size = Vector2(window.GetSize()) * 0.25f;
mActor = Actor::New();
mActor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
mActor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
mActor.SetProperty( Actor::Property::COLOR, Color::RED );
mActor.SetProperty( Actor::Property::SIZE, Vector3( size.x, size.x, size.x ) );
mActor.AddRenderer( mRenderer );
- stage.Add( mActor );
+ window.Add( mActor );
}
private:
*/
void OnInit(Application& app)
{
- Stage stage = Dali::Stage::GetCurrent();
- stage.KeyEventSignal().Connect(this, &ExampleController::OnKeyEvent);
+ Window window = app.GetWindow();
+ window.KeyEventSignal().Connect(this, &ExampleController::OnKeyEvent);
// Creates a default view with a default tool bar.
- // The view is added to the stage.
+ // The view is added to the window.
mContentLayer = DemoHelper::CreateView( app,
mView,
mToolBar,
*/
void AddContentLayer()
{
- Stage stage = Stage::GetCurrent();
- Vector2 stageSize = stage.GetSize();
+ Window window = mApplication.GetWindow();
+ Vector2 windowSize = window.GetSize();
mScrollView = ScrollView::New();
mScrollView.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::CENTER);
mScrollView.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::CENTER);
mContentLayer.Add( mScrollView );
- mScrollView.SetProperty( Actor::Property::SIZE, stageSize );
+ mScrollView.SetProperty( Actor::Property::SIZE, windowSize );
mScrollView.SetAxisAutoLock( true );
mScrollView.SetAxisAutoLockGradient( 1.0f );
{
Actor page = CreatePage();
- page.SetProperty( Actor::Property::POSITION, Vector2( column * stageSize.x, row * stageSize.y ));
+ page.SetProperty( Actor::Property::POSITION, Vector2( column * windowSize.x, row * windowSize.y ));
mScrollView.Add( page );
mPages.push_back(page);
page.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
page.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
- Stage stage = Stage::GetCurrent();
- Vector2 stageSize = stage.GetSize();
+ Window window = mApplication.GetWindow();
+ Vector2 windowSize = window.GetSize();
const float margin = 10.0f;
- // Calculate the number of images going across (columns) within a page, according to the screen resolution and dpi.
- int imageColumns = round(IMAGE_ROWS * (stageSize.x / stage.GetDpi().x) / (stageSize.y / stage.GetDpi().y));
- const Vector3 imageSize((stageSize.x / imageColumns) - margin, (stageSize.y / IMAGE_ROWS) - margin, 0.0f);
+ // Calculate the number of images going across (columns) within a page, according to the screen resolution
+ int imageColumns = round(IMAGE_ROWS * (windowSize.x / windowSize.y));
+ const Vector3 imageSize((windowSize.x / imageColumns) - margin, (windowSize.y / IMAGE_ROWS) - margin, 0.0f);
for(int row = 0;row<IMAGE_ROWS;row++)
{
image.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
image.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
- Vector3 position( margin * 0.5f + (imageSize.x + margin) * column - stageSize.width * 0.5f,
- margin * 0.5f + (imageSize.y + margin) * row - stageSize.height * 0.5f,
+ Vector3 position( margin * 0.5f + (imageSize.x + margin) * column - windowSize.width * 0.5f,
+ margin * 0.5f + (imageSize.y + margin) * row - windowSize.height * 0.5f,
0.0f);
image.SetProperty( Actor::Property::POSITION, position + imageSize * 0.5f );
image.SetProperty( Actor::Property::SIZE, imageSize );
{
bool snap(true);
- Stage stage = Stage::GetCurrent();
- Vector2 stageSize = stage.GetSize();
+ Window window = mApplication.GetWindow();
+ Vector2 windowSize = window.GetSize();
- RulerPtr rulerX = CreateRuler(snap ? stageSize.width : 0.0f);
+ RulerPtr rulerX = CreateRuler(snap ? windowSize.width : 0.0f);
RulerPtr rulerY = new DefaultRuler;
- rulerX->SetDomain(RulerDomain(0.0f, stageSize.x * PAGE_COLUMNS, false));
+ rulerX->SetDomain(RulerDomain(0.0f, windowSize.x * PAGE_COLUMNS, false));
rulerY->Disable();
Dali::Path path = Dali::Path::New();
if( mEffectMode == PageCarouselEffect)
{
- points[0] = Vector3( stageSize.x*0.75, 0.0f, -stageSize.x*0.75f);
+ points[0] = Vector3( windowSize.x*0.75, 0.0f, -windowSize.x*0.75f);
points[1] = Vector3( 0.0f, 0.0f, 0.0f );
- points[2] = Vector3( -stageSize.x*0.75f, 0.0f, -stageSize.x*0.75f);
+ points[2] = Vector3( -windowSize.x*0.75f, 0.0f, -windowSize.x*0.75f);
path.SetProperty( Path::Property::POINTS, points );
- controlPoints[0] = Vector3( stageSize.x*0.5f, 0.0f, 0.0f );
- controlPoints[1] = Vector3( stageSize.x*0.5f, 0.0f, 0.0f );
- controlPoints[2] = Vector3(-stageSize.x*0.5f, 0.0f, 0.0f );
- controlPoints[3] = Vector3(-stageSize.x*0.5f, 0.0f, 0.0f );
+ controlPoints[0] = Vector3( windowSize.x*0.5f, 0.0f, 0.0f );
+ controlPoints[1] = Vector3( windowSize.x*0.5f, 0.0f, 0.0f );
+ controlPoints[2] = Vector3(-windowSize.x*0.5f, 0.0f, 0.0f );
+ controlPoints[3] = Vector3(-windowSize.x*0.5f, 0.0f, 0.0f );
path.SetProperty( Path::Property::CONTROL_POINTS, controlPoints );
forward = Vector3::ZERO;
}
else if( mEffectMode == PageCubeEffect)
{
- points[0] = Vector3( stageSize.x*0.5, 0.0f, stageSize.x*0.5f);
+ points[0] = Vector3( windowSize.x*0.5, 0.0f, windowSize.x*0.5f);
points[1] = Vector3( 0.0f, 0.0f, 0.0f );
- points[2] = Vector3( -stageSize.x*0.5f, 0.0f, stageSize.x*0.5f);
+ points[2] = Vector3( -windowSize.x*0.5f, 0.0f, windowSize.x*0.5f);
path.SetProperty( Path::Property::POINTS, points );
- controlPoints[0] = Vector3( stageSize.x*0.5f, 0.0f, stageSize.x*0.3f );
- controlPoints[1] = Vector3( stageSize.x*0.3f, 0.0f, 0.0f );
- controlPoints[2] = Vector3(-stageSize.x*0.3f, 0.0f, 0.0f );
- controlPoints[3] = Vector3(-stageSize.x*0.5f, 0.0f, stageSize.x*0.3f );
+ controlPoints[0] = Vector3( windowSize.x*0.5f, 0.0f, windowSize.x*0.3f );
+ controlPoints[1] = Vector3( windowSize.x*0.3f, 0.0f, 0.0f );
+ controlPoints[2] = Vector3(-windowSize.x*0.3f, 0.0f, 0.0f );
+ controlPoints[3] = Vector3(-windowSize.x*0.5f, 0.0f, windowSize.x*0.3f );
path.SetProperty( Path::Property::CONTROL_POINTS, controlPoints );
forward = Vector3(-1.0f,0.0f,0.0f);
}
else if( mEffectMode == PageSpiralEffect)
{
- points[0] = Vector3( stageSize.x*0.5, 0.0f, -stageSize.x*0.5f);
+ points[0] = Vector3( windowSize.x*0.5, 0.0f, -windowSize.x*0.5f);
points[1] = Vector3( 0.0f, 0.0f, 0.0f );
- points[2] = Vector3( -stageSize.x*0.5f, 0.0f, -stageSize.x*0.5f);
+ points[2] = Vector3( -windowSize.x*0.5f, 0.0f, -windowSize.x*0.5f);
path.SetProperty( Path::Property::POINTS, points );
- controlPoints[0] = Vector3( stageSize.x*0.5f, 0.0f, 0.0f );
- controlPoints[1] = Vector3( stageSize.x*0.5f, 0.0f, 0.0f );
- controlPoints[2] = Vector3(-stageSize.x*0.5f, 0.0f, 0.0f );
- controlPoints[3] = Vector3(-stageSize.x*0.5f, 0.0f, 0.0f );
+ controlPoints[0] = Vector3( windowSize.x*0.5f, 0.0f, 0.0f );
+ controlPoints[1] = Vector3( windowSize.x*0.5f, 0.0f, 0.0f );
+ controlPoints[2] = Vector3(-windowSize.x*0.5f, 0.0f, 0.0f );
+ controlPoints[3] = Vector3(-windowSize.x*0.5f, 0.0f, 0.0f );
path.SetProperty( Path::Property::CONTROL_POINTS, controlPoints );
forward = Vector3(-1.0f,0.0f,0.0f);
}
else if( mEffectMode == PageWaveEffect)
{
- points[0] = Vector3( stageSize.x, 0.0f, -stageSize.x);
+ points[0] = Vector3( windowSize.x, 0.0f, -windowSize.x);
points[1] = Vector3( 0.0f, 0.0f, 0.0f );
- points[2] = Vector3( -stageSize.x, 0.0f, -stageSize.x);
+ points[2] = Vector3( -windowSize.x, 0.0f, -windowSize.x);
path.SetProperty( Path::Property::POINTS, points );
- controlPoints[0] = Vector3( 0.0f, 0.0f, -stageSize.x );
- controlPoints[1] = Vector3( stageSize.x*0.5f, 0.0f, 0.0f );
- controlPoints[2] = Vector3( -stageSize.x*0.5f, 0.0f, 0.0f);
- controlPoints[3] = Vector3(0.0f, 0.0f,-stageSize.x );
+ controlPoints[0] = Vector3( 0.0f, 0.0f, -windowSize.x );
+ controlPoints[1] = Vector3( windowSize.x*0.5f, 0.0f, 0.0f );
+ controlPoints[2] = Vector3( -windowSize.x*0.5f, 0.0f, 0.0f);
+ controlPoints[3] = Vector3(0.0f, 0.0f,-windowSize.x );
path.SetProperty( Path::Property::CONTROL_POINTS, controlPoints );
forward = Vector3(-1.0f,0.0f,0.0f);
}
- mScrollViewEffect = ScrollViewPagePathEffect::New(path, forward,Toolkit::ScrollView::Property::SCROLL_FINAL_X, Vector3(stageSize.x,stageSize.y,0.0f),PAGE_COLUMNS);
+ mScrollViewEffect = ScrollViewPagePathEffect::New(path, forward,Toolkit::ScrollView::Property::SCROLL_FINAL_X, Vector3(windowSize.x,windowSize.y,0.0f),PAGE_COLUMNS);
mScrollView.SetScrollSnapDuration(EFFECT_SNAP_DURATION);
mScrollView.SetScrollFlickDuration(EFFECT_FLICK_DURATION);
mScrollView.SetScrollSnapAlphaFunction(AlphaFunction::EASE_OUT);
mScrollView.SetScrollFlickAlphaFunction(AlphaFunction::EASE_OUT);
mScrollView.RemoveConstraintsFromChildren();
- rulerX = CreateRuler(snap ? stageSize.width * 0.5f : 0.0f);
- rulerX->SetDomain( RulerDomain( 0.0f, stageSize.x * 0.5f * PAGE_COLUMNS, false ) );
+ rulerX = CreateRuler(snap ? windowSize.width * 0.5f : 0.0f);
+ rulerX->SetDomain( RulerDomain( 0.0f, windowSize.x * 0.5f * PAGE_COLUMNS, false ) );
unsigned int currentPage = mScrollView.GetCurrentPage();
if( mScrollViewEffect )
/*
- * 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.
const Vector3 RIGHT_POINT( R3_2, 0.5f, 0.0f);
const Vector3 FRONT_POINT( 0.0f, 0.0f, 20.0f);
-const Vector2 DEFAULT_STAGE_SIZE( 480.0f, 800.0f );
+const Vector2 DEFAULT_WINDOW_SIZE( 480.0f, 800.0f );
const float X_ROTATION_DISPLACEMENT_FACTOR = 60.f;
const float Y_ROTATION_DISPLACEMENT_FACTOR = 60.f;
{
srand(0); // Want repeatable path
- Stage::GetCurrent().KeyEventSignal().Connect(this, &TestApp::OnKeyEvent);
+ app.GetWindow().KeyEventSignal().Connect(this, &TestApp::OnKeyEvent);
CreateToolbarAndView(app);
CreateShadowViewAndLights();
void CreateToolbarAndView(Application& app)
{
// Creates a default view with a default tool bar.
- // The view is added to the stage.
+ // The view is added to the window.
Toolkit::ToolBar toolBar;
mContents = DemoHelper::CreateView( app,
mView,
mLightAnchor.SetProperty( Actor::Property::ORIENTATION, CalculateWorldRotation( mLightXRotation, mLightYRotation ) );
// Work out a scaling factor as the initial light position was calculated for desktop
- // Need to scale light position as scene actor size is based on stage size (i.e. much bigger on device)
- Vector2 stageSize( Stage::GetCurrent().GetSize() );
- float scaleFactor = stageSize.x / DEFAULT_STAGE_SIZE.x;
+ // Need to scale light position as scene actor size is based on window size (i.e. much bigger on device)
+ Vector2 windowSize( mApp.GetWindow().GetSize() );
+ float scaleFactor = windowSize.x / DEFAULT_WINDOW_SIZE.x;
mCastingLight = Actor::New();
mCastingLight.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::CENTER);
{
if( mSceneActor )
{
- Stage::GetCurrent().Remove(mSceneActor);
+ mApp.GetWindow().Remove(mSceneActor);
}
if( mView )
{
- Stage::GetCurrent().Remove(mView);
+ mApp.GetWindow().Remove(mView);
}
}
/*
- * 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.
*/
void Create( Application& application )
{
- Stage stage = Stage::GetCurrent();
+ Window window = application.GetWindow();
- stage.KeyEventSignal().Connect(this, &SimpleTextLabelExample::OnKeyEvent);
+ window.KeyEventSignal().Connect(this, &SimpleTextLabelExample::OnKeyEvent);
TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
label01.SetBackgroundColor( Color::BLACK );
- stage.Add( label01 );
+ window.Add( label01 );
TextLabel label02 = TextLabel::New();
label02.SetBackgroundColor( Color::BLACK );
- stage.Add( label02 );
+ window.Add( label02 );
TextLabel label03 = TextLabel::New();
label03.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
label03.SetBackgroundColor( Color::WHITE );
- stage.Add( label03 );
+ window.Add( label03 );
TextLabel label04 = TextLabel::New();
label04.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
label04.SetBackgroundColor( Color::BLACK );
- stage.Add( label04 );
+ window.Add( label04 );
}
/**
/*
- * 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.
*/
void OnInit(Application& app)
{
- Stage stage = Dali::Stage::GetCurrent();
- stage.SetBackgroundColor( Color::WHITE );
- stage.KeyEventSignal().Connect(this, &ExampleController::OnKeyEvent);
+ Window window = app.GetWindow();
+ Vector2 windowSize = window.GetSize();
+ window.SetBackgroundColor( Color::WHITE );
+ window.KeyEventSignal().Connect(this, &ExampleController::OnKeyEvent);
- // Make the scroll view's size a certain percentage of the stage
- const Vector2 pageSize = stage.GetSize() * 0.75f;
+ // Make the scroll view's size a certain percentage of the window
+ const Vector2 pageSize = windowSize * 0.75f;
// Create a scroll view and set our desired properties
ScrollView scrollView = ScrollView::New();
scrollView.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
scrollView.SetProperty( Actor::Property::SIZE, pageSize );
scrollView.SetAxisAutoLock( true );
- stage.Add( scrollView );
+ window.Add( scrollView );
// We want to the scroll-view so only one page is shown
scrollView.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX );
page.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
page.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
- Stage stage = Stage::GetCurrent();
+ Window window = mApplication.GetWindow();
// Calculate the number of images going across (columns) within a page, the image size and the size of the text
const int imageColumns = round( ROWS_PER_PAGE * ( pageSize.width ) / ( pageSize.height ) );
/*
- * 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.
*/
void Create( Application& application )
{
- Stage stage = Stage::GetCurrent();
- stage.KeyEventSignal().Connect(this, &SimpleTextFieldExample::OnKeyEvent);
- stage.SetBackgroundColor( Vector4( 0.04f, 0.345f, 0.392f, 1.0f ) );
+ Window window = application.GetWindow();
+ window.KeyEventSignal().Connect(this, &SimpleTextFieldExample::OnKeyEvent);
+ window.SetBackgroundColor( Vector4( 0.04f, 0.345f, 0.392f, 1.0f ) );
TextField field = TextField::New();
field.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
field.SetProperty( TextField::Property::PLACEHOLDER_TEXT, "Unnamed folder" );
field.SetProperty( TextField::Property::PLACEHOLDER_TEXT_FOCUSED, "Enter folder name." );
- stage.Add( field );
+ window.Add( field );
}
/**
/*
- * 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.
*/
void Create( Application& application )
{
- Stage stage = Stage::GetCurrent();
+ Window window = application.GetWindow();
- stage.KeyEventSignal().Connect(this, &SimpleTextLabelExample::OnKeyEvent);
+ window.KeyEventSignal().Connect(this, &SimpleTextLabelExample::OnKeyEvent);
mLabel = TextLabel::New( "A Quick Brown Fox Jumps Over The Lazy Dog" );
mLabel.SetProperty( Dali::Actor::Property::NAME, "SimpleTextLabel" );
mLabel.SetProperty( TextLabel::Property::TEXT_COLOR, Color::BLACK );
mLabel.SetBackgroundColor( Color::WHITE );
- stage.Add( mLabel );
+ window.Add( mLabel );
}
/**
/*
- * 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.
*/
void Create( Application& application )
{
- Stage stage = Stage::GetCurrent();
- stage.SetBackgroundColor( Color::WHITE );
- stage.SetBackgroundColor( Vector4( 0.04f, 0.345f, 0.392f, 1.0f ) );
+ Window window = application.GetWindow();
+ window.SetBackgroundColor( Color::WHITE );
+ window.SetBackgroundColor( Vector4( 0.04f, 0.345f, 0.392f, 1.0f ) );
- stage.KeyEventSignal().Connect(this, &SimpleTextRendererExample::OnKeyEvent);
+ window.KeyEventSignal().Connect(this, &SimpleTextRendererExample::OnKeyEvent);
const std::string image1 = "<item 'width'=26 'height'=26 'url'='" + IMAGE1 + "'/>";
const std::string image2 = "<item 'width'=26 'height'=26/>";
actor.AddRenderer( renderer );
- stage.Add( actor );
+ window.Add( actor );
}
/**
/*
- * 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.
*/
void Create( Application& application )
{
- Stage stage = Stage::GetCurrent();
+ Window window = application.GetWindow();
- stage.KeyEventSignal().Connect(this, &TextVisualExample::OnKeyEvent);
- stage.SetBackgroundColor( Color::WHITE );
+ window.KeyEventSignal().Connect(this, &TextVisualExample::OnKeyEvent);
+ window.SetBackgroundColor( Color::WHITE );
Dali::Toolkit::Control control = Dali::Toolkit::ImageView::New();
control.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
control.SetProperty( Dali::Toolkit::Control::Property::BACKGROUND, map );
- stage.Add( control );
+ window.Add( control );
}
/**
void SimpleVisualsApplication::Create( Application& application )
{
- Stage stage = Stage::GetCurrent();
- stage.SetBackgroundColor( Vector4( 0.1f, 0.1f, 0.1f, 1.0f ) );
+ Window window = application.GetWindow();
+ window.SetBackgroundColor( Vector4( 0.1f, 0.1f, 0.1f, 1.0f ) );
// Connect to key events so can quit application
- stage.KeyEventSignal().Connect(this, &SimpleVisualsApplication::OnKeyEvent);
+ window.KeyEventSignal().Connect(this, &SimpleVisualsApplication::OnKeyEvent);
// Create a table view to parent the 2 MyControls
TableView contentLayout = TableView::New( 2, 2 );
// Listen to focus change so can see Visual change from NORMAL to FOCUSED state
KeyboardFocusManager::Get().PreFocusChangeSignal().Connect( this, &SimpleVisualsApplication::OnKeyboardPreFocusChange );
- stage.Add( contentLayout );
+ window.Add( contentLayout );
// Create 2 MyControls and add to table view.
mMyControl = MyControl::New();
/*
- * Copyright (c) 2017 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.
void Create( Application& application )
{
// The Init signal is received once (only) during the Application lifetime
- Stage stage = Stage::GetCurrent();
+ Window window = application.GetWindow();
// Respond to key events if not handled
- stage.KeyEventSignal().Connect(this, &SizeNegotiationController::OnKeyEvent);
+ window.KeyEventSignal().Connect(this, &SizeNegotiationController::OnKeyEvent);
// Creates a default view with a default tool bar.
- // The view is added to the stage.
+ // The view is added to the window.
mContentLayer = DemoHelper::CreateView( application,
mView,
mToolBar,
mItemView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
// Use a grid layout for tests
- Vector2 stageSize = stage.GetSize();
+ Vector2 windowSize = window.GetSize();
Toolkit::ItemLayoutPtr gridLayout = Toolkit::DefaultItemLayout::New( Toolkit::DefaultItemLayout::LIST );
Vector3 itemSize;
- gridLayout->GetItemSize( 0, Vector3( stageSize ), itemSize );
- itemSize.height = stageSize.y / 10;
+ gridLayout->GetItemSize( 0, Vector3( windowSize ), itemSize );
+ itemSize.height = windowSize.y / 10;
gridLayout->SetItemSize( itemSize );
mItemView.AddLayout( *gridLayout );
- mItemView.ActivateLayout( 0, Vector3(stageSize.x, stageSize.y, stageSize.x), 0.0f );
+ mItemView.ActivateLayout( 0, Vector3(windowSize.x, windowSize.y, windowSize.x), 0.0f );
mContentLayer.Add( mItemView );
}
- void StagePopup( Toolkit::Popup popup )
+ void ShowPopup( Toolkit::Popup popup )
{
- Stage::GetCurrent().Add( popup );
+ mApplication.GetWindow().Add( popup );
popup.SetDisplayState( Toolkit::Popup::SHOWN );
}
Toolkit::Popup CreatePopup()
{
- Stage stage = Stage::GetCurrent();
- const float POPUP_WIDTH_DP = stage.GetSize().width * 0.75f;
+ Window window = mApplication.GetWindow();
+ const float POPUP_WIDTH_DP = window.GetSize().GetWidth() * 0.75f;
Toolkit::Popup popup = Toolkit::Popup::New();
popup.SetProperty( Dali::Actor::Property::NAME, "popup" );
mPopup.Add( table );
- StagePopup( mPopup );
+ ShowPopup( mPopup );
}
else if( button.GetProperty< std::string >( Dali::Actor::Property::NAME ) == TABLEVIEW_BUTTON_3CELL_ID )
{
mPopup.SetContent( table );
- StagePopup( mPopup );
+ ShowPopup( mPopup );
}
else if( button.GetProperty< std::string >( Dali::Actor::Property::NAME ) == TABLEVIEW_BUTTON_3X3CELL_ID )
{
mPopup.Add( table );
- StagePopup( mPopup );
+ ShowPopup( mPopup );
}
else if( button.GetProperty< std::string >( Dali::Actor::Property::NAME ) == TABLEVIEW_BUTTON_FIXED1_ID )
{
mPopup.Add( table );
- StagePopup( mPopup );
+ ShowPopup( mPopup );
}
else if( button.GetProperty< std::string >( Dali::Actor::Property::NAME ) == TABLEVIEW_BUTTON_FIXED2_ID )
{
mPopup.Add( table );
- StagePopup( mPopup );
+ ShowPopup( mPopup );
}
else if( button.GetProperty< std::string >( Dali::Actor::Property::NAME ) == TABLEVIEW_BUTTON_FIT1_ID )
{
mPopup.Add( table );
- StagePopup( mPopup );
+ ShowPopup( mPopup );
}
else if( button.GetProperty< std::string >( Dali::Actor::Property::NAME ) == TABLEVIEW_BUTTON_FIT2_ID )
{
mPopup.Add( table );
- StagePopup( mPopup );
+ ShowPopup( mPopup );
}
else if( button.GetProperty< std::string >( Dali::Actor::Property::NAME ) == TABLEVIEW_BUTTON_NATURAL1_ID )
{
mPopup.Add( table );
- StagePopup( mPopup );
+ ShowPopup( mPopup );
}
else if( button.GetProperty< std::string >( Dali::Actor::Property::NAME ) == TABLEVIEW_BUTTON_NATURAL2_ID )
{
mPopup.Add( table );
- StagePopup( mPopup );
+ ShowPopup( mPopup );
}
else if( button.GetProperty< std::string >( Dali::Actor::Property::NAME ) == TABLEVIEW_BUTTON_NATURAL3_ID )
{
}
mPopup.Add( table );
- StagePopup( mPopup );
+ ShowPopup( mPopup );
}
else if( button.GetProperty< std::string >( Dali::Actor::Property::NAME ) == POPUP_BUTTON_CONTENT_IMAGE_SCALE_ID )
{
mPopup.Add( image );
- StagePopup( mPopup );
+ ShowPopup( mPopup );
}
else if( button.GetProperty< std::string >( Dali::Actor::Property::NAME ) == POPUP_BUTTON_CONTENT_IMAGE_FIT_ID )
{
mPopup.Add( image );
- StagePopup( mPopup );
+ ShowPopup( mPopup );
}
else if( button.GetProperty< std::string >( Dali::Actor::Property::NAME ) == POPUP_BUTTON_CONTENT_IMAGE_FILL_ID )
{
mPopup.Add( image );
- StagePopup( mPopup );
+ ShowPopup( mPopup );
}
return true;
/*
- * Copyright (c) 2017 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.
*/
void OnInit( Application& application )
{
- Stage stage = Stage::GetCurrent();
- stage.KeyEventSignal().Connect(this, &SparkleEffectExample::OnKeyEvent);
- stage.SetBackgroundColor( BACKGROUND_COLOR );
+ Window window = application.GetWindow();
+ window.KeyEventSignal().Connect(this, &SparkleEffectExample::OnKeyEvent);
+ window.SetBackgroundColor( BACKGROUND_COLOR );
mCircleBackground = ImageView::New( CIRCLE_BACKGROUND_IMAGE );
mCircleBackground.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
mCircleBackground.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
- stage.Add( mCircleBackground );
+ window.Add( mCircleBackground );
mEffect = SparkleEffect::New();
mMeshActor = CreateMeshActor();
- stage.Add( mMeshActor );
+ window.Add( mMeshActor );
mMeshActor.SetProperty( Actor::Property::POSITION, ACTOR_POSITION );
mMeshActor.SetProperty( Actor::Property::SCALE, ACTOR_SCALE );
void StylingApplication::Create( Application& application )
{
- Stage stage = Stage::GetCurrent();
- stage.KeyEventSignal().Connect(this, &StylingApplication::OnKeyEvent);
- stage.SetBackgroundColor( Vector4( 0.1f, 0.1f, 0.1f, 1.0f ) );
+ Window window = application.GetWindow();
+ window.KeyEventSignal().Connect(this, &StylingApplication::OnKeyEvent);
+ window.SetBackgroundColor( Vector4( 0.1f, 0.1f, 0.1f, 1.0f ) );
mContentPane = CreateContentPane();
- stage.Add( mContentPane );
- mContentPane.SetProperty( Actor::Property::SIZE, stage.GetSize() );
+ window.Add( mContentPane );
+ mContentPane.SetProperty( Actor::Property::SIZE, Vector2(window.GetSize()) );
// Content panes:
TableView contentLayout = TableView::New( 5, 1 );
Popup StylingApplication::CreateResetPopup()
{
- Stage stage = Stage::GetCurrent();
+ Window window = mApplication.GetWindow();
Popup popup= Popup::New();
popup.SetProperty( Dali::Actor::Property::NAME,"ResetPopup");
popup.SetStyleName("ResetPopup");
popup.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
popup.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
- popup.SetProperty( Actor::Property::SIZE, Vector2( stage.GetSize().width * 0.75f, 0.0f ) );
+ popup.SetProperty( Actor::Property::SIZE, Vector2( window.GetSize().GetWidth() * 0.75f, 0.0f ) );
popup.SetProperty( Popup::Property::TAIL_VISIBILITY, false );
popup.OutsideTouchedSignal().Connect( this, &StylingApplication::HidePopup );
popup.HiddenSignal().Connect( this, &StylingApplication::PopupHidden );
mResetPopup = CreateResetPopup ();
}
- Stage::GetCurrent().Add( mResetPopup );
+ mApplication.GetWindow().Add( mResetPopup );
mResetPopup.SetDisplayState( Popup::SHOWN );
return true;
/*
- * 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.
void Create( Application& application )
{
- Stage stage = Stage::GetCurrent();
- stage.KeyEventSignal().Connect( this, &SuperBlurViewExample::OnKeyEvent );
+ Window window = application.GetWindow();
+ window.KeyEventSignal().Connect( this, &SuperBlurViewExample::OnKeyEvent );
mSuperBlurView = SuperBlurView::New( DEFAULT_BLUR_LEVEL );
mSuperBlurView.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
mSuperBlurView.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
mSuperBlurView.SetProperty( Actor::Property::SIZE, Vector2( 800, 1280 ) );
mSuperBlurView.SetProperty( SuperBlurView::Property::IMAGE_URL, BACKGROUND_IMAGE );
- stage.Add( mSuperBlurView );
+ window.Add( mSuperBlurView );
mBlurAnimation = Animation::New(1.0f);
mBlurAnimation.AnimateTo( Property(mSuperBlurView, mSuperBlurView.GetBlurStrengthPropertyIndex()), 1.0f );
mPushButton.SetProperty( Button::Property::LABEL, "Blur" );
mPushButton.PressedSignal().Connect( this, &SuperBlurViewExample::OnButtonPressed );
mPushButton.ReleasedSignal().Connect( this, &SuperBlurViewExample::OnButtonReleased );
- stage.Add( mPushButton );
+ window.Add( mPushButton );
}
bool OnButtonPressed( Button button )
const char* TOOLBAR_IMAGE = DEMO_IMAGE_DIR "top-bar.png"; ///< The tool-bar image.
const float TOOLBAR_BUTTON_PERCENTAGE = 0.1f; ///< The button's space width as a percentage of the toolbar's width.
const float TOOLBAR_TITLE_PERCENTAGE = 0.7f; ///< The title's width as a percentage of the toolbar's width.
-const float TOOLBAR_HEIGHT_PERCENTAGE = 0.05f; ///< The toolbar's height as a percentage of the stage's height.
+const float TOOLBAR_HEIGHT_PERCENTAGE = 0.05f; ///< The toolbar's height as a percentage of the window's height.
const float TOOLBAR_PADDING = 4.f; ///< The padding in pixels.
const float BUTTON_PERCENTAGE = 0.8f; ///< The button's height as a percentage of the space for the buttons in the toolbar.
-const Vector3 TEXT_EDITOR_RELATIVE_SIZE( 0.9f, 0.5f, 1.0f ); ///< The size of the text editor as a percentage of the stage's size.
+const Vector3 TEXT_EDITOR_RELATIVE_SIZE( 0.9f, 0.5f, 1.0f ); ///< The size of the text editor as a percentage of the window's size.
const Vector4 TEXT_EDITOR_BACKGROUND_COLOR( 1.f, 1.f, 1.f, 0.15f ); ///< The background color of the text editor.
const Vector4 COLORS[] = { Color::RED,
*/
void Create( Application& application )
{
- Stage stage = Stage::GetCurrent();
+ Window window = application.GetWindow();
// Respond to key events
- stage.KeyEventSignal().Connect(this, &TextEditorExample::OnKeyEvent);
+ window.KeyEventSignal().Connect(this, &TextEditorExample::OnKeyEvent);
// Set a background color.
- stage.SetBackgroundColor( BACKGROUND_COLOR );
+ window.SetBackgroundColor( BACKGROUND_COLOR );
- // The stage size.
- const Vector2 stageSize = stage.GetSize();
+ // The window size.
+ const Vector2 windowSize = window.GetSize();
// Creates a default view with a default tool bar.
- // The view is added to the stage.
+ // The view is added to the window.
// Set the toolbar style
- const float toolBarHeight = TOOLBAR_HEIGHT_PERCENTAGE * stageSize.height;
+ const float toolBarHeight = TOOLBAR_HEIGHT_PERCENTAGE * windowSize.height;
const DemoHelper::ViewStyle viewStyle( TOOLBAR_BUTTON_PERCENTAGE,
TOOLBAR_TITLE_PERCENTAGE,
toolBarHeight,
mEditor.SetBackgroundColor( TEXT_EDITOR_BACKGROUND_COLOR );
- const Size boundingBoxSize( stageSize * TEXT_EDITOR_RELATIVE_SIZE.GetVectorXY() );
+ const Size boundingBoxSize( windowSize * TEXT_EDITOR_RELATIVE_SIZE.GetVectorXY() );
Rect<int> boundingBox( 0,
static_cast<int>( toolBarHeight ),
static_cast<int>( boundingBoxSize.width ),
*/
void Create( Application& application )
{
- Stage stage = Stage::GetCurrent();
+ Window window = application.GetWindow();
- stage.SetBackgroundColor( Vector4( 0.04f, 0.345f, 0.392f, 1.0f ) );
- stage.KeyEventSignal().Connect(this, &TextFieldExample::OnKeyEvent);
+ window.SetBackgroundColor( Vector4( 0.04f, 0.345f, 0.392f, 1.0f ) );
+ window.KeyEventSignal().Connect(this, &TextFieldExample::OnKeyEvent);
mButton = CreateFolderButton();
mButton.ClickedSignal().Connect( this, &TextFieldExample::OnButtonClicked );
- stage.Add( mButton );
+ window.Add( mButton );
}
PushButton CreateFolderButton()
bool OnButtonClicked( Toolkit::Button button )
{
- Stage stage = Stage::GetCurrent();
- Vector2 stageSize = stage.GetSize();
+ Window window = mApplication.GetWindow();
+ Vector2 windowSize = window.GetSize();
// Remove previously hidden pop-up
UnparentAndReset(mPopup);
// Launch a pop-up containing TextField
- mField = CreateTextField( stageSize, mButtonLabel );
+ mField = CreateTextField( windowSize, mButtonLabel );
mPopup = CreatePopup();
mPopup.Add( mField );
mPopup.OutsideTouchedSignal().Connect( this, &TextFieldExample::OnPopupOutsideTouched );
- stage.Add( mPopup );
+ window.Add( mPopup );
mPopup.SetDisplayState( Popup::SHOWN );
return true;
}
- TextField CreateTextField( const Vector2& stageSize, const std::string& text )
+ TextField CreateTextField( const Vector2& windowSize, const std::string& text )
{
TextField field = TextField::New();
field.SetProperty( Dali::Actor::Property::NAME,"textField");
field.SetProperty( TextField::Property::TEXT_COLOR, Vector4( 0.0f, 1.0f, 1.0f, 1.0f ) ); // CYAN
field.SetProperty( TextField::Property::PLACEHOLDER_TEXT, "Unnamed folder" );
field.SetProperty( TextField::Property::PLACEHOLDER_TEXT_FOCUSED, "Enter folder name." );
- field.SetProperty( TextField::Property::DECORATION_BOUNDING_BOX, Rect<int>( BORDER_WIDTH, BORDER_WIDTH, stageSize.width - BORDER_WIDTH*2, stageSize.height - BORDER_WIDTH*2 ) );
+ field.SetProperty( TextField::Property::DECORATION_BOUNDING_BOX, Rect<int>( BORDER_WIDTH, BORDER_WIDTH, windowSize.width - BORDER_WIDTH*2, windowSize.height - BORDER_WIDTH*2 ) );
return field;
}
/*
- * Copyright (c) 2017 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.
if ( !mContainer4 )
{
CreateContainer ( mContainer4 , mLayoutSize);
- Stage stage = Stage::GetCurrent();
- Vector2 stageSize = stage.GetSize();
- mContainer4.SetProperty( Actor::Property::POSITION, Vector2( 0, stageSize.height*0.25f*3 ));
- stage.Add( mContainer4 );
+ Window window = mApplication.GetWindow();
+ Vector2 windowSize = window.GetSize();
+ mContainer4.SetProperty( Actor::Property::POSITION, Vector2( 0, windowSize.height*0.25f*3 ));
+ window.Add( mContainer4 );
// Info
CreateContainer ( mContainer4Info , mLayoutSize );
mContainer4Info.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_RIGHT );
*/
void Create( Application& application )
{
- Stage stage = Stage::GetCurrent();
- Vector2 stageSize = stage.GetSize();
+ Window window = application.GetWindow();
+ Vector2 windowSize = window.GetSize();
- stage.KeyEventSignal().Connect(this, &TextFontsExample::OnKeyEvent);
+ window.KeyEventSignal().Connect(this, &TextFontsExample::OnKeyEvent);
CreateFolderButton ( mButton );
mButton.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_CENTER );
mButton.ClickedSignal().Connect( this, &TextFontsExample::OnButtonClicked );
- stage.Add( mButton );
+ window.Add( mButton );
- mLayoutSize = Vector2( stageSize.width*0.5f, stageSize.height*0.10f );
+ mLayoutSize = Vector2( windowSize.width*0.5f, windowSize.height*0.10f );
CreateContainer ( mContainer , mLayoutSize);
CreateContainer ( mContainer2 , mLayoutSize );
CreateContainer ( mContainer3 , mLayoutSize );
mContainer2Info.Add( mLabel2Info );
mContainer3Info.Add( mLabel3Info );
- stage.Add( mContainer );
- stage.Add( mContainer2 );
- stage.Add( mContainer3 );
+ window.Add( mContainer );
+ window.Add( mContainer2 );
+ window.Add( mContainer3 );
CreateTextLabel ( mLabel, LABEL_TEXT, Color::WHITE );
mLabel3.SetProperty( TextLabel::Property::FONT_FAMILY, "SamsungOneUI" );
mContainer.SetProperty( Actor::Property::POSITION, Vector2( 0, 0 ));
- mContainer2.SetProperty( Actor::Property::POSITION, Vector2( 0, stageSize.height*0.25f ));
- mContainer3.SetProperty( Actor::Property::POSITION, Vector2( 0, stageSize.height*0.25f*2 ));
+ mContainer2.SetProperty( Actor::Property::POSITION, Vector2( 0, windowSize.height*0.25f ));
+ mContainer3.SetProperty( Actor::Property::POSITION, Vector2( 0, windowSize.height*0.25f*2 ));
mContainer.Add( mLabel );
mContainer2.Add( mLabel2 );
/*
- * Copyright (c) 2017 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.
// The Init signal is received once (only) during the Application lifetime
void Create( Application& application )
{
- Stage stage = Stage::GetCurrent();
- stage.SetBackgroundColor( Color::WHITE );
- stage.KeyEventSignal().Connect(this, &EmojiExample::OnKeyEvent);
+ Window window = application.GetWindow();
+ window.SetBackgroundColor( Color::WHITE );
+ window.KeyEventSignal().Connect(this, &EmojiExample::OnKeyEvent);
mTableView = Toolkit::TableView::New( NUMBER_OF_EMOJIS, 1 );
mTableView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
mTableView.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
mTableView.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
mTableView.TouchSignal().Connect( this, &EmojiExample::OnTouch );
- stage.Add( mTableView );
+ window.Add( mTableView );
for( unsigned int index = 0u; index < NUMBER_OF_EMOJIS; ++index )
{
/*
- * Copyright (c) 2017 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.
*/
void Create( Application& application )
{
- Stage stage = Stage::GetCurrent();
+ Window window = application.GetWindow();
- stage.KeyEventSignal().Connect(this, &TextLabelMultiLanguageExample::OnKeyEvent);
- stage.SetBackgroundColor( Color::WHITE );
+ window.KeyEventSignal().Connect(this, &TextLabelMultiLanguageExample::OnKeyEvent);
+ window.SetBackgroundColor( Color::WHITE );
mTableView = Toolkit::TableView::New( NUMBER_OF_LANGUAGES, 1 );
mTableView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
mTableView.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
mTableView.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
mTableView.TouchSignal().Connect( this, &TextLabelMultiLanguageExample::OnTouch );
- stage.Add( mTableView );
+ window.Add( mTableView );
for( unsigned int index = 0u; index < NUMBER_OF_LANGUAGES; ++index )
{
float value;
};
-const float STYLE_BUTTON_POSTION_RELATIVE_TO_STAGE = 0.9f;
-const float BUTTON_SIZE_RATIO_TO_STAGE = 0.1f;
+const float STYLE_BUTTON_POSTION_RELATIVE_TO_WINDOW = 0.9f;
+const float BUTTON_SIZE_RATIO_TO_WINDOW = 0.1f;
const float OUTLINE_WIDTH = 2.0f;
const Vector2 SHADOW_OFFSET = Vector2( 2.0f, 2.0f );
const int GAP_BETWEEN_BUTTONS = 3;
void SetUpExpandingStyleButtons( Vector2 position )
{
mExpandingButtons = Demo::ExpandingButtons::New();
- mExpandingButtons.SetProperty( Actor::Property::POSITION, Vector2( mButtonSize.width, mStageSize.height * STYLE_BUTTON_POSTION_RELATIVE_TO_STAGE ));
+ mExpandingButtons.SetProperty( Actor::Property::POSITION, Vector2( mButtonSize.width, mWindowSize.height * STYLE_BUTTON_POSTION_RELATIVE_TO_WINDOW ));
mExpandingButtons.CollapsingSignal().Connect( this, &TextLabelExample::OnExpandingButtonCollapsing );
mExpandingButtons.SetProperty( Actor::Property::SIZE, mButtonSize );
// Creates the buttons to be expanded
*/
void Create( Application& application )
{
- Stage stage = Stage::GetCurrent();
+ Window window = application.GetWindow();
- stage.KeyEventSignal().Connect(this, &TextLabelExample::OnKeyEvent);
- mStageSize = stage.GetSize();
- mButtonSize = Size( mStageSize.height * 0.1, mStageSize.height * 0.1 ); // Button size 1/10 of stage height
+ window.KeyEventSignal().Connect(this, &TextLabelExample::OnKeyEvent);
+ mWindowSize = window.GetSize();
+ mButtonSize = Size( mWindowSize.height * 0.1, mWindowSize.height * 0.1 ); // Button size 1/10 of window height
mContainer = Control::New();
mContainer.SetProperty( Dali::Actor::Property::NAME, "Container" );
mContainer.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
- mLayoutSize = Vector2(mStageSize.width*0.6f, mStageSize.width*0.6f);
+ mLayoutSize = Vector2(mWindowSize.width*0.6f, mWindowSize.width*0.6f);
mContainer.SetProperty( Actor::Property::SIZE, mLayoutSize );
- stage.Add( mContainer );
+ window.Add( mContainer );
// Resize the center layout when the corner is grabbed
mGrabCorner = ImageView::New( BACKGROUND_IMAGE );
mContainer.Add( mLabel );
// Clicking ExpandingButton shows the Registered Style buttons, clicking again hides them.
- Vector2 expandingButtonPosition( mButtonSize.width, mStageSize.height * STYLE_BUTTON_POSTION_RELATIVE_TO_STAGE );
+ Vector2 expandingButtonPosition( mButtonSize.width, mWindowSize.height * STYLE_BUTTON_POSTION_RELATIVE_TO_WINDOW );
SetUpExpandingStyleButtons( expandingButtonPosition );
- stage.Add( mExpandingButtons );
+ window.Add( mExpandingButtons );
// Add a border for the container so you can see the container is being resized while grabbing the handle.
mBorder = Control::New();
if( mLayoutSize.x >= 2.0f ||
mLayoutSize.y >= 2.0f )
{
- mLayoutSize.x = std::min ( mLayoutSize.x, mStageSize.width );
- mLayoutSize.y = std::min ( mLayoutSize.y, mStageSize.height*.9f );
+ mLayoutSize.x = std::min ( mLayoutSize.x, mWindowSize.width );
+ mLayoutSize.y = std::min ( mLayoutSize.y, mWindowSize.height*.9f );
// Avoid pixel mis-alignment issue
Vector2 clampedSize = Vector2( std::max( ConvertToEven( static_cast<int>( mLayoutSize.x )), 2 ),
Animation mColorButtonsAnimation;
- Size mStageSize;
+ Size mWindowSize;
Size mButtonSize;
unsigned int mLanguageId;
label.SetProperty( TextLabel::Property::SHADOW, shadowMap );
label.SetProperty( TextLabel::Property::ENABLE_MARKUP, true );
- Vector2 stageSize = Stage::GetCurrent().GetSize();
- label.SetProperty( Actor::Property::POSITION, Vector3( Random::Range( 0.0f, stageSize.x ), Random::Range( 0.0f, stageSize.y ), 0.0f) );
+ Vector2 windowSize = mApplication.GetWindow().GetSize();
+ label.SetProperty( Actor::Property::POSITION, Vector3( Random::Range( 0.0f, windowSize.x ), Random::Range( 0.0f, windowSize.y ), 0.0f) );
switch ( type )
{
shadowMap.Insert( "offset", Vector2( 0.0f, 0.0f ) );
label.SetProperty( TextLabel::Property::SHADOW, shadowMap );
- label.SetProperty( Actor::Property::SIZE, Vector2(stageSize.x, stageSize.y * 0.25f) ); // Set the text label in larger size
+ label.SetProperty( Actor::Property::SIZE, Vector2(windowSize.x, windowSize.y * 0.25f) ); // Set the text label in larger size
break;
}
default:
*/
void CreateMainMenu()
{
- Stage stage = Stage::GetCurrent();
- Vector2 stageSize = stage.GetSize();
+ Vector2 windowSize = mApplication.GetWindow().GetSize();
mTapDetector = TapGestureDetector::New();
mTapDetector.DetectedSignal().Connect( this, &TextMemoryProfilingExample::OnTap );
mItemView.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
mLayout = DefaultItemLayout::New( DefaultItemLayout::LIST );
- mLayout->SetItemSize( Vector3( stageSize.width, 60.0f, 0.0f ) );
+ mLayout->SetItemSize( Vector3( windowSize.width, 60.0f, 0.0f ) );
mItemView.AddLayout( *mLayout );
// Activate the layout
- mItemView.ActivateLayout( 0, Vector3( stageSize ), 0.0f );
+ mItemView.ActivateLayout( 0, Vector3( windowSize ), 0.0f );
}
/**
*/
void CreateTextLabels( int type )
{
- Stage stage = Stage::GetCurrent();
-
// Delete any existing text labels
unsigned int numChildren = mLayer.GetChildCount();
*/
void Create( Application& application )
{
- Stage stage = Stage::GetCurrent();
+ Window window = application.GetWindow();
- stage.KeyEventSignal().Connect(this, &TextMemoryProfilingExample::OnKeyEvent);
+ window.KeyEventSignal().Connect(this, &TextMemoryProfilingExample::OnKeyEvent);
Layer contents = DemoHelper::CreateView( mApplication,
mView,
mNavigationView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
mNavigationView.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
mNavigationView.SetBackgroundColor( Color::WHITE );
- stage.Add( mNavigationView );
+ window.Add( mNavigationView );
CreateMainMenu();
mNavigationView.Push( mItemView );
void TextOverlapController::Create( Application& app )
{
- Stage stage = Stage::GetCurrent();
- stage.KeyEventSignal().Connect( this, &TextOverlapController::OnKeyEvent );
+ Window window = app.GetWindow();
+ window.KeyEventSignal().Connect( this, &TextOverlapController::OnKeyEvent );
- Vector2 stageSize = stage.GetSize();
+ Vector2 windowSize = window.GetSize();
mLabels[0] = TextLabel::New("Text Label 1");
mLabels[1] = TextLabel::New("Text Label 2");
mLabels[i].SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
mLabels[i].SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
mLabels[i].SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
- mLabels[i].SetProperty( Actor::Property::POSITION, Vector2( 0, (i*2+1) * stageSize.height * 0.25f ));
+ mLabels[i].SetProperty( Actor::Property::POSITION, Vector2( 0, (i*2+1) * windowSize.height * 0.25f ));
}
- stage.Add( mLabels[0] );
- stage.Add( mLabels[1] );
+ window.Add( mLabels[0] );
+ window.Add( mLabels[1] );
mSwapButton = PushButton::New();
mSwapButton.SetProperty( Button::Property::LABEL, "Swap depth order");
mSwapButton.ClickedSignal().Connect( this, &TextOverlapController::OnClicked );
mSwapButton.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
mSwapButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );
- stage.Add( mSwapButton );
+ window.Add( mSwapButton );
- Layer rootLayer = stage.GetRootLayer();
+ Layer rootLayer = window.GetRootLayer();
rootLayer.SetProperty( Dali::Actor::Property::NAME,"RootLayer");
mPanDetector = PanGestureDetector::New();
}
else if( mGrabbedActor && gesture.state == PanGesture::Continuing )
{
- Vector2 stageSize = Stage::GetCurrent().GetSize();
+ Vector2 windowSize = mApplication.GetWindow().GetSize();
Vector3 size = mGrabbedActor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE );
- float y = Clamp( gesture.position.y, size.y * 0.5f, stageSize.y - size.y*0.5f );
+ float y = Clamp( gesture.position.y, size.y * 0.5f, windowSize.y - size.y*0.5f );
mGrabbedActor.SetProperty( Actor::Property::POSITION, Vector2( 0, y ));
}
else
}
else
{
- Dali::Layer l = Dali::Stage::GetCurrent().GetRootLayer();
+ Dali::Layer l = mApplication.GetWindow().GetRootLayer();
int so = l.GetProperty<int>(Dali::DevelActor::Property::SIBLING_ORDER);
l.SetProperty(Dali::DevelActor::Property::SIBLING_ORDER, so+1);
}
/*
- * 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.
namespace
{
-const float STAGE_HEIGHT_MULTIPLIER( 1.5f );
+const float WINDOW_HEIGHT_MULTIPLIER( 1.5f );
const Vector2 BOX_SIZE( Vector2(330.0f, 80.0f ) );
const Vector2 SCROLLING_BOX_SIZE( Vector2(330.0f, 40.0f ) );
const float MAX_OFFSCREEN_RENDERING_SIZE = 2048.f;
*/
void Create( Application& application )
{
- Stage stage = Stage::GetCurrent();
- mStageSize = stage.GetSize();
+ Window window = application.GetWindow();
+ mWindowSize = window.GetSize();
- stage.KeyEventSignal().Connect(this, &TextScrollingExample::OnKeyEvent);
+ window.KeyEventSignal().Connect(this, &TextScrollingExample::OnKeyEvent);
// Create Root actor
Actor rootActor = Actor::New();
rootActor.SetProperty( Dali::Actor::Property::NAME,"rootActor");
rootActor.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
- rootActor.SetProperty( Actor::Property::SIZE, mStageSize );
+ rootActor.SetProperty( Actor::Property::SIZE, mWindowSize );
rootActor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
- stage.Add( rootActor );
+ window.Add( rootActor );
mAnimation = Animation::New( 1.0f );
- const Size mTargetActorSize( mStageSize.width, mStageSize.height * STAGE_HEIGHT_MULTIPLIER );
+ const Size mTargetActorSize( mWindowSize.width, mWindowSize.height * WINDOW_HEIGHT_MULTIPLIER );
// Create Desktop
Control desktop = Control::New();
field.SetProperty( Actor::Property::PADDING, Padding( 1.0f, 1.0f, 1.0f, 1.0f ) );
field.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
field.SetProperty( TextField::Property::PLACEHOLDER_TEXT, "Enter Folder Name" );
- field.SetProperty( TextField::Property::DECORATION_BOUNDING_BOX, Rect<int>( SCREEN_BORDER, SCREEN_BORDER, mStageSize.width - SCREEN_BORDER*2, mStageSize.height - SCREEN_BORDER*2 ) );
+ field.SetProperty( TextField::Property::DECORATION_BOUNDING_BOX, Rect<int>( SCREEN_BORDER, SCREEN_BORDER, mWindowSize.width - SCREEN_BORDER*2, mWindowSize.height - SCREEN_BORDER*2 ) );
boxA.Add( field );
boxA.SetProperty( Actor::Property::SIZE, BOX_SIZE);
Vector2 position = Vector2( gesture.displacement );
mTargetActorPosition.y = mTargetActorPosition.y + position.y;
mTargetActorPosition.y = std::min( mTargetActorPosition.y, -mTargetActorSize.height );
- mTargetActorPosition.y = std::max( mTargetActorPosition.y, ( mTargetActorSize.height - mStageSize.height*0.25f ) );
+ mTargetActorPosition.y = std::max( mTargetActorPosition.y, ( mTargetActorSize.height - mWindowSize.height*0.25f ) );
actor.SetProperty( Actor::Property::POSITION, Vector2( 0.0f, mTargetActorPosition.y ));
}
}
Vector2 mTargetActorPosition;
Vector2 mTargetActorSize;
- Vector2 mStageSize;
+ Vector2 mWindowSize;
TextLabel mLargeLabel;
TextLabel mSmallLabel;
{
// The Init signal is received once (only) during the Application lifetime
- Stage stage = Stage::GetCurrent();
- stage.KeyEventSignal().Connect(this, &ExampleController::OnKeyEvent);
+ Window window = application.GetWindow();
+ window.KeyEventSignal().Connect(this, &ExampleController::OnKeyEvent);
- mStageSize = stage.GetSize();
+ mWindowSize = window.GetSize();
Texture texture1 = DemoHelper::LoadTexture( MATERIAL_SAMPLE );
Texture texture2 = DemoHelper::LoadTexture( MATERIAL_SAMPLE2 );
mMeshActor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_CENTER );
mMeshActor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_CENTER );
- stage.Add( mMeshActor );
+ window.Add( mMeshActor );
mRenderer2 = Renderer::New( mGeometry, mShader );
mRenderer2.SetTextures( mTextureSet2 );
mMeshActor2.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_CENTER );
mMeshActor2.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_CENTER );
- stage.Add( mMeshActor2 );
+ window.Add( mMeshActor2 );
Animation animation = Animation::New(5);
KeyFrames keyFrames = KeyFrames::New();
animation.SetLooping(true);
animation.Play();
- stage.SetBackgroundColor(Vector4(0.0f, 0.2f, 0.2f, 1.0f));
+ window.SetBackgroundColor(Vector4(0.0f, 0.2f, 0.2f, 1.0f));
}
/**
private:
Application& mApplication; ///< Application instance
- Vector3 mStageSize; ///< The size of the stage
+ Vector3 mWindowSize; ///< The size of the window
Shader mShader;
TextureSet mTextureSet1;
/*
- * Copyright (c) 2017 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.
// The Init signal is received once (only) during the Application lifetime
void Create( Application& application )
{
- // Get a handle to the stage
- Stage stage = Stage::GetCurrent();
- stage.SetBackgroundColor( Color::BLUE);
+ // Get a handle to the window
+ Window window = application.GetWindow();
+ window.SetBackgroundColor( Color::BLUE);
mTextLabel = TextLabel::New( "Tilt Sensor Demo" );
mTextLabel.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
mTextLabel.SetProperty( TextLabel::Property::TEXT_COLOR, Color::WHITE );
mTextLabel.SetProperty( TextLabel::Property::POINT_SIZE, 15.0f );
mTextLabel.SetProperty( Dali::Actor::Property::NAME, "tiltLabel" );
- stage.Add( mTextLabel );
+ window.Add( mTextLabel );
- // Respond to a click anywhere on the stage
- stage.GetRootLayer().TouchSignal().Connect( this, &TiltController::OnTouch );
+ // Respond to a click anywhere on the window
+ window.GetRootLayer().TouchSignal().Connect( this, &TiltController::OnTouch );
CreateSensor();
// Connect signals to allow Back and Escape to exit.
- stage.KeyEventSignal().Connect( this, &TiltController::OnKeyEvent );
+ window.KeyEventSignal().Connect( this, &TiltController::OnKeyEvent );
}
void CreateSensor()
namespace
{
-const Vector4 STAGE_COLOR( 211.0f / 255.0f, 211.0f / 255.0f, 211.0f / 255.0f, 1.0f ); ///< The color of the stage
+const Vector4 WINDOW_COLOR( 211.0f / 255.0f, 211.0f / 255.0f, 211.0f / 255.0f, 1.0f ); ///< The color of the window
const char * const THEME_PATH( DEMO_STYLE_DIR "tooltip-example-theme.json" ); ///< The theme used for this example
const float POSITION_INCREMENTER( 0.2f ); ///< The position difference between the controls along the Y-Axis.
} // unnamed namespace
// The Init signal is received once (only) during the Application lifetime
void Create( Application& application )
{
- // Set the stage background color and connect to the stage's key signal to allow Back and Escape to exit.
- Stage stage = Stage::GetCurrent();
- stage.SetBackgroundColor( STAGE_COLOR );
- stage.KeyEventSignal().Connect( this, &TooltipController::OnKeyEvent );
- const Vector2 stageSize = stage.GetSize();
+ // Set the window background color and connect to the window's key signal to allow Back and Escape to exit.
+ Window window = application.GetWindow();
+ window.SetBackgroundColor( WINDOW_COLOR );
+ window.KeyEventSignal().Connect( this, &TooltipController::OnKeyEvent );
+ const Vector2 windowSize = window.GetSize();
// Add a text label at the top for information purposes
Control label = TextLabel::New( "Hover over buttons to see tooltip" );
label.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_CENTER );
label.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_CENTER );
label.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "Center" );
- stage.Add( label );
+ window.Add( label );
// Simple tooltip from stylesheet
Control simple = PushButton::New();
simple.SetStyleName( "TooltipTextOnly" );
SetLabel( simple, "Simple" );
- Layout( simple, stageSize );
- stage.Add( simple );
+ Layout( simple, windowSize );
+ window.Add( simple );
// Tooltip with icon and text, from stylesheet
Control iconWithText = PushButton::New();
iconWithText.SetStyleName( "TooltipArray" );
SetLabel( iconWithText, "Icon with Text" );
- Layout( iconWithText, stageSize );
- stage.Add( iconWithText );
+ Layout( iconWithText, windowSize );
+ window.Add( iconWithText );
// Tooltip with custom style, from stylesheet
Control customFromStylesheet = PushButton::New();
customFromStylesheet.SetStyleName( "TooltipCustom" );
SetLabel( customFromStylesheet, "Custom From Stylesheet" );
- Layout( customFromStylesheet, stageSize );
- stage.Add( customFromStylesheet );
+ Layout( customFromStylesheet, windowSize );
+ window.Add( customFromStylesheet );
// Tooltip with custom style, from code
Control customFromCode = PushButton::New();
SetLabel( customFromCode, "Custom From Code" );
- Layout( customFromCode, stageSize );
+ Layout( customFromCode, windowSize );
customFromCode.SetProperty( DevelControl::Property::TOOLTIP,
{ { Tooltip::Property::CONTENT,
Property::Array{ { { { Toolkit::Visual::Property::TYPE, Visual::IMAGE },
{ { Tooltip::Background::Property::VISUAL, DEMO_IMAGE_DIR "tooltip.9.png" },
{ Tooltip::Background::Property::BORDER, Rect< int >( 1, 5, 5, 1 ) } } }
} );
- stage.Add( customFromCode );
+ window.Add( customFromCode );
}
/**
/**
* @brief Lays out the control in the appropriate location.
* @param[in] control The control to layout.
- * @param[in] stageSize The size of the stage, passing it in so we don't have to retrieve it every time.
+ * @param[in] windowSize The size of the window, passing it in so we don't have to retrieve it every time.
*/
- void Layout( Control control, const Vector2& stageSize )
+ void Layout( Control control, const Vector2& windowSize )
{
if( control )
{
control.SetProperty( Actor::Property::SIZE_MODE_FACTOR, Vector3( 0.75, 0.1, 1.0 ) );
control.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
control.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_CENTER );
- control.SetProperty( Actor::Property::POSITION_Y, stageSize.height * previousPosition );
+ control.SetProperty( Actor::Property::POSITION_Y, windowSize.height * previousPosition );
}
}
void TransitionApplication::Create( Application& application )
{
- Stage stage = Stage::GetCurrent();
- stage.KeyEventSignal().Connect(this, &TransitionApplication::OnKeyEvent);
- stage.SetBackgroundColor( Vector4( 0.1f, 0.1f, 0.1f, 1.0f ) );
+ Window window = application.GetWindow();
+ window.KeyEventSignal().Connect(this, &TransitionApplication::OnKeyEvent);
+ window.SetBackgroundColor( Vector4( 0.1f, 0.1f, 0.1f, 1.0f ) );
// Content panes:
TableView contentLayout = TableView::New( 3, 1 );
contentLayout.SetBackgroundColor( Vector4(0.949, 0.949, 0.949, 1.0) );
// Assign all rows the size negotiation property of fitting to children
- stage.Add( contentLayout );
+ window.Add( contentLayout );
mTitle = TextLabel::New( "Custom Control Transition Example" );
mTitle.SetProperty( Dali::Actor::Property::NAME, "Title" );
void Create( Application& application )
{
- mStageSize = Stage::GetCurrent().GetSize();
+ Window window = application.GetWindow();
+ mWindowSize = window.GetSize();
mVideoView = Toolkit::VideoView::New();
- Stage::GetCurrent().Add( mVideoView );
+ window.Add( mVideoView );
mVideoView.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
mVideoView.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
mVideoView.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
mRotationAnimation.AnimateBy( Property(mVideoView, Actor::Property::ORIENTATION), Quaternion(Degree(0.f), Degree(360.f), Degree(0.f)) );
mRotationAnimation.SetLooping(false);
- Stage::GetCurrent().KeyEventSignal().Connect( this, &VideoViewController::OnKeyEvent );
-
+ window.KeyEventSignal().Connect( this, &VideoViewController::OnKeyEvent );
}
bool OnButtonClicked( Button button )
{
if( !mIsFullScreen )
{
- mVideoView.SetProperty( Actor::Property::SIZE, mStageSize );
+ mVideoView.SetProperty( Actor::Property::SIZE, mWindowSize );
mIsFullScreen = true;
}
else
Application& mApplication;
VideoView mVideoView;
Layer mMenu;
- Vector2 mStageSize;
+ Vector2 mWindowSize;
bool mIsPlay;
bool mIsFullScreen;
/*
- * 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.
*/
void Create( Application& application )
{
- // Get a handle to the stage
- Stage stage = Stage::GetCurrent();
- stage.SetBackgroundColor( Color::WHITE );
+ // Get a handle to the window
+ Window window = application.GetWindow();
+ window.SetBackgroundColor( Color::WHITE );
// Text Label filling the entire screen, with a background
mTextLabel = DevelHandle::New< TextLabel >( TEXT_LABEL_PROPERTIES );
- stage.Add( mTextLabel );
+ window.Add( mTextLabel );
// We want to change the padding when tapping
mTapDetector = TapGestureDetector::New();
// Create an ImageView with the default behaviour, i.e. image fills to control size
mFillImage = ImageView::New( IMAGE_NAME );
DevelHandle::SetProperties( mFillImage, FILL_IMAGE_PROPERTIES );
- stage.Add( mFillImage );
+ window.Add( mFillImage );
// Create an ImageView that Keeps the aspect ratio while fitting within the given size
mFitKeepAspectRatioImage = DevelHandle::New< ImageView >( FIT_KEEP_ASPECT_RATIO_IMAGE_BASIC_PROPERTIES );
{ ImageVisual::Property::URL, IMAGE_NAME },
{ DevelVisual::Property::VISUAL_FITTING_MODE, DevelVisual::FIT_KEEP_ASPECT_RATIO }
} );
- stage.Add( mFitKeepAspectRatioImage );
+ window.Add( mFitKeepAspectRatioImage );
// Create an overlay label for fill image
Actor fillLabel = TextLabel::New( FILL_LABEL );
DevelHandle::SetProperties( fillLabel, FILL_IMAGE_PROPERTIES );
DevelHandle::SetProperties( fillLabel, OVERLAY_LABEL_PROPERTIES );
- stage.Add( fillLabel );
+ window.Add( fillLabel );
// Create an overlay label for the Fit/Keep Aspect image
Actor fitLabel = TextLabel::New( FIT_KEEP_ASPECT_LABEL );
DevelHandle::SetProperties( fitLabel, FIT_KEEP_ASPECT_RATIO_IMAGE_BASIC_PROPERTIES );
DevelHandle::SetProperties( fitLabel, OVERLAY_LABEL_PROPERTIES );
- stage.Add( fitLabel );
+ window.Add( fitLabel );
// Respond to key events, exit if ESC/Back, change the padding if anything else
- stage.KeyEventSignal().Connect( this, &VisualFittingModeController::OnKeyEvent );
+ window.KeyEventSignal().Connect( this, &VisualFittingModeController::OnKeyEvent );
// Set the initial padding
ChangePadding();
void TransitionApplication::Create( Application& application )
{
- Stage stage = Stage::GetCurrent();
- stage.KeyEventSignal().Connect(this, &TransitionApplication::OnKeyEvent);
- stage.SetBackgroundColor( Vector4( 0.1f, 0.1f, 0.1f, 1.0f ) );
+ Window window = application.GetWindow();
+ window.KeyEventSignal().Connect(this, &TransitionApplication::OnKeyEvent);
+ window.SetBackgroundColor( Vector4( 0.1f, 0.1f, 0.1f, 1.0f ) );
// Content panes:
TableView contentLayout = TableView::New( 4, 1 );
// Assign all rows the size negotiation property of fitting to children
- stage.Add( contentLayout );
+ window.Add( contentLayout );
mTitle = TextLabel::New( "Custom Control Transition Example" );
mTitle.SetProperty( Dali::Actor::Property::NAME, "Title" );
// The Init signal is received once (only) during the Application lifetime
void Create( Application& application )
{
- // Get a handle to the stage
- Stage stage = Stage::GetCurrent();
- stage.SetBackgroundColor( Vector4(0.2, 0.6, 1, 1) );
+ // Get a handle to the window
+ Window window = application.GetWindow();
+ window.SetBackgroundColor( Vector4(0.2, 0.6, 1, 1) );
- float width = stage.GetSize().width;
- float height = stage.GetSize().height;
+ float width = window.GetSize().GetWidth();
+ float height = window.GetSize().GetHeight();
float fontSize = width * 0.02f;
mWebView = Toolkit::WebView::New( "ko-KR", "Asia/Seoul" );
std::string url = GetNextUrl();
mWebView.LoadUrl( url );
- stage.Add(mWebView);
+ window.Add(mWebView);
mAddressLabel = Toolkit::TextLabel::New( url );
mAddressLabel.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
mAddressLabel.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE );
mAddressLabel.SetBackgroundColor( Vector4( 0, 0, 0, 0.5f ) );
mAddressLabel.TouchSignal().Connect( this, &WebViewController::OnTouchText );
- stage.Add( mAddressLabel );
+ window.Add( mAddressLabel );
// Respond to key events
- stage.KeyEventSignal().Connect( this, &WebViewController::OnKeyEvent );
+ window.KeyEventSignal().Connect( this, &WebViewController::OnKeyEvent );
Toolkit::KeyboardFocusManager::Get().SetCurrentFocusActor( mWebView );
}
Control CreateBackground( std::string stylename )
{
Control background = Control::New();
- Stage::GetCurrent().Add( background );
background.SetStyleName( stylename );
background.SetProperty( Actor::Property::NAME, "BACKGROUND" );
background.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
void DaliTableView::Initialize( Application& application )
{
- Stage::GetCurrent().KeyEventSignal().Connect( this, &DaliTableView::OnKeyEvent );
- const Vector2 stageSize = Stage::GetCurrent().GetSize();
+ Window window = application.GetWindow();
+ window.KeyEventSignal().Connect( this, &DaliTableView::OnKeyEvent );
+ const Window::WindowSize windowSize = window.GetSize();
// Background
mRootActor = CreateBackground( "LauncherBackground" );
- Stage::GetCurrent().Add( mRootActor );
+ window.Add( mRootActor );
// Add logo
ImageView logo = ImageView::New( LOGO_PATH );
mScrollView.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::HEIGHT );
mScrollView.SetProperty( Actor::Property::SIZE_MODE_FACTOR, Vector3( 0.0f, 0.6f, 0.0f ) );
- const float buttonsPageMargin = ( 1.0f - TABLE_RELATIVE_SIZE.x ) * 0.5f * stageSize.width;
+ const float buttonsPageMargin = ( 1.0f - TABLE_RELATIVE_SIZE.x ) * 0.5f * windowSize.GetWidth();
mScrollView.SetProperty( Actor::Property::PADDING, Padding( buttonsPageMargin, buttonsPageMargin, 0.0f, 0.0f ) );
mScrollView.SetAxisAutoLock( true );
mScrollView.ScrollStartedSignal().Connect( this, &DaliTableView::OnScrollStart );
mScrollView.TouchSignal().Connect( this, &DaliTableView::OnScrollTouched );
- mPageWidth = stageSize.width * TABLE_RELATIVE_SIZE.x * 0.5f;
+ mPageWidth = windowSize.GetWidth() * TABLE_RELATIVE_SIZE.x * 0.5f;
// Populate background and bubbles - needs to be scrollViewLayer so scroll ends show
Actor bubbleContainer = Actor::New();
Dali::Window winHandle = application.GetWindow();
- if( stageSize.width <= stageSize.height )
+ if( windowSize.GetWidth() <= windowSize.GetHeight() )
{
winHandle.AddAvailableOrientation( Dali::Window::PORTRAIT );
winHandle.RemoveAvailableOrientation( Dali::Window::LANDSCAPE );
void DaliTableView::Populate()
{
- const Vector2 stageSize = Stage::GetCurrent().GetSize();
+ const Window::WindowSize windowSize = mApplication.GetWindow().GetSize();
mTotalPages = ( mExampleList.size() + EXAMPLES_PER_PAGE - 1 ) / EXAMPLES_PER_PAGE;
// Update Ruler info.
mScrollRulerX = new FixedRuler( mPageWidth );
mScrollRulerY = new DefaultRuler();
- mScrollRulerX->SetDomain( RulerDomain( 0.0f, (mTotalPages+1) * stageSize.width * TABLE_RELATIVE_SIZE.x * 0.5f, true ) );
+ mScrollRulerX->SetDomain( RulerDomain( 0.0f, (mTotalPages+1) * windowSize.GetWidth() * TABLE_RELATIVE_SIZE.x * 0.5f, true ) );
mScrollRulerY->Disable();
mScrollView.SetRulerX( mScrollRulerX );
mScrollView.SetRulerY( mScrollRulerY );
void DaliTableView::Rotate( unsigned int degrees )
{
// Resize the root actor
- Vector2 stageSize = Stage::GetCurrent().GetSize();
- Vector3 targetSize( stageSize.x, stageSize.y, 1.0f );
+ const Window::WindowSize windowSize = mApplication.GetWindow().GetSize();
+ const Vector2 originalSize( windowSize.GetWidth(), windowSize.GetHeight() );
+ Vector3 targetSize( originalSize.x, originalSize.y, 1.0f );
if( degrees == 90 || degrees == 270 )
{
- targetSize = Vector3( stageSize.y, stageSize.x, 1.0f );
+ targetSize = Vector3( originalSize.y, originalSize.x, 1.0f );
}
if( mRotateAnimation )
void DaliTableView::SetupInnerPageCubeEffect()
{
- const Vector2 stageSize = Stage::GetCurrent().GetSize();
+ const Window::WindowSize windowDimensions = mApplication.GetWindow().GetSize();
+ const Vector2 windowSize(windowDimensions.GetWidth(), windowDimensions.GetHeight());
Dali::Path path = Dali::Path::New();
Dali::Property::Array points;
points.Resize(3);
- points[0] = Vector3( stageSize.x*0.5, 0.0f, stageSize.x*0.5f);
+ points[0] = Vector3( windowSize.x*0.5, 0.0f, windowSize.x*0.5f);
points[1] = Vector3( 0.0f, 0.0f, 0.0f );
- points[2] = Vector3( -stageSize.x*0.5f, 0.0f, stageSize.x*0.5f);
+ points[2] = Vector3( -windowSize.x*0.5f, 0.0f, windowSize.x*0.5f);
path.SetProperty( Path::Property::POINTS, points );
Dali::Property::Array controlPoints;
controlPoints.Resize(4);
- controlPoints[0] = Vector3( stageSize.x*0.5f, 0.0f, stageSize.x*0.3f );
- controlPoints[1] = Vector3( stageSize.x*0.3f, 0.0f, 0.0f );
- controlPoints[2] = Vector3(-stageSize.x*0.3f, 0.0f, 0.0f );
- controlPoints[3] = Vector3(-stageSize.x*0.5f, 0.0f, stageSize.x*0.3f );
+ controlPoints[0] = Vector3( windowSize.x*0.5f, 0.0f, windowSize.x*0.3f );
+ controlPoints[1] = Vector3( windowSize.x*0.3f, 0.0f, 0.0f );
+ controlPoints[2] = Vector3(-windowSize.x*0.3f, 0.0f, 0.0f );
+ controlPoints[3] = Vector3(-windowSize.x*0.5f, 0.0f, windowSize.x*0.3f );
path.SetProperty( Path::Property::CONTROL_POINTS, controlPoints );
mScrollViewEffect = ScrollViewPagePathEffect::New(path,
Vector3(-1.0f,0.0f,0.0f),
Toolkit::ScrollView::Property::SCROLL_FINAL_X,
- Vector3(stageSize.x*TABLE_RELATIVE_SIZE.x,stageSize.y*TABLE_RELATIVE_SIZE.y,0.0f),mTotalPages);
+ Vector3(windowSize.x*TABLE_RELATIVE_SIZE.x,windowSize.y*TABLE_RELATIVE_SIZE.y,0.0f),mTotalPages);
}
void DaliTableView::OnKeyEvent( const KeyEvent& event )
mVersionPopup.SetResizePolicy( ResizePolicy::FIT_TO_CHILDREN, Dimension::HEIGHT );
mVersionPopup.OutsideTouchedSignal().Connect( this, &DaliTableView::HideVersionPopup );
- Stage::GetCurrent().Add( mVersionPopup );
+ mApplication.GetWindow().Add( mVersionPopup );
}
mVersionPopup.SetDisplayState( Popup::SHOWN );
#define DALI_DEMO_UTILITY_H
/*
- * Copyright (c) 2016 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.
#include <dali/dali.h>
#include <dali/public-api/rendering/geometry.h>
#include <dali/public-api/rendering/texture.h>
+#include <dali/public-api/math/uint-16-pair.h>
#include <dali/devel-api/adaptor-framework/image-loading.h>
namespace DemoHelper
return texture;
}
-Dali::Texture LoadStageFillingTexture( const char* imagePath )
+Dali::Texture LoadWindowFillingTexture( Dali::Uint16Pair size, const char* imagePath )
{
- Dali::Vector2 stageSize = Dali::Stage::GetCurrent().GetSize();
- return LoadTexture( imagePath, Dali::ImageDimensions( stageSize.x, stageSize.y ), Dali::FittingMode::SCALE_TO_FILL, Dali::SamplingMode::BOX_THEN_LINEAR );
+ return LoadTexture( imagePath, size, Dali::FittingMode::SCALE_TO_FILL, Dali::SamplingMode::BOX_THEN_LINEAR );
}
Dali::Geometry CreateTexturedQuad()
const Dali::Toolkit::Alignment::Padding DEFAULT_PLAY_PADDING(12.0f, 12.0f, 12.0f, 12.0f);
const Dali::Toolkit::Alignment::Padding DEFAULT_MODE_SWITCH_PADDING(8.0f, 8.0f, 8.0f, 8.0f);
-float ScalePointSize(int pointSize)
-{
- Dali::Vector2 dpi = Dali::Stage::GetCurrent().GetDpi();
- float meanDpi = (dpi.height + dpi.width) * 0.5f;
- return pointSize * 220.0f / meanDpi; // 220 is the default horizontal DPI defined in adaptor Application
-}
-
Dali::Layer CreateToolbar( Dali::Toolkit::ToolBar& toolBar,
const std::string& toolbarImagePath,
const std::string& title,
const ViewStyle& style )
{
- Dali::Stage stage = Dali::Stage::GetCurrent();
-
Dali::Layer toolBarLayer = Dali::Layer::New();
toolBarLayer.SetProperty( Dali::Actor::Property::NAME, "TOOLBAR_LAYER" );
toolBarLayer.SetProperty( Dali::Actor::Property::ANCHOR_POINT, Dali::AnchorPoint::TOP_CENTER );
const std::string& title,
const ViewStyle& style = DEFAULT_VIEW_STYLE )
{
- Dali::Stage stage = Dali::Stage::GetCurrent();
+ Dali::Window window = application.GetWindow();
// Create default View.
view = Dali::Toolkit::Control::New();
view.SetProperty( Dali::Actor::Property::PARENT_ORIGIN, Dali::ParentOrigin::CENTER );
view.SetResizePolicy( Dali::ResizePolicy::FILL_TO_PARENT, Dali::Dimension::ALL_DIMENSIONS );
- // Add the view to the stage before setting the background.
- stage.Add( view );
+ // Add the view to the window before setting the background.
+ window.Add( view );
// Set background image, loading it at screen resolution:
if ( !backgroundImagePath.empty() )
Dali::Property::Map map;
map[Dali::Toolkit::Visual::Property::TYPE] = Dali::Toolkit::Visual::IMAGE;
map[Dali::Toolkit::ImageVisual::Property::URL] = backgroundImagePath;
- map[Dali::Toolkit::ImageVisual::Property::DESIRED_WIDTH] = stage.GetSize().x;
- map[Dali::Toolkit::ImageVisual::Property::DESIRED_HEIGHT] = stage.GetSize().y;
+ map[Dali::Toolkit::ImageVisual::Property::DESIRED_WIDTH] = window.GetSize().GetWidth();
+ map[Dali::Toolkit::ImageVisual::Property::DESIRED_HEIGHT] = window.GetSize().GetHeight();
map[Dali::Toolkit::ImageVisual::Property::FITTING_MODE] = Dali::FittingMode::SCALE_TO_FILL;
map[Dali::Toolkit::ImageVisual::Property::SAMPLING_MODE] = Dali::SamplingMode::BOX_THEN_LINEAR;
map[Dali::Toolkit::ImageVisual::Property::SYNCHRONOUS_LOADING] = true;
view.SetProperty( Dali::Toolkit::Control::Property::BACKGROUND, map );
}
- // FIXME
- // Connects the orientation signal with the View::OrientationChanged method.
- //application.GetOrientation().ChangedSignal().Connect( &view, &Dali::Toolkit::View::OrientationChanged );
-
// Create default ToolBar
Dali::Layer toolBarLayer = CreateToolbar( toolBar, toolbarImagePath, title, style );