Merge branch devel/master (1.0.49) into tizen
[platform/core/uifw/dali-demo.git] / examples / new-window / new-window-example.cpp
1 /*
2  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 // EXTERNAL INCLUDES
18 #include <dali/devel-api/rendering/renderer.h>
19 #include <dali-toolkit/dali-toolkit.h>
20 #include <dali-toolkit/devel-api/controls/bubble-effect/bubble-emitter.h>
21
22 #include <cstdio>
23 #include <iostream>
24
25 // INTERNAL INCLUDES
26 #include "shared/view.h"
27
28 using namespace Dali;
29 using namespace Dali::Toolkit;
30
31 class NewWindowController;
32
33 namespace
34 {
35 const char * const BACKGROUND_IMAGE( DALI_IMAGE_DIR "background-2.jpg" );
36 const char * const TOOLBAR_IMAGE( DALI_IMAGE_DIR "top-bar.png" );
37 const char * const LOSE_CONTEXT_IMAGE( DALI_IMAGE_DIR "icon-cluster-wobble.png" );
38 const char * const LOSE_CONTEXT_IMAGE_SELECTED( DALI_IMAGE_DIR "icon-cluster-wobble-selected.png" );
39 const char * const BASE_IMAGE( DALI_IMAGE_DIR "gallery-large-14.jpg" );
40 const char * const EFFECT_IMAGE( DALI_IMAGE_DIR "gallery-large-18.jpg" );
41 const char * const LOGO_IMAGE(DALI_IMAGE_DIR "dali-logo.png");
42
43 const float EXPLOSION_DURATION(1.2f);
44 const unsigned int EMIT_INTERVAL_IN_MS(40);
45 const float TRACK_DURATION_IN_MS(970);
46
47 Application gApplication;
48 NewWindowController* gNewWindowController(NULL);
49
50 #define MAKE_SHADER(A)#A
51
52 const char* VERTEX_COLOR_MESH = MAKE_SHADER(
53 attribute mediump vec3  aPosition;\n
54 attribute lowp    vec3  aColor;\n
55 uniform   mediump mat4  uMvpMatrix;\n
56 uniform   mediump vec3  uSize;\n
57 varying   lowp    vec3  vColor;\n
58 \n
59 void main()\n
60 {\n
61   gl_Position = uMvpMatrix * vec4( aPosition*uSize, 1.0 );\n
62   vColor = aColor;\n
63 }\n
64 );
65
66 const char* FRAGMENT_COLOR_MESH = MAKE_SHADER(
67 uniform lowp vec4  uColor;\n
68 varying lowp vec3  vColor;\n
69 \n
70 void main()\n
71 {\n
72   gl_FragColor = vec4(vColor,1.0)*uColor;
73 }\n
74 );
75
76 const char* VERTEX_TEXTURE_MESH = MAKE_SHADER(
77 attribute mediump vec3  aPosition;\n
78 attribute highp   vec2  aTexCoord;\n
79 uniform   mediump mat4  uMvpMatrix;\n
80 uniform   mediump vec3  uSize;\n
81 varying   mediump vec2  vTexCoord;\n
82 \n
83 void main()\n
84 {\n
85   gl_Position = uMvpMatrix * vec4( aPosition*uSize, 1.0 );\n
86   vTexCoord = aTexCoord;\n
87 }\n
88 );
89
90 const char* FRAGMENT_TEXTURE_MESH = MAKE_SHADER(
91 varying mediump vec2  vTexCoord;\n
92 uniform lowp    vec4  uColor;\n
93 uniform sampler2D     sTexture;\n
94 \n
95 void main()\n
96 {\n
97   gl_FragColor = texture2D( sTexture, vTexCoord ) * uColor;
98 }\n
99 );
100
101 const char* FRAGMENT_BLEND_SHADER = MAKE_SHADER(
102 uniform mediump float alpha;\n
103 \n
104 void main()\n
105 {\n
106   mediump vec4 fragColor = texture2D(sTexture, vTexCoord);\n
107   mediump vec4 fxColor   = texture2D(sEffect, vTexCoord);\n
108   gl_FragColor = mix(fragColor,fxColor, alpha);\n
109 }\n
110 );
111
112 }; // anonymous namespace
113
114
115 class NewWindowController : public ConnectionTracker
116 {
117 public:
118   NewWindowController( Application& app );
119   void Create( Application& app );
120   void Destroy( Application& app );
121
122   void AddBubbles(const Vector2& stageSize);
123   void AddMeshActor();
124   void AddBlendingImageActor();
125   void AddTextLabel();
126
127   ImageActor CreateBlurredMirrorImage(const char* imageName);
128   FrameBufferImage CreateFrameBufferForImage(const char* imageName, Image image, ShaderEffect shaderEffect);
129   void SetUpBubbleEmission( const Vector2& emitPosition, const Vector2& direction );
130   Geometry CreateMeshGeometry();
131   ShaderEffect CreateColorModifierer( const Vector3& rgbDelta );
132
133   static void NewWindow(void);
134
135   bool OnTrackTimerTick();
136   void OnKeyEvent(const KeyEvent& event);
137   bool OnLoseContextButtonClicked( Toolkit::Button button );
138   void OnContextLost();
139   void OnContextRegained();
140
141 private:
142   Application                mApplication;
143   TextLabel                  mTextActor;
144
145   Toolkit::Control           mView;                              ///< The View instance.
146   Toolkit::ToolBar           mToolBar;                           ///< The View's Toolbar.
147   TextLabel                  mTitleActor;                        ///< The Toolbar's Title.
148   Layer                      mContentLayer;                      ///< Content layer (scrolling cluster content)
149   Toolkit::PushButton        mLoseContextButton;
150
151   Toolkit::BubbleEmitter     mEmitter;
152   Timer                      mEmitTrackTimer;
153   bool                       mNeedNewAnimation;
154   unsigned int               mAnimateComponentCount;
155   Animation                  mEmitAnimation;
156 };
157
158
159 NewWindowController::NewWindowController( Application& application )
160 : mApplication(application),
161   mNeedNewAnimation(true)
162 {
163   mApplication.InitSignal().Connect(this, &NewWindowController::Create);
164   mApplication.TerminateSignal().Connect(this, &NewWindowController::Destroy);
165 }
166
167 void NewWindowController::Create( Application& app )
168 {
169   Stage stage = Stage::GetCurrent();
170   stage.SetBackgroundColor(Color::YELLOW);
171
172   stage.KeyEventSignal().Connect(this, &NewWindowController::OnKeyEvent);
173
174   // The Init signal is received once (only) during the Application lifetime
175
176   // Hide the indicator bar
177   mApplication.GetWindow().ShowIndicator( Dali::Window::INVISIBLE );
178
179   mContentLayer = DemoHelper::CreateView( app,
180                                           mView,
181                                           mToolBar,
182                                           "",
183                                           TOOLBAR_IMAGE,
184                                           "Context recovery" );
185
186   Size stageSize = stage.GetSize();
187   Image backgroundImage = ResourceImage::New( BACKGROUND_IMAGE, Dali::ImageDimensions( stageSize.x, stageSize.y ), Dali::FittingMode::SCALE_TO_FILL, Dali::SamplingMode::BOX_THEN_LINEAR );
188   ImageActor backgroundActor = ImageActor::New( backgroundImage );
189   backgroundActor.SetParentOrigin( ParentOrigin::CENTER );
190   backgroundActor.SetZ(-2.f);
191   mContentLayer.Add(backgroundActor);
192
193   // Point the default render task at the view
194   RenderTaskList taskList = stage.GetRenderTaskList();
195   RenderTask defaultTask = taskList.GetTask( 0u );
196   if ( defaultTask )
197   {
198     defaultTask.SetSourceActor( mView );
199   }
200
201   mLoseContextButton = Toolkit::PushButton::New();
202   mLoseContextButton.SetButtonImage( ResourceImage::New( LOSE_CONTEXT_IMAGE ) );
203   mLoseContextButton.SetSelectedImage( ResourceImage::New( LOSE_CONTEXT_IMAGE_SELECTED ) );
204   mLoseContextButton.ClickedSignal().Connect( this, &NewWindowController::OnLoseContextButtonClicked );
205   mToolBar.AddControl( mLoseContextButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight, DemoHelper::DEFAULT_MODE_SWITCH_PADDING );
206
207   Actor logoLayoutActor = Actor::New();
208   logoLayoutActor.SetParentOrigin(ParentOrigin::CENTER);
209   logoLayoutActor.SetPosition(0.0f, -200.0f, 0.0f);
210   logoLayoutActor.SetScale(0.5f);
211   mContentLayer.Add(logoLayoutActor);
212
213   Image image = ResourceImage::New(LOGO_IMAGE);
214   ImageActor imageActor = ImageActor::New(image);
215   imageActor.SetName("dali-logo");
216   imageActor.SetParentOrigin(ParentOrigin::CENTER);
217   imageActor.SetAnchorPoint(AnchorPoint::BOTTOM_CENTER);
218   logoLayoutActor.Add(imageActor);
219
220   ImageActor mirrorImageActor = CreateBlurredMirrorImage(LOGO_IMAGE);
221   mirrorImageActor.SetParentOrigin(ParentOrigin::CENTER);
222   mirrorImageActor.SetAnchorPoint(AnchorPoint::TOP_CENTER);
223   logoLayoutActor.Add(mirrorImageActor);
224
225   AddBubbles(stage.GetSize());
226   AddMeshActor();
227   AddBlendingImageActor();
228   AddTextLabel();
229
230   stage.ContextLostSignal().Connect(this, &NewWindowController::OnContextLost);
231   stage.ContextRegainedSignal().Connect(this, &NewWindowController::OnContextRegained);
232 }
233
234 void NewWindowController::Destroy( Application& app )
235 {
236   UnparentAndReset(mTextActor);
237 }
238
239 void NewWindowController::AddBubbles(const Vector2& stageSize)
240 {
241   mEmitter = Toolkit::BubbleEmitter::New( stageSize,
242                                           ResourceImage::New( DALI_IMAGE_DIR "bubble-ball.png" ),
243                                           200, Vector2( 5.0f, 5.0f ) );
244
245   Image background = ResourceImage::New(BACKGROUND_IMAGE);
246   mEmitter.SetBackground( background, Vector3(0.5f, 0.f,0.5f) );
247   mEmitter.SetBubbleDensity( 9.f );
248   Actor bubbleRoot = mEmitter.GetRootActor();
249   mContentLayer.Add( bubbleRoot );
250   bubbleRoot.SetParentOrigin(ParentOrigin::CENTER);
251   bubbleRoot.SetZ(0.1f);
252
253   mEmitTrackTimer = Timer::New( EMIT_INTERVAL_IN_MS );
254   mEmitTrackTimer.TickSignal().Connect(this, &NewWindowController::OnTrackTimerTick);
255   mEmitTrackTimer.Start();
256 }
257
258 void NewWindowController::AddMeshActor()
259 {
260   Geometry meshGeometry = CreateMeshGeometry();
261
262   // Create a coloured mesh
263   Shader shaderColorMesh = Shader::New( VERTEX_COLOR_MESH, FRAGMENT_COLOR_MESH );
264   Material colorMeshmaterial = Material::New( shaderColorMesh );
265   Renderer colorMeshRenderer = Renderer::New( meshGeometry, colorMeshmaterial );
266
267   Actor colorMeshActor = Actor::New();
268   colorMeshActor.AddRenderer( colorMeshRenderer );
269   colorMeshActor.SetSize( 175.f,175.f );
270   colorMeshActor.SetParentOrigin( ParentOrigin::CENTER );
271   colorMeshActor.SetAnchorPoint(AnchorPoint::TOP_CENTER);
272   colorMeshActor.SetPosition(Vector3(0.0f, 50.0f, 0.0f));
273   colorMeshActor.SetOrientation( Degree(75.f), Vector3::XAXIS );
274   colorMeshActor.SetName("ColorMeshActor");
275   mContentLayer.Add( colorMeshActor );
276
277  // Create a textured mesh
278   Image effectImage = ResourceImage::New(EFFECT_IMAGE);
279   Sampler sampler = Sampler::New(effectImage, "sTexture");
280
281   Shader shaderTextureMesh = Shader::New( VERTEX_TEXTURE_MESH, FRAGMENT_TEXTURE_MESH );
282   Material textureMeshMaterial = Material::New( shaderTextureMesh );
283   textureMeshMaterial.AddSampler( sampler );
284   Renderer textureMeshRenderer = Renderer::New( meshGeometry, textureMeshMaterial );
285
286   Actor textureMeshActor = Actor::New();
287   textureMeshActor.AddRenderer( textureMeshRenderer );
288   textureMeshActor.SetSize( 175.f,175.f );
289   textureMeshActor.SetParentOrigin( ParentOrigin::CENTER );
290   textureMeshActor.SetAnchorPoint(AnchorPoint::TOP_CENTER);
291   textureMeshActor.SetPosition(Vector3(0.0f, 200.0f, 0.0f));
292   textureMeshActor.SetOrientation( Degree(75.f), Vector3::XAXIS );
293   textureMeshActor.SetName("TextureMeshActor");
294   mContentLayer.Add( textureMeshActor );
295 }
296
297 void NewWindowController::AddBlendingImageActor()
298 {
299   ShaderEffect colorModifier = CreateColorModifierer(Vector3( 0.5f, 0.5f, 0.5f ));
300   Image effectImage = ResourceImage::New(EFFECT_IMAGE);
301   FrameBufferImage fb2 = CreateFrameBufferForImage( EFFECT_IMAGE, effectImage, colorModifier );
302
303   ImageActor tmpActor = ImageActor::New(fb2);
304   mContentLayer.Add(tmpActor);
305   tmpActor.SetParentOrigin(ParentOrigin::CENTER_RIGHT);
306   tmpActor.SetAnchorPoint(AnchorPoint::TOP_RIGHT);
307   tmpActor.SetPosition(Vector3(0.0f, 150.0f, 0.0f));
308   tmpActor.SetScale(0.25f);
309
310   // create blending shader effect
311   ShaderEffect blendShader = ShaderEffect::New( "", FRAGMENT_BLEND_SHADER );
312   blendShader.SetEffectImage( fb2 );
313   blendShader.SetUniform("alpha", 0.5f);
314
315   Image baseImage = ResourceImage::New(BASE_IMAGE);
316   ImageActor blendActor = ImageActor::New( baseImage );
317   blendActor.SetParentOrigin(ParentOrigin::CENTER_RIGHT);
318   blendActor.SetAnchorPoint(AnchorPoint::BOTTOM_RIGHT);
319   blendActor.SetPosition(Vector3(0.0f, 100.0f, 0.0f));
320   blendActor.SetSize(140, 140);
321   blendActor.SetShaderEffect( blendShader );
322   mContentLayer.Add(blendActor);
323 }
324
325 void NewWindowController::AddTextLabel()
326 {
327   mTextActor = TextLabel::New("Some text");
328   mTextActor.SetParentOrigin(ParentOrigin::CENTER);
329   mTextActor.SetColor(Color::RED);
330   mTextActor.SetName("PushMe text");
331   mContentLayer.Add( mTextActor );
332 }
333
334 ImageActor NewWindowController::CreateBlurredMirrorImage(const char* imageName)
335 {
336   Image image = ResourceImage::New(imageName);
337
338   Uint16Pair intFboSize = ResourceImage::GetImageSize(imageName);
339   Vector2 FBOSize = Vector2( intFboSize.GetWidth(), intFboSize.GetHeight() );
340   FrameBufferImage fbo = FrameBufferImage::New( FBOSize.width, FBOSize.height, Pixel::RGBA8888);
341
342   GaussianBlurView gbv = GaussianBlurView::New(5, 2.0f, Pixel::RGBA8888, 0.5f, 0.5f, true);
343   gbv.SetBackgroundColor(Color::TRANSPARENT);
344   gbv.SetUserImageAndOutputRenderTarget( image, fbo );
345   gbv.SetSize(FBOSize);
346   Stage::GetCurrent().Add(gbv);
347   gbv.ActivateOnce();
348
349   ImageActor blurredActor = ImageActor::New(fbo);
350   blurredActor.SetSize(FBOSize);
351   blurredActor.SetScale(1.0f, -1.0f, 1.0f);
352   return blurredActor;
353 }
354
355 FrameBufferImage NewWindowController::CreateFrameBufferForImage(const char* imageName, Image image, ShaderEffect shaderEffect)
356 {
357   Stage stage = Stage::GetCurrent();
358   Uint16Pair intFboSize = ResourceImage::GetImageSize(imageName);
359   Vector2 FBOSize = Vector2(intFboSize.GetWidth(), intFboSize.GetHeight());
360
361   FrameBufferImage framebuffer = FrameBufferImage::New(FBOSize.x, FBOSize.y );
362
363   RenderTask renderTask = stage.GetRenderTaskList().CreateTask();
364
365   ImageActor imageActor = ImageActor::New(image);
366   imageActor.SetName("Source image actor");
367   if(shaderEffect)
368   {
369     imageActor.SetShaderEffect(shaderEffect);
370   }
371   imageActor.SetParentOrigin(ParentOrigin::CENTER);
372   imageActor.SetAnchorPoint(AnchorPoint::CENTER);
373   imageActor.SetScale(1.0f, -1.0f, 1.0f);
374   stage.Add(imageActor); // Not in default image view
375
376   CameraActor cameraActor = CameraActor::New(FBOSize);
377   cameraActor.SetParentOrigin(ParentOrigin::CENTER);
378   cameraActor.SetFieldOfView(Math::PI*0.25f);
379   cameraActor.SetNearClippingPlane(1.0f);
380   cameraActor.SetAspectRatio(FBOSize.width / FBOSize.height);
381   cameraActor.SetType(Dali::Camera::FREE_LOOK); // camera orientation based solely on actor
382   cameraActor.SetPosition(0.0f, 0.0f, ((FBOSize.height * 0.5f) / tanf(Math::PI * 0.125f)));
383   stage.Add(cameraActor);
384
385   renderTask.SetSourceActor(imageActor);
386   renderTask.SetInputEnabled(false);
387   renderTask.SetTargetFrameBuffer(framebuffer);
388   renderTask.SetCameraActor( cameraActor );
389   renderTask.SetClearColor( Color::TRANSPARENT );
390   renderTask.SetClearEnabled( true );
391   renderTask.SetRefreshRate(RenderTask::REFRESH_ONCE);
392
393   return framebuffer;
394 }
395
396 void NewWindowController::SetUpBubbleEmission( const Vector2& emitPosition, const Vector2& direction)
397 {
398   if( mNeedNewAnimation )
399   {
400     float duration = Random::Range(1.f, 1.5f);
401     mEmitAnimation = Animation::New( duration );
402     mNeedNewAnimation = false;
403     mAnimateComponentCount = 0;
404   }
405
406   mEmitter.EmitBubble( mEmitAnimation, emitPosition, direction, Vector2(10,10) );
407
408   mAnimateComponentCount++;
409
410   if( mAnimateComponentCount % 6 ==0 )
411   {
412     mEmitAnimation.Play();
413     mNeedNewAnimation = true;
414   }
415 }
416
417 Geometry NewWindowController::CreateMeshGeometry()
418 {
419   // Create vertices and specify their color
420   struct Vertex
421   {
422     Vector3 position;
423     Vector2 textureCoordinates;
424     Vector3 color;
425   };
426
427   Vertex vertexData[5] = {
428     { Vector3(  0.0f,  0.0f, 0.5f ), Vector2(0.5f, 0.5f), Vector3(1.0f, 1.0f, 1.0f) },
429     { Vector3( -0.5f, -0.5f, 0.0f ), Vector2(0.0f, 0.0f), Vector3(1.0f, 0.0f, 0.0f) },
430     { Vector3(  0.5f, -0.5f, 0.0f ), Vector2(1.0f, 0.0f), Vector3(1.0f, 1.0f, 0.0f) },
431     { Vector3( -0.5f,  0.5f, 0.0f ), Vector2(0.0f, 1.0f), Vector3(0.0f, 1.0f, 0.0f) },
432     { Vector3(  0.5f,  0.5f, 0.0f ), Vector2(1.0f, 1.0f), Vector3(0.0f, 0.0f, 1.0f) }  };
433
434   Property::Map vertexFormat;
435   vertexFormat["aPosition"] = Property::VECTOR3;
436   vertexFormat["aTexCoord"] = Property::VECTOR2;
437   vertexFormat["aColor"] = Property::VECTOR3;
438   PropertyBuffer vertices = PropertyBuffer::New( vertexFormat, 5 );
439   vertices.SetData( vertexData );
440
441   // Specify all the faces
442   unsigned int indexData[12] = { 0,1,3,0,2,4,0,3,4,0,2,1 };
443   Property::Map indexFormat;
444   indexFormat["indices"] = Property::INTEGER;
445   PropertyBuffer indices = PropertyBuffer::New( indexFormat, 12 );
446   indices.SetData( indexData );
447
448   // Create the geometry object
449   Geometry geometry = Geometry::New();
450   geometry.AddVertexBuffer( vertices );
451   geometry.SetIndexBuffer( indices );
452
453   return geometry;
454 }
455
456 ShaderEffect NewWindowController::CreateColorModifierer( const Vector3& rgbDelta )
457 {
458  std::string fragmentShader = MAKE_SHADER(
459    precision highp float;\n
460    uniform vec3 uRGBDelta;\n
461    uniform float uIgnoreAlpha;\n
462    float rand(vec2 co) \n
463    {\n
464      return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453); \n}
465    \n
466    void main() {\n
467      vec4 color = texture2D(sTexture, vTexCoord); \n
468      // modify the hsv Value
469      color.rgb += uRGBDelta * rand(vTexCoord); \n
470      // if the new vale exceeds one, then decrease it
471      color.rgb -= max(color.rgb*2.0 - vec3(2.0), 0.0);\n
472      // if the new vale drops below zero, then increase it
473      color.rgb -= min(color.rgb*2.0, 0.0);\n
474      gl_FragColor = color; \n
475    }\n
476  );
477
478  ShaderEffect shaderEffect = ShaderEffect::New("", fragmentShader);
479  shaderEffect.SetUniform( "uRGBDelta", rgbDelta );
480
481  return shaderEffect;
482 }
483
484 void NewWindowController::NewWindow(void)
485 {
486   PositionSize posSize(0, 0, 720, 1280);
487   gApplication.ReplaceWindow(posSize, "NewWindow"); // Generates a new window
488 }
489
490 bool NewWindowController::OnLoseContextButtonClicked( Toolkit::Button button )
491 {
492   // Add as an idle callback to avoid ProcessEvents being recursively called.
493   mApplication.AddIdle( MakeCallback( NewWindowController::NewWindow ) );
494   return true;
495 }
496
497 bool NewWindowController::OnTrackTimerTick()
498 {
499   static int time=0;
500   const float radius(250.0f);
501
502   time += EMIT_INTERVAL_IN_MS;
503   float modTime = time / TRACK_DURATION_IN_MS;
504   float angle = 2.0f*Math::PI*modTime;
505
506   Vector2 position(radius*cosf(angle), radius*-sinf(angle));
507   Vector2 aimPos(radius*2*sinf(angle), radius*2*-cosf(angle));
508   Vector2 direction = aimPos-position;
509   Vector2 stageSize = Stage::GetCurrent().GetSize();
510
511   SetUpBubbleEmission( stageSize*0.5f+position, direction );
512   SetUpBubbleEmission( stageSize*0.5f+position*0.75f, direction );
513   SetUpBubbleEmission( stageSize*0.5f+position*0.7f, direction );
514
515   return true;
516 }
517
518 void NewWindowController::OnKeyEvent(const KeyEvent& event)
519 {
520   if(event.state == KeyEvent::Down)
521   {
522     if( IsKey( event, Dali::DALI_KEY_ESCAPE) || IsKey( event, Dali::DALI_KEY_BACK) )
523     {
524       mApplication.Quit();
525     }
526   }
527 }
528
529 void NewWindowController::OnContextLost()
530 {
531   printf("Stage reporting context loss\n");
532 }
533
534 void NewWindowController::OnContextRegained()
535 {
536   printf("Stage reporting context regain\n");
537 }
538
539 void RunTest(Application& app)
540 {
541   gNewWindowController = new NewWindowController(app);
542   app.MainLoop(Configuration::APPLICATION_DOES_NOT_HANDLE_CONTEXT_LOSS);
543 }
544
545 // Entry point for Linux & Tizen applications
546 //
547 int main(int argc, char **argv)
548 {
549   gApplication = Application::New(&argc, &argv, DALI_DEMO_THEME_PATH);
550   RunTest(gApplication);
551
552   return 0;
553 }