Merge "Updates following rename of PropertyBuffer" into devel/master
[platform/core/uifw/dali-demo.git] / examples / fpp-game / fpp-game-example.cpp
index 211028f..03cf099 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -39,7 +39,7 @@ const char* SCENE_URL =
    It contains following modules:
 
    GameScene  - responsible for loading and managing the scene data,
-                it wraps around stage. Owns list of entities. Scene can be deserialised
+                it wraps around window. Owns list of entities. Scene can be deserialised
                 from json file ( see scene.json )
    GameEntity - the renderable object that has also a transformation. It wraps DALi actors.
 
@@ -93,32 +93,28 @@ public:
   // The Init signal is received once (only) during the Application lifetime
   void Create( Application& application )
   {
-    // Disable indicator
-    Dali::Window winHandle = application.GetWindow();
-    winHandle.ShowIndicator( Dali::Window::INVISIBLE );
+    // Get a handle to the window
+    mWindow = application.GetWindow();
 
-    // Get a handle to the stage
-    mStage = Stage::GetCurrent();
-
-    mStage.SetBackgroundColor( Color::BLACK );
+    mWindow.SetBackgroundColor( Color::BLACK );
 
     // Use 3D layer
-    mStage.GetRootLayer().SetBehavior( Layer::LAYER_3D );
+    mWindow.GetRootLayer().SetProperty( Layer::Property::BEHAVIOR, Layer::LAYER_3D );
 
     // Load game scene
-    mScene.Load( SCENE_URL );
+    mScene.Load( mWindow, SCENE_URL );
 
     // Display tutorial
-    mTutorialController.DisplayTutorial();
+    mTutorialController.DisplayTutorial( mWindow );
 
     // Connect OnKeyEvent signal
-    mStage.KeyEventSignal().Connect( this, &GameController::OnKeyEvent );
+    mWindow.KeyEventSignal().Connect( this, &GameController::OnKeyEvent );
   }
 
   // Handle a quit key event
   void OnKeyEvent(const KeyEvent& event)
   {
-    if(event.state == KeyEvent::Down)
+    if(event.GetState() == KeyEvent::Down)
     {
       if( IsKey( event, Dali::DALI_KEY_ESCAPE) || IsKey( event, Dali::DALI_KEY_BACK) )
       {
@@ -131,24 +127,14 @@ private:
 
   Application&              mApplication;
   GameScene                 mScene;
-  Stage                     mStage;
+  Window                    mWindow;
   FppGameTutorialController mTutorialController;
 };
 
-void RunTest( Application& application )
-{
-  GameController test( application );
-
-  application.MainLoop();
-}
-
-// Entry point for Linux & Tizen applications
-//
 int DALI_EXPORT_API main( int argc, char **argv )
 {
   Application application = Application::New( &argc, &argv );
-
-  RunTest( application );
-
+  GameController test( application );
+  application.MainLoop();
   return 0;
 }