X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=examples%2Fframe-callback%2Fframe-callback.cpp;h=88c66f6bf4c116d3831179b9e12f39cfc00095ca;hb=1b19fd140ff139b5854a1a62447faf31b175d8f6;hp=fcab8fccb721145012ab42751e3fc412aacd0aa1;hpb=b79b6521995670bef0e96e7b5d3eac8fd359db93;p=platform%2Fcore%2Fuifw%2Fdali-demo.git diff --git a/examples/frame-callback/frame-callback.cpp b/examples/frame-callback/frame-callback.cpp index fcab8fc..88c66f6 100644 --- a/examples/frame-callback/frame-callback.cpp +++ b/examples/frame-callback/frame-callback.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 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. @@ -19,50 +19,51 @@ #include "frame-callback.h" using namespace Dali; +using namespace std; FrameCallback::FrameCallback() : mActorIdContainer(), - stageHalfWidth( 0.0f ) + windowHalfWidth(0.0f) { } -void FrameCallback::SetStageWidth( float stageWidth ) +void FrameCallback::SetWindowWidth(float windowWidth) { - stageHalfWidth = stageWidth * 0.5f; + windowHalfWidth = windowWidth * 0.5f; } -void FrameCallback::AddId( uint32_t id ) +void FrameCallback::AddId(uint32_t id) { - mActorIdContainer.PushBack( id ); + mActorIdContainer.PushBack(id); } -void FrameCallback::Update( Dali::UpdateProxy& updateProxy, float /* elapsedSeconds */ ) +void FrameCallback::Update(Dali::UpdateProxy& updateProxy, float /* elapsedSeconds */) { // Go through Actor ID container and check if we've hit the sides. - for( auto&& i : mActorIdContainer ) + for(auto&& i : mActorIdContainer) { Vector3 position; Vector3 size; - if( updateProxy.GetPositionAndSize( i, position, size ) ) // Retrieve the position and size using the Actor ID. + if(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 ) + float halfWidthPoint = windowHalfWidth - size.width * 0.5f; + float xTranslation = 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; - if( updateProxy.GetColor( i, color ) ) + if(updateProxy.GetColor(i, color)) { color.a = xTranslation / halfWidthPoint; - updateProxy.SetColor( i, color ); + updateProxy.SetColor(i, color); } } }