From 694dced621016315f10a5bdbd3f4552f5e29e380 Mon Sep 17 00:00:00 2001 From: Adeel Kazmi Date: Wed, 8 Jul 2020 18:09:36 +0100 Subject: [PATCH] Use Window instead of Stage Change-Id: I01ebd8f862d6564da7fbf3de4d540c496f4f2848 --- builder/dali-builder.cpp | 14 ++-- .../alpha-blending-cpu-example.cpp | 18 ++--- .../animated-gradient-call-active.cpp | 71 ++++++++--------- .../animated-gradient-card-active.cpp | 54 ++++++------- .../animated-images/animated-images-example.cpp | 30 ++++---- .../animated-shapes/animated-shapes-example.cpp | 42 +++++----- .../animated-vector-images-example.cpp | 6 +- examples/arc-visual/arc-visual-example.cpp | 24 +++--- examples/benchmark/benchmark.cpp | 72 +++++++++-------- examples/bezier-curve/bezier-curve-example.cpp | 12 +-- examples/blocks/blocks-example.cpp | 88 ++++++++++----------- examples/bloom-view/bloom-view-example.cpp | 16 ++-- examples/bubble-effect/bubble-effect-example.cpp | 20 ++--- examples/builder/examples.cpp | 26 +++---- examples/buttons/buttons-example.cpp | 6 +- .../clipping-draw-order/clipping-draw-order.cpp | 22 +++--- examples/clipping/clipping-example.cpp | 20 ++--- examples/color-visual/color-visual-example.cpp | 14 ++-- .../compressed-texture-formats-example.cpp | 14 ++-- examples/contact-cards/contact-card-layouter.cpp | 11 +-- examples/contact-cards/contact-card-layouter.h | 8 +- examples/contact-cards/contact-card.cpp | 10 +-- examples/contact-cards/contact-card.h | 10 ++- examples/contact-cards/contact-cards-example.cpp | 15 ++-- .../cube-transition-effect-example.cpp | 22 +++--- examples/deferred-shading/deferred-shading.cpp | 38 ++++----- .../dissolve-effect/dissolve-effect-example.cpp | 29 +++---- examples/drag-and-drop/drag-and-drop-example.cpp | 12 +-- examples/effects-view/effects-view-example.cpp | 22 +++--- examples/flex-container/flex-container-example.cpp | 16 ++-- examples/focus-integration/focus-integration.cpp | 13 ++-- examples/fpp-game/fpp-game-example.cpp | 18 ++--- examples/fpp-game/fpp-game-tutorial-controller.cpp | 34 ++++---- examples/fpp-game/fpp-game-tutorial-controller.h | 11 +-- examples/fpp-game/game-camera.cpp | 37 ++++----- examples/fpp-game/game-camera.h | 17 ++-- examples/fpp-game/game-scene.cpp | 11 ++- examples/fpp-game/game-scene.h | 6 +- examples/frame-callback/frame-callback-example.cpp | 48 ++++++------ examples/frame-callback/frame-callback.cpp | 10 +-- examples/frame-callback/frame-callback.h | 10 +-- .../gaussian-blur-view-example.cpp | 18 ++--- examples/gestures/gesture-example.cpp | 33 ++++---- examples/gradients/gradients-example.cpp | 20 ++--- examples/hello-world/hello-world-example.cpp | 21 +++-- .../homescreen-benchmark/homescreen-benchmark.cpp | 38 ++++----- examples/image-policies/image-policies-example.cpp | 18 ++--- .../image-scaling-and-filtering-example.cpp | 90 +++++++++++----------- .../image-scaling-irregular-grid-example.cpp | 40 +++++----- .../image-view-alpha-blending-example.cpp | 12 +-- .../image-view-pixel-area-example.cpp | 8 +- examples/image-view-svg/image-view-svg-example.cpp | 38 ++++----- examples/image-view-url/image-view-url-example.cpp | 12 +-- examples/image-view/image-view-example.cpp | 10 +-- examples/item-view/item-view-example.cpp | 49 ++++++------ examples/line-mesh/line-mesh-example.cpp | 24 +++--- examples/magnifier/magnifier-example.cpp | 46 +++++------ examples/mesh-morph/mesh-morph-example.cpp | 12 +-- examples/mesh-visual/mesh-visual-example.cpp | 31 ++++---- .../metaball-explosion-example.cpp | 22 +++--- .../metaball-refrac/metaball-refrac-example.cpp | 22 +++--- examples/model3d-view/model3d-view-example.cpp | 20 ++--- examples/motion-blur/motion-blur-example.cpp | 21 ++--- examples/motion-stretch/motion-stretch-example.cpp | 19 ++--- .../native-image-source-example.cpp | 62 +++++++-------- examples/page-turn-view/page-turn-view-example.cpp | 20 ++--- examples/perf-scroll/perf-scroll.cpp | 36 ++++----- examples/pivot/pivot-example.cpp | 14 ++-- examples/point-mesh/point-mesh-example.cpp | 12 +-- examples/popup/popup-example.cpp | 40 +++++----- .../pre-render-callback-example.cpp | 18 ++--- .../primitive-shapes/primitive-shapes-example.cpp | 12 +-- examples/progress-bar/progress-bar-example.cpp | 6 +- .../property-notification-example.cpp | 12 +-- examples/ray-marching/ray-marching-example.cpp | 14 ++-- examples/reflection-demo/reflection-example.cpp | 44 +++++------ .../refraction-effect-example.cpp | 24 +++--- .../remote-image-loading-example.cpp | 30 ++++---- .../renderer-stencil/renderer-stencil-example.cpp | 34 ++++---- .../renderer-stencil/renderer-stencil-shaders.h | 3 +- .../rendering-basic-light-example.cpp | 28 +++---- .../rendering-basic-pbr-example.cpp | 45 +++++------ examples/rendering-cube/rendering-cube.cpp | 22 +++--- examples/rendering-line/rendering-line.cpp | 20 ++--- .../rendering-radial-progress/radial-progress.cpp | 14 ++-- examples/rendering-skybox/look-camera.cpp | 22 +++--- examples/rendering-skybox/look-camera.h | 10 ++- examples/rendering-skybox/rendering-skybox.cpp | 22 +++--- .../rendering-textured-cube.cpp | 22 +++--- examples/rendering-triangle/rendering-triangle.cpp | 20 ++--- examples/scroll-view/scroll-view-example.cpp | 90 +++++++++++----------- .../shadows-and-lights-example.cpp | 18 ++--- .../simple-text-label-example.cpp | 14 ++-- .../simple-scroll-view-example.cpp | 17 ++-- examples/simple-text-field/simple-text-field.cpp | 10 +-- .../simple-text-label-example.cpp | 8 +- .../simple-text-renderer-example.cpp | 12 +-- .../simple-text-visual-example.cpp | 10 +-- .../simple-visuals-application.cpp | 8 +- .../size-negotiation/size-negotiation-example.cpp | 50 ++++++------ examples/sparkle/sparkle-effect-example.cpp | 12 +-- examples/styling/styling-application.cpp | 16 ++-- .../super-blur-view/super-blur-view-example.cpp | 10 +-- examples/text-editor/text-editor-example.cpp | 20 ++--- examples/text-field/text-field-example.cpp | 20 ++--- examples/text-fonts/text-fonts-example.cpp | 30 ++++---- examples/text-label-emojis/text-label-emojis.cpp | 10 +-- .../text-label-multi-language-example.cpp | 10 +-- examples/text-label/text-label-example.cpp | 28 +++---- .../text-memory-profiling-example.cpp | 21 +++-- examples/text-overlap/text-overlap-example.cpp | 22 +++--- examples/text-scrolling/text-scrolling-example.cpp | 22 +++--- examples/textured-mesh/textured-mesh-example.cpp | 14 ++-- examples/tilt/tilt-example.cpp | 16 ++-- examples/tooltip/tooltip-example.cpp | 36 ++++----- examples/transitions/transition-application.cpp | 8 +- examples/video-view/video-view-example.cpp | 12 +-- .../visual-fitting-mode-example.cpp | 20 ++--- .../visual-transitions/transition-application.cpp | 8 +- examples/web-view/web-view-example.cpp | 16 ++-- shared/dali-table-view.cpp | 44 ++++++----- shared/utility.h | 8 +- shared/view.h | 23 ++---- 123 files changed, 1427 insertions(+), 1443 deletions(-) mode change 100755 => 100644 examples/drag-and-drop/drag-and-drop-example.cpp diff --git a/builder/dali-builder.cpp b/builder/dali-builder.cpp index b0e3248..0f9d5bf 100644 --- a/builder/dali-builder.cpp +++ b/builder/dali-builder.cpp @@ -187,7 +187,7 @@ public: 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: @@ -199,8 +199,8 @@ 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 ); @@ -217,11 +217,11 @@ private: 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 Collection; @@ -239,7 +239,7 @@ private: } RenderTask defaultTask = taskList.GetTask(0); - defaultTask.SetSourceActor( stage.GetRootLayer() ); + defaultTask.SetSourceActor( window.GetRootLayer() ); defaultTask.SetFrameBuffer( FrameBuffer() ); } } diff --git a/examples/alpha-blending-cpu/alpha-blending-cpu-example.cpp b/examples/alpha-blending-cpu/alpha-blending-cpu-example.cpp index 2389c93..4a80e59 100644 --- a/examples/alpha-blending-cpu/alpha-blending-cpu-example.cpp +++ b/examples/alpha-blending-cpu/alpha-blending-cpu-example.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -53,34 +53,34 @@ private: // 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 ) diff --git a/examples/animated-gradient-call-active/animated-gradient-call-active.cpp b/examples/animated-gradient-call-active/animated-gradient-call-active.cpp index cf63455..1ce69a8 100644 --- a/examples/animated-gradient-call-active/animated-gradient-call-active.cpp +++ b/examples/animated-gradient-call-active/animated-gradient-call-active.cpp @@ -1,5 +1,5 @@ /* -* 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. @@ -30,9 +30,9 @@ namespace { // 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; @@ -129,29 +129,30 @@ public: // 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(); @@ -185,7 +186,7 @@ private: 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(); @@ -213,15 +214,15 @@ private: 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 ); @@ -231,8 +232,8 @@ private: 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 ); @@ -242,8 +243,8 @@ private: 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 ); @@ -253,7 +254,7 @@ private: 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 ); @@ -261,13 +262,13 @@ private: 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(); @@ -300,15 +301,15 @@ private: 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() @@ -337,7 +338,7 @@ private: if( button == mCallStartButton ) { mBackground.SetStyleName( BACKGROUND_ACTIVE_STYLE_STR ); - mStage.Add( mButtonClip ); + mWindow.Add( mButtonClip ); mMoveFront.Play(); } else if( button == mCallEndButton ) @@ -363,7 +364,7 @@ private: private: Application& mApplication; - Stage mStage; + Window mWindow; Control mBackground; diff --git a/examples/animated-gradient-card-active/animated-gradient-card-active.cpp b/examples/animated-gradient-card-active/animated-gradient-card-active.cpp index 46334ba..7ec7d9f 100644 --- a/examples/animated-gradient-card-active/animated-gradient-card-active.cpp +++ b/examples/animated-gradient-card-active/animated-gradient-card-active.cpp @@ -1,5 +1,5 @@ /* -* 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. @@ -30,9 +30,9 @@ namespace { // 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; @@ -122,7 +122,7 @@ public: } ~CardManager() {} - void Init(Stage& stage) + void Init(Window& window) { mSize = CARD_SIZE * SCALED_WIDTH; mOffset = CARD_OFFSET * SCALED_WIDTH; @@ -156,7 +156,7 @@ public: 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] ); } } @@ -280,26 +280,27 @@ public: // 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(); @@ -307,7 +308,7 @@ public: SetupActors(); SetupAnimation(); - mStage.GetRootLayer().TouchSignal().Connect( this, &CardController::OnTouchLayer ); + mWindow.GetRootLayer().TouchSignal().Connect( this, &CardController::OnTouchLayer ); Reset(); } @@ -379,8 +380,9 @@ public: { 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(); @@ -389,7 +391,7 @@ public: mCardChanger.Start(); } // Scroll to left - else if( diff.x < -mStage.GetSize().x * offset ) + else if( diff.x < -windowWidth * offset ) { mCards.mCurState = 2; MoveLeft(); @@ -578,7 +580,7 @@ private: void SetupCards() { - mCards.Init( mStage ); + mCards.Init( mWindow ); for( int k = 0; k < CARD_NUM; k++ ) { mCards[k].TouchSignal().Connect( this, &CardController::OnTouchCards ); @@ -587,7 +589,7 @@ private: mNormalEndColor = mCards.GetColorBackground( mCards.mCurIndex ); } - // Create and Add to stage + // Create and Add to window void SetupActors() { mAddButton = ImageView::New(); @@ -630,10 +632,10 @@ private: 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() @@ -776,7 +778,7 @@ private: private: Application& mApplication; - Stage mStage; + Window mWindow; CardManager mCards; diff --git a/examples/animated-images/animated-images-example.cpp b/examples/animated-images/animated-images-example.cpp index 4e947e6..13ca64a 100644 --- a/examples/animated-images/animated-images-example.cpp +++ b/examples/animated-images/animated-images-example.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -107,16 +107,16 @@ private: */ 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(); @@ -126,7 +126,7 @@ private: /** * @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 ); @@ -148,7 +148,7 @@ private: VerticalAlignment::CENTER ); radioButtonLayout.SetProperty( Actor::Property::POSITION_Y, -10.0f ); - Stage::GetCurrent().Add( radioButtonLayout ); + window.Add( radioButtonLayout ); } /** @@ -168,16 +168,14 @@ private: /** * @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(); } @@ -190,10 +188,10 @@ private: 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 ); } } @@ -281,7 +279,7 @@ private: { mImageType = ( button == mAnimatedImageButton ) ? ImageType::ANIMATED_IMAGE : ImageType::IMAGE_ARRAY; - CreateAnimatedImageViews(); + CreateAnimatedImageViews(mApplication.GetWindow()); return true; } diff --git a/examples/animated-shapes/animated-shapes-example.cpp b/examples/animated-shapes/animated-shapes-example.cpp index 66828d1..9cb9220 100644 --- a/examples/animated-shapes/animated-shapes-example.cpp +++ b/examples/animated-shapes/animated-shapes-example.cpp @@ -91,19 +91,17 @@ public: 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(); @@ -120,12 +118,12 @@ public: 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 ); @@ -134,13 +132,13 @@ public: 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 ) @@ -214,8 +212,8 @@ public: 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); @@ -305,8 +303,8 @@ public: 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); @@ -407,8 +405,8 @@ public: 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 ); diff --git a/examples/animated-vector-images/animated-vector-images-example.cpp b/examples/animated-vector-images/animated-vector-images-example.cpp index bbcd57e..77c2705 100644 --- a/examples/animated-vector-images/animated-vector-images-example.cpp +++ b/examples/animated-vector-images/animated-vector-images-example.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -84,7 +84,7 @@ class AnimatedVectorImageViewController: public ConnectionTracker // 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, @@ -144,7 +144,7 @@ class AnimatedVectorImageViewController: public ConnectionTracker mTable.AddChild( mImageViews[x], TableView::CellPosition( CellPlacement::IMAGE, x ) ); } - Stage::GetCurrent().KeyEventSignal().Connect(this, &AnimatedVectorImageViewController::OnKeyEvent); + application.GetWindow().KeyEventSignal().Connect(this, &AnimatedVectorImageViewController::OnKeyEvent); } private: diff --git a/examples/arc-visual/arc-visual-example.cpp b/examples/arc-visual/arc-visual-example.cpp index 4ae4e23..984ab0d 100644 --- a/examples/arc-visual/arc-visual-example.cpp +++ b/examples/arc-visual/arc-visual-example.cpp @@ -98,15 +98,15 @@ 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 ); @@ -117,7 +117,7 @@ private: 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 ); @@ -128,7 +128,7 @@ private: 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 ); @@ -139,7 +139,7 @@ private: 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 ); @@ -150,7 +150,7 @@ private: 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 ); @@ -161,13 +161,13 @@ private: 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 ) diff --git a/examples/benchmark/benchmark.cpp b/examples/benchmark/benchmark.cpp index a07e5f9..e8755a5 100644 --- a/examples/benchmark/benchmark.cpp +++ b/examples/benchmark/benchmark.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -215,37 +215,34 @@ class Benchmark : public ConnectionTracker 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 ) { @@ -273,7 +270,7 @@ public: void CreateImageViews() { - Stage stage = Stage::GetCurrent(); + Window window = mApplication.GetWindow(); unsigned int actorCount(mRowsPerPage*mColumnsPerPage * mPageCount); mImageView.resize(actorCount); @@ -282,7 +279,7 @@ public: 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]); } } @@ -300,7 +297,7 @@ public: } //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( mRowsPerPage ) * mColumnsPerPage * mPageCount ); @@ -392,17 +390,17 @@ public: { 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(); @@ -417,7 +415,7 @@ public: 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); diff --git a/examples/bezier-curve/bezier-curve-example.cpp b/examples/bezier-curve/bezier-curve-example.cpp index 717ee66..38405af 100644 --- a/examples/bezier-curve/bezier-curve-example.cpp +++ b/examples/bezier-curve/bezier-curve-example.cpp @@ -149,10 +149,10 @@ public: // 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; @@ -161,7 +161,7 @@ public: 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); @@ -275,7 +275,7 @@ public: 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 ); @@ -286,7 +286,7 @@ public: 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) diff --git a/examples/blocks/blocks-example.cpp b/examples/blocks/blocks-example.cpp index 9d5f33b..66c9916 100644 --- a/examples/blocks/blocks-example.cpp +++ b/examples/blocks/blocks-example.cpp @@ -60,12 +60,12 @@ const Vector3 INITIAL_BALL_DIRECTION(1.0f, 1.0f, 0.0f); ///< 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! @@ -249,10 +249,10 @@ public: */ 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, @@ -271,23 +271,23 @@ public: 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); @@ -295,14 +295,14 @@ private: 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); @@ -310,29 +310,29 @@ private: 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( delegate, property, CollisionCircleRectangleConstraint( -Vector3(0.0f, mPaddleHitMargin.height * 0.575f, 0.0f),-Vector3(mPaddleHitMargin) ) ); constraint.AddSource( Source(mBall, Actor::Property::POSITION) ); @@ -387,8 +387,8 @@ private: 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( brickSize.width ); mBrickImageMap["desiredHeight"] = static_cast( brickSize.height ); @@ -425,13 +425,13 @@ private: */ 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++) { @@ -449,13 +449,13 @@ private: */ 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++) { @@ -478,13 +478,13 @@ private: */ 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 @@ -546,7 +546,7 @@ private: /** - * 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. @@ -808,7 +808,7 @@ private: */ 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); diff --git a/examples/bloom-view/bloom-view-example.cpp b/examples/bloom-view/bloom-view-example.cpp index 8859b94..5ec9ce5 100644 --- a/examples/bloom-view/bloom-view-example.cpp +++ b/examples/bloom-view/bloom-view-example.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -72,14 +72,14 @@ public: 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(); @@ -117,7 +117,7 @@ public: 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 ); @@ -125,7 +125,7 @@ public: PulseBloomIntensity(); // Respond to key events - stage.KeyEventSignal().Connect( this, &BloomExample::OnKeyEvent ); + window.KeyEventSignal().Connect( this, &BloomExample::OnKeyEvent ); } void OnKeyEvent( const KeyEvent& event ) diff --git a/examples/bubble-effect/bubble-effect-example.cpp b/examples/bubble-effect/bubble-effect-example.cpp index 444f8d7..ad6b774 100644 --- a/examples/bubble-effect/bubble-effect-example.cpp +++ b/examples/bubble-effect/bubble-effect-example.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -56,7 +56,7 @@ const unsigned int DEFAULT_NUMBER_OF_BUBBLES( 1000 ); }// 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: @@ -91,13 +91,13 @@ private: // 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, @@ -126,14 +126,14 @@ private: 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. @@ -253,7 +253,7 @@ private: 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 ] ); diff --git a/examples/builder/examples.cpp b/examples/builder/examples.cpp index bcb3234..3d9803a 100644 --- a/examples/builder/examples.cpp +++ b/examples/builder/examples.cpp @@ -266,7 +266,7 @@ public: void SetUpItemView() { - Stage stage = Stage::GetCurrent(); + Window window = mApp.GetWindow(); mTapDetector = TapGestureDetector::New(); mTapDetector.DetectedSignal().Connect( this, &ExampleApp::OnTap ); @@ -279,7 +279,7 @@ public: 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 ); @@ -343,7 +343,7 @@ public: } // Activate the layout - Vector3 size(stage.GetSize()); + Vector3 size(window.GetSize()); mItemView.ActivateLayout(0, size, 0.0f/*immediate*/); } @@ -379,7 +379,7 @@ public: 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 ); @@ -392,7 +392,7 @@ public: 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 Collection; @@ -410,7 +410,7 @@ public: } RenderTask defaultTask = taskList.GetTask(0); - defaultTask.SetSourceActor( stage.GetRootLayer() ); + defaultTask.SetSourceActor( window.GetRootLayer() ); defaultTask.SetFrameBuffer( FrameBuffer() ); } @@ -452,7 +452,7 @@ public: 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 ); @@ -461,9 +461,9 @@ public: 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, @@ -488,7 +488,7 @@ public: 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; @@ -497,14 +497,14 @@ public: 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(); diff --git a/examples/buttons/buttons-example.cpp b/examples/buttons/buttons-example.cpp index 649b417..61dd217 100644 --- a/examples/buttons/buttons-example.cpp +++ b/examples/buttons/buttons-example.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -92,10 +92,10 @@ class ButtonsController: public ConnectionTracker // 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, diff --git a/examples/clipping-draw-order/clipping-draw-order.cpp b/examples/clipping-draw-order/clipping-draw-order.cpp index efe0162..c8a5775 100644 --- a/examples/clipping-draw-order/clipping-draw-order.cpp +++ b/examples/clipping-draw-order/clipping-draw-order.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -49,12 +49,12 @@ public: // 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" ); @@ -69,7 +69,7 @@ public: 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. @@ -194,11 +194,11 @@ public: 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 ) diff --git a/examples/clipping/clipping-example.cpp b/examples/clipping/clipping-example.cpp index 6eb1ee2..2e42cbb 100644 --- a/examples/clipping/clipping-example.cpp +++ b/examples/clipping/clipping-example.cpp @@ -74,9 +74,9 @@ private: */ 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 ); @@ -85,22 +85,22 @@ private: 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. @@ -121,7 +121,7 @@ private: .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() ); @@ -137,7 +137,7 @@ private: 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 ); } /** diff --git a/examples/color-visual/color-visual-example.cpp b/examples/color-visual/color-visual-example.cpp index ea630d9..d96e586 100644 --- a/examples/color-visual/color-visual-example.cpp +++ b/examples/color-visual/color-visual-example.cpp @@ -68,22 +68,22 @@ public: // 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 ) diff --git a/examples/compressed-texture-formats/compressed-texture-formats-example.cpp b/examples/compressed-texture-formats/compressed-texture-formats-example.cpp index 2c0de1d..ec957ce 100644 --- a/examples/compressed-texture-formats/compressed-texture-formats-example.cpp +++ b/examples/compressed-texture-formats/compressed-texture-formats-example.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -107,9 +107,9 @@ public: // 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 ); @@ -174,11 +174,11 @@ public: 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 ) diff --git a/examples/contact-cards/contact-card-layouter.cpp b/examples/contact-cards/contact-card-layouter.cpp index c638f83..e5ab2c9 100644 --- a/examples/contact-cards/contact-card-layouter.cpp +++ b/examples/contact-cards/contact-card-layouter.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -18,9 +18,6 @@ // CLASS HEADER #include "contact-card-layouter.h" -// EXTERNAL INCLUDES -#include - // INTERNAL INCLUDES #include "contact-card.h" @@ -57,14 +54,14 @@ ContactCardLayouter::~ContactCardLayouter() // 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; @@ -98,7 +95,7 @@ void ContactCardLayouter::AddContact( const std::string& contactName, const std: } // 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() diff --git a/examples/contact-cards/contact-card-layouter.h b/examples/contact-cards/contact-card-layouter.h index ed4d17b..06a8512 100644 --- a/examples/contact-cards/contact-card-layouter.h +++ b/examples/contact-cards/contact-card-layouter.h @@ -2,7 +2,7 @@ #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. @@ -21,6 +21,7 @@ // EXTERNAL INCLUDES #include #include +#include #include #include @@ -32,7 +33,7 @@ class ContactCard; /** * @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. @@ -53,11 +54,12 @@ public: /** * @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: diff --git a/examples/contact-cards/contact-card.cpp b/examples/contact-cards/contact-card.cpp index 1f8735e..3d77260 100644 --- a/examples/contact-cards/contact-card.cpp +++ b/examples/contact-cards/contact-card.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -87,6 +87,7 @@ const Vector4 HEADER_COLOR( 231.0f/255.0f, 231.0f/255.0f, 231.0f/255.0f, 1.0f ); } // unnamed namespace ContactCard::ContactCard( + Dali::Window window, const ContactCardLayoutInfo& contactCardLayoutInfo, const std::string& contactName, const std::string& contactAddress, @@ -106,9 +107,8 @@ ContactCard::ContactCard( 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(); @@ -120,7 +120,7 @@ ContactCard::ContactCard( 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(); diff --git a/examples/contact-cards/contact-card.h b/examples/contact-cards/contact-card.h index cee4000..21a981f 100644 --- a/examples/contact-cards/contact-card.h +++ b/examples/contact-cards/contact-card.h @@ -2,7 +2,7 @@ #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. @@ -21,6 +21,7 @@ // EXTERNAL INCLUDES #include #include +#include #include #include #include @@ -47,22 +48,23 @@ public: /** * @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(); diff --git a/examples/contact-cards/contact-cards-example.cpp b/examples/contact-cards/contact-cards-example.cpp index d48bff5..c8eb8eb 100644 --- a/examples/contact-cards/contact-cards-example.cpp +++ b/examples/contact-cards/contact-cards-example.cpp @@ -19,7 +19,6 @@ #include #include #include -#include #include #include @@ -32,7 +31,7 @@ using namespace Dali::Toolkit; 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 @@ -43,7 +42,7 @@ const char * const THEME_PATH( DEMO_STYLE_DIR "contact-cards-example-theme.json" * 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. @@ -79,15 +78,15 @@ private: */ 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 ); } } diff --git a/examples/cube-transition-effect/cube-transition-effect-example.cpp b/examples/cube-transition-effect/cube-transition-effect-example.cpp index ba73d76..08f0228 100644 --- a/examples/cube-transition-effect/cube-transition-effect-example.cpp +++ b/examples/cube-transition-effect/cube-transition-effect-example.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -159,11 +159,11 @@ private: 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; @@ -210,9 +210,9 @@ CubeTransitionApp::~CubeTransitionApp() 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 ); @@ -240,11 +240,11 @@ void CubeTransitionApp::OnInit( Application& application ) 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 ); @@ -315,7 +315,7 @@ void CubeTransitionApp::OnPanGesture( Actor actor, const PanGesture& gesture ) void CubeTransitionApp::GoToNextImage() { - mNextTexture = LoadStageFillingTexture( IMAGES[ mIndex ] ); + mNextTexture = LoadWindowFillingTexture( IMAGES[ mIndex ] ); mCurrentEffect.SetTargetTexture( mNextTexture ); mIsImageLoading = false; mCurrentEffect.StartTransition( mPanPosition, mPanDisplacement ); @@ -390,9 +390,9 @@ bool CubeTransitionApp::OnTimerTick() 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); diff --git a/examples/deferred-shading/deferred-shading.cpp b/examples/deferred-shading/deferred-shading.cpp index 78aff54..8e8324a 100644 --- a/examples/deferred-shading/deferred-shading.cpp +++ b/examples/deferred-shading/deferred-shading.cpp @@ -501,24 +501,22 @@ public: 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(); - 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(); @@ -529,7 +527,7 @@ private: CenterActor(sceneRoot); mSceneRoot = sceneRoot; - stage.Add(sceneRoot); + window.Add(sceneRoot); // Create an axis to spin our actors around. auto axis = Actor::New(); @@ -546,7 +544,6 @@ private: 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: { @@ -595,8 +592,8 @@ private: } // Create off-screen textures, fbo and render task. - uint32_t width = static_cast(stageSize.x); - uint32_t height = static_cast(stageSize.y); + uint32_t width = static_cast(windowSize.x); + uint32_t height = static_cast(windowSize.y); Texture rttNormal = Texture::New(TextureType::TEXTURE_2D, Pixel::Format::RGB888, width, height); @@ -610,7 +607,7 @@ private: fbo.AttachColorTexture(rttColor); RenderTask sceneRender = tasks.CreateTask(); - sceneRender.SetViewportSize(stageSize); + sceneRender.SetViewportSize(windowSize); sceneRender.SetFrameBuffer(fbo); sceneRender.SetCameraActor(camera); sceneRender.SetSourceActor(sceneRoot); @@ -625,7 +622,7 @@ private: // 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); @@ -641,7 +638,6 @@ private: 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); @@ -657,7 +653,7 @@ private: finalImage.AddRenderer(finalImageRenderer); mFinalImage = finalImage; - stage.Add(finalImage); + window.Add(finalImage); // Create a node for our lights auto lights = Actor::New(); @@ -704,16 +700,16 @@ private: 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); diff --git a/examples/dissolve-effect/dissolve-effect-example.cpp b/examples/dissolve-effect/dissolve-effect-example.cpp index 409e358..8ceec26 100644 --- a/examples/dissolve-effect/dissolve-effect-example.cpp +++ b/examples/dissolve-effect/dissolve-effect-example.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -81,21 +81,20 @@ const float TRANSITION_DURATION = 2.5f; //2.5 second 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; @@ -215,9 +214,11 @@ DissolveEffectApp::~DissolveEffectApp() 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. @@ -246,14 +247,14 @@ void DissolveEffectApp::OnInit( Application& application ) 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 ); @@ -286,7 +287,7 @@ void DissolveEffectApp::OnPanGesture( Actor actor, const PanGesture& gesture ) 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 ); @@ -401,7 +402,7 @@ bool DissolveEffectApp::OnTimerTick() 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 ); diff --git a/examples/drag-and-drop/drag-and-drop-example.cpp b/examples/drag-and-drop/drag-and-drop-example.cpp old mode 100755 new mode 100644 index 1c76b37..0c56042 --- a/examples/drag-and-drop/drag-and-drop-example.cpp +++ b/examples/drag-and-drop/drag-and-drop-example.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -71,20 +71,20 @@ public: // 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++) { @@ -105,7 +105,7 @@ public: mRect[i] = Rect(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); diff --git a/examples/effects-view/effects-view-example.cpp b/examples/effects-view/effects-view-example.cpp index 597bd40..25d1779 100644 --- a/examples/effects-view/effects-view-example.cpp +++ b/examples/effects-view/effects-view-example.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -99,7 +99,7 @@ private: EffectsView mDropShadowView; EffectsView mEmbossView; Toolkit::TextLabel mTitleActor; ///< The title on the toolbar - Vector2 mStageSize; + Vector2 mWindowSize; int mEffectSize; }; @@ -120,14 +120,14 @@ void EffectsViewApp::OnAppInitialize( Application& application ) { // The Init signal is received once (only) during the Application lifetime - Stage stage = Stage::GetCurrent(); - stage.KeyEventSignal().Connect(this, &EffectsViewApp::OnKeyEvent); - stage.SetBackgroundColor( Color::WHITE ); + 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. @@ -138,17 +138,17 @@ void EffectsViewApp::OnAppInitialize( Application& application ) 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 ); @@ -171,7 +171,7 @@ EffectsView EffectsViewApp::CreateEffectsView( EffectsView::EffectType type, con 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 diff --git a/examples/flex-container/flex-container-example.cpp b/examples/flex-container/flex-container-example.cpp index b488674..62deb04 100644 --- a/examples/flex-container/flex-container-example.cpp +++ b/examples/flex-container/flex-container-example.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -119,14 +119,14 @@ public: */ 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, @@ -192,7 +192,7 @@ public: 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); @@ -237,7 +237,7 @@ public: // 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 ); } diff --git a/examples/focus-integration/focus-integration.cpp b/examples/focus-integration/focus-integration.cpp index c439e17..2d2759e 100644 --- a/examples/focus-integration/focus-integration.cpp +++ b/examples/focus-integration/focus-integration.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -53,7 +53,8 @@ public: void Create( Application& application ) { - mStage = Stage::GetCurrent(); + mWindow = application.GetWindow(); + Vector2 windowSize = mWindow.GetSize(); mContentLayer = DemoHelper::CreateView( application, mView, mToolBar, @@ -78,7 +79,7 @@ public: // 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" ); @@ -86,7 +87,7 @@ public: 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 ) ); @@ -144,7 +145,7 @@ public: 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 @@ -186,7 +187,7 @@ private: private: Application& mApplication; - Stage mStage; + Window mWindow; TableView mContainer; TextLabel mEventLabel; Toolkit::Control mView; ///< The View instance. diff --git a/examples/fpp-game/fpp-game-example.cpp b/examples/fpp-game/fpp-game-example.cpp index a3d3258..9d209fa 100644 --- a/examples/fpp-game/fpp-game-example.cpp +++ b/examples/fpp-game/fpp-game-example.cpp @@ -39,7 +39,7 @@ const char* SCENE_URL = 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. @@ -93,22 +93,22 @@ public: // 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 @@ -127,7 +127,7 @@ private: Application& mApplication; GameScene mScene; - Stage mStage; + Window mWindow; FppGameTutorialController mTutorialController; }; diff --git a/examples/fpp-game/fpp-game-tutorial-controller.cpp b/examples/fpp-game/fpp-game-tutorial-controller.cpp index dd38419..ef20090 100644 --- a/examples/fpp-game/fpp-game-tutorial-controller.cpp +++ b/examples/fpp-game/fpp-game-tutorial-controller.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -42,7 +42,7 @@ FppGameTutorialController::~FppGameTutorialController() void FppGameTutorialController::OnTouch( const TouchData& touchEvent ) { - Vector2 size( mStage.GetSize() ); + Vector2 size( mWindow.GetSize() ); bool isLandscape( size.x > size.y ); @@ -94,26 +94,26 @@ void FppGameTutorialController::OnTouch( const TouchData& touchEvent ) } } -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 ) ) ); @@ -126,7 +126,7 @@ void FppGameTutorialController::DisplayTutorial() 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 ) ) ); @@ -136,7 +136,7 @@ void FppGameTutorialController::DisplayTutorial() // 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 ); @@ -147,12 +147,12 @@ void FppGameTutorialController::DisplayTutorial() 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 ); @@ -166,13 +166,13 @@ void FppGameTutorialController::DisplayTutorial() 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 ); } diff --git a/examples/fpp-game/fpp-game-tutorial-controller.h b/examples/fpp-game/fpp-game-tutorial-controller.h index 897a922..cafdeb6 100644 --- a/examples/fpp-game/fpp-game-tutorial-controller.h +++ b/examples/fpp-game/fpp-game-tutorial-controller.h @@ -2,7 +2,7 @@ #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. @@ -20,8 +20,8 @@ #include #include -#include #include +#include #include class FppGameTutorialController : public Dali::ConnectionTracker @@ -40,8 +40,9 @@ public: /** * 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 @@ -56,7 +57,7 @@ public: void OnTutorialAnimationFinished( Dali::Animation& animation ); /** - * Handles tutorial completion stage + * Handles tutorial completion window * @param animation Animation object */ void OnTutorialComplete( Dali::Animation& animation ); @@ -69,7 +70,7 @@ private: 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 diff --git a/examples/fpp-game/game-camera.cpp b/examples/fpp-game/game-camera.cpp index 2f99710..aa59f65 100644 --- a/examples/fpp-game/game-camera.cpp +++ b/examples/fpp-game/game-camera.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -17,7 +17,6 @@ #include "game-camera.h" -#include #include #include #include @@ -69,14 +68,16 @@ GameCamera::~GameCamera() 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(); @@ -92,8 +93,6 @@ void GameCamera::Initialise( float fovY, float near, float far ) bool GameCamera::OnTick() { - Vector2 stageSize = Stage::GetCurrent().GetSize(); - // --------------------------------------------------------------------- // update rotation Vector2 tmp( mScreenLookDelta ); @@ -101,8 +100,8 @@ bool GameCamera::OnTick() 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 ) @@ -112,8 +111,8 @@ bool GameCamera::OnTick() } 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 ) @@ -154,8 +153,8 @@ bool GameCamera::OnTick() 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 ) @@ -178,8 +177,6 @@ bool GameCamera::OnTick() 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 ); @@ -196,11 +193,9 @@ void GameCamera::InitialiseDefaultCamera() 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 ); @@ -212,8 +207,6 @@ void GameCamera::CreateInterceptorActor() 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 ); @@ -224,13 +217,13 @@ bool GameCamera::OnTouch( Actor actor, const TouchData& touch ) { 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 diff --git a/examples/fpp-game/game-camera.h b/examples/fpp-game/game-camera.h index f1d6306..edbfdc8 100644 --- a/examples/fpp-game/game-camera.h +++ b/examples/fpp-game/game-camera.h @@ -2,7 +2,7 @@ #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. @@ -30,7 +30,7 @@ * 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. @@ -54,17 +54,13 @@ public: /** * 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: @@ -115,8 +111,9 @@ 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 diff --git a/examples/fpp-game/game-scene.cpp b/examples/fpp-game/game-scene.cpp index 7142c0e..1c322ee 100644 --- a/examples/fpp-game/game-scene.cpp +++ b/examples/fpp-game/game-scene.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -44,7 +44,7 @@ GameScene::~GameScene() { } -bool GameScene::Load(const char *filename) +bool GameScene::Load(Window window, const char *filename) { ByteArray bytes; if( !LoadFile( filename, bytes ) ) @@ -150,12 +150,11 @@ bool GameScene::Load(const char *filename) 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 ) ) ); @@ -169,7 +168,7 @@ bool GameScene::Load(const char *filename) } // 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; } diff --git a/examples/fpp-game/game-scene.h b/examples/fpp-game/game-scene.h index 0b0c689..a726c2f 100644 --- a/examples/fpp-game/game-scene.h +++ b/examples/fpp-game/game-scene.h @@ -2,7 +2,7 @@ #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. @@ -27,6 +27,7 @@ #include "game-camera.h" #include +#include class GameCamera; class GameEntity; @@ -57,10 +58,11 @@ public: /** * 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 diff --git a/examples/frame-callback/frame-callback-example.cpp b/examples/frame-callback/frame-callback-example.cpp index d780ff8..0c530d3 100644 --- a/examples/frame-callback/frame-callback-example.cpp +++ b/examples/frame-callback/frame-callback-example.cpp @@ -55,7 +55,6 @@ public: */ FrameCallbackController( Application& application ) : mApplication( application ), - mStage(), mFrameCallback(), mTextLabel(), mTapDetector(), @@ -72,35 +71,35 @@ private: * * 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 ); @@ -109,10 +108,10 @@ private: 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 ); @@ -128,29 +127,29 @@ private: 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 ); } @@ -177,7 +176,6 @@ private: 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. diff --git a/examples/frame-callback/frame-callback.cpp b/examples/frame-callback/frame-callback.cpp index 52ef117..f2c6a30 100644 --- a/examples/frame-callback/frame-callback.cpp +++ b/examples/frame-callback/frame-callback.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -23,13 +23,13 @@ using namespace std; 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 ) @@ -46,7 +46,7 @@ void FrameCallback::Update( Dali::UpdateProxy& updateProxy, float /* elapsedSeco 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 ) { diff --git a/examples/frame-callback/frame-callback.h b/examples/frame-callback/frame-callback.h index 3302c0f..d4f49db 100644 --- a/examples/frame-callback/frame-callback.h +++ b/examples/frame-callback/frame-callback.h @@ -2,7 +2,7 @@ #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. @@ -39,10 +39,10 @@ public: 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. @@ -62,7 +62,7 @@ private: 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. }; diff --git a/examples/gaussian-blur-view/gaussian-blur-view-example.cpp b/examples/gaussian-blur-view/gaussian-blur-view-example.cpp index f0cc5a9..b3651d0 100644 --- a/examples/gaussian-blur-view/gaussian-blur-view-example.cpp +++ b/examples/gaussian-blur-view/gaussian-blur-view-example.cpp @@ -54,15 +54,15 @@ private: 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 ) { @@ -85,8 +85,8 @@ private: 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" ); @@ -104,13 +104,13 @@ private: 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 ) diff --git a/examples/gestures/gesture-example.cpp b/examples/gestures/gesture-example.cpp index 81cd2c7..c76496b 100644 --- a/examples/gestures/gesture-example.cpp +++ b/examples/gestures/gesture-example.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -81,10 +81,10 @@ const float ROTATE_BACK_ANIMATION_DURATION( 0.25f ); * @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 ); @@ -141,20 +141,21 @@ private: */ 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 ); @@ -206,10 +207,10 @@ private: 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(); } @@ -323,9 +324,9 @@ private: 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 ); } diff --git a/examples/gradients/gradients-example.cpp b/examples/gradients/gradients-example.cpp index 0f59724..2125c95 100644 --- a/examples/gradients/gradients-example.cpp +++ b/examples/gradients/gradients-example.cpp @@ -59,12 +59,12 @@ public: // 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, @@ -155,9 +155,9 @@ public: } 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; } @@ -169,9 +169,9 @@ public: } 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; } diff --git a/examples/hello-world/hello-world-example.cpp b/examples/hello-world/hello-world-example.cpp index f0f830e..22a13ab 100644 --- a/examples/hello-world/hello-world-example.cpp +++ b/examples/hello-world/hello-world-example.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -33,28 +33,25 @@ public: 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 ) diff --git a/examples/homescreen-benchmark/homescreen-benchmark.cpp b/examples/homescreen-benchmark/homescreen-benchmark.cpp index daf5233..e47e5be 100644 --- a/examples/homescreen-benchmark/homescreen-benchmark.cpp +++ b/examples/homescreen-benchmark/homescreen-benchmark.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -164,8 +164,8 @@ public: // 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 ); @@ -174,20 +174,20 @@ public: // 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 ) @@ -254,14 +254,16 @@ public: 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( mConfig.mRows ); const float COL_WIDTH = ( scaledWidth - (PADDING*2.0f) ) / static_cast( mConfig.mCols ); - Vector2 dpi = Stage::GetCurrent().GetDpi(); + Vector2 dpi = window.GetDpi(); static int currentIconIndex = 0; @@ -373,7 +375,7 @@ public: void PopulatePages() { - Vector3 stageSize( Stage::GetCurrent().GetSize() ); + Vector3 windowSize( mApplication.GetWindow().GetSize() ); for( int i = 0; i < mConfig.mPageCount; ++i ) { @@ -386,7 +388,7 @@ public: // 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 ); } @@ -409,18 +411,18 @@ public: 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 ); diff --git a/examples/image-policies/image-policies-example.cpp b/examples/image-policies/image-policies-example.cpp index 28c8022..bc82b2f 100644 --- a/examples/image-policies/image-policies-example.cpp +++ b/examples/image-policies/image-policies-example.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -165,7 +165,7 @@ class ImagePolicies: public ConnectionTracker /** * 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() { @@ -193,7 +193,7 @@ class ImagePolicies: public ConnectionTracker } /** - * 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() { @@ -247,7 +247,7 @@ class ImagePolicies: public ConnectionTracker } /** - * 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() @@ -333,7 +333,7 @@ class ImagePolicies: public ConnectionTracker } /** - * 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() @@ -382,8 +382,8 @@ class ImagePolicies: public ConnectionTracker 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(); @@ -391,7 +391,7 @@ class ImagePolicies: public ConnectionTracker 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 ); @@ -423,7 +423,7 @@ class ImagePolicies: public ConnectionTracker 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; diff --git a/examples/image-scaling-and-filtering/image-scaling-and-filtering-example.cpp b/examples/image-scaling-and-filtering/image-scaling-and-filtering-example.cpp index 1efe904..c6f842e 100644 --- a/examples/image-scaling-and-filtering/image-scaling-and-filtering-example.cpp +++ b/examples/image-scaling-and-filtering/image-scaling-and-filtering-example.cpp @@ -155,7 +155,7 @@ public: 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), @@ -174,28 +174,29 @@ public: // 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 ); @@ -206,10 +207,10 @@ public: 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(); @@ -235,7 +236,7 @@ public: mPanGestureDetector.DetectedSignal().Connect( this, &ImageScalingAndFilteringController::OnPan ); // Tie-in input event handlers: - stage.KeyEventSignal().Connect( this, &ImageScalingAndFilteringController::OnKeyEvent ); + window.KeyEventSignal().Connect( this, &ImageScalingAndFilteringController::OnKeyEvent ); CreateControls(); @@ -247,17 +248,18 @@ public: */ 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: @@ -274,7 +276,7 @@ public: 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 ); @@ -353,8 +355,8 @@ public: 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" ); @@ -406,7 +408,7 @@ public: 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 ) @@ -433,7 +435,7 @@ public: 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) || @@ -538,13 +540,13 @@ public: { 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(); } @@ -553,10 +555,11 @@ public: 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(); } @@ -579,29 +582,29 @@ public: } 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" ) { @@ -641,8 +644,8 @@ private: 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; @@ -659,14 +662,15 @@ private: 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: @@ -680,7 +684,7 @@ private: Toolkit::ImageView mGrabCorner; PanGestureDetector mPanGestureDetector; Toolkit::ImageView mImageView; - Vector2 mImageStageScale; + Vector2 mImageWindowScale; int mCurrentPath; FittingMode::Type mFittingMode; SamplingMode::Type mSamplingMode; diff --git a/examples/image-scaling-irregular-grid/image-scaling-irregular-grid-example.cpp b/examples/image-scaling-irregular-grid/image-scaling-irregular-grid-example.cpp index 3b85542..1242d95 100644 --- a/examples/image-scaling-irregular-grid/image-scaling-irregular-grid-example.cpp +++ b/examples/image-scaling-irregular-grid/image-scaling-irregular-grid-example.cpp @@ -281,11 +281,11 @@ public: 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 ); } } @@ -297,11 +297,11 @@ public: { 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, @@ -320,10 +320,10 @@ public: 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 ); @@ -334,11 +334,11 @@ public: */ 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(); @@ -355,12 +355,12 @@ public: // 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 ); @@ -484,9 +484,9 @@ public: } 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 ); } } @@ -630,7 +630,7 @@ private: 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; diff --git a/examples/image-view-alpha-blending/image-view-alpha-blending-example.cpp b/examples/image-view-alpha-blending/image-view-alpha-blending-example.cpp index 554a913..13dcc0a 100644 --- a/examples/image-view-alpha-blending/image-view-alpha-blending-example.cpp +++ b/examples/image-view-alpha-blending/image-view-alpha-blending-example.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -46,9 +46,9 @@ 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.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 ); @@ -60,7 +60,7 @@ private: 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) ); @@ -70,7 +70,7 @@ private: 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) ); diff --git a/examples/image-view-pixel-area/image-view-pixel-area-example.cpp b/examples/image-view-pixel-area/image-view-pixel-area-example.cpp index fa0884e..8de9d5b 100644 --- a/examples/image-view-pixel-area/image-view-pixel-area-example.cpp +++ b/examples/image-view-pixel-area/image-view-pixel-area-example.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -54,9 +54,9 @@ 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.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; diff --git a/examples/image-view-svg/image-view-svg-example.cpp b/examples/image-view-svg/image-view-svg-example.cpp index 30c6ca7..7ca18d9 100644 --- a/examples/image-view-svg/image-view-svg-example.cpp +++ b/examples/image-view-svg/image-view-svg-example.cpp @@ -63,27 +63,27 @@ public: // 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 @@ -91,16 +91,16 @@ public: 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 ); @@ -114,11 +114,11 @@ public: // 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(); @@ -246,7 +246,7 @@ public: private: Application& mApplication; - Actor mStageBackground; + Actor mWindowBackground; PanGestureDetector mPanGestureDetector; PinchGestureDetector mPinchGestureDetector; diff --git a/examples/image-view-url/image-view-url-example.cpp b/examples/image-view-url/image-view-url-example.cpp index 5046f08..a5bef1a 100644 --- a/examples/image-view-url/image-view-url-example.cpp +++ b/examples/image-view-url/image-view-url-example.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -71,9 +71,9 @@ 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.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; @@ -107,7 +107,7 @@ private: 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); @@ -129,7 +129,7 @@ private: 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(); diff --git a/examples/image-view/image-view-example.cpp b/examples/image-view/image-view-example.cpp index 69cc423..84085e9 100644 --- a/examples/image-view/image-view-example.cpp +++ b/examples/image-view/image-view-example.cpp @@ -70,7 +70,7 @@ unsigned int GetButtonIndex( Toolkit::Button button ) 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 ); @@ -99,7 +99,7 @@ class ImageViewController: public ConnectionTracker // 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, @@ -134,7 +134,7 @@ class ImageViewController: public ConnectionTracker 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); @@ -179,7 +179,7 @@ class ImageViewController: public ConnectionTracker mImageViewRoundedCornerStatus[x] = false; } - Stage::GetCurrent().KeyEventSignal().Connect(this, &ImageViewController::OnKeyEvent); + application.GetWindow().KeyEventSignal().Connect(this, &ImageViewController::OnKeyEvent); } private: @@ -193,7 +193,7 @@ private: visual.Reset(); } - bool ToggleImageOnStage( Toolkit::Button button ) + bool ToggleImageOnWindow( Toolkit::Button button ) { unsigned int buttonIndex = GetButtonIndex( button ); diff --git a/examples/item-view/item-view-example.cpp b/examples/item-view/item-view-example.cpp index ffba8fd..4e7a77a 100644 --- a/examples/item-view/item-view-example.cpp +++ b/examples/item-view/item-view-example.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -196,14 +196,14 @@ public: */ 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, @@ -237,11 +237,11 @@ public: 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(); @@ -252,11 +252,11 @@ public: 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(); @@ -267,20 +267,20 @@ public: 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 ); @@ -344,18 +344,18 @@ public: */ 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; } } @@ -363,18 +363,18 @@ public: // Set the new orientation to the layout mItemView.GetLayout(layoutId)->SetOrientation(static_cast(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 ) ); } } @@ -382,7 +382,7 @@ public: 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 ) @@ -553,7 +553,7 @@ public: { case Gesture::Started: { - const Size& size = Stage::GetCurrent().GetSize(); + const Size& size = mApplication.GetWindow().GetSize(); ItemRange range( 0u, 0u ); mItemView.GetItemsRange( range ); @@ -895,7 +895,8 @@ public: // From ItemFactory actor.SetProperty( Actor::Property::KEYBOARD_FOCUSABLE, true ); Vector3 spiralItemSize; - static_cast(*mSpiralLayout).GetItemSize( 0u, Vector3( Stage::GetCurrent().GetSize() ), spiralItemSize ); + Vector2 windowSize = mApplication.GetWindow().GetSize(); + static_cast(*mSpiralLayout).GetItemSize( 0u, Vector3( windowSize ), spiralItemSize ); // Add a checkbox child actor; invisible until edit-mode is enabled ImageView checkbox = ImageView::New(); diff --git a/examples/line-mesh/line-mesh-example.cpp b/examples/line-mesh/line-mesh-example.cpp index 3d7b25f..ff3aace 100644 --- a/examples/line-mesh/line-mesh-example.cpp +++ b/examples/line-mesh/line-mesh-example.cpp @@ -121,7 +121,7 @@ public: */ ExampleController( Application& application ) : mApplication( application ), - mStageSize(), + mWindowSize(), mShader(), mGeometry(), mRenderer(), @@ -152,7 +152,7 @@ public: */ void Create( Application& application ) { - Stage stage = Stage::GetCurrent(); + Window window = application.GetWindow(); // initial settings mPrimitiveType = Geometry::LINES; @@ -161,13 +161,13 @@ public: 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)); } /** @@ -175,12 +175,12 @@ public: */ 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(); } @@ -202,7 +202,7 @@ public: 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(); @@ -219,7 +219,7 @@ public: */ 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 ); @@ -293,8 +293,8 @@ public: 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); } /** @@ -376,7 +376,7 @@ public: private: Application& mApplication; ///< Application instance - Vector3 mStageSize; ///< The size of the stage + Vector3 mWindowSize; ///< The size of the window Shader mShader; Geometry mGeometry; diff --git a/examples/magnifier/magnifier-example.cpp b/examples/magnifier/magnifier-example.cpp index 35a6b47..e1d7b6b 100644 --- a/examples/magnifier/magnifier-example.cpp +++ b/examples/magnifier/magnifier-example.cpp @@ -29,30 +29,30 @@ namespace 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) { } @@ -64,12 +64,12 @@ struct MagnifierPathConstraint 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 }; @@ -194,14 +194,14 @@ public: */ 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, @@ -217,12 +217,12 @@ public: 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 ); @@ -239,7 +239,7 @@ public: // 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 ); @@ -247,13 +247,13 @@ public: ContinueAnimation(); // Apply constraint to animate the position of the magnifier. - constraint = Constraint::New( mBouncingMagnifier, Actor::Property::POSITION, MagnifierPathConstraint(mStageSize, mStageSize * 0.5f) ); + constraint = Constraint::New( 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( mBouncingMagnifier, Toolkit::Magnifier::Property::SOURCE_POSITION, MagnifierPathConstraint(mStageSize) ); + constraint = Constraint::New( mBouncingMagnifier, Toolkit::Magnifier::Property::SOURCE_POSITION, MagnifierPathConstraint(mWindowSize) ); constraint.AddSource( LocalSource(Actor::Property::SIZE) ); constraint.AddSource( LocalSource(mAnimationTimeProperty) ); constraint.Apply(); @@ -325,7 +325,7 @@ public: Vector3 touchPoint( event.GetScreenPosition( 0 ) ); - SetMagnifierPosition(touchPoint - mStageSize * 0.5f); + SetMagnifierPosition(touchPoint - mWindowSize * 0.5f); } return false; @@ -361,7 +361,7 @@ public: /** * 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) { @@ -369,7 +369,7 @@ public: // 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 ); } @@ -392,7 +392,7 @@ private: 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. diff --git a/examples/mesh-morph/mesh-morph-example.cpp b/examples/mesh-morph/mesh-morph-example.cpp index 7b73c23..af8662c 100644 --- a/examples/mesh-morph/mesh-morph-example.cpp +++ b/examples/mesh-morph/mesh-morph-example.cpp @@ -281,10 +281,10 @@ public: */ 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 @@ -303,14 +303,14 @@ public: 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)); } /** @@ -338,7 +338,7 @@ public: private: Application& mApplication; ///< Application instance - Vector3 mStageSize; ///< The size of the stage + Vector3 mWindowSize; ///< The size of the window Shader mShader; Geometry mGeometry; diff --git a/examples/mesh-visual/mesh-visual-example.cpp b/examples/mesh-visual/mesh-visual-example.cpp index 23f18a9..02fef7e 100644 --- a/examples/mesh-visual/mesh-visual-example.cpp +++ b/examples/mesh-visual/mesh-visual-example.cpp @@ -63,7 +63,7 @@ const int MODEL_TAG = 0; 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 @@ -92,12 +92,12 @@ public: // 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 ); @@ -111,7 +111,7 @@ public: 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. @@ -254,8 +254,9 @@ public: 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 ); @@ -273,7 +274,7 @@ public: //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(); @@ -348,16 +349,16 @@ public: } } - //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 ); @@ -384,7 +385,7 @@ public: //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 ) { diff --git a/examples/metaball-explosion/metaball-explosion-example.cpp b/examples/metaball-explosion/metaball-explosion-example.cpp index 283bc0c..5601a00 100644 --- a/examples/metaball-explosion/metaball-explosion-example.cpp +++ b/examples/metaball-explosion/metaball-explosion-example.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -337,15 +337,15 @@ MetaballExplosionController::~MetaballExplosionController() 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 ); @@ -364,7 +364,7 @@ void MetaballExplosionController::Create( Application& app ) 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 ) @@ -470,14 +470,14 @@ void MetaballExplosionController::CreateMetaballActors() 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 ); @@ -519,8 +519,8 @@ void MetaballExplosionController::CreateComposition() 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() diff --git a/examples/metaball-refrac/metaball-refrac-example.cpp b/examples/metaball-refrac/metaball-refrac-example.cpp index 3b41883..2184a7a 100644 --- a/examples/metaball-refrac/metaball-refrac-example.cpp +++ b/examples/metaball-refrac/metaball-refrac-example.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -318,13 +318,13 @@ MetaballRefracController::~MetaballRefracController() 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 ); @@ -338,7 +338,7 @@ void MetaballRefracController::Create( Application& app ) 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 ) @@ -449,13 +449,13 @@ void MetaballRefracController::CreateMetaballActors() 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 ); @@ -494,8 +494,8 @@ void MetaballRefracController::CreateComposition() mRendererRefraction.SetTextures( mTextureSetNormal ); mCompositionActor.AddRenderer( mRendererRefraction ); - Stage stage = Stage::GetCurrent(); - stage.Add( mCompositionActor ); + Window window = mApplication.GetWindow(); + window.Add( mCompositionActor ); } void MetaballRefracController::CreateAnimations() diff --git a/examples/model3d-view/model3d-view-example.cpp b/examples/model3d-view/model3d-view-example.cpp index 721bd5f..0e251a4 100644 --- a/examples/model3d-view/model3d-view-example.cpp +++ b/examples/model3d-view/model3d-view-example.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -80,15 +80,15 @@ public: // 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; @@ -109,7 +109,7 @@ public: 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(); @@ -153,8 +153,8 @@ public: 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 ); @@ -176,8 +176,8 @@ public: } 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; diff --git a/examples/motion-blur/motion-blur-example.cpp b/examples/motion-blur/motion-blur-example.cpp index f1b8d26..7f2c733 100644 --- a/examples/motion-blur/motion-blur-example.cpp +++ b/examples/motion-blur/motion-blur-example.cpp @@ -149,12 +149,13 @@ public: 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, @@ -163,8 +164,8 @@ public: 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 @@ -204,7 +205,7 @@ public: // // 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 ) ); @@ -239,16 +240,16 @@ public: 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 ); @@ -280,8 +281,8 @@ public: 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; diff --git a/examples/motion-stretch/motion-stretch-example.cpp b/examples/motion-stretch/motion-stretch-example.cpp index 9cc0d16..be2e9fa 100644 --- a/examples/motion-stretch/motion-stretch-example.cpp +++ b/examples/motion-stretch/motion-stretch-example.cpp @@ -129,11 +129,12 @@ public: 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, @@ -142,8 +143,8 @@ public: 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 @@ -212,16 +213,16 @@ public: 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 ); @@ -252,8 +253,8 @@ public: 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; diff --git a/examples/native-image-source/native-image-source-example.cpp b/examples/native-image-source/native-image-source-example.cpp index a389a27..b4f4656 100644 --- a/examples/native-image-source/native-image-source-example.cpp +++ b/examples/native-image-source/native-image-source-example.cpp @@ -126,11 +126,11 @@ public: // 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(); @@ -139,21 +139,21 @@ public: 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 ); @@ -162,8 +162,8 @@ public: 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 ); @@ -171,8 +171,8 @@ public: 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 ); @@ -180,8 +180,8 @@ public: 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 ); @@ -189,31 +189,31 @@ public: 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); @@ -247,11 +247,11 @@ public: { 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 ); @@ -264,7 +264,7 @@ public: 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 ); @@ -338,8 +338,8 @@ public: { 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(); diff --git a/examples/page-turn-view/page-turn-view-example.cpp b/examples/page-turn-view/page-turn-view-example.cpp index 3e84f98..3e90935 100644 --- a/examples/page-turn-view/page-turn-view-example.cpp +++ b/examples/page-turn-view/page-turn-view-example.cpp @@ -203,9 +203,9 @@ PageTurnExample::~PageTurnExample() */ 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 ); @@ -223,8 +223,8 @@ void PageTurnExample::OnWindowResized( Window window, Window::WindowSize size ) void PageTurnExample::Rotate( DemoOrientation orientation ) { - Stage stage = Stage::GetCurrent(); - Vector2 stageSize = stage.GetSize(); + Window window = mApplication.GetWindow(); + Vector2 windowSize = window.GetSize(); if( mOrientation != orientation ) { @@ -234,30 +234,30 @@ void PageTurnExample::Rotate( DemoOrientation 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 ); } } } diff --git a/examples/perf-scroll/perf-scroll.cpp b/examples/perf-scroll/perf-scroll.cpp index 1680e96..be98e66 100644 --- a/examples/perf-scroll/perf-scroll.cpp +++ b/examples/perf-scroll/perf-scroll.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -230,24 +230,24 @@ public: // 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 ) { @@ -275,7 +275,7 @@ public: void CreateImageViews() { - Stage stage = Stage::GetCurrent(); + Window window = mApplication.GetWindow(); unsigned int actorCount( mRowsPerPage*mColumnsPerPage * mPageCount ); mImageView.resize( actorCount ); @@ -308,7 +308,7 @@ public: } //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); iGetItemSize( 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 ); } @@ -195,27 +195,27 @@ public: */ 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; } @@ -247,7 +247,7 @@ public: case ResizePolicy::FILL_TO_PARENT: { newPolicy = ResizePolicy::FIXED; - newSize[ dimension ] = stageDimensionSize; + newSize[ dimension ] = windowDimensionSize; modifyPolicy = true; break; } @@ -255,7 +255,7 @@ public: case ResizePolicy::SIZE_RELATIVE_TO_PARENT: { newPolicy = ResizePolicy::FIXED; - newSize[ dimension ] = stageDimensionSize * sizeModeFactor; + newSize[ dimension ] = windowDimensionSize * sizeModeFactor; modifyPolicy = true; break; } @@ -263,7 +263,7 @@ public: case ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT: { newPolicy = ResizePolicy::FIXED; - newSize[ dimension ] = stageDimensionSize + sizeModeFactor; + newSize[ dimension ] = windowDimensionSize + sizeModeFactor; modifyPolicy = true; break; } @@ -306,7 +306,7 @@ public: } else { - Stage::GetCurrent().Add( popup ); + mApplication.GetWindow().Add( popup ); } mPopup.SetDisplayState( Toolkit::Popup::SHOWN ); @@ -331,8 +331,8 @@ public: 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" ); @@ -484,7 +484,7 @@ public: 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 ); } } diff --git a/examples/pre-render-callback/pre-render-callback-example.cpp b/examples/pre-render-callback/pre-render-callback-example.cpp index 94d431a..908bf94 100644 --- a/examples/pre-render-callback/pre-render-callback-example.cpp +++ b/examples/pre-render-callback/pre-render-callback-example.cpp @@ -49,7 +49,7 @@ public: */ PreRenderCallbackController ( Application& application ) : mApplication( application ), - mStage(), + mWindow(), mTapDetector(), mKeepPreRender(false), mRotateTextCharacter(0), @@ -89,13 +89,13 @@ private: */ 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(); @@ -113,8 +113,8 @@ private: 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 ) ); } @@ -171,7 +171,7 @@ private: 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 */ ) @@ -231,7 +231,7 @@ private: private: Application& mApplication; - Stage mStage; + Window mWindow; TapGestureDetector mTapDetector; ///< Tap detector to enable the PreRenderCallback bool mKeepPreRender; int mRotateTextCharacter; diff --git a/examples/primitive-shapes/primitive-shapes-example.cpp b/examples/primitive-shapes/primitive-shapes-example.cpp index af7f6e8..00e3926 100644 --- a/examples/primitive-shapes/primitive-shapes-example.cpp +++ b/examples/primitive-shapes/primitive-shapes-example.cpp @@ -83,9 +83,9 @@ public: // 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(); @@ -94,7 +94,7 @@ public: 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 ); @@ -106,7 +106,7 @@ public: 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. @@ -268,7 +268,7 @@ public: } } - //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: // // +--------------------------------+ diff --git a/examples/progress-bar/progress-bar-example.cpp b/examples/progress-bar/progress-bar-example.cpp index 12cb027..1364790 100644 --- a/examples/progress-bar/progress-bar-example.cpp +++ b/examples/progress-bar/progress-bar-example.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -67,10 +67,10 @@ private: // 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, diff --git a/examples/property-notification/property-notification-example.cpp b/examples/property-notification/property-notification-example.cpp index 026999d..28287b2 100644 --- a/examples/property-notification/property-notification-example.cpp +++ b/examples/property-notification/property-notification-example.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -56,10 +56,10 @@ public: */ 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" ); @@ -68,7 +68,7 @@ public: 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 ); diff --git a/examples/ray-marching/ray-marching-example.cpp b/examples/ray-marching/ray-marching-example.cpp index 3c60bf5..7ea5486 100644 --- a/examples/ray-marching/ray-marching-example.cpp +++ b/examples/ray-marching/ray-marching-example.cpp @@ -113,17 +113,17 @@ public: // 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, @@ -203,7 +203,7 @@ public: void AddContentLayer() { - Stage stage = Stage::GetCurrent(); + Window window = mApplication.GetWindow(); //Create all the renderers Renderer renderer = CreateQuadRenderer(); diff --git a/examples/reflection-demo/reflection-example.cpp b/examples/reflection-demo/reflection-example.cpp index 18329bb..ecd635d 100644 --- a/examples/reflection-demo/reflection-example.cpp +++ b/examples/reflection-demo/reflection-example.cpp @@ -185,15 +185,15 @@ 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(); - 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 ); @@ -219,7 +219,7 @@ private: /** * Create scene nodes */ - CreateSceneFromGLTF( stage, &gltf ); + CreateSceneFromGLTF( window, &gltf ); auto planeActor = mLayer3D.FindChildByName( "Plane" ); auto solarActor = mLayer3D.FindChildByName( "solar_root" ); @@ -256,9 +256,9 @@ private: 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(0, 0, stageWidth, stageHeight ) ); + task3D.SetViewport( Rect(0, 0, windowWidth, windowHeight ) ); task3D.SetCameraActor( cameraActor ); task3D.SetClearColor( Color::BLACK ); task3D.SetClearEnabled( true ); @@ -269,23 +269,23 @@ private: * 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(0, 0, stageWidth, stageHeight ) ); + renderTask.SetViewport( Rect(0, 0, windowWidth, windowHeight ) ); renderTask.SetCameraActor( cameraRefActor ); renderTask.SetClearColor( Color::BLACK ); renderTask.SetClearEnabled( true ); @@ -300,11 +300,11 @@ private: 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 ) ); @@ -313,12 +313,12 @@ private: 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(); @@ -328,7 +328,7 @@ private: 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 ); @@ -411,7 +411,7 @@ private: mActors = std::move(actors); - // Add root actor to the stage + // Add root actor to the window mLayer3D.Add( mActors[0] ); for( auto& actor : mActors ) diff --git a/examples/refraction-effect/refraction-effect-example.cpp b/examples/refraction-effect/refraction-effect-example.cpp index dae8568..6be6080 100644 --- a/examples/refraction-effect/refraction-effect-example.cpp +++ b/examples/refraction-effect/refraction-effect-example.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -243,13 +243,13 @@ private: // 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, @@ -284,7 +284,7 @@ private: 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 ); @@ -293,7 +293,7 @@ private: 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 ); @@ -310,13 +310,13 @@ private: 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( mMeshActor, lightSpinOffsetIndex, LightOffsetConstraint(stageSize.x*0.1f) ); + Constraint constraint = Constraint::New( mMeshActor, lightSpinOffsetIndex, LightOffsetConstraint(windowSize.x*0.1f) ); constraint.AddSource( LocalSource(mSpinAngleIndex) ); constraint.Apply(); @@ -347,7 +347,7 @@ private: 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; } @@ -537,8 +537,8 @@ private: 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()); diff --git a/examples/remote-image-loading/remote-image-loading-example.cpp b/examples/remote-image-loading/remote-image-loading-example.cpp index 8cdac24..5bf7e1f 100644 --- a/examples/remote-image-loading/remote-image-loading-example.cpp +++ b/examples/remote-image-loading/remote-image-loading-example.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -56,10 +56,10 @@ public: // 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 ); @@ -68,7 +68,7 @@ public: 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"); @@ -78,7 +78,7 @@ public: 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"); @@ -87,7 +87,7 @@ public: 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"); @@ -96,7 +96,7 @@ public: 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"); @@ -105,7 +105,7 @@ public: 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"); @@ -114,10 +114,10 @@ public: 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) @@ -140,7 +140,7 @@ public: { if (event.state == KeyEvent::Down) { - std::cout<<"Stage key : " << event.keyCode << std::endl; + std::cout<<"Window key : " << event.keyCode << std::endl; } } @@ -148,7 +148,7 @@ public: { if (touch.GetState(0) == PointState::DOWN) { - std::cout<<"Stage touch" << std::endl; + std::cout<<"Window touch" << std::endl; } } @@ -187,7 +187,7 @@ public: } private: - Stage stage; + Window mWindow; Application &mApplication; Control mControl1; diff --git a/examples/renderer-stencil/renderer-stencil-example.cpp b/examples/renderer-stencil/renderer-stencil-example.cpp index 5f73dea..9868596 100644 --- a/examples/renderer-stencil/renderer-stencil-example.cpp +++ b/examples/renderer-stencil/renderer-stencil-example.cpp @@ -38,7 +38,7 @@ const char * const BACKGROUND_IMAGE( DEMO_IMAGE_DIR "background-gradient.jpg" ); 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. @@ -113,7 +113,7 @@ private: */ 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(); @@ -128,17 +128,17 @@ private: 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 ); @@ -148,7 +148,7 @@ private: 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(); @@ -157,12 +157,13 @@ private: 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. @@ -253,10 +254,10 @@ private: 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: @@ -480,7 +481,8 @@ 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 ) @@ -492,9 +494,9 @@ private: 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 ); diff --git a/examples/renderer-stencil/renderer-stencil-shaders.h b/examples/renderer-stencil/renderer-stencil-shaders.h index fcf758f..d82b0d1 100644 --- a/examples/renderer-stencil/renderer-stencil-shaders.h +++ b/examples/renderer-stencil/renderer-stencil-shaders.h @@ -2,7 +2,7 @@ #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. @@ -23,7 +23,6 @@ // 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" ); diff --git a/examples/rendering-basic-light/rendering-basic-light-example.cpp b/examples/rendering-basic-light/rendering-basic-light-example.cpp index 2441743..f9b960b 100644 --- a/examples/rendering-basic-light/rendering-basic-light-example.cpp +++ b/examples/rendering-basic-light/rendering-basic-light-example.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -157,17 +157,17 @@ public: // 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 ); @@ -176,7 +176,7 @@ public: 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(); @@ -193,11 +193,11 @@ public: // 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 ); } /** @@ -373,16 +373,16 @@ public: */ 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 ); } /** diff --git a/examples/rendering-basic-pbr/rendering-basic-pbr-example.cpp b/examples/rendering-basic-pbr/rendering-basic-pbr-example.cpp index 0805c6b..c333bc3 100644 --- a/examples/rendering-basic-pbr/rendering-basic-pbr-example.cpp +++ b/examples/rendering-basic-pbr/rendering-basic-pbr-example.cpp @@ -104,14 +104,14 @@ public: // 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 ); @@ -125,11 +125,11 @@ public: // 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 ); @@ -168,8 +168,8 @@ public: } 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); @@ -266,7 +266,8 @@ public: */ 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 ); @@ -279,40 +280,40 @@ public: // 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 ); } diff --git a/examples/rendering-cube/rendering-cube.cpp b/examples/rendering-cube/rendering-cube.cpp index c80ca3a..e7059ff 100644 --- a/examples/rendering-cube/rendering-cube.cpp +++ b/examples/rendering-cube/rendering-cube.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -79,9 +79,9 @@ public: // 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(); @@ -98,11 +98,11 @@ public: // 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 ) @@ -243,16 +243,16 @@ public: */ 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 ); } /** diff --git a/examples/rendering-line/rendering-line.cpp b/examples/rendering-line/rendering-line.cpp index 4006ac3..2d6dbe3 100644 --- a/examples/rendering-line/rendering-line.cpp +++ b/examples/rendering-line/rendering-line.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -75,9 +75,9 @@ public: // 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(); @@ -91,11 +91,11 @@ public: // 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 ) @@ -165,8 +165,8 @@ public: */ 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 ); @@ -174,7 +174,7 @@ public: 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: diff --git a/examples/rendering-radial-progress/radial-progress.cpp b/examples/rendering-radial-progress/radial-progress.cpp index 5628c62..2c7008b 100644 --- a/examples/rendering-radial-progress/radial-progress.cpp +++ b/examples/rendering-radial-progress/radial-progress.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -124,11 +124,11 @@ public: // 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(); @@ -136,7 +136,7 @@ public: 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 ); @@ -152,7 +152,7 @@ public: 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 ) diff --git a/examples/rendering-skybox/look-camera.cpp b/examples/rendering-skybox/look-camera.cpp index d64c29c..3e49c8d 100644 --- a/examples/rendering-skybox/look-camera.cpp +++ b/examples/rendering-skybox/look-camera.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -17,7 +17,6 @@ #include "look-camera.h" -#include #include #include #include @@ -68,8 +67,10 @@ LookCamera::~LookCamera() 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; @@ -91,15 +92,15 @@ void LookCamera::Initialise( const Vector3& position, float fovY, float near, fl 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 ) @@ -119,8 +120,7 @@ bool LookCamera::OnTick() 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 ); @@ -134,11 +134,11 @@ void LookCamera::InitialiseDefaultCamera() 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 ); @@ -150,8 +150,6 @@ void LookCamera::CreateInterceptorActor() 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 ) ); diff --git a/examples/rendering-skybox/look-camera.h b/examples/rendering-skybox/look-camera.h index 6cd3a60..4a0dc92 100644 --- a/examples/rendering-skybox/look-camera.h +++ b/examples/rendering-skybox/look-camera.h @@ -2,7 +2,7 @@ #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. @@ -20,6 +20,7 @@ #include #include +#include #include /** @@ -43,12 +44,13 @@ public: /** * 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 @@ -85,6 +87,8 @@ private: private: + Dali::Window mWindow; /// The window the camera belongs to + Dali::CameraActor mCameraActor; /// Camera actor Dali::Actor mInterceptorActor; /// Actor intercepting user input diff --git a/examples/rendering-skybox/rendering-skybox.cpp b/examples/rendering-skybox/rendering-skybox.cpp index b9b2e50..db94cfe 100644 --- a/examples/rendering-skybox/rendering-skybox.cpp +++ b/examples/rendering-skybox/rendering-skybox.cpp @@ -147,9 +147,9 @@ public: // 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(); @@ -175,7 +175,7 @@ public: PlayAnimation(); // Respond to key events - stage.KeyEventSignal().Connect( this, &TexturedCubeController::OnKeyEvent ); + window.KeyEventSignal().Connect( this, &TexturedCubeController::OnKeyEvent ); } /** @@ -200,12 +200,12 @@ public: */ 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 ); } /** @@ -404,8 +404,8 @@ public: 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 ); } /** @@ -435,7 +435,7 @@ public: // 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" ); @@ -443,7 +443,7 @@ public: 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 ); } /** diff --git a/examples/rendering-textured-cube/rendering-textured-cube.cpp b/examples/rendering-textured-cube/rendering-textured-cube.cpp index d472e65..cc20719 100644 --- a/examples/rendering-textured-cube/rendering-textured-cube.cpp +++ b/examples/rendering-textured-cube/rendering-textured-cube.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -82,9 +82,9 @@ public: // 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(); @@ -104,11 +104,11 @@ public: // 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 ) @@ -261,16 +261,16 @@ public: */ 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 ); } /** diff --git a/examples/rendering-triangle/rendering-triangle.cpp b/examples/rendering-triangle/rendering-triangle.cpp index f637e50..58fedcb 100644 --- a/examples/rendering-triangle/rendering-triangle.cpp +++ b/examples/rendering-triangle/rendering-triangle.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -75,9 +75,9 @@ public: // 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(); @@ -91,11 +91,11 @@ public: // 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 ) @@ -166,8 +166,8 @@ public: */ 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 ); @@ -175,7 +175,7 @@ public: 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: diff --git a/examples/scroll-view/scroll-view-example.cpp b/examples/scroll-view/scroll-view-example.cpp index 301e6c8..ab7789a 100644 --- a/examples/scroll-view/scroll-view-example.cpp +++ b/examples/scroll-view/scroll-view-example.cpp @@ -164,11 +164,11 @@ public: */ 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, @@ -207,14 +207,14 @@ private: */ 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 ); @@ -227,7 +227,7 @@ private: { 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); @@ -276,14 +276,14 @@ private: 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;rowSetDomain(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(); @@ -331,74 +331,74 @@ private: 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 ) diff --git a/examples/shadows-and-lights/shadows-and-lights-example.cpp b/examples/shadows-and-lights/shadows-and-lights-example.cpp index d7ac08b..8ce3e83 100644 --- a/examples/shadows-and-lights/shadows-and-lights-example.cpp +++ b/examples/shadows-and-lights/shadows-and-lights-example.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -56,7 +56,7 @@ const Vector3 LEFT_POINT( -R3_2, 0.5f, 0.0f); 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; @@ -145,7 +145,7 @@ public: { srand(0); // Want repeatable path - Stage::GetCurrent().KeyEventSignal().Connect(this, &TestApp::OnKeyEvent); + app.GetWindow().KeyEventSignal().Connect(this, &TestApp::OnKeyEvent); CreateToolbarAndView(app); CreateShadowViewAndLights(); @@ -155,7 +155,7 @@ public: 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, @@ -235,9 +235,9 @@ public: 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); @@ -403,11 +403,11 @@ public: { if( mSceneActor ) { - Stage::GetCurrent().Remove(mSceneActor); + mApp.GetWindow().Remove(mSceneActor); } if( mView ) { - Stage::GetCurrent().Remove(mView); + mApp.GetWindow().Remove(mView); } } diff --git a/examples/simple-bitmap-font-text-label/simple-text-label-example.cpp b/examples/simple-bitmap-font-text-label/simple-text-label-example.cpp index 4976cd5..e86cf13 100644 --- a/examples/simple-bitmap-font-text-label/simple-text-label-example.cpp +++ b/examples/simple-bitmap-font-text-label/simple-text-label-example.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -54,9 +54,9 @@ public: */ 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(); @@ -119,7 +119,7 @@ public: label01.SetBackgroundColor( Color::BLACK ); - stage.Add( label01 ); + window.Add( label01 ); TextLabel label02 = TextLabel::New(); @@ -135,7 +135,7 @@ public: label02.SetBackgroundColor( Color::BLACK ); - stage.Add( label02 ); + window.Add( label02 ); TextLabel label03 = TextLabel::New(); label03.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER ); @@ -149,7 +149,7 @@ public: label03.SetBackgroundColor( Color::WHITE ); - stage.Add( label03 ); + window.Add( label03 ); TextLabel label04 = TextLabel::New(); label04.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER ); @@ -164,7 +164,7 @@ public: label04.SetBackgroundColor( Color::BLACK ); - stage.Add( label04 ); + window.Add( label04 ); } /** diff --git a/examples/simple-scroll-view/simple-scroll-view-example.cpp b/examples/simple-scroll-view/simple-scroll-view-example.cpp index 461aa40..93c4f2c 100644 --- a/examples/simple-scroll-view/simple-scroll-view-example.cpp +++ b/examples/simple-scroll-view/simple-scroll-view-example.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -58,12 +58,13 @@ private: */ 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(); @@ -71,7 +72,7 @@ private: 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 ); @@ -108,7 +109,7 @@ private: 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 ) ); diff --git a/examples/simple-text-field/simple-text-field.cpp b/examples/simple-text-field/simple-text-field.cpp index 3f3731f..fcd3d8b 100644 --- a/examples/simple-text-field/simple-text-field.cpp +++ b/examples/simple-text-field/simple-text-field.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -52,9 +52,9 @@ public: */ 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 ); @@ -66,7 +66,7 @@ public: field.SetProperty( TextField::Property::PLACEHOLDER_TEXT, "Unnamed folder" ); field.SetProperty( TextField::Property::PLACEHOLDER_TEXT_FOCUSED, "Enter folder name." ); - stage.Add( field ); + window.Add( field ); } /** diff --git a/examples/simple-text-label/simple-text-label-example.cpp b/examples/simple-text-label/simple-text-label-example.cpp index e3078e6..3c00db9 100644 --- a/examples/simple-text-label/simple-text-label-example.cpp +++ b/examples/simple-text-label/simple-text-label-example.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -50,9 +50,9 @@ public: */ 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" ); @@ -63,7 +63,7 @@ public: mLabel.SetProperty( TextLabel::Property::TEXT_COLOR, Color::BLACK ); mLabel.SetBackgroundColor( Color::WHITE ); - stage.Add( mLabel ); + window.Add( mLabel ); } /** diff --git a/examples/simple-text-renderer/simple-text-renderer-example.cpp b/examples/simple-text-renderer/simple-text-renderer-example.cpp index 283c26a..8135fd3 100644 --- a/examples/simple-text-renderer/simple-text-renderer-example.cpp +++ b/examples/simple-text-renderer/simple-text-renderer-example.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -274,11 +274,11 @@ public: */ 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 = ""; const std::string image2 = ""; @@ -319,7 +319,7 @@ public: actor.AddRenderer( renderer ); - stage.Add( actor ); + window.Add( actor ); } /** diff --git a/examples/simple-text-visual/simple-text-visual-example.cpp b/examples/simple-text-visual/simple-text-visual-example.cpp index 24a6c68..1327a71 100644 --- a/examples/simple-text-visual/simple-text-visual-example.cpp +++ b/examples/simple-text-visual/simple-text-visual-example.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -50,10 +50,10 @@ public: */ 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 ); @@ -72,7 +72,7 @@ public: control.SetProperty( Dali::Toolkit::Control::Property::BACKGROUND, map ); - stage.Add( control ); + window.Add( control ); } /** diff --git a/examples/simple-visuals-control/simple-visuals-application.cpp b/examples/simple-visuals-control/simple-visuals-application.cpp index a687bd9..8536c5a 100644 --- a/examples/simple-visuals-control/simple-visuals-application.cpp +++ b/examples/simple-visuals-control/simple-visuals-application.cpp @@ -101,11 +101,11 @@ void SimpleVisualsApplication::OnKeyEvent( const KeyEvent& keyEvent ) 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 ); @@ -121,7 +121,7 @@ void SimpleVisualsApplication::Create( Application& application ) // 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(); diff --git a/examples/size-negotiation/size-negotiation-example.cpp b/examples/size-negotiation/size-negotiation-example.cpp index a1ad2d5..20dc4e2 100644 --- a/examples/size-negotiation/size-negotiation-example.cpp +++ b/examples/size-negotiation/size-negotiation-example.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -112,13 +112,13 @@ public: 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, @@ -139,22 +139,22 @@ public: 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 ); } @@ -177,8 +177,8 @@ public: 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" ); @@ -211,7 +211,7 @@ public: mPopup.Add( table ); - StagePopup( mPopup ); + ShowPopup( mPopup ); } else if( button.GetProperty< std::string >( Dali::Actor::Property::NAME ) == TABLEVIEW_BUTTON_3CELL_ID ) { @@ -240,7 +240,7 @@ public: mPopup.SetContent( table ); - StagePopup( mPopup ); + ShowPopup( mPopup ); } else if( button.GetProperty< std::string >( Dali::Actor::Property::NAME ) == TABLEVIEW_BUTTON_3X3CELL_ID ) { @@ -304,7 +304,7 @@ public: mPopup.Add( table ); - StagePopup( mPopup ); + ShowPopup( mPopup ); } else if( button.GetProperty< std::string >( Dali::Actor::Property::NAME ) == TABLEVIEW_BUTTON_FIXED1_ID ) { @@ -355,7 +355,7 @@ public: mPopup.Add( table ); - StagePopup( mPopup ); + ShowPopup( mPopup ); } else if( button.GetProperty< std::string >( Dali::Actor::Property::NAME ) == TABLEVIEW_BUTTON_FIXED2_ID ) { @@ -413,7 +413,7 @@ public: mPopup.Add( table ); - StagePopup( mPopup ); + ShowPopup( mPopup ); } else if( button.GetProperty< std::string >( Dali::Actor::Property::NAME ) == TABLEVIEW_BUTTON_FIT1_ID ) { @@ -479,7 +479,7 @@ public: mPopup.Add( table ); - StagePopup( mPopup ); + ShowPopup( mPopup ); } else if( button.GetProperty< std::string >( Dali::Actor::Property::NAME ) == TABLEVIEW_BUTTON_FIT2_ID ) { @@ -543,7 +543,7 @@ public: mPopup.Add( table ); - StagePopup( mPopup ); + ShowPopup( mPopup ); } else if( button.GetProperty< std::string >( Dali::Actor::Property::NAME ) == TABLEVIEW_BUTTON_NATURAL1_ID ) { @@ -613,7 +613,7 @@ public: mPopup.Add( table ); - StagePopup( mPopup ); + ShowPopup( mPopup ); } else if( button.GetProperty< std::string >( Dali::Actor::Property::NAME ) == TABLEVIEW_BUTTON_NATURAL2_ID ) { @@ -666,7 +666,7 @@ public: mPopup.Add( table ); - StagePopup( mPopup ); + ShowPopup( mPopup ); } else if( button.GetProperty< std::string >( Dali::Actor::Property::NAME ) == TABLEVIEW_BUTTON_NATURAL3_ID ) { @@ -716,7 +716,7 @@ public: } mPopup.Add( table ); - StagePopup( mPopup ); + ShowPopup( mPopup ); } else if( button.GetProperty< std::string >( Dali::Actor::Property::NAME ) == POPUP_BUTTON_CONTENT_IMAGE_SCALE_ID ) { @@ -729,7 +729,7 @@ public: mPopup.Add( image ); - StagePopup( mPopup ); + ShowPopup( mPopup ); } else if( button.GetProperty< std::string >( Dali::Actor::Property::NAME ) == POPUP_BUTTON_CONTENT_IMAGE_FIT_ID ) { @@ -743,7 +743,7 @@ public: mPopup.Add( image ); - StagePopup( mPopup ); + ShowPopup( mPopup ); } else if( button.GetProperty< std::string >( Dali::Actor::Property::NAME ) == POPUP_BUTTON_CONTENT_IMAGE_FILL_ID ) { @@ -757,7 +757,7 @@ public: mPopup.Add( image ); - StagePopup( mPopup ); + ShowPopup( mPopup ); } return true; diff --git a/examples/sparkle/sparkle-effect-example.cpp b/examples/sparkle/sparkle-effect-example.cpp index 7c61588..67af10f 100644 --- a/examples/sparkle/sparkle-effect-example.cpp +++ b/examples/sparkle/sparkle-effect-example.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -85,21 +85,21 @@ private: */ 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 ); diff --git a/examples/styling/styling-application.cpp b/examples/styling/styling-application.cpp index caae713..9286ecd 100644 --- a/examples/styling/styling-application.cpp +++ b/examples/styling/styling-application.cpp @@ -105,13 +105,13 @@ StylingApplication::~StylingApplication() 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 ); @@ -396,14 +396,14 @@ Actor StylingApplication::CreateResizableContentPane() 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 ); @@ -568,7 +568,7 @@ bool StylingApplication::OnResetClicked( Button button ) mResetPopup = CreateResetPopup (); } - Stage::GetCurrent().Add( mResetPopup ); + mApplication.GetWindow().Add( mResetPopup ); mResetPopup.SetDisplayState( Popup::SHOWN ); return true; diff --git a/examples/super-blur-view/super-blur-view-example.cpp b/examples/super-blur-view/super-blur-view-example.cpp index a659a2e..22b885b 100644 --- a/examples/super-blur-view/super-blur-view-example.cpp +++ b/examples/super-blur-view/super-blur-view-example.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -52,15 +52,15 @@ private: 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 ); @@ -74,7 +74,7 @@ private: 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 ) diff --git a/examples/text-editor/text-editor-example.cpp b/examples/text-editor/text-editor-example.cpp index e589ed0..4fb9fc9 100644 --- a/examples/text-editor/text-editor-example.cpp +++ b/examples/text-editor/text-editor-example.cpp @@ -39,10 +39,10 @@ const Vector4 BACKGROUND_COLOR( 0.04f, 0.345f, 0.392f, 1.0f ); ///< The bac 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, @@ -80,22 +80,22 @@ public: */ 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, @@ -159,7 +159,7 @@ public: 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 boundingBox( 0, static_cast( toolBarHeight ), static_cast( boundingBoxSize.width ), diff --git a/examples/text-field/text-field-example.cpp b/examples/text-field/text-field-example.cpp index 12fbae9..b2478b3 100644 --- a/examples/text-field/text-field-example.cpp +++ b/examples/text-field/text-field-example.cpp @@ -67,14 +67,14 @@ public: */ 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() @@ -88,24 +88,24 @@ public: 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"); @@ -116,7 +116,7 @@ public: 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( BORDER_WIDTH, BORDER_WIDTH, stageSize.width - BORDER_WIDTH*2, stageSize.height - BORDER_WIDTH*2 ) ); + field.SetProperty( TextField::Property::DECORATION_BOUNDING_BOX, Rect( BORDER_WIDTH, BORDER_WIDTH, windowSize.width - BORDER_WIDTH*2, windowSize.height - BORDER_WIDTH*2 ) ); return field; } diff --git a/examples/text-fonts/text-fonts-example.cpp b/examples/text-fonts/text-fonts-example.cpp index 30860c4..7559df8 100644 --- a/examples/text-fonts/text-fonts-example.cpp +++ b/examples/text-fonts/text-fonts-example.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -115,10 +115,10 @@ public: 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 ); @@ -148,17 +148,17 @@ public: */ 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 ); @@ -180,9 +180,9 @@ public: 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 ); @@ -193,8 +193,8 @@ public: 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 ); diff --git a/examples/text-label-emojis/text-label-emojis.cpp b/examples/text-label-emojis/text-label-emojis.cpp index b35e025..3c96974 100644 --- a/examples/text-label-emojis/text-label-emojis.cpp +++ b/examples/text-label-emojis/text-label-emojis.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -56,9 +56,9 @@ public: // 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 ); @@ -66,7 +66,7 @@ public: 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 ) { diff --git a/examples/text-label-multi-language/text-label-multi-language-example.cpp b/examples/text-label-multi-language/text-label-multi-language-example.cpp index b5100ce..d55d2a7 100644 --- a/examples/text-label-multi-language/text-label-multi-language-example.cpp +++ b/examples/text-label-multi-language/text-label-multi-language-example.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -57,10 +57,10 @@ public: */ 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 ); @@ -68,7 +68,7 @@ public: 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 ) { diff --git a/examples/text-label/text-label-example.cpp b/examples/text-label/text-label-example.cpp index 8d853af..9f3088a 100644 --- a/examples/text-label/text-label-example.cpp +++ b/examples/text-label/text-label-example.cpp @@ -132,8 +132,8 @@ struct HSVColorConstraint 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; @@ -185,7 +185,7 @@ public: 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 @@ -203,18 +203,18 @@ public: */ 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 ); @@ -239,9 +239,9 @@ public: 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(); @@ -596,8 +596,8 @@ public: 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( mLayoutSize.x )), 2 ), @@ -776,7 +776,7 @@ private: Animation mColorButtonsAnimation; - Size mStageSize; + Size mWindowSize; Size mButtonSize; unsigned int mLanguageId; diff --git a/examples/text-memory-profiling/text-memory-profiling-example.cpp b/examples/text-memory-profiling/text-memory-profiling-example.cpp index 475b594..37d45a5 100644 --- a/examples/text-memory-profiling/text-memory-profiling-example.cpp +++ b/examples/text-memory-profiling/text-memory-profiling-example.cpp @@ -106,8 +106,8 @@ public: 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 ) { @@ -181,7 +181,7 @@ public: 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: @@ -196,8 +196,7 @@ public: */ void CreateMainMenu() { - Stage stage = Stage::GetCurrent(); - Vector2 stageSize = stage.GetSize(); + Vector2 windowSize = mApplication.GetWindow().GetSize(); mTapDetector = TapGestureDetector::New(); mTapDetector.DetectedSignal().Connect( this, &TextMemoryProfilingExample::OnTap ); @@ -209,12 +208,12 @@ public: 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 ); } /** @@ -245,8 +244,6 @@ public: */ void CreateTextLabels( int type ) { - Stage stage = Stage::GetCurrent(); - // Delete any existing text labels unsigned int numChildren = mLayer.GetChildCount(); @@ -278,9 +275,9 @@ public: */ 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, @@ -316,7 +313,7 @@ public: 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 ); diff --git a/examples/text-overlap/text-overlap-example.cpp b/examples/text-overlap/text-overlap-example.cpp index ea8700f..97d7141 100644 --- a/examples/text-overlap/text-overlap-example.cpp +++ b/examples/text-overlap/text-overlap-example.cpp @@ -25,10 +25,10 @@ TextOverlapController::TextOverlapController( Application& app ) 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"); @@ -47,11 +47,11 @@ void TextOverlapController::Create( Application& app ) 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"); @@ -60,10 +60,10 @@ void TextOverlapController::Create( Application& app ) 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(); @@ -91,9 +91,9 @@ void TextOverlapController::OnPan( Actor actor, const PanGesture& gesture ) } 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 @@ -128,7 +128,7 @@ void TextOverlapController::OnKeyEvent( const KeyEvent& keyEvent ) } else { - Dali::Layer l = Dali::Stage::GetCurrent().GetRootLayer(); + Dali::Layer l = mApplication.GetWindow().GetRootLayer(); int so = l.GetProperty(Dali::DevelActor::Property::SIBLING_ORDER); l.SetProperty(Dali::DevelActor::Property::SIBLING_ORDER, so+1); } diff --git a/examples/text-scrolling/text-scrolling-example.cpp b/examples/text-scrolling/text-scrolling-example.cpp index 52c35d4..13de7dd 100644 --- a/examples/text-scrolling/text-scrolling-example.cpp +++ b/examples/text-scrolling/text-scrolling-example.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -28,7 +28,7 @@ using namespace Dali::Toolkit; 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; @@ -119,23 +119,23 @@ public: */ 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(); @@ -163,7 +163,7 @@ public: 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( SCREEN_BORDER, SCREEN_BORDER, mStageSize.width - SCREEN_BORDER*2, mStageSize.height - SCREEN_BORDER*2 ) ); + field.SetProperty( TextField::Property::DECORATION_BOUNDING_BOX, Rect( SCREEN_BORDER, SCREEN_BORDER, mWindowSize.width - SCREEN_BORDER*2, mWindowSize.height - SCREEN_BORDER*2 ) ); boxA.Add( field ); boxA.SetProperty( Actor::Property::SIZE, BOX_SIZE); @@ -382,7 +382,7 @@ public: 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 )); } } @@ -394,7 +394,7 @@ private: Vector2 mTargetActorPosition; Vector2 mTargetActorSize; - Vector2 mStageSize; + Vector2 mWindowSize; TextLabel mLargeLabel; TextLabel mSmallLabel; diff --git a/examples/textured-mesh/textured-mesh-example.cpp b/examples/textured-mesh/textured-mesh-example.cpp index 6ee57f1..31bd22a 100644 --- a/examples/textured-mesh/textured-mesh-example.cpp +++ b/examples/textured-mesh/textured-mesh-example.cpp @@ -104,10 +104,10 @@ public: { // 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 ); @@ -133,7 +133,7 @@ public: 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 ); @@ -151,7 +151,7 @@ public: 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(); @@ -167,7 +167,7 @@ public: 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)); } /** @@ -195,7 +195,7 @@ public: private: Application& mApplication; ///< Application instance - Vector3 mStageSize; ///< The size of the stage + Vector3 mWindowSize; ///< The size of the window Shader mShader; TextureSet mTextureSet1; diff --git a/examples/tilt/tilt-example.cpp b/examples/tilt/tilt-example.cpp index 713af77..06bf64e 100644 --- a/examples/tilt/tilt-example.cpp +++ b/examples/tilt/tilt-example.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -41,9 +41,9 @@ public: // 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 ); @@ -53,15 +53,15 @@ public: 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() diff --git a/examples/tooltip/tooltip-example.cpp b/examples/tooltip/tooltip-example.cpp index de3ed42..6d599f6 100644 --- a/examples/tooltip/tooltip-example.cpp +++ b/examples/tooltip/tooltip-example.cpp @@ -24,7 +24,7 @@ using namespace Dali::Toolkit; 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 @@ -52,44 +52,44 @@ private: // 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 }, @@ -106,7 +106,7 @@ private: { { 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 ); } /** @@ -143,9 +143,9 @@ private: /** * @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 ) { @@ -154,7 +154,7 @@ private: 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 ); } } diff --git a/examples/transitions/transition-application.cpp b/examples/transitions/transition-application.cpp index 160a02d..9872397 100644 --- a/examples/transitions/transition-application.cpp +++ b/examples/transitions/transition-application.cpp @@ -69,9 +69,9 @@ TransitionApplication::~TransitionApplication() 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 ); @@ -83,7 +83,7 @@ void TransitionApplication::Create( Application& application ) 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" ); diff --git a/examples/video-view/video-view-example.cpp b/examples/video-view/video-view-example.cpp index d648e5c..f9d999c 100644 --- a/examples/video-view/video-view-example.cpp +++ b/examples/video-view/video-view-example.cpp @@ -59,10 +59,11 @@ class VideoViewController: public ConnectionTracker 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 ); @@ -165,8 +166,7 @@ class VideoViewController: public ConnectionTracker 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 ) @@ -245,7 +245,7 @@ class VideoViewController: public ConnectionTracker { if( !mIsFullScreen ) { - mVideoView.SetProperty( Actor::Property::SIZE, mStageSize ); + mVideoView.SetProperty( Actor::Property::SIZE, mWindowSize ); mIsFullScreen = true; } else @@ -275,7 +275,7 @@ private: Application& mApplication; VideoView mVideoView; Layer mMenu; - Vector2 mStageSize; + Vector2 mWindowSize; bool mIsPlay; bool mIsFullScreen; diff --git a/examples/visual-fitting-mode/visual-fitting-mode-example.cpp b/examples/visual-fitting-mode/visual-fitting-mode-example.cpp index 7873d32..817f306 100644 --- a/examples/visual-fitting-mode/visual-fitting-mode-example.cpp +++ b/examples/visual-fitting-mode/visual-fitting-mode-example.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -116,13 +116,13 @@ private: */ 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(); @@ -132,7 +132,7 @@ private: // 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 ); @@ -143,22 +143,22 @@ private: { 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(); diff --git a/examples/visual-transitions/transition-application.cpp b/examples/visual-transitions/transition-application.cpp index b50e676..b721341 100644 --- a/examples/visual-transitions/transition-application.cpp +++ b/examples/visual-transitions/transition-application.cpp @@ -69,9 +69,9 @@ TransitionApplication::~TransitionApplication() 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 ); @@ -83,7 +83,7 @@ void TransitionApplication::Create( Application& application ) // 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" ); diff --git a/examples/web-view/web-view-example.cpp b/examples/web-view/web-view-example.cpp index 2ff41df..af668dc 100644 --- a/examples/web-view/web-view-example.cpp +++ b/examples/web-view/web-view-example.cpp @@ -57,12 +57,12 @@ public: // 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" ); @@ -75,7 +75,7 @@ public: 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 ); @@ -83,10 +83,10 @@ public: 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 ); } diff --git a/shared/dali-table-view.cpp b/shared/dali-table-view.cpp index c62c84c..21cb43e 100644 --- a/shared/dali-table-view.cpp +++ b/shared/dali-table-view.cpp @@ -105,7 +105,6 @@ const char * const DEMO_BUILD_DATE = __DATE__ " " __TIME__; 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 ); @@ -229,12 +228,13 @@ void DaliTableView::SortAlphabetically( bool sortAlphabetically ) 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 ); @@ -259,7 +259,7 @@ void DaliTableView::Initialize( Application& application ) 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 ); @@ -267,7 +267,7 @@ void DaliTableView::Initialize( Application& application ) 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(); @@ -290,7 +290,7 @@ void DaliTableView::Initialize( Application& application ) 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 ); @@ -398,7 +398,7 @@ void DaliTableView::OnButtonsPageRelayout( const Dali::Actor& actor ) 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; @@ -472,7 +472,7 @@ void DaliTableView::Populate() // 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 ); @@ -481,12 +481,13 @@ void DaliTableView::Populate() 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 ) @@ -670,29 +671,30 @@ void DaliTableView::ApplyScrollViewEffect() 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 ) @@ -935,7 +937,7 @@ void DaliTableView::OnLogoTapped( Dali::Actor actor, const Dali::TapGesture& tap 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 ); diff --git a/shared/utility.h b/shared/utility.h index f3ba3e7..7c31dff 100644 --- a/shared/utility.h +++ b/shared/utility.h @@ -2,7 +2,7 @@ #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. @@ -21,6 +21,7 @@ #include #include #include +#include #include namespace DemoHelper @@ -44,10 +45,9 @@ Dali::Texture LoadTexture( const char* imagePath, 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() diff --git a/shared/view.h b/shared/view.h index 6c36bee..1ef05ce 100644 --- a/shared/view.h +++ b/shared/view.h @@ -51,20 +51,11 @@ const float DEFAULT_TEXT_STYLE_POINT_SIZE( 8.0f ); 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 ); @@ -115,7 +106,7 @@ Dali::Layer CreateView( Dali::Application& application, 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(); @@ -123,8 +114,8 @@ Dali::Layer CreateView( Dali::Application& application, 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() ) @@ -132,18 +123,14 @@ Dali::Layer CreateView( Dali::Application& application, 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 ); -- 2.7.4