1 #ifndef __DALI_INTERNAL_CORE_H__
2 #define __DALI_INTERNAL_CORE_H__
5 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
7 // Licensed under the Flora License, Version 1.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://floralicense.org/license/
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.
21 #include <dali/public-api/object/ref-object.h>
22 #include <dali/internal/common/owner-pointer.h>
23 #include <dali/internal/event/animation/animation-playlist-declarations.h>
24 #include <dali/internal/event/common/stage-def.h>
25 #include <dali/internal/update/resources/resource-manager-declarations.h>
32 class RenderController;
33 class PlatformAbstraction;
36 class GlSyncAbstraction;
47 class NotificationManager;
48 class AnimationPlaylist;
49 class PropertyNotificationManager;
50 class DynamicsNotifier;
53 class GestureEventProcessor;
55 class ResourceManager;
72 * Internal class for Dali::Integration::Core
79 * Create and initialise a new Core instance
81 Core( Integration::RenderController& renderController,
82 Integration::PlatformAbstraction& platform,
83 Integration::GlAbstraction& glAbstraction,
84 Integration::GlSyncAbstraction& glSyncAbstraction,
85 Integration::GestureManager& gestureManager );
93 * @copydoc Dali::Integration::Core::ContextCreated()
95 void ContextCreated();
98 * @copydoc Dali::Integration::Core::ContextToBeDestroyed()
100 void ContextToBeDestroyed();
103 * @copydoc Dali::Integration::Core::SurfaceResized(unsigned int, unsigned int)
105 void SurfaceResized(unsigned int width, unsigned int height);
108 * @copydoc Dali::Integration::Core::SetDpi(unsigned int, unsigned int)
110 void SetDpi(unsigned int dpiHorizontal, unsigned int dpiVertical);
113 * @copydoc Dali::Integration::Core::SetMinimumFrameTimeInterval(unsigned int)
115 void SetMinimumFrameTimeInterval(unsigned int interval);
118 * @copydoc Dali::Integration::Core::Update()
120 void Update( Integration::UpdateStatus& status );
123 * @copydoc Dali::Integration::Core::Render()
125 void Render( Integration::RenderStatus& status );
128 * @copydoc Dali::Integration::Core::Suspend()
133 * @copydoc Dali::Integration::Core::Resume()
138 * @copydoc Dali::Integration::Core::QueueEvent(const Integration::Event&)
140 void QueueEvent( const Integration::Event& event );
143 * @copydoc Dali::Integration::Core::ProcessEvents()
145 void ProcessEvents();
148 * @copydoc Dali::Integration::Core::UpdateTouchData(const Integration::TouchData&)
150 void UpdateTouchData(const Integration::TouchData& touch);
153 * @copydoc Dali::Integration::Core::GetMaximumUpdateCount()
155 unsigned int GetMaximumUpdateCount() const;
158 * @copydoc Dali::Integration::Core::Sleep()
163 * @copydoc Dali::Integration::Core::Wake()
168 * @copydoc Dali::Integration::Core::VSync()
170 void VSync( unsigned int frameNumber, unsigned int seconds, unsigned int microseconds );
173 * @copydoc Dali::Integration::Core::GetSystemOverlay()
175 Integration::SystemOverlay& GetSystemOverlay();
177 private: // for use by ThreadLocalStorage
180 * Returns the current stage.
181 * @return A smart-pointer to the current stage.
183 StagePtr GetCurrentStage();
186 * Returns the platform abstraction.
187 * @return A reference to the platform abstraction.
189 Integration::PlatformAbstraction& GetPlatform();
192 * Returns the update manager.
193 * @return A reference to the update manager.
195 SceneGraph::UpdateManager& GetUpdateManager();
198 * Returns the render manager.
199 * @return A reference to the render manager.
201 SceneGraph::RenderManager& GetRenderManager();
204 * Returns the notification manager.
205 * @return A reference to the Notification Manager.
207 NotificationManager& GetNotificationManager();
210 * Returns the Resource Manager.
211 * @return A reference to the Resource Manager.
213 ResourceManager& GetResourceManager();
216 * Returns the Resource client.
217 * @return A reference to the Resource Client.
219 ResourceClient& GetResourceClient();
222 * Returns the Font factory
223 * @return A reference to the Font factory.
225 FontFactory& GetFontFactory();
228 * Returns the Image factory
229 * @return A reference to the Image factory.
231 ImageFactory& GetImageFactory();
234 * Returns the Model factory
235 * @return A reference to the Model factory.
237 ModelFactory& GetModelFactory();
240 * Returns the Shader factory
241 * @return A reference to the Shader binary factory.
243 ShaderFactory& GetShaderFactory();
246 * Returns the gesture event processor.
247 * @return A reference to the gesture event processor.
249 GestureEventProcessor& GetGestureEventProcessor();
252 * Returns the Emoji factory.
253 * @return a reference to the Emoji factory.
255 EmojiFactory& GetEmojiFactory();
260 * Undefined copy and assignment operators
262 Core(const Core& core); // No definition
263 Core& operator=(const Core& core); // No definition
266 * Create Thread local storage
268 void CreateThreadLocalStorage();
272 Integration::RenderController& mRenderController; ///< Reference to Render controller to tell it to keep rendering
273 Integration::PlatformAbstraction& mPlatform; ///< The interface providing platform specific services.
275 IntrusivePtr<Stage> mStage; ///< The current stage
276 GestureEventProcessor* mGestureEventProcessor; ///< The gesture event processor
277 EventProcessor* mEventProcessor; ///< The event processor
278 SceneGraph::UpdateManager* mUpdateManager; ///< Update manager
279 SceneGraph::RenderManager* mRenderManager; ///< Render manager
280 SceneGraph::DiscardQueue* mDiscardQueue; ///< Used to cleanup nodes & resources when no longer in use.
281 ResourcePostProcessList* mResourcePostProcessQueue; ///< Stores resource ids which require post processing after render
282 NotificationManager* mNotificationManager; ///< Notification manager
283 AnimationPlaylistOwner mAnimationPlaylist; ///< For 'Fire and forget' animation support
284 OwnerPointer<PropertyNotificationManager> mPropertyNotificationManager; ///< For safe signal emmision of property changed notifications
285 OwnerPointer<DynamicsNotifier> mDynamicsNotifier;
286 FrameTime* mFrameTime; ///< Time when we render
287 FontFactory* mFontFactory; ///< font resource factory
288 ImageFactory* mImageFactory; ///< Image resource factory
289 ModelFactory* mModelFactory; ///< Model resource factory
290 ShaderFactory* mShaderFactory; ///< Shader resource factory
291 ResourceClient* mResourceClient; ///< Asynchronous Resource Loading
292 ResourceManager* mResourceManager; ///< Asynchronous Resource Loading
293 TouchResampler* mTouchResampler; ///< Resamples touches to correct frame rate.
294 EmojiFactory* mEmojiFactory; ///< Emoji resource factory.
296 bool mIsActive : 1; ///< Whether Core is active or suspended
297 bool mProcessingEvent : 1; ///< True during ProcessEvents()
299 friend class ThreadLocalStorage;
303 } // namespace Internal
307 #endif // __DALI_INTERNAL_CORE_H__