struct HandlePositionConstraint
{
- HandlePositionConstraint(float minRelX, float maxRelX, float minRelY, float maxRelY)
- : minRelX(minRelX),
- maxRelX(maxRelX),
- minRelY(minRelY),
- maxRelY(maxRelY)
- {
- }
-
void operator()(Vector3& current, const PropertyInputContainer& inputs)
{
Vector3 size(inputs[0]->GetVector3());
current.y = Clamp(current.y, minRelY * size.y, maxRelY * size.y);
}
- float minRelX;
- float maxRelX;
- float minRelY;
- float maxRelY;
+ float minRelX{0.0f};
+ float maxRelX{0.0f};
+ float minRelY{0.0f};
+ float maxRelY{0.0f};
};
void AnimatingPositionConstraint(Vector3& current, const PropertyInputContainer& inputs)
positionAnimation.FinishedSignal().Connect(this, &BezierCurveExample::OnAnimationFinished);
// Set up constraints for drag/drop
- Constraint constraint = Constraint::New<Vector3>(actor, Actor::Property::POSITION, HandlePositionConstraint(-0.5, 0.5, -1, 1));
+ Constraint constraint = Constraint::New<Vector3>(actor, Actor::Property::POSITION, HandlePositionConstraint{-0.5, 0.5, -1, 1});
constraint.AddSource(Source(parent, Actor::Property::SIZE));
constraint.Apply();
struct Vertex
{
- Vector3 position;
- Vector3 normal;
+ Vector3 position{};
+ Vector3 normal{};
};
Vertex vertexData[] = {
{positions[0]},
int DALI_EXPORT_API main(int argc, char** argv)
{
- const bool showLights = [](int argc, char** argv) {
+ const bool showLights = [argc, argv]() {
auto endArgs = argv + argc;
return std::find_if(argv, endArgs, [](const char* arg) {
return strcmp(arg, "--show-lights") == 0;
}) != endArgs;
- }(argc, argv);
+ }();
Application app = Application::New(&argc, &argv);
DeferredShadingExample example(app, (showLights ? DeferredShadingExample::Options::SHOW_LIGHTS : 0));
* */
struct ImageConfiguration
{
- ImageConfiguration(const char* const path, const Vector2 dimensions)
- : path(path),
- dimensions(dimensions)
+ ImageConfiguration(const char* const imagePath, const Vector2 dims)
+ : path(imagePath),
+ dimensions(dims)
{
}
const char* path;
*/
struct PositionedImage
{
- PositionedImage(ImageConfiguration& configuration, unsigned cellX, unsigned cellY, Vector2 imageGridDims)
- : configuration(configuration),
- cellX(cellX),
- cellY(cellY),
- imageGridDims(imageGridDims)
+ PositionedImage(ImageConfiguration& config, unsigned x, unsigned y, Vector2 imageGridDimensions)
+ : configuration(config),
+ cellX(x),
+ cellY(y),
+ imageGridDims(imageGridDimensions)
{
}
// Place the images in the grid:
- std::vector<ImageConfiguration>::iterator config, end;
- GridFlags grid(gridWidth, maxGridHeight);
- std::vector<PositionedImage> placedImages;
+ GridFlags grid(gridWidth, maxGridHeight);
+ std::vector<PositionedImage> placedImages;
- for(config = configurations.begin(), end = configurations.end(); config != end; ++config)
+ for(std::vector<ImageConfiguration>::iterator config = configurations.begin(), end = configurations.end(); config != end; ++config)
{
unsigned cellX, cellY;
Vector2 imageGridDims;
mMinusButton.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
mMinusButton.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT);
- Toolkit::PushButton mPlusButton = Toolkit::PushButton::New();
+ mPlusButton = Toolkit::PushButton::New();
mPlusButton.SetProperty(Toolkit::Button::Property::LABEL, ">>");
mPlusButton.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
mPlusButton.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_RIGHT);
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
destPos.y = localPoint.y - originOffsetY;
destPos.z = 0.0f;
- float animDuration = 0.5f;
- mActorTapMovementAnimation = Animation::New(animDuration);
+ float tapMovementAnimDuration = 0.5f;
+ mActorTapMovementAnimation = Animation::New(tapMovementAnimDuration);
if(mMotionBlurImageView)
{
- mActorTapMovementAnimation.AnimateTo(Property(mMotionBlurImageView, Actor::Property::POSITION), destPos, AlphaFunction::EASE_IN_OUT_SINE, TimePeriod(animDuration));
+ mActorTapMovementAnimation.AnimateTo(Property(mMotionBlurImageView, Actor::Property::POSITION), destPos, AlphaFunction::EASE_IN_OUT_SINE, TimePeriod(tapMovementAnimDuration));
}
mActorTapMovementAnimation.SetEndAction(Animation::BAKE);
mActorTapMovementAnimation.Play();
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
destPos.y = localPoint.y - originOffsetY;
destPos.z = 0.0f;
- float animDuration = 0.5f;
- mActorTapMovementAnimation = Animation::New(animDuration);
+ float tapMovementAnimDuration = 0.5f;
+ mActorTapMovementAnimation = Animation::New(tapMovementAnimDuration);
if(mMotionStretchImageView)
{
- mActorTapMovementAnimation.AnimateTo(Property(mMotionStretchImageView, Actor::Property::POSITION), destPos, AlphaFunction::EASE_IN_OUT_SINE, TimePeriod(animDuration));
+ mActorTapMovementAnimation.AnimateTo(Property(mMotionStretchImageView, Actor::Property::POSITION), destPos, AlphaFunction::EASE_IN_OUT_SINE, TimePeriod(tapMovementAnimDuration));
}
mActorTapMovementAnimation.SetEndAction(Animation::BAKE);
mActorTapMovementAnimation.Play();
Vector3 position;
Vector3 normal;
Vector2 textureCoord;
-
- Vertex()
- {
- }
-
- Vertex(const Vector3& position, const Vector3& normal, const Vector2& textureCoord)
- : position(position),
- normal(normal),
- textureCoord(textureCoord)
- {
- }
};
} // namespace
// make sure all the faces are front-facing
if(normal.z > 0)
{
- vertices.push_back(Vertex(vertexPositions[faceIndices[i]], normal, textureCoordinates[faceIndices[i]]));
- vertices.push_back(Vertex(vertexPositions[faceIndices[i + 1]], normal, textureCoordinates[faceIndices[i + 1]]));
- vertices.push_back(Vertex(vertexPositions[faceIndices[i + 2]], normal, textureCoordinates[faceIndices[i + 2]]));
+ vertices.push_back(Vertex{vertexPositions[faceIndices[i]], normal, textureCoordinates[faceIndices[i]]});
+ vertices.push_back(Vertex{vertexPositions[faceIndices[i + 1]], normal, textureCoordinates[faceIndices[i + 1]]});
+ vertices.push_back(Vertex{vertexPositions[faceIndices[i + 2]], normal, textureCoordinates[faceIndices[i + 2]]});
}
else
{
normal *= -1.f;
- vertices.push_back(Vertex(vertexPositions[faceIndices[i]], normal, textureCoordinates[faceIndices[i]]));
- vertices.push_back(Vertex(vertexPositions[faceIndices[i + 2]], normal, textureCoordinates[faceIndices[i + 2]]));
- vertices.push_back(Vertex(vertexPositions[faceIndices[i + 1]], normal, textureCoordinates[faceIndices[i + 1]]));
+ vertices.push_back(Vertex{vertexPositions[faceIndices[i]], normal, textureCoordinates[faceIndices[i]]});
+ vertices.push_back(Vertex{vertexPositions[faceIndices[i + 2]], normal, textureCoordinates[faceIndices[i + 2]]});
+ vertices.push_back(Vertex{vertexPositions[faceIndices[i + 1]], normal, textureCoordinates[faceIndices[i + 1]]});
}
}
{
if(line[0] == 'v' && std::isspace(line[1])) // vertex
{
- std::istringstream iss(line.substr(2), std::istringstream::in);
+ std::istringstream vertexIss(line.substr(2), std::istringstream::in);
unsigned int i = 0;
Vector3 vertex;
- while(iss >> vertex[i++] && i < 3)
+ while(vertexIss >> vertex[i++] && i < 3)
;
if(vertex.x < boundingBox[0]) boundingBox[0] = vertex.x;
if(vertex.x > boundingBox[1]) boundingBox[1] = vertex.x;
numOfInt++;
}
- std::istringstream iss(line.substr(2), std::istringstream::in);
+ std::istringstream faceIss(line.substr(2), std::istringstream::in);
Dali::Vector<unsigned int> indices;
indices.Resize(numOfInt);
unsigned int i = 0;
- while(iss >> indices[i++] && i < numOfInt)
+ while(faceIss >> indices[i++] && i < numOfInt)
;
unsigned int step = (i + 1) / 3;
faceIndices.PushBack(indices[0] - 1);
{},\r
{},\r
nullptr,\r
- };\r
+ {}};\r
DliLoader::LoadParams loadParams{input, output};\r
if(!loader.LoadScene(path, loadParams))\r
{\r
viewProjection};\r
NodeDefinition::CreateParams nodeParams{\r
resources,\r
- xforms};\r
+ xforms,\r
+ {},\r
+ {},\r
+ {}};\r
Customization::Choices choices;\r
\r
Actor root = Actor::New();\r
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
float particleIdx = static_cast<float>(idx / 4 + 1); // count from 1
float colorIdx = colorIndex + 1.f; // count from 1
- vertices.push_back(Vertex(Vector2(-colorIdx, -particleIdx), particlePath0, particlePath1, particlePath2, particlePath3, particlePath4, particlePath5));
- vertices.push_back(Vertex(Vector2(-colorIdx, particleIdx), particlePath0, particlePath1, particlePath2, particlePath3, particlePath4, particlePath5));
- vertices.push_back(Vertex(Vector2(colorIdx, particleIdx), particlePath0, particlePath1, particlePath2, particlePath3, particlePath4, particlePath5));
- vertices.push_back(Vertex(Vector2(colorIdx, -particleIdx), particlePath0, particlePath1, particlePath2, particlePath3, particlePath4, particlePath5));
+ vertices.push_back(Vertex{Vector2(-colorIdx, -particleIdx), particlePath0, particlePath1, particlePath2, particlePath3, particlePath4, particlePath5});
+ vertices.push_back(Vertex{Vector2(-colorIdx, particleIdx), particlePath0, particlePath1, particlePath2, particlePath3, particlePath4, particlePath5});
+ vertices.push_back(Vertex{Vector2(colorIdx, particleIdx), particlePath0, particlePath1, particlePath2, particlePath3, particlePath4, particlePath5});
+ vertices.push_back(Vertex{Vector2(colorIdx, -particleIdx), particlePath0, particlePath1, particlePath2, particlePath3, particlePath4, particlePath5});
faces.push_back(idx);
faces.push_back(idx + 1);
// Geometry format used by the SparkeEffect
struct Vertex
{
- Vertex(const Vector2& texCoord,
- const Vector2& aParticlePath0,
- const Vector2& aParticlePath1,
- const Vector2& aParticlePath2,
- const Vector2& aParticlePath3,
- const Vector2& aParticlePath4,
- const Vector2& aParticlePath5)
- : aTexCoord(texCoord),
- aParticlePath0(aParticlePath0),
- aParticlePath1(aParticlePath1),
- aParticlePath2(aParticlePath2),
- aParticlePath3(aParticlePath3),
- aParticlePath4(aParticlePath4),
- aParticlePath5(aParticlePath5)
- {
- }
-
Vector2 aTexCoord;
Vector2 aParticlePath0;
Vector2 aParticlePath1;
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
struct HSVColorConstraint
{
- HSVColorConstraint(float hue, float saturation, float value)
- : hue(hue),
- saturation(saturation),
- value(value)
+ HSVColorConstraint(float hueParam, float saturationParam, float valueParam)
+ : hue(hueParam),
+ saturation(saturationParam),
+ value(valueParam)
{
}
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
mAnimation = Animation::New(1.0f);
- const Size mTargetActorSize(mWindowSize.width, mWindowSize.height * WINDOW_HEIGHT_MULTIPLIER);
+ const Size targetActorSize(mWindowSize.width, mWindowSize.height * WINDOW_HEIGHT_MULTIPLIER);
// Create Desktop
Control desktop = Control::New();
desktop.SetProperty(Dali::Actor::Property::NAME, "desktopActor");
desktop.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
desktop.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
- desktop.SetProperty(Actor::Property::SIZE, mTargetActorSize);
+ desktop.SetProperty(Actor::Property::SIZE, targetActorSize);
rootActor.Add(desktop); // Add desktop (content) to offscreen actor
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
void ShadowButton::RelayoutVisuals(const Vector2& targetSize)
{
- bool transitioning = false;
- ShadowButton::Transitions::iterator iter = mTransitions.begin();
- for(; iter != mTransitions.end(); ++iter)
+ bool transitioning = false;
+ for(ShadowButton::Transitions::iterator iter = mTransitions.begin();
+ iter != mTransitions.end();
+ ++iter)
{
if(iter->mPlaying == true)
{
}
// Extract transform maps out of the visual definition and store them
- Property::Value* value = map->Find(Visual::Property::TRANSFORM, "transform");
- if(value)
+ Property::Value* transformValue = map->Find(Visual::Property::TRANSFORM, "transform");
+ if(transformValue)
{
- Property::Map* transformMap = value->GetMap();
+ Property::Map* transformMap = transformValue->GetMap();
if(transformMap)
{
ShadowButton::Transforms::iterator iter = FindTransform(index);
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
const Property::Map* map = value.GetMap();
if(map)
{
- Property::Value* value = map->Find(Visual::Property::TRANSFORM, "transform");
- if(value)
+ Property::Value* transformValue = map->Find(Visual::Property::TRANSFORM, "transform");
+ if(transformValue)
{
- Property::Map* transformMap = value->GetMap();
+ Property::Map* transformMap = transformValue->GetMap();
if(transformMap)
{
// We'll increment this whenever SIZE, ORIGIN or ANCHOR_POINT's are modified as we won't need to create a new visual if only these properties are used