From c5c74fe46d93d26c7aa71a5019b2f4a6fc0505ae Mon Sep 17 00:00:00 2001 From: Adeel Kazmi Date: Thu, 4 Oct 2018 20:27:39 +0100 Subject: [PATCH] Updates following FrameCallback changes Change-Id: I6f7e6fe49e640f828fa7aa288560477a1cd9157c --- examples/frame-callback/frame-callback.cpp | 36 ++++++++++++++++-------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/examples/frame-callback/frame-callback.cpp b/examples/frame-callback/frame-callback.cpp index 27c4466..142c9eb 100644 --- a/examples/frame-callback/frame-callback.cpp +++ b/examples/frame-callback/frame-callback.cpp @@ -18,8 +18,6 @@ // CLASS HEADER #include "frame-callback.h" -#include - using namespace Dali; FrameCallback::FrameCallback() @@ -45,23 +43,27 @@ void FrameCallback::Update( Dali::UpdateProxy& updateProxy, float /* elapsedSeco { Vector3 position; Vector3 size; - updateProxy.GetPositionAndSize( i, position, size ); // Retrieve the position and size using the Actor ID. - - float halfWidthPoint = stageHalfWidth - size.width * 0.5f; - float xTranslation = std::abs( position.x ); - if( xTranslation > halfWidthPoint ) + if( updateProxy.GetPositionAndSize( i, position, size ) ) // Retrieve the position and size using the Actor ID. { - // Actor has hit the edge, adjust the size accordingly. - float adjustment = xTranslation - halfWidthPoint; - size.width += adjustment * SIZE_MULTIPLIER; - size.height += adjustment * SIZE_MULTIPLIER; + float halfWidthPoint = stageHalfWidth - size.width * 0.5f; + float xTranslation = std::abs( position.x ); + if( xTranslation > halfWidthPoint ) + { + // Actor has hit the edge, adjust the size accordingly. + float adjustment = xTranslation - halfWidthPoint; + size.width += adjustment * SIZE_MULTIPLIER; + size.height += adjustment * SIZE_MULTIPLIER; - updateProxy.SetSize( i, size ); // Set the size using the UpdateProxy. - } + updateProxy.SetSize( i, size ); // Set the size using the UpdateProxy. + } - // Retrieve the actor's position and set make it more transparent the closer it is to the middle. - Vector4 color = updateProxy.GetWorldColor( i ); - color.a = xTranslation / halfWidthPoint; - updateProxy.SetWorldColor( i, color ); + // Retrieve the actor's position and set make it more transparent the closer it is to the middle. + Vector4 color; + if( updateProxy.GetColor( i, color ) ) + { + color.a = xTranslation / halfWidthPoint; + updateProxy.SetColor( i, color ); + } + } } } -- 2.7.4