Merge "Changed Shadow example to use ImageView." into devel/master
[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( Actor& parentActor, const Vector2& stageSize);
123   void AddMeshActor( Actor& parentActor );
124   void AddBlendingImageActor( Actor& parentActor );
125   void AddTextLabel( Actor& parentActor );
126
127   ImageView CreateBlurredMirrorImage(const char* imageName);
128   FrameBufferImage CreateFrameBufferForImage( const char* imageName, Property::Map& shaderEffect, const Vector3& rgbDelta );
129   void SetUpBubbleEmission( const Vector2& emitPosition, const Vector2& direction );
130   Geometry CreateMeshGeometry();
131   Dali::Property::Map CreateColorModifierer();
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   ImageView backgroundActor = ImageView::New( backgroundImage );
189   backgroundActor.SetParentOrigin( ParentOrigin::CENTER );
190   mContentLayer.Add(backgroundActor);
191
192   // Point the default render task at the view
193   RenderTaskList taskList = stage.GetRenderTaskList();
194   RenderTask defaultTask = taskList.GetTask( 0u );
195   if ( defaultTask )
196   {
197     defaultTask.SetSourceActor( mView );
198   }
199
200   mLoseContextButton = Toolkit::PushButton::New();
201   mLoseContextButton.SetUnselectedImage( LOSE_CONTEXT_IMAGE );
202   mLoseContextButton.SetSelectedImage( LOSE_CONTEXT_IMAGE_SELECTED );
203   mLoseContextButton.ClickedSignal().Connect( this, &NewWindowController::OnLoseContextButtonClicked );
204   mToolBar.AddControl( mLoseContextButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight, DemoHelper::DEFAULT_MODE_SWITCH_PADDING );
205
206   Actor logoLayoutActor = Actor::New();
207   logoLayoutActor.SetParentOrigin(ParentOrigin::CENTER);
208   logoLayoutActor.SetPosition(0.0f, -200.0f, 0.0f);
209   logoLayoutActor.SetScale(0.5f);
210   backgroundActor.Add(logoLayoutActor);
211
212   Image image = ResourceImage::New(LOGO_IMAGE);
213   ImageView imageView = ImageView::New(image);
214   imageView.SetName("dali-logo");
215   imageView.SetParentOrigin(ParentOrigin::CENTER);
216   imageView.SetAnchorPoint(AnchorPoint::BOTTOM_CENTER);
217   logoLayoutActor.Add(imageView);
218
219   ImageView mirrorImageView = CreateBlurredMirrorImage(LOGO_IMAGE);
220   mirrorImageView.SetParentOrigin(ParentOrigin::CENTER);
221   mirrorImageView.SetAnchorPoint(AnchorPoint::TOP_CENTER);
222   logoLayoutActor.Add(mirrorImageView);
223
224   AddBubbles( backgroundActor, stage.GetSize());
225   AddMeshActor( backgroundActor );
226   AddBlendingImageActor( backgroundActor );
227   AddTextLabel( backgroundActor );
228
229   stage.ContextLostSignal().Connect(this, &NewWindowController::OnContextLost);
230   stage.ContextRegainedSignal().Connect(this, &NewWindowController::OnContextRegained);
231 }
232
233 void NewWindowController::Destroy( Application& app )
234 {
235   UnparentAndReset(mTextActor);
236 }
237
238 void NewWindowController::AddBubbles( Actor& parentActor, const Vector2& stageSize)
239 {
240   mEmitter = Toolkit::BubbleEmitter::New( stageSize,
241                                           ResourceImage::New( DALI_IMAGE_DIR "bubble-ball.png" ),
242                                           200, Vector2( 5.0f, 5.0f ) );
243
244   Image background = ResourceImage::New(BACKGROUND_IMAGE);
245   mEmitter.SetBackground( background, Vector3(0.5f, 0.f,0.5f) );
246   mEmitter.SetBubbleDensity( 9.f );
247   Actor bubbleRoot = mEmitter.GetRootActor();
248   parentActor.Add( bubbleRoot );
249   bubbleRoot.SetParentOrigin(ParentOrigin::CENTER);
250   bubbleRoot.SetZ(0.1f);
251
252   mEmitTrackTimer = Timer::New( EMIT_INTERVAL_IN_MS );
253   mEmitTrackTimer.TickSignal().Connect(this, &NewWindowController::OnTrackTimerTick);
254   mEmitTrackTimer.Start();
255 }
256
257 void NewWindowController::AddMeshActor( Actor& parentActor )
258 {
259   Geometry meshGeometry = CreateMeshGeometry();
260
261   // Create a coloured mesh
262   Shader shaderColorMesh = Shader::New( VERTEX_COLOR_MESH, FRAGMENT_COLOR_MESH );
263   Material colorMeshmaterial = Material::New( shaderColorMesh );
264   Renderer colorMeshRenderer = Renderer::New( meshGeometry, colorMeshmaterial );
265
266   Actor colorMeshActor = Actor::New();
267   colorMeshActor.AddRenderer( colorMeshRenderer );
268   colorMeshActor.SetSize( 175.f,175.f );
269   colorMeshActor.SetParentOrigin( ParentOrigin::CENTER );
270   colorMeshActor.SetAnchorPoint(AnchorPoint::TOP_CENTER);
271   colorMeshActor.SetPosition(Vector3(0.0f, 50.0f, 0.0f));
272   colorMeshActor.SetOrientation( Degree(75.f), Vector3::XAXIS );
273   colorMeshActor.SetName("ColorMeshActor");
274   parentActor.Add( colorMeshActor );
275
276  // Create a textured mesh
277   Image effectImage = ResourceImage::New(EFFECT_IMAGE);
278   Shader shaderTextureMesh = Shader::New( VERTEX_TEXTURE_MESH, FRAGMENT_TEXTURE_MESH );
279   Material textureMeshMaterial = Material::New( shaderTextureMesh );
280   textureMeshMaterial.AddTexture(effectImage, "sTexture");
281   Renderer textureMeshRenderer = Renderer::New( meshGeometry, textureMeshMaterial );
282
283   Actor textureMeshActor = Actor::New();
284   textureMeshActor.AddRenderer( textureMeshRenderer );
285   textureMeshActor.SetSize( 175.f,175.f );
286   textureMeshActor.SetParentOrigin( ParentOrigin::CENTER );
287   textureMeshActor.SetAnchorPoint(AnchorPoint::TOP_CENTER);
288   textureMeshActor.SetPosition(Vector3(0.0f, 200.0f, 0.0f));
289   textureMeshActor.SetOrientation( Degree(75.f), Vector3::XAXIS );
290   textureMeshActor.SetName("TextureMeshActor");
291   parentActor.Add( textureMeshActor );
292 }
293
294 void NewWindowController::AddBlendingImageActor( Actor& parentActor )
295 {
296   Property::Map colorModifier = CreateColorModifierer();
297
298   FrameBufferImage fb2 = CreateFrameBufferForImage( EFFECT_IMAGE, colorModifier, Vector3( 0.5f, 0.5f, 0.5f ) );
299
300   ImageView tmpActor = ImageView::New(fb2);
301   parentActor.Add(tmpActor);
302   tmpActor.SetParentOrigin(ParentOrigin::CENTER_RIGHT);
303   tmpActor.SetAnchorPoint(AnchorPoint::TOP_RIGHT);
304   tmpActor.SetPosition(Vector3(0.0f, 150.0f, 0.0f));
305   tmpActor.SetScale(0.25f);
306
307   // create blending shader effect
308   ShaderEffect blendShader = ShaderEffect::New( "", FRAGMENT_BLEND_SHADER );
309   blendShader.SetEffectImage( fb2 );
310   blendShader.SetUniform("alpha", 0.5f);
311
312   Image baseImage = ResourceImage::New(BASE_IMAGE);
313   ImageActor blendActor = ImageActor::New( baseImage );
314   blendActor.SetParentOrigin(ParentOrigin::CENTER_RIGHT);
315   blendActor.SetAnchorPoint(AnchorPoint::BOTTOM_RIGHT);
316   blendActor.SetPosition(Vector3(0.0f, 100.0f, 0.0f));
317   blendActor.SetSize(140, 140);
318   blendActor.SetShaderEffect( blendShader );
319   parentActor.Add(blendActor);
320 }
321
322 void NewWindowController::AddTextLabel( Actor& parentActor )
323 {
324   mTextActor = TextLabel::New("Some text");
325   mTextActor.SetParentOrigin(ParentOrigin::CENTER);
326   mTextActor.SetColor(Color::RED);
327   mTextActor.SetName("PushMe text");
328   parentActor.Add( mTextActor );
329 }
330
331 ImageView NewWindowController::CreateBlurredMirrorImage(const char* imageName)
332 {
333   Image image = ResourceImage::New(imageName);
334
335   Uint16Pair intFboSize = ResourceImage::GetImageSize(imageName);
336   Vector2 FBOSize = Vector2( intFboSize.GetWidth(), intFboSize.GetHeight() );
337   FrameBufferImage fbo = FrameBufferImage::New( FBOSize.width, FBOSize.height, Pixel::RGBA8888);
338
339   GaussianBlurView gbv = GaussianBlurView::New(5, 2.0f, Pixel::RGBA8888, 0.5f, 0.5f, true);
340   gbv.SetBackgroundColor(Color::TRANSPARENT);
341   gbv.SetUserImageAndOutputRenderTarget( image, fbo );
342   gbv.SetSize(FBOSize);
343   Stage::GetCurrent().Add(gbv);
344   gbv.ActivateOnce();
345
346   ImageView blurredActor = ImageView::New(fbo);
347   blurredActor.SetSize(FBOSize);
348   blurredActor.SetScale(1.0f, -1.0f, 1.0f);
349   return blurredActor;
350 }
351
352 FrameBufferImage NewWindowController::CreateFrameBufferForImage(const char* imageName, Property::Map& shaderEffect, const Vector3& rgbDelta )
353 {
354   Stage stage = Stage::GetCurrent();
355   Uint16Pair intFboSize = ResourceImage::GetImageSize( imageName );
356   Vector2 FBOSize = Vector2(intFboSize.GetWidth(), intFboSize.GetHeight());
357
358   FrameBufferImage framebuffer = FrameBufferImage::New(FBOSize.x, FBOSize.y );
359
360   RenderTask renderTask = stage.GetRenderTaskList().CreateTask();
361
362   ImageView imageView = ImageView::New( imageName );
363   imageView.SetName("Source image actor");
364   imageView.SetProperty( ImageView::Property::IMAGE, shaderEffect );
365   imageView.RegisterProperty( "uRGBDelta", rgbDelta );
366
367   imageView.SetParentOrigin(ParentOrigin::CENTER);
368   imageView.SetAnchorPoint(AnchorPoint::CENTER);
369   imageView.SetScale(1.0f, -1.0f, 1.0f);
370   stage.Add(imageView); // Not in default image view
371
372   CameraActor cameraActor = CameraActor::New(FBOSize);
373   cameraActor.SetParentOrigin(ParentOrigin::CENTER);
374   cameraActor.SetFieldOfView(Math::PI*0.25f);
375   cameraActor.SetNearClippingPlane(1.0f);
376   cameraActor.SetAspectRatio(FBOSize.width / FBOSize.height);
377   cameraActor.SetType(Dali::Camera::FREE_LOOK); // camera orientation based solely on actor
378   cameraActor.SetPosition(0.0f, 0.0f, ((FBOSize.height * 0.5f) / tanf(Math::PI * 0.125f)));
379   stage.Add(cameraActor);
380
381   renderTask.SetSourceActor(imageView);
382   renderTask.SetInputEnabled(false);
383   renderTask.SetTargetFrameBuffer(framebuffer);
384   renderTask.SetCameraActor( cameraActor );
385   renderTask.SetClearColor( Color::TRANSPARENT );
386   renderTask.SetClearEnabled( true );
387   renderTask.SetRefreshRate(RenderTask::REFRESH_ONCE);
388
389   return framebuffer;
390 }
391
392 void NewWindowController::SetUpBubbleEmission( const Vector2& emitPosition, const Vector2& direction)
393 {
394   if( mNeedNewAnimation )
395   {
396     float duration = Random::Range(1.f, 1.5f);
397     mEmitAnimation = Animation::New( duration );
398     mNeedNewAnimation = false;
399     mAnimateComponentCount = 0;
400   }
401
402   mEmitter.EmitBubble( mEmitAnimation, emitPosition, direction, Vector2(10,10) );
403
404   mAnimateComponentCount++;
405
406   if( mAnimateComponentCount % 6 ==0 )
407   {
408     mEmitAnimation.Play();
409     mNeedNewAnimation = true;
410   }
411 }
412
413 Geometry NewWindowController::CreateMeshGeometry()
414 {
415   // Create vertices and specify their color
416   struct Vertex
417   {
418     Vector3 position;
419     Vector2 textureCoordinates;
420     Vector3 color;
421   };
422
423   Vertex vertexData[5] = {
424     { Vector3(  0.0f,  0.0f, 0.5f ), Vector2(0.5f, 0.5f), Vector3(1.0f, 1.0f, 1.0f) },
425     { Vector3( -0.5f, -0.5f, 0.0f ), Vector2(0.0f, 0.0f), Vector3(1.0f, 0.0f, 0.0f) },
426     { Vector3(  0.5f, -0.5f, 0.0f ), Vector2(1.0f, 0.0f), Vector3(1.0f, 1.0f, 0.0f) },
427     { Vector3( -0.5f,  0.5f, 0.0f ), Vector2(0.0f, 1.0f), Vector3(0.0f, 1.0f, 0.0f) },
428     { Vector3(  0.5f,  0.5f, 0.0f ), Vector2(1.0f, 1.0f), Vector3(0.0f, 0.0f, 1.0f) }  };
429
430   Property::Map vertexFormat;
431   vertexFormat["aPosition"] = Property::VECTOR3;
432   vertexFormat["aTexCoord"] = Property::VECTOR2;
433   vertexFormat["aColor"] = Property::VECTOR3;
434   PropertyBuffer vertices = PropertyBuffer::New( vertexFormat, 5 );
435   vertices.SetData( vertexData );
436
437   // Specify all the faces
438   unsigned int indexData[12] = { 0,1,3,0,2,4,0,3,4,0,2,1 };
439   Property::Map indexFormat;
440   indexFormat["indices"] = Property::INTEGER;
441   PropertyBuffer indices = PropertyBuffer::New( indexFormat, 12 );
442   indices.SetData( indexData );
443
444   // Create the geometry object
445   Geometry geometry = Geometry::New();
446   geometry.AddVertexBuffer( vertices );
447   geometry.SetIndexBuffer( indices );
448
449   return geometry;
450 }
451
452 Dali::Property::Map NewWindowController::CreateColorModifierer()
453 {
454  const char* fragmentShader ( DALI_COMPOSE_SHADER (
455    precision highp float;\n
456    uniform vec3 uRGBDelta;\n
457    uniform float uIgnoreAlpha;\n
458    \n
459    varying mediump vec2 vTexCoord;\n
460    uniform sampler2D sTexture;\n
461    \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  Property::Map map;
479  Property::Map customShader;
480  customShader[ "fragment-shader" ] = fragmentShader;
481  map[ "shader" ] = customShader;
482
483  return map;
484 }
485
486 void NewWindowController::NewWindow(void)
487 {
488   PositionSize posSize(0, 0, 720, 1280);
489   gApplication.ReplaceWindow(posSize, "NewWindow"); // Generates a new window
490 }
491
492 bool NewWindowController::OnLoseContextButtonClicked( Toolkit::Button button )
493 {
494   // Add as an idle callback to avoid ProcessEvents being recursively called.
495   mApplication.AddIdle( MakeCallback( NewWindowController::NewWindow ) );
496   return true;
497 }
498
499 bool NewWindowController::OnTrackTimerTick()
500 {
501   static int time=0;
502   const float radius(250.0f);
503
504   time += EMIT_INTERVAL_IN_MS;
505   float modTime = time / TRACK_DURATION_IN_MS;
506   float angle = 2.0f*Math::PI*modTime;
507
508   Vector2 position(radius*cosf(angle), radius*-sinf(angle));
509   Vector2 aimPos(radius*2*sinf(angle), radius*2*-cosf(angle));
510   Vector2 direction = aimPos-position;
511   Vector2 stageSize = Stage::GetCurrent().GetSize();
512
513   SetUpBubbleEmission( stageSize*0.5f+position, direction );
514   SetUpBubbleEmission( stageSize*0.5f+position*0.75f, direction );
515   SetUpBubbleEmission( stageSize*0.5f+position*0.7f, direction );
516
517   return true;
518 }
519
520 void NewWindowController::OnKeyEvent(const KeyEvent& event)
521 {
522   if(event.state == KeyEvent::Down)
523   {
524     if( IsKey( event, Dali::DALI_KEY_ESCAPE) || IsKey( event, Dali::DALI_KEY_BACK) )
525     {
526       mApplication.Quit();
527     }
528   }
529 }
530
531 void NewWindowController::OnContextLost()
532 {
533   printf("Stage reporting context loss\n");
534 }
535
536 void NewWindowController::OnContextRegained()
537 {
538   printf("Stage reporting context regain\n");
539 }
540
541 void RunTest(Application& app)
542 {
543   gNewWindowController = new NewWindowController(app);
544   app.MainLoop(Configuration::APPLICATION_DOES_NOT_HANDLE_CONTEXT_LOSS);
545 }
546
547 // Entry point for Linux & Tizen applications
548 //
549 int main(int argc, char **argv)
550 {
551   gApplication = Application::New(&argc, &argv, DALI_DEMO_THEME_PATH);
552   RunTest(gApplication);
553
554   return 0;
555 }