/*
- * 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.
// CLASS HEADER
#include "frame-callback.h"
-#include <iostream>
-
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( unsigned int 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;
- 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 = 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 = 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);
+ }
+ }
}
}