KeyEvent class pimpling
[platform/core/uifw/dali-demo.git] / examples / image-scaling-irregular-grid / image-scaling-irregular-grid-example.cpp
index 1242d95..47aa49a 100644 (file)
@@ -48,6 +48,8 @@
 #include <iostream>
 #include <dali-toolkit/devel-api/controls/control-devel.h>
 #include <dali-toolkit/devel-api/controls/scroll-bar/scroll-bar.h>
+#include <random>       // std::default_random_engine
+#include <chrono>       // std::chrono::system_clock
 
 // INTERNAL INCLUDES
 #include "grid-flags.h"
@@ -417,8 +419,10 @@ public:
       }
     }
     // Stir-up the list to get some nice irregularity in the generated field:
-    std::random_shuffle( configurations.begin(), configurations.end() );
-    std::random_shuffle( configurations.begin(), configurations.end() );
+    unsigned int seed = std::chrono::system_clock::now().time_since_epoch().count();
+    std::shuffle( configurations.begin(), configurations.end(), std::default_random_engine(seed) );
+    seed = std::chrono::system_clock::now().time_since_epoch().count();
+    std::shuffle( configurations.begin(), configurations.end(), std::default_random_engine(seed) );
 
     // Place the images in the grid:
 
@@ -498,7 +502,7 @@ public:
   * @param[in] actor The actor touched
   * @param[in] event The Touch information.
   */
-  bool OnTouchImage( Actor actor, const TouchData& event )
+  bool OnTouchImage( Actor actor, const TouchEvent& event )
   {
     if( ( event.GetPointCount() > 0 ) && ( !mScrolling ) )
     {
@@ -538,7 +542,7 @@ public:
   */
   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 ) )