1 #ifndef __DALI_INTERNAL_CORE_H__
2 #define __DALI_INTERNAL_CORE_H__
5 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
22 #include <dali/public-api/object/ref-object.h>
23 #include <dali/integration-api/context-notifier.h>
24 #include <dali/internal/common/owner-pointer.h>
25 #include <dali/internal/event/animation/animation-playlist-declarations.h>
26 #include <dali/internal/event/common/stage-def.h>
27 #include <dali/internal/update/resources/resource-manager-declarations.h>
28 #include <dali/public-api/common/view-mode.h>
29 #include <dali/integration-api/resource-policies.h>
36 class RenderController;
37 class PlatformAbstraction;
40 class GlSyncAbstraction;
51 class NotificationManager;
52 class AnimationPlaylist;
53 class PropertyNotificationManager;
56 class GestureEventProcessor;
58 class ResourceManager;
73 * Internal class for Dali::Integration::Core
80 * Create and initialise a new Core instance
82 Core( Integration::RenderController& renderController,
83 Integration::PlatformAbstraction& platform,
84 Integration::GlAbstraction& glAbstraction,
85 Integration::GlSyncAbstraction& glSyncAbstraction,
86 Integration::GestureManager& gestureManager,
87 ResourcePolicy::DataRetention dataRetentionPolicy );
95 * @copydoc Dali::Integration::Core::GetContextNotifier()
97 Integration::ContextNotifierInterface* GetContextNotifier();
100 * @copydoc Dali::Integration::Core::ContextCreated()
102 void ContextCreated();
105 * @copydoc Dali::Integration::Core::ContextDestroyed()
107 void ContextDestroyed();
110 * @copydoc Dali::Integration::Core::RecoverFromContextLoss()
112 void RecoverFromContextLoss();
115 * @copydoc Dali::Integration::Core::SurfaceResized(unsigned int, unsigned int)
117 void SurfaceResized(unsigned int width, unsigned int height);
120 * @copydoc Dali::Integration::Core::SetDpi(unsigned int, unsigned int)
122 void SetDpi(unsigned int dpiHorizontal, unsigned int dpiVertical);
125 * @copydoc Dali::Integration::Core::SetMinimumFrameTimeInterval(unsigned int)
127 void SetMinimumFrameTimeInterval(unsigned int interval);
130 * @copydoc Dali::Integration::Core::Update()
132 void Update( float elapsedSeconds, unsigned int lastVSyncTimeMilliseconds, unsigned int nextVSyncTimeMilliseconds, Integration::UpdateStatus& status );
135 * @copydoc Dali::Integration::Core::Render()
137 void Render( Integration::RenderStatus& status );
140 * @copydoc Dali::Integration::Core::Suspend()
145 * @copydoc Dali::Integration::Core::Resume()
150 * @copydoc Dali::Integration::Core::SceneCreated()
155 * @copydoc Dali::Integration::Core::QueueEvent(const Integration::Event&)
157 void QueueEvent( const Integration::Event& event );
160 * @copydoc Dali::Integration::Core::ProcessEvents()
162 void ProcessEvents();
165 * @copydoc Dali::Integration::Core::UpdateTouchData(const Integration::TouchData&)
167 void UpdateTouchData(const Integration::TouchData& touch);
170 * @copydoc Dali::Integration::Core::GetMaximumUpdateCount()
172 unsigned int GetMaximumUpdateCount() const;
175 * @copydoc Dali::Integration::Core::GetSystemOverlay()
177 Integration::SystemOverlay& GetSystemOverlay();
182 * @copydoc Dali::Integration::Core::SetViewMode()
184 void SetViewMode( ViewMode viewMode );
187 * @copydoc Dali::Integration::Core::GetViewMode()
189 ViewMode GetViewMode() const;
192 * @copydoc Dali::Integration::Core::SetStereoBase()
194 void SetStereoBase( float stereoBase );
197 * @copydoc Dali::Integration::Core::GetStereoBase()
199 float GetStereoBase() const;
201 private: // for use by ThreadLocalStorage
204 * Returns the current stage.
205 * @return A smart-pointer to the current stage.
207 StagePtr GetCurrentStage();
210 * Returns the platform abstraction.
211 * @return A reference to the platform abstraction.
213 Integration::PlatformAbstraction& GetPlatform();
216 * Returns the update manager.
217 * @return A reference to the update manager.
219 SceneGraph::UpdateManager& GetUpdateManager();
222 * Returns the render manager.
223 * @return A reference to the render manager.
225 SceneGraph::RenderManager& GetRenderManager();
228 * Returns the notification manager.
229 * @return A reference to the Notification Manager.
231 NotificationManager& GetNotificationManager();
234 * Returns the Resource Manager.
235 * @return A reference to the Resource Manager.
237 ResourceManager& GetResourceManager();
240 * Returns the Resource client.
241 * @return A reference to the Resource Client.
243 ResourceClient& GetResourceClient();
246 * Returns the Font factory
247 * @return A reference to the Font factory.
249 FontFactory& GetFontFactory();
252 * Returns the Image factory
253 * @return A reference to the Image factory.
255 ImageFactory& GetImageFactory();
258 * Returns the Shader factory
259 * @return A reference to the Shader binary factory.
261 ShaderFactory& GetShaderFactory();
264 * Returns the gesture event processor.
265 * @return A reference to the gesture event processor.
267 GestureEventProcessor& GetGestureEventProcessor();
270 * Returns the Emoji factory.
271 * @return a reference to the Emoji factory.
273 EmojiFactory& GetEmojiFactory();
278 * Undefined copy and assignment operators
280 Core(const Core& core); // No definition
281 Core& operator=(const Core& core); // No definition
284 * Create Thread local storage
286 void CreateThreadLocalStorage();
290 Integration::RenderController& mRenderController; ///< Reference to Render controller to tell it to keep rendering
291 Integration::PlatformAbstraction& mPlatform; ///< The interface providing platform specific services.
293 IntrusivePtr<Stage> mStage; ///< The current stage
294 GestureEventProcessor* mGestureEventProcessor; ///< The gesture event processor
295 EventProcessor* mEventProcessor; ///< The event processor
296 SceneGraph::UpdateManager* mUpdateManager; ///< Update manager
297 SceneGraph::RenderManager* mRenderManager; ///< Render manager
298 SceneGraph::DiscardQueue* mDiscardQueue; ///< Used to cleanup nodes & resources when no longer in use.
299 ResourcePostProcessList* mResourcePostProcessQueue; ///< Stores resource ids which require post processing after render
300 NotificationManager* mNotificationManager; ///< Notification manager
301 AnimationPlaylistOwner mAnimationPlaylist; ///< For 'Fire and forget' animation support
302 OwnerPointer<PropertyNotificationManager> mPropertyNotificationManager; ///< For safe signal emmision of property changed notifications
303 FontFactory* mFontFactory; ///< font resource factory
304 ImageFactory* mImageFactory; ///< Image resource factory
305 ShaderFactory* mShaderFactory; ///< Shader resource factory
306 ResourceClient* mResourceClient; ///< Asynchronous Resource Loading
307 ResourceManager* mResourceManager; ///< Asynchronous Resource Loading
308 TouchResampler* mTouchResampler; ///< Resamples touches to correct frame rate.
309 EmojiFactory* mEmojiFactory; ///< Emoji resource factory.
311 bool mIsActive : 1; ///< Whether Core is active or suspended
312 bool mProcessingEvent : 1; ///< True during ProcessEvents()
314 friend class ThreadLocalStorage;
318 } // namespace Internal
322 #endif // __DALI_INTERNAL_CORE_H__