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;
74 * Internal class for Dali::Integration::Core
81 * Create and initialise a new Core instance
83 Core( Integration::RenderController& renderController,
84 Integration::PlatformAbstraction& platform,
85 Integration::GlAbstraction& glAbstraction,
86 Integration::GlSyncAbstraction& glSyncAbstraction,
87 Integration::GestureManager& gestureManager,
88 ResourcePolicy::DataRetention dataRetentionPolicy );
96 * @copydoc Dali::Integration::Core::GetContextNotifier()
98 Integration::ContextNotifierInterface* GetContextNotifier();
101 * @copydoc Dali::Integration::Core::ContextCreated()
103 void ContextCreated();
106 * @copydoc Dali::Integration::Core::ContextDestroyed()
108 void ContextDestroyed();
111 * @copydoc Dali::Integration::Core::RecoverFromContextLoss()
113 void RecoverFromContextLoss();
116 * @copydoc Dali::Integration::Core::SurfaceResized(unsigned int, unsigned int)
118 void SurfaceResized(unsigned int width, unsigned int height);
121 * @copydoc Dali::Integration::Core::SetDpi(unsigned int, unsigned int)
123 void SetDpi(unsigned int dpiHorizontal, unsigned int dpiVertical);
126 * @copydoc Dali::Integration::Core::SetMinimumFrameTimeInterval(unsigned int)
128 void SetMinimumFrameTimeInterval(unsigned int interval);
131 * @copydoc Dali::Integration::Core::Update()
133 void Update( float elapsedSeconds, unsigned int lastVSyncTimeMilliseconds, unsigned int nextVSyncTimeMilliseconds, Integration::UpdateStatus& status );
136 * @copydoc Dali::Integration::Core::Render()
138 void Render( Integration::RenderStatus& status );
141 * @copydoc Dali::Integration::Core::Suspend()
146 * @copydoc Dali::Integration::Core::Resume()
151 * @copydoc Dali::Integration::Core::QueueEvent(const Integration::Event&)
153 void QueueEvent( const Integration::Event& event );
156 * @copydoc Dali::Integration::Core::ProcessEvents()
158 void ProcessEvents();
161 * @copydoc Dali::Integration::Core::UpdateTouchData(const Integration::TouchData&)
163 void UpdateTouchData(const Integration::TouchData& touch);
166 * @copydoc Dali::Integration::Core::GetMaximumUpdateCount()
168 unsigned int GetMaximumUpdateCount() const;
171 * @copydoc Dali::Integration::Core::GetSystemOverlay()
173 Integration::SystemOverlay& GetSystemOverlay();
178 * @copydoc Dali::Integration::Core::SetViewMode()
180 void SetViewMode( ViewMode viewMode );
183 * @copydoc Dali::Integration::Core::GetViewMode()
185 ViewMode GetViewMode() const;
188 * @copydoc Dali::Integration::Core::SetStereoBase()
190 void SetStereoBase( float stereoBase );
193 * @copydoc Dali::Integration::Core::GetStereoBase()
195 float GetStereoBase() const;
197 private: // for use by ThreadLocalStorage
200 * Returns the current stage.
201 * @return A smart-pointer to the current stage.
203 StagePtr GetCurrentStage();
206 * Returns the platform abstraction.
207 * @return A reference to the platform abstraction.
209 Integration::PlatformAbstraction& GetPlatform();
212 * Returns the update manager.
213 * @return A reference to the update manager.
215 SceneGraph::UpdateManager& GetUpdateManager();
218 * Returns the render manager.
219 * @return A reference to the render manager.
221 SceneGraph::RenderManager& GetRenderManager();
224 * Returns the notification manager.
225 * @return A reference to the Notification Manager.
227 NotificationManager& GetNotificationManager();
230 * Returns the Resource Manager.
231 * @return A reference to the Resource Manager.
233 ResourceManager& GetResourceManager();
236 * Returns the Resource client.
237 * @return A reference to the Resource Client.
239 ResourceClient& GetResourceClient();
242 * Returns the Font factory
243 * @return A reference to the Font factory.
245 FontFactory& GetFontFactory();
248 * Returns the Image factory
249 * @return A reference to the Image factory.
251 ImageFactory& GetImageFactory();
254 * Returns the Model factory
255 * @return A reference to the Model factory.
257 ModelFactory& GetModelFactory();
260 * Returns the Shader factory
261 * @return A reference to the Shader binary factory.
263 ShaderFactory& GetShaderFactory();
266 * Returns the gesture event processor.
267 * @return A reference to the gesture event processor.
269 GestureEventProcessor& GetGestureEventProcessor();
272 * Returns the Emoji factory.
273 * @return a reference to the Emoji factory.
275 EmojiFactory& GetEmojiFactory();
280 * Undefined copy and assignment operators
282 Core(const Core& core); // No definition
283 Core& operator=(const Core& core); // No definition
286 * Create Thread local storage
288 void CreateThreadLocalStorage();
292 Integration::RenderController& mRenderController; ///< Reference to Render controller to tell it to keep rendering
293 Integration::PlatformAbstraction& mPlatform; ///< The interface providing platform specific services.
295 IntrusivePtr<Stage> mStage; ///< The current stage
296 GestureEventProcessor* mGestureEventProcessor; ///< The gesture event processor
297 EventProcessor* mEventProcessor; ///< The event processor
298 SceneGraph::UpdateManager* mUpdateManager; ///< Update manager
299 SceneGraph::RenderManager* mRenderManager; ///< Render manager
300 SceneGraph::DiscardQueue* mDiscardQueue; ///< Used to cleanup nodes & resources when no longer in use.
301 ResourcePostProcessList* mResourcePostProcessQueue; ///< Stores resource ids which require post processing after render
302 NotificationManager* mNotificationManager; ///< Notification manager
303 AnimationPlaylistOwner mAnimationPlaylist; ///< For 'Fire and forget' animation support
304 OwnerPointer<PropertyNotificationManager> mPropertyNotificationManager; ///< For safe signal emmision of property changed notifications
305 FontFactory* mFontFactory; ///< font resource factory
306 ImageFactory* mImageFactory; ///< Image resource factory
307 ModelFactory* mModelFactory; ///< Model resource factory
308 ShaderFactory* mShaderFactory; ///< Shader resource factory
309 ResourceClient* mResourceClient; ///< Asynchronous Resource Loading
310 ResourceManager* mResourceManager; ///< Asynchronous Resource Loading
311 TouchResampler* mTouchResampler; ///< Resamples touches to correct frame rate.
312 EmojiFactory* mEmojiFactory; ///< Emoji resource factory.
314 bool mIsActive : 1; ///< Whether Core is active or suspended
315 bool mProcessingEvent : 1; ///< True during ProcessEvents()
317 friend class ThreadLocalStorage;
321 } // namespace Internal
325 #endif // __DALI_INTERNAL_CORE_H__