Commit b79b6521995670bef0e96e7b5d3eac8fd359db93
[dali_1.3.46] Merge branch 'devel/master'
Change-Id: I75aee0d88e06855f4e3c3dd7f6b2acabf1fae181
Showing
3 changed files
with
23 additions
and
21 deletions
examples/frame-callback/frame-callback.cpp
| ... | ... | @@ -18,8 +18,6 @@ |
| 18 | 18 | // CLASS HEADER |
| 19 | 19 | #include "frame-callback.h" |
| 20 | 20 | |
| 21 | -#include <iostream> | |
| 22 | - | |
| 23 | 21 | using namespace Dali; |
| 24 | 22 | |
| 25 | 23 | FrameCallback::FrameCallback() |
| ... | ... | @@ -33,7 +31,7 @@ void FrameCallback::SetStageWidth( float stageWidth ) |
| 33 | 31 | stageHalfWidth = stageWidth * 0.5f; |
| 34 | 32 | } |
| 35 | 33 | |
| 36 | -void FrameCallback::AddId( unsigned int id ) | |
| 34 | +void FrameCallback::AddId( uint32_t id ) | |
| 37 | 35 | { |
| 38 | 36 | mActorIdContainer.PushBack( id ); |
| 39 | 37 | } |
| ... | ... | @@ -45,23 +43,27 @@ void FrameCallback::Update( Dali::UpdateProxy& updateProxy, float /* elapsedSeco |
| 45 | 43 | { |
| 46 | 44 | Vector3 position; |
| 47 | 45 | Vector3 size; |
| 48 | - updateProxy.GetPositionAndSize( i, position, size ); // Retrieve the position and size using the Actor ID. | |
| 49 | - | |
| 50 | - float halfWidthPoint = stageHalfWidth - size.width * 0.5f; | |
| 51 | - float xTranslation = std::abs( position.x ); | |
| 52 | - if( xTranslation > halfWidthPoint ) | |
| 46 | + if( updateProxy.GetPositionAndSize( i, position, size ) ) // Retrieve the position and size using the Actor ID. | |
| 53 | 47 | { |
| 54 | - // Actor has hit the edge, adjust the size accordingly. | |
| 55 | - float adjustment = xTranslation - halfWidthPoint; | |
| 56 | - size.width += adjustment * SIZE_MULTIPLIER; | |
| 57 | - size.height += adjustment * SIZE_MULTIPLIER; | |
| 48 | + float halfWidthPoint = stageHalfWidth - size.width * 0.5f; | |
| 49 | + float xTranslation = std::abs( position.x ); | |
| 50 | + if( xTranslation > halfWidthPoint ) | |
| 51 | + { | |
| 52 | + // Actor has hit the edge, adjust the size accordingly. | |
| 53 | + float adjustment = xTranslation - halfWidthPoint; | |
| 54 | + size.width += adjustment * SIZE_MULTIPLIER; | |
| 55 | + size.height += adjustment * SIZE_MULTIPLIER; | |
| 58 | 56 | |
| 59 | - updateProxy.SetSize( i, size ); // Set the size using the UpdateProxy. | |
| 60 | - } | |
| 57 | + updateProxy.SetSize( i, size ); // Set the size using the UpdateProxy. | |
| 58 | + } | |
| 61 | 59 | |
| 62 | - // Retrieve the actor's position and set make it more transparent the closer it is to the middle. | |
| 63 | - Vector4 color = updateProxy.GetWorldColor( i ); | |
| 64 | - color.a = xTranslation / halfWidthPoint; | |
| 65 | - updateProxy.SetWorldColor( i, color ); | |
| 60 | + // Retrieve the actor's position and set make it more transparent the closer it is to the middle. | |
| 61 | + Vector4 color; | |
| 62 | + if( updateProxy.GetColor( i, color ) ) | |
| 63 | + { | |
| 64 | + color.a = xTranslation / halfWidthPoint; | |
| 65 | + updateProxy.SetColor( i, color ); | |
| 66 | + } | |
| 67 | + } | |
| 66 | 68 | } |
| 67 | 69 | } | ... | ... |
examples/frame-callback/frame-callback.h
| ... | ... | @@ -48,7 +48,7 @@ public: |
| 48 | 48 | * @brief The actor with the specified ID will be changed when Update() is called. |
| 49 | 49 | * @param[in] id Actor ID of actor which should be changed by the FrameCallback. |
| 50 | 50 | */ |
| 51 | - void AddId( unsigned int id ); | |
| 51 | + void AddId( uint32_t id ); | |
| 52 | 52 | |
| 53 | 53 | private: |
| 54 | 54 | |
| ... | ... | @@ -61,7 +61,7 @@ private: |
| 61 | 61 | |
| 62 | 62 | private: |
| 63 | 63 | |
| 64 | - Dali::Vector< unsigned int > mActorIdContainer; ///< Container of Actor IDs. | |
| 64 | + Dali::Vector< uint32_t > mActorIdContainer; ///< Container of Actor IDs. | |
| 65 | 65 | float stageHalfWidth; ///< Half the width of the stage. Center is 0,0 in the world matrix. |
| 66 | 66 | |
| 67 | 67 | constexpr static float SIZE_MULTIPLIER = 2.0f; ///< Multiplier for the size to set as the actors hit the edge. | ... | ... |