/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <cstring> // for strcmp
// INTERNAL INCLUDES
-#include <dali/integration-api/system-overlay.h>
#include <dali/internal/event/actors/layer-impl.h>
#include <dali/internal/event/actors/layer-list.h>
#include <dali/internal/event/actors/camera-actor-impl.h>
-#include <dali/internal/event/actor-attachments/camera-attachment-impl.h>
-#include <dali/internal/event/common/system-overlay-impl.h>
#include <dali/internal/event/common/thread-local-storage.h>
#include <dali/internal/event/common/property-notification-manager.h>
#include <dali/internal/event/render-tasks/render-task-list-impl.h>
+#include <dali/internal/event/update/frame-callback-interface-impl.h>
#include <dali/internal/update/nodes/node.h>
+#include <dali/internal/update/manager/scene-graph-frame-callback.h>
#include <dali/internal/event/common/object-registry-impl.h>
#include <dali/integration-api/platform-abstraction.h>
#include <dali/public-api/common/constants.h>
+#include <dali/public-api/events/touch-event.h>
#include <dali/public-api/object/type-registry.h>
#include <dali/public-api/render-tasks/render-task-list.h>
+#include <dali/public-api/rendering/frame-buffer.h>
+#include <dali/public-api/common/constants.h>
using Dali::Internal::SceneGraph::Node;
+namespace
+{
+#if defined(DEBUG_ENABLED)
+Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_DEPTH_TIMER" );
+#endif
+}
+
namespace Dali
{
namespace
{
-const float DEFAULT_STEREO_BASE( 65.0f );
-
// Signals
-const char* const SIGNAL_KEY_EVENT = "key-event";
-const char* const SIGNAL_EVENT_PROCESSING_FINISHED = "event-processing-finished";
-const char* const SIGNAL_TOUCHED = "touched";
-const char* const SIGNAL_WHEEL_EVENT = "wheel-event";
-const char* const SIGNAL_CONTEXT_LOST = "context-lost";
-const char* const SIGNAL_CONTEXT_REGAINED = "context-regained";
-const char* const SIGNAL_SCENE_CREATED = "scene-created";
-
-TypeRegistration mType( typeid(Dali::Stage), typeid(Dali::BaseHandle), NULL );
-
-SignalConnectorType signalConnector1( mType, SIGNAL_KEY_EVENT, &Stage::DoConnectSignal );
-SignalConnectorType signalConnector2( mType, SIGNAL_EVENT_PROCESSING_FINISHED, &Stage::DoConnectSignal );
-SignalConnectorType signalConnector3( mType, SIGNAL_TOUCHED, &Stage::DoConnectSignal );
-SignalConnectorType signalConnector4( mType, SIGNAL_WHEEL_EVENT, &Stage::DoConnectSignal );
-SignalConnectorType signalConnector5( mType, SIGNAL_CONTEXT_LOST, &Stage::DoConnectSignal );
-SignalConnectorType signalConnector6( mType, SIGNAL_CONTEXT_REGAINED, &Stage::DoConnectSignal );
-SignalConnectorType signalConnector7( mType, SIGNAL_SCENE_CREATED, &Stage::DoConnectSignal );
+static constexpr std::string_view SIGNAL_KEY_EVENT = "keyEvent";
+static constexpr std::string_view SIGNAL_KEY_EVENT_GENERATED = "keyEventGenerated";
+static constexpr std::string_view SIGNAL_EVENT_PROCESSING_FINISHED = "eventProcessingFinished";
+static constexpr std::string_view SIGNAL_TOUCHED = "touched";
+static constexpr std::string_view SIGNAL_WHEEL_EVENT = "wheelEvent";
+static constexpr std::string_view SIGNAL_CONTEXT_LOST = "contextLost";
+static constexpr std::string_view SIGNAL_CONTEXT_REGAINED = "contextRegained";
+static constexpr std::string_view SIGNAL_SCENE_CREATED = "sceneCreated";
+
+TypeRegistration mType( typeid(Dali::Stage), typeid(Dali::BaseHandle), nullptr );
+
+SignalConnectorType signalConnector1(mType, std::string(SIGNAL_KEY_EVENT), &Stage::DoConnectSignal);
+SignalConnectorType signalConnector2(mType, std::string(SIGNAL_EVENT_PROCESSING_FINISHED), &Stage::DoConnectSignal);
+SignalConnectorType signalConnector4(mType, std::string(SIGNAL_WHEEL_EVENT), &Stage::DoConnectSignal);
+SignalConnectorType signalConnector5(mType, std::string(SIGNAL_CONTEXT_LOST), &Stage::DoConnectSignal);
+SignalConnectorType signalConnector6(mType, std::string(SIGNAL_CONTEXT_REGAINED), &Stage::DoConnectSignal);
+SignalConnectorType signalConnector7(mType, std::string(SIGNAL_SCENE_CREATED), &Stage::DoConnectSignal);
+SignalConnectorType signalConnector8(mType, std::string(SIGNAL_KEY_EVENT_GENERATED), &Stage::DoConnectSignal);
+SignalConnectorType signalConnector9(mType, std::string(SIGNAL_TOUCHED), &Stage::DoConnectSignal);
} // unnamed namespace
-StagePtr Stage::New( AnimationPlaylist& playlist,
- PropertyNotificationManager& propertyNotificationManager,
- SceneGraph::UpdateManager& updateManager,
- NotificationManager& notificationManager )
+StagePtr Stage::New( SceneGraph::UpdateManager& updateManager )
{
- return StagePtr( new Stage( playlist, propertyNotificationManager, updateManager, notificationManager ) );
-}
-
-void Stage::Initialize()
-{
- mObjectRegistry = ObjectRegistry::New();
-
- // Create the ordered list of layers
- mLayerList = LayerList::New( mUpdateManager, false/*not system-level*/ );
-
- // The stage owns the default layer
- mRootLayer = Layer::NewRoot( *mLayerList, mUpdateManager, false/*not system-level*/ );
- mRootLayer->SetName("RootLayer");
-
- // Create the default camera actor first; this is needed by the RenderTaskList
- CreateDefaultCameraActor();
-
- // Create the list of render-tasks
- mRenderTaskList = RenderTaskList::New( *this, *this, false/*not system-level*/ );
-
- // Create the default render-task
- Dali::RenderTask defaultRenderTask = mRenderTaskList->CreateTask();
+ return StagePtr( new Stage( updateManager ) );
}
-void Stage::Uninitialize()
+void Stage::Initialize( Scene& scene )
{
- // Remove actors added to SystemOverlay
- delete mSystemOverlay;
- mSystemOverlay = NULL;
-
- if( mDefaultCamera )
- {
- // its enough to release the handle so the object is released
- // don't need to remove it from root actor as root actor will delete the object
- mDefaultCamera.Reset();
- }
-
- if( mRootLayer )
- {
- // we are closing down so just delete the root, no point emit disconnect
- // signals or send messages to update
- mRootLayer.Reset();
- }
+ mScene = &scene;
+ mScene->SetBackgroundColor( Dali::DEFAULT_BACKGROUND_COLOR );
+ mScene->EventProcessingFinishedSignal().Connect( this, &Stage::OnEventProcessingFinished );
+ mScene->KeyEventSignal().Connect( this, &Stage::OnKeyEvent );
+ mScene->TouchedSignal().Connect( this, &Stage::OnTouchEvent );
+ mScene->WheelEventSignal().Connect( this, &Stage::OnWheelEvent );
}
StagePtr Stage::GetCurrent()
{
- StagePtr stage( NULL );
+ StagePtr stage( nullptr );
// no checking in this version
ThreadLocalStorage* tls = ThreadLocalStorage::GetInternal();
if( tls )
ObjectRegistry& Stage::GetObjectRegistry()
{
- return *mObjectRegistry;
-}
-
-void Stage::RegisterObject( Dali::BaseObject* object )
-{
- mObjectRegistry->RegisterObject( object );
-}
-
-void Stage::UnregisterObject( Dali::BaseObject* object )
-{
- mObjectRegistry->UnregisterObject( object );
+ return ThreadLocalStorage::Get().GetObjectRegistry();
}
Layer& Stage::GetRootActor()
{
- return *mRootLayer;
-}
-
-AnimationPlaylist& Stage::GetAnimationPlaylist()
-{
- return mAnimationPlaylist;
-}
-
-PropertyNotificationManager& Stage::GetPropertyNotificationManager()
-{
- return mPropertyNotificationManager;
+ Dali::Layer rootLayer = GetRootLayer();
+ return GetImplementation( rootLayer );
}
void Stage::Add( Actor& actor )
{
- mRootLayer->Add( actor );
+ mScene->Add( actor );
}
void Stage::Remove( Actor& actor )
{
- mRootLayer->Remove( actor );
-}
-
-void Stage::SetSize(float width, float height)
-{
- // Internally we want to report the actual size of the stage.
- mSize.width = width;
- mSize.height = height;
-
- // Calculates the aspect ratio, near and far clipping planes, field of view and camera Z position.
- mDefaultCamera->SetPerspectiveProjection( mSize );
-
- // The depth of the stage gets set to the maximun of these values
- mRootLayer->SetSize( mSize );
-
- // Repeat for SystemOverlay actors
- if( mSystemOverlay )
- {
- mSystemOverlay->GetImpl()->SetSize( mSize.width, mSize.height );
- }
-
- SetDefaultSurfaceRectMessage( mUpdateManager, Rect<int>( 0, 0, width, height ) );
+ mScene->Remove( actor );
}
Vector2 Stage::GetSize() const
{
- return mSize;
+ return mScene->GetSize();
}
RenderTaskList& Stage::GetRenderTaskList() const
{
- return *mRenderTaskList;
-}
-
-void Stage::CreateDefaultCameraActor()
-{
- // The default camera attributes and position is such that
- // children of the default layer, can be positioned at (0,0) and
- // be at the top-left of the viewport.
- mDefaultCamera = CameraActor::New( Size::ZERO );
- mDefaultCamera->SetParentOrigin(ParentOrigin::CENTER);
- Add(*(mDefaultCamera.Get()));
+ return mScene->GetRenderTaskList();
}
Actor& Stage::GetDefaultRootActor()
{
- return *mRootLayer;
+ return mScene->GetDefaultRootActor();
}
CameraActor& Stage::GetDefaultCameraActor()
{
- return *mDefaultCamera;
+ return mScene->GetDefaultCameraActor();
}
-unsigned int Stage::GetLayerCount() const
+uint32_t Stage::GetLayerCount() const
{
- return mLayerList->GetLayerCount();
+ return mScene->GetLayerCount();
}
-Dali::Layer Stage::GetLayer( unsigned int depth ) const
+Dali::Layer Stage::GetLayer( uint32_t depth ) const
{
- return Dali::Layer(mLayerList->GetLayer( depth ));
+ return mScene->GetLayer( depth );
}
Dali::Layer Stage::GetRootLayer() const
{
- return Dali::Layer( mRootLayer.Get() );
+ return mScene->GetRootLayer();
}
LayerList& Stage::GetLayerList()
{
- return *mLayerList;
+ return mScene->GetLayerList();
}
-Integration::SystemOverlay& Stage::GetSystemOverlay()
+void Stage::SetBackgroundColor(Vector4 color)
{
- // Lazily create system-level if requested
- if( !mSystemOverlay )
- {
- mSystemOverlay = new Integration::SystemOverlay( SystemOverlay::New( *this ) );
- DALI_ASSERT_ALWAYS( NULL != mSystemOverlay && "Failed to create system overlay" );
-
- mSystemOverlay->GetImpl()->SetSize( mSize.width, mSize.height );
- }
-
- return *mSystemOverlay;
+ mScene->SetBackgroundColor( color );
}
-SystemOverlay* Stage::GetSystemOverlayInternal()
+Vector4 Stage::GetBackgroundColor() const
{
- SystemOverlay* overlay( NULL );
-
- if( mSystemOverlay )
- {
- overlay = mSystemOverlay->GetImpl();
- }
-
- return overlay;
+ return mScene->GetBackgroundColor();
}
-void Stage::SetViewMode( ViewMode viewMode )
+Vector2 Stage::GetDpi() const
{
- if( mViewMode != viewMode )
- {
- DALI_LOG_INFO( Debug::Filter::gActor, Debug::Concise, "View mode changed from %d to %d\n", mViewMode, viewMode);
-
- if( mViewMode == MONO )
- {
- mDefaultCamera->SetOrientation( Dali::ANGLE_180, Vector3::YAXIS );
- mRenderTaskList->GetTask(0).SetSourceActor( Dali::Actor() );
-
- //Create camera and RenderTask for left eye
- mLeftCamera = CameraActor::New( Size::ZERO );
- mLeftCamera->SetParentOrigin( ParentOrigin::CENTER );
- mDefaultCamera->Add( *mLeftCamera.Get() );
- mLeftRenderTask = mRenderTaskList->CreateTask();
- mLeftRenderTask.SetCameraActor( Dali::CameraActor( mLeftCamera.Get() ) );
- mLeftCamera->SetType( Dali::Camera::FREE_LOOK );
-
- //Create camera and RenderTask for right eye
- mRightCamera = CameraActor::New( Size::ZERO );
- mRightCamera->SetParentOrigin( ParentOrigin::CENTER );
- mDefaultCamera->Add( *mRightCamera.Get() );
- mRightRenderTask = mRenderTaskList->CreateTask();
- mRightRenderTask.SetClearColor( Vector4( 1.0f,0.0f,0.0f,1.0f));
-
- mRightRenderTask.SetCameraActor( Dali::CameraActor( mRightCamera.Get() ) );
- mRightCamera->SetType( Dali::Camera::FREE_LOOK );
- }
-
- // save new mode
- mViewMode = viewMode;
-
- switch( viewMode )
- {
- case MONO:
- {
- // delete extra stereoscopic render tasks and cameras
- mRenderTaskList->RemoveTask( mLeftRenderTask );
- mDefaultCamera->Remove( *mLeftCamera.Get() );
- mLeftRenderTask.Reset();
- mLeftCamera.Reset();
- mRenderTaskList->RemoveTask( mRightRenderTask );
- mDefaultCamera->Remove( *mRightCamera.Get() );
- mRightRenderTask.Reset();
- mRightCamera.Reset();
- mDefaultCamera->SetOrientation( Dali::ANGLE_0, Vector3::YAXIS );
- mDefaultCamera->SetType( Dali::Camera::LOOK_AT_TARGET );
- mRenderTaskList->GetTask(0).SetSourceActor( Dali::Layer(mRootLayer.Get()) );
-
- break;
- }
- case STEREO_HORIZONTAL:
- {
- //Stereo mode with horizontal split is for landscape mode. That's the reason for the cameras being rotated
- //Top camera renders the scene as seen from the right eye and bottom camera as seen from left.
-
- //Calculate separation in pixels along vertical axis ( mStereoBase is defined in millimetres )
- const float stereoBase( ( (mStereoBase / 25.4f) * GetDpi().y ) * 0.5f );
-
- //Calculate aspect ratio
- float aspect = mSize.width / (mSize.height * 0.5f);
-
- mLeftCamera->SetPerspectiveProjection( mSize, Vector2( 0.0f,stereoBase) );
- mLeftCamera->SetAspectRatio( aspect );
-
- mLeftCamera->SetOrientation( -Dali::ANGLE_90, Vector3::ZAXIS );
- mLeftCamera->SetPosition( Vector3( stereoBase, 0.0f, 0.0f ) );
- mLeftRenderTask.SetViewport( Viewport(0, mSize.height * 0.5f, mSize.width, mSize.height * 0.5f) );
-
- mRightCamera->SetPerspectiveProjection( mSize, Vector2( 0.0, -stereoBase) );
- mRightCamera->SetAspectRatio( aspect );
- mRightCamera->SetOrientation( -Dali::ANGLE_90, Vector3::ZAXIS );
- mRightCamera->SetPosition( Vector3(-stereoBase, 0.0f, 0.0f ) );
- mRightRenderTask.SetViewport( Viewport(0, 0, mSize.width, mSize.height * 0.5f ) );
-
- break;
- }
- case STEREO_VERTICAL:
- {
- //Calculate separation in pixels along horizontal axis
- const float stereoBase( ( (mStereoBase / 25.4f) * GetDpi().x ) * 0.5f );
-
- //Recalculate fov based on viewport size
- const float fov = 2.0f * std::atan( mSize.y / (2.0f * std::max( mSize.x*0.5f, mSize.y )) );
-
- mLeftCamera->SetPerspectiveProjection( Size( mSize.x * 0.5f, mSize.y ), Vector2(stereoBase,0.0f) );
- mLeftCamera->SetFieldOfView( fov );
- mLeftCamera->SetOrientation( Dali::ANGLE_0, Vector3::ZAXIS );
- mLeftCamera->SetPosition( Vector3( stereoBase, 0.0f, 0.0f ) );
- mLeftRenderTask.SetViewport( Viewport(0, 0, mSize.width * 0.5f, mSize.height ) );
-
- mRightCamera->SetPerspectiveProjection( Size( mSize.x * 0.5f, mSize.y ), Vector2(-stereoBase,0.0f) );
- mRightCamera->SetFieldOfView( fov );
- mRightCamera->SetOrientation( Dali::ANGLE_0, Vector3::ZAXIS );
- mRightCamera->SetPosition( Vector3( -stereoBase, 0.0f, 0.0f ) );
- mRightRenderTask.SetViewport( Viewport(mSize.width * 0.5f, 0, mSize.width * 0.5f, mSize.height ) );
-
- break;
- }
- case STEREO_INTERLACED:
- {
- break;
- }
- }
- }
+ return mScene->GetDpi();
}
-ViewMode Stage::GetViewMode() const
+void Stage::KeepRendering( float durationSeconds )
{
- return mViewMode;
+ // Send message to keep rendering
+ KeepRenderingMessage( mUpdateManager, durationSeconds );
}
-void Stage::SetStereoBase( float stereoBase )
+void Stage::SetRenderingBehavior( DevelStage::Rendering renderingBehavior )
{
- if( ! Equals( mStereoBase, stereoBase ) )
+ if( mRenderingBehavior != renderingBehavior )
{
- DALI_LOG_INFO( Debug::Filter::gActor, Debug::Concise, "old( %.2f) new(%.2f)", mStereoBase, stereoBase );
- mStereoBase = stereoBase;
-
- switch( mViewMode )
- {
- case STEREO_HORIZONTAL:
- {
- stereoBase = mStereoBase / 25.4f * GetDpi().y * 0.5f;
- float aspect = mSize.width / (mSize.height * 0.5f);
-
- mLeftCamera->SetPerspectiveProjection( mSize, Vector2( 0.0, stereoBase) );
- mLeftCamera->SetAspectRatio( aspect );
- mLeftCamera->SetPosition( Vector3( stereoBase, 0.0f, 0.0f ) );
-
- mRightCamera->SetPerspectiveProjection( mSize, Vector2( 0.0, -stereoBase) );
- mRightCamera->SetAspectRatio( aspect );
- mRightCamera->SetPosition( Vector3(-stereoBase, 0.0f, 0.0f ) );
-
- break;
- }
- case STEREO_VERTICAL:
- {
- stereoBase = mStereoBase / 25.4f * GetDpi().x * 0.5f;
- const float fov = 2.0f * std::atan( mSize.y / (2.0f * std::max( mSize.x*0.5f, mSize.y )) );
-
- mLeftCamera->SetPerspectiveProjection( Size( mSize.x * 0.5f, mSize.y ), Vector2(stereoBase,0.0f) );
- mLeftCamera->SetFieldOfView( fov );
- mLeftCamera->SetPosition( Vector3( stereoBase, 0.0f, 0.0f ) );
-
- mRightCamera->SetPerspectiveProjection( Size( mSize.x * 0.5f, mSize.y ), Vector2(-stereoBase,0.0f) );
- mRightCamera->SetFieldOfView( fov );
- mRightCamera->SetPosition( Vector3(-stereoBase, 0.0f, 0.0f ) );
-
- break;
- }
- default:
- break;
- }
- }
-}
+ // Send message to change the rendering behavior
+ SetRenderingBehaviorMessage( mUpdateManager, renderingBehavior );
-float Stage::GetStereoBase() const
-{
- return mStereoBase;
-}
-
-void Stage::SetBackgroundColor(Vector4 color)
-{
- // Cache for public GetBackgroundColor()
- mBackgroundColor = color;
-
- // Send message to change color in next frame
- SetBackgroundColorMessage( mUpdateManager, color );
-}
-
-Vector4 Stage::GetBackgroundColor() const
-{
- return mBackgroundColor;
-}
-
-Vector2 Stage::GetDpi() const
-{
- return mDpi;
-}
-
-void Stage::SetDpi(Vector2 dpi)
-{
- mDpi = dpi;
+ mRenderingBehavior = renderingBehavior;
+ }
}
-void Stage::KeepRendering( float durationSeconds )
+DevelStage::Rendering Stage::GetRenderingBehavior() const
{
- // Send message to keep rendering
- KeepRenderingMessage( mUpdateManager, durationSeconds );
+ return mRenderingBehavior;
}
bool Stage::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
{
bool connected( true );
- Stage* stage = dynamic_cast<Stage*>(object);
+ Stage* stage = static_cast< Stage* >(object); // TypeRegistry guarantees that this is the correct type.
+ std::string_view name(signalName);
- if( 0 == strcmp( signalName.c_str(), SIGNAL_KEY_EVENT ) )
+ if(name == SIGNAL_KEY_EVENT)
{
stage->KeyEventSignal().Connect( tracker, functor );
}
- else if( 0 == strcmp( signalName.c_str(), SIGNAL_EVENT_PROCESSING_FINISHED ) )
+ else if(name == SIGNAL_KEY_EVENT_GENERATED)
+ {
+ stage->KeyEventGeneratedSignal().Connect( tracker, functor );
+ }
+ else if(name == SIGNAL_EVENT_PROCESSING_FINISHED)
{
stage->EventProcessingFinishedSignal().Connect( tracker, functor );
}
- else if( 0 == strcmp( signalName.c_str(), SIGNAL_TOUCHED ) )
+ else if(name == SIGNAL_TOUCHED)
{
stage->TouchedSignal().Connect( tracker, functor );
}
- else if( 0 == strcmp( signalName.c_str(), SIGNAL_WHEEL_EVENT ) )
+ else if(name == SIGNAL_WHEEL_EVENT)
{
stage->WheelEventSignal().Connect( tracker, functor );
}
- else if( 0 == strcmp( signalName.c_str(), SIGNAL_CONTEXT_LOST ) )
+ else if(name == SIGNAL_CONTEXT_LOST)
{
stage->ContextLostSignal().Connect( tracker, functor );
}
- else if( 0 == strcmp( signalName.c_str(), SIGNAL_CONTEXT_REGAINED ) )
+ else if(name == SIGNAL_CONTEXT_REGAINED)
{
stage->ContextRegainedSignal().Connect( tracker, functor );
}
- else if( 0 == strcmp( signalName.c_str(), SIGNAL_SCENE_CREATED ) )
+ else if(name == SIGNAL_SCENE_CREATED)
{
stage->SceneCreatedSignal().Connect( tracker, functor );
}
return connected;
}
+void Stage::OnEventProcessingFinished()
+{
+ EmitEventProcessingFinishedSignal();
+}
+
+void Stage::OnKeyEvent( const Dali::KeyEvent& event )
+{
+ bool consumed = EmitKeyEventGeneratedSignal( event );
+ if( !consumed )
+ {
+ EmitKeyEventSignal( event );
+ }
+}
+
+void Stage::OnTouchEvent( const Dali::TouchEvent& touch )
+{
+ EmitTouchedSignal( touch );
+}
+
+void Stage::OnWheelEvent( const Dali::WheelEvent& event )
+{
+ EmitWheelEventSignal( event );
+}
+
void Stage::EmitKeyEventSignal(const KeyEvent& event)
{
// Emit the key event signal when no actor in the stage has gained the key input focus
mKeyEventSignal.Emit( event );
}
+bool Stage::EmitKeyEventGeneratedSignal(const KeyEvent& event)
+{
+ // Emit the KeyEventGenerated signal when KeyEvent is generated
+
+ return mKeyEventGeneratedSignal.Emit( event );
+}
+
void Stage::EmitEventProcessingFinishedSignal()
{
- mEventProcessingFinishedSignal.Emit();
+ mEventProcessingFinishedSignal.Emit();
}
-void Stage::EmitTouchedSignal( const TouchEvent& touch )
+void Stage::EmitTouchedSignal( const Dali::TouchEvent& touch )
{
mTouchedSignal.Emit( touch );
}
-void Stage::EmitWheelEventSignal(const WheelEvent& event)
+void Stage::EmitWheelEventSignal( const WheelEvent& event )
{
// Emit the wheel event signal when no actor in the stage has gained the wheel input focus
return mKeyEventSignal;
}
+Dali::DevelStage::KeyEventGeneratedSignalType& Stage::KeyEventGeneratedSignal()
+{
+ return mKeyEventGeneratedSignal;
+}
+
+void Stage::AddFrameCallback( FrameCallbackInterface& frameCallback, Actor& rootActor )
+{
+ DALI_ASSERT_ALWAYS( ( ! FrameCallbackInterface::Impl::Get( frameCallback ).IsConnectedToSceneGraph() )
+ && "FrameCallbackInterface implementation already added" );
+
+ // Create scene-graph object and transfer to UpdateManager
+ OwnerPointer< SceneGraph::FrameCallback > transferOwnership( SceneGraph::FrameCallback::New( frameCallback ) );
+ AddFrameCallbackMessage( mUpdateManager, transferOwnership, rootActor.GetNode() );
+}
+
+void Stage::RemoveFrameCallback( FrameCallbackInterface& frameCallback )
+{
+ FrameCallbackInterface::Impl::Get( frameCallback ).Invalidate();
+ RemoveFrameCallbackMessage( mUpdateManager, frameCallback );
+}
+
Dali::Stage::EventProcessingFinishedSignalType& Stage::EventProcessingFinishedSignal()
{
return mEventProcessingFinishedSignal;
}
-Dali::Stage::TouchedSignalType& Stage::TouchedSignal()
+Dali::Stage::TouchEventSignalType& Stage::TouchedSignal()
{
return mTouchedSignal;
}
mContextRegainedSignal.Emit();
}
-Stage::Stage( AnimationPlaylist& playlist,
- PropertyNotificationManager& propertyNotificationManager,
- SceneGraph::UpdateManager& updateManager,
- NotificationManager& notificationManager )
-: mAnimationPlaylist( playlist ),
- mPropertyNotificationManager(propertyNotificationManager),
- mUpdateManager(updateManager),
- mNotificationManager(notificationManager),
- mSize(Vector2::ZERO),
- mBackgroundColor(Dali::Stage::DEFAULT_BACKGROUND_COLOR),
- mViewMode( MONO ),
- mStereoBase( DEFAULT_STEREO_BASE ),
- mSystemOverlay(NULL)
-{
-}
-
-SceneGraph::UpdateManager& Stage::GetUpdateManager()
+Stage::Stage( SceneGraph::UpdateManager& updateManager )
+: mUpdateManager( updateManager ),
+ mKeyEventSignal(),
+ mKeyEventGeneratedSignal(),
+ mEventProcessingFinishedSignal(),
+ mTouchedSignal(),
+ mWheelEventSignal(),
+ mContextLostSignal(),
+ mContextRegainedSignal(),
+ mSceneCreatedSignal(),
+ mRenderingBehavior( DevelStage::Rendering::IF_REQUIRED )
{
- return mUpdateManager;
}
-unsigned int* Stage::ReserveMessageSlot( std::size_t size, bool updateScene )
-{
- return mUpdateManager.ReserveMessageSlot( size, updateScene );
-}
-
-BufferIndex Stage::GetEventBufferIndex() const
-{
- return mUpdateManager.GetEventBufferIndex();
-}
-
-Stage::~Stage()
-{
- delete mSystemOverlay;
-
- mObjectRegistry.Reset();
-}
+Stage::~Stage() = default;
} // namespace Internal