Commit e44945d1202b8b92df6df99d3bfcefee301e2929
[dali_1.2.34] Merge branch 'devel/master'
Change-Id: If44623378fd40e4b8efcabc396391a13c5e4e6d2
Showing
17 changed files
with
422 additions
and
14 deletions
com.samsung.dali-demo.xml
| ... | ... | @@ -200,4 +200,19 @@ |
| 200 | 200 | <ui-application appid="focus-integration.example" exec="/usr/apps/com.samsung.dali-demo/bin/focus-integration.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> |
| 201 | 201 | <label>Focus Integration</label> |
| 202 | 202 | </ui-application> |
| 203 | + <ui-application appid="rendering-cube.example" exec="/usr/apps/com.samsung.dali-demo/bin/rendering-cube.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> | |
| 204 | + <label>Rendering Cube</label> | |
| 205 | + </ui-application> | |
| 206 | + <ui-application appid="rendering-line.example" exec="/usr/apps/com.samsung.dali-demo/bin/rendering-line.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> | |
| 207 | + <label>Rendering Line</label> | |
| 208 | + </ui-application> | |
| 209 | + <ui-application appid="rendering-textured-cube.example" exec="/usr/apps/com.samsung.dali-demo/bin/rendering-textured-cube.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> | |
| 210 | + <label>Rendering Textured Cube</label> | |
| 211 | + </ui-application> | |
| 212 | + <ui-application appid="rendering-triangle.example" exec="/usr/apps/com.samsung.dali-demo/bin/rendering-triangle.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> | |
| 213 | + <label>Rendering Triangle</label> | |
| 214 | + </ui-application> | |
| 215 | + <ui-application appid="rendering-radial-progress.example" exec="/usr/apps/com.samsung.dali-demo/bin/rendering-radial-progress.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> | |
| 216 | + <label>Rendering Radial Progress</label> | |
| 217 | + </ui-application> | |
| 203 | 218 | </manifest> | ... | ... |
examples-reel/dali-examples-reel.cpp
| ... | ... | @@ -67,6 +67,7 @@ int DALI_EXPORT_API main(int argc, char **argv) |
| 67 | 67 | demo.AddExample(Example("rendering-triangle.example", DALI_DEMO_STR_TITLE_RENDERING_DRAW_TRIANGLE)); |
| 68 | 68 | demo.AddExample(Example("rendering-cube.example", DALI_DEMO_STR_TITLE_RENDERING_DRAW_CUBE)); |
| 69 | 69 | demo.AddExample(Example("rendering-textured-cube.example", DALI_DEMO_STR_TITLE_RENDERING_TEXTURED_CUBE)); |
| 70 | + demo.AddExample(Example("rendering-radial-progress.example", DALI_DEMO_STR_TITLE_RENDERING_RADIAL_PROGRESS)); | |
| 70 | 71 | demo.AddExample(Example("scroll-view.example", DALI_DEMO_STR_TITLE_SCROLL_VIEW)); |
| 71 | 72 | demo.AddExample(Example("size-negotiation.example", DALI_DEMO_STR_TITLE_NEGOTIATE_SIZE)); |
| 72 | 73 | demo.AddExample(Example("styling.example", DALI_DEMO_STR_TITLE_STYLING)); | ... | ... |
examples/rendering-radial-progress/radial-progress.cpp
0 → 100644
| 1 | +/* | |
| 2 | + * Copyright (c) 2017 Samsung Electronics Co., Ltd. | |
| 3 | + * | |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | |
| 5 | + * you may not use this file except in compliance with the License. | |
| 6 | + * You may obtain a copy of the License at | |
| 7 | + * | |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | |
| 9 | + * | |
| 10 | + * Unless required by applicable law or agreed to in writing, software | |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 13 | + * See the License for the specific language governing permissions and | |
| 14 | + * limitations under the License. | |
| 15 | + * | |
| 16 | + */ | |
| 17 | + | |
| 18 | +#include <dali/dali.h> | |
| 19 | +#include <dali-toolkit/dali-toolkit.h> | |
| 20 | + | |
| 21 | +using namespace Dali; | |
| 22 | + | |
| 23 | +namespace // unnamed namespace | |
| 24 | +{ | |
| 25 | + | |
| 26 | +const char* TEXTURE_URL = DEMO_IMAGE_DIR "RadialEffect-280x280.png"; | |
| 27 | +const unsigned int TEXTURE_WIDTH = 280; | |
| 28 | +const unsigned int TEXTURE_HEIGHT = 280; | |
| 29 | + | |
| 30 | +const int NUMBER_OF_SIDES( 64 ); // number of sides of the polygon used as a stencil | |
| 31 | +const float INITIAL_DELAY( 2.0f ); // initial delay before showing the circle | |
| 32 | +const float PROGRESS_DURATION( 0.5f ); // number of seconds to fully show the circle | |
| 33 | + | |
| 34 | + | |
| 35 | +/* | |
| 36 | + * Vertex shader for textured quad | |
| 37 | + */ | |
| 38 | +const char* VERTEX_SHADER_TEXTURED = DALI_COMPOSE_SHADER( | |
| 39 | +attribute mediump vec2 aPosition;\n | |
| 40 | +uniform mediump mat4 uMvpMatrix;\n // DALi shader builtin | |
| 41 | +uniform mediump vec3 uSize;\n // DALi shader builtin | |
| 42 | +\n | |
| 43 | +varying mediump vec2 vTexCoord;\n | |
| 44 | +void main()\n | |
| 45 | +{\n | |
| 46 | + mediump vec4 vertexPosition = vec4(aPosition, 0.0, 1.0);\n | |
| 47 | + vertexPosition.xyz *= uSize;\n | |
| 48 | + vTexCoord = vec2(1.0, 1.0)*(aPosition + vec2(0.5) );\n | |
| 49 | + gl_Position = uMvpMatrix * vertexPosition;\n | |
| 50 | +}\n | |
| 51 | +); | |
| 52 | + | |
| 53 | +/* | |
| 54 | + * Fragment shaderfor textured quad | |
| 55 | + */ | |
| 56 | +const char* FRAGMENT_SHADER_TEXTURED = DALI_COMPOSE_SHADER( | |
| 57 | +uniform sampler2D uTexture;\n | |
| 58 | +\n | |
| 59 | +varying mediump vec2 vTexCoord;\n | |
| 60 | +void main()\n | |
| 61 | +{\n | |
| 62 | + mediump vec4 texColor = texture2D( uTexture, vTexCoord );\n | |
| 63 | + gl_FragColor = texColor;\n | |
| 64 | +}\n | |
| 65 | +); | |
| 66 | + | |
| 67 | +/* | |
| 68 | + * Vertex shader for polygon | |
| 69 | + */ | |
| 70 | +const char* VERTEX_SHADER_BASIC = DALI_COMPOSE_SHADER( | |
| 71 | +attribute mediump vec3 aPosition;\n | |
| 72 | +uniform mediump mat4 uMvpMatrix;\n // DALi shader builtin | |
| 73 | +uniform mediump vec3 uSize;\n // DALi shader builtin | |
| 74 | +uniform mediump float uProgress;\n | |
| 75 | +\n | |
| 76 | +varying mediump vec2 vTexCoord;\n | |
| 77 | +void main()\n | |
| 78 | +{\n | |
| 79 | + mediump vec4 vertexPosition = vec4(aPosition.x, aPosition.y, 0.0, 1.0);\n | |
| 80 | +\n | |
| 81 | + float index = aPosition.z;\n | |
| 82 | + if( uProgress < index )\n | |
| 83 | + {\n | |
| 84 | + vertexPosition = vec4(0.0, 0.0, 0.0, 1.0);\n | |
| 85 | + }\n | |
| 86 | +\n | |
| 87 | + vertexPosition.xyz *= uSize;\n | |
| 88 | + gl_Position = uMvpMatrix * vertexPosition;\n | |
| 89 | +}\n | |
| 90 | +); | |
| 91 | + | |
| 92 | +/* | |
| 93 | + * Fragment shader for polygon | |
| 94 | + */ | |
| 95 | +const char* FRAGMENT_SHADER_BASIC = DALI_COMPOSE_SHADER( | |
| 96 | + | |
| 97 | +void main()\n | |
| 98 | +{\n | |
| 99 | + gl_FragColor = vec4( 1.0, 1.0, 1.0, 1.0 );\n | |
| 100 | +}\n | |
| 101 | +); | |
| 102 | + | |
| 103 | +} // unnamed namespace | |
| 104 | + | |
| 105 | + | |
| 106 | +// This example shows how to render a radial progress indicator | |
| 107 | +// | |
| 108 | +class RadialProgressController : public ConnectionTracker | |
| 109 | +{ | |
| 110 | +public: | |
| 111 | + | |
| 112 | + RadialProgressController( Application& application ) | |
| 113 | + : mApplication( application ) | |
| 114 | + { | |
| 115 | + // Connect to the Application's Init signal | |
| 116 | + mApplication.InitSignal().Connect( this, &RadialProgressController::Create ); | |
| 117 | + } | |
| 118 | + | |
| 119 | + ~RadialProgressController() | |
| 120 | + { | |
| 121 | + // Nothing to do here | |
| 122 | + } | |
| 123 | + | |
| 124 | + // The Init signal is received once (only) during the Application lifetime | |
| 125 | + void Create( Application& application ) | |
| 126 | + { | |
| 127 | + Stage stage = Stage::GetCurrent(); | |
| 128 | + stage.SetBackgroundColor( Color::BLACK ); | |
| 129 | + | |
| 130 | + // 1. Create actor to show the effect | |
| 131 | + mActor = Actor::New(); | |
| 132 | + mActor.SetAnchorPoint( AnchorPoint::CENTER ); | |
| 133 | + mActor.SetParentOrigin( ParentOrigin::CENTER ); | |
| 134 | + mActor.SetSize( Vector2( TEXTURE_WIDTH, TEXTURE_HEIGHT ) ); | |
| 135 | + mActor.RegisterProperty("uProgress", float(1.0f) ); | |
| 136 | + stage.Add( mActor ); | |
| 137 | + | |
| 138 | + // 1. Create stencil renderer i.e. a triangle fan in the shape of a circle | |
| 139 | + Renderer stencilRenderer = CreatePolygon( NUMBER_OF_SIDES ); | |
| 140 | + mActor.AddRenderer( stencilRenderer ); | |
| 141 | + | |
| 142 | + // 2. Create textured quad renderer | |
| 143 | + Renderer texturedQuad = CreateTexturedQuad( TEXTURE_URL ); | |
| 144 | + mActor.AddRenderer( texturedQuad ); | |
| 145 | + | |
| 146 | + // 5. Animate the progress uniform | |
| 147 | + Animation animation = Animation::New( PROGRESS_DURATION + INITIAL_DELAY ); | |
| 148 | + animation.AnimateTo( Property(mActor,"uProgress"), float(NUMBER_OF_SIDES+1), TimePeriod(INITIAL_DELAY, PROGRESS_DURATION) ); | |
| 149 | + animation.Play(); | |
| 150 | + | |
| 151 | + // 6. Exit the application when touched | |
| 152 | + stage.GetRootLayer().TouchSignal().Connect( this, &RadialProgressController::OnTouch ); | |
| 153 | + } | |
| 154 | + | |
| 155 | + bool OnTouch( Actor actor, const TouchData& touch ) | |
| 156 | + { | |
| 157 | + // quit the application | |
| 158 | + mApplication.Quit(); | |
| 159 | + return true; | |
| 160 | + } | |
| 161 | + | |
| 162 | + /** | |
| 163 | + * Generates stencil mask geometry. Geometry is rendered as | |
| 164 | + * a triangle fan and occupies square 2.0x2.0. | |
| 165 | + * @param[in] numberOfSides The more subdivisions the more smooth mask animation. | |
| 166 | + */ | |
| 167 | + Renderer CreatePolygon( unsigned int numberOfSides ) | |
| 168 | + { | |
| 169 | + float count( numberOfSides ); | |
| 170 | + | |
| 171 | + // compute radial step in radians | |
| 172 | + const float STEP( (2.0f * M_PI) / count ); | |
| 173 | + float angle( 0.0f ); | |
| 174 | + | |
| 175 | + std::vector< Vector3 > vertices; | |
| 176 | + vertices.push_back( Vector3::ZERO ); | |
| 177 | + | |
| 178 | + for( size_t i = 0; i <= numberOfSides; ++i ) | |
| 179 | + { | |
| 180 | + vertices.push_back( Vector3( -0.5f * cos( angle ), -0.5f * sin( angle ), i+1 ) ); | |
| 181 | + angle += STEP; | |
| 182 | + } | |
| 183 | + | |
| 184 | + Property::Map vertexFormat; | |
| 185 | + vertexFormat[ "aPosition" ] = Property::VECTOR3; | |
| 186 | + | |
| 187 | + // describe vertex format ( only 2-dimensional positions ) | |
| 188 | + PropertyBuffer vertexBuffer = PropertyBuffer::New( vertexFormat ); | |
| 189 | + vertexBuffer.SetData( vertices.data(), vertices.size() ); | |
| 190 | + | |
| 191 | + // create geometry | |
| 192 | + Geometry geometry = Geometry::New(); | |
| 193 | + geometry.AddVertexBuffer( vertexBuffer ); | |
| 194 | + geometry.SetType( Geometry::TRIANGLE_FAN ); | |
| 195 | + | |
| 196 | + Shader shader = Shader::New( VERTEX_SHADER_BASIC, FRAGMENT_SHADER_BASIC ); | |
| 197 | + Renderer renderer = Renderer::New( geometry, shader ); | |
| 198 | + | |
| 199 | + // Setting stencil data. We don't want to render to the color buffer so | |
| 200 | + // with use of RenderMode property we specify that only stencil buffer will | |
| 201 | + // be affected. | |
| 202 | + renderer.SetProperty( Renderer::Property::RENDER_MODE, RenderMode::STENCIL ); | |
| 203 | + | |
| 204 | + // Set stencil function | |
| 205 | + renderer.SetProperty( Renderer::Property::STENCIL_FUNCTION, StencilFunction::ALWAYS ); | |
| 206 | + | |
| 207 | + // Stencil function reference | |
| 208 | + renderer.SetProperty( Renderer::Property::STENCIL_FUNCTION_REFERENCE, 1 ); | |
| 209 | + | |
| 210 | + // Stencil function mask | |
| 211 | + renderer.SetProperty( Renderer::Property::STENCIL_FUNCTION_MASK, 0xFF ); | |
| 212 | + | |
| 213 | + // Set stencil operations | |
| 214 | + renderer.SetProperty( Renderer::Property::STENCIL_OPERATION_ON_FAIL, StencilOperation::KEEP ); | |
| 215 | + renderer.SetProperty( Renderer::Property::STENCIL_OPERATION_ON_Z_FAIL, StencilOperation::KEEP ); | |
| 216 | + renderer.SetProperty( Renderer::Property::STENCIL_OPERATION_ON_Z_PASS, StencilOperation::REPLACE ); | |
| 217 | + | |
| 218 | + // Stencil mask to write | |
| 219 | + renderer.SetProperty( Renderer::Property::STENCIL_MASK, 0xFF ); | |
| 220 | + | |
| 221 | + // Set depth index lower than textured quad renderer, so stencil will render first | |
| 222 | + renderer.SetProperty( Renderer::Property::DEPTH_INDEX, 1 ); | |
| 223 | + | |
| 224 | + return renderer; | |
| 225 | + } | |
| 226 | + | |
| 227 | + /** | |
| 228 | + * Creates textured quad renderer | |
| 229 | + */ | |
| 230 | + Renderer CreateTexturedQuad( const char* url ) | |
| 231 | + { | |
| 232 | + // Create shader & geometry needed by Renderer | |
| 233 | + | |
| 234 | + Shader shader = Shader::New( VERTEX_SHADER_TEXTURED, FRAGMENT_SHADER_TEXTURED ); | |
| 235 | + | |
| 236 | + Property::Map vertexFormat; | |
| 237 | + vertexFormat["aPosition"] = Property::VECTOR2; | |
| 238 | + PropertyBuffer vertexBuffer = PropertyBuffer::New( vertexFormat ); | |
| 239 | + | |
| 240 | + const float P( 0.5f ); | |
| 241 | + const Vector2 vertices[] = { | |
| 242 | + Vector2( -P, -P ), | |
| 243 | + Vector2( +P, -P ), | |
| 244 | + Vector2( -P, +P ), | |
| 245 | + Vector2( +P, +P ) | |
| 246 | + }; | |
| 247 | + | |
| 248 | + vertexBuffer.SetData( vertices, 4 ); | |
| 249 | + | |
| 250 | + // Instantiate quad geometry | |
| 251 | + Geometry geometry = Geometry::New(); | |
| 252 | + geometry.AddVertexBuffer( vertexBuffer ); | |
| 253 | + geometry.SetType( Geometry::TRIANGLE_STRIP ); | |
| 254 | + | |
| 255 | + // Load texture | |
| 256 | + PixelData pixelData = Toolkit::SyncImageLoader::Load( url ); | |
| 257 | + Texture texture = Texture::New( TextureType::TEXTURE_2D, pixelData.GetPixelFormat(), pixelData.GetWidth(), pixelData.GetHeight() ); | |
| 258 | + texture.Upload( pixelData ); | |
| 259 | + texture.GenerateMipmaps(); | |
| 260 | + | |
| 261 | + // Create texture set | |
| 262 | + TextureSet textureSet = TextureSet::New(); | |
| 263 | + textureSet.SetTexture( 0, texture ); | |
| 264 | + | |
| 265 | + // Create renderer | |
| 266 | + Renderer renderer = Renderer::New( geometry, shader ); | |
| 267 | + renderer.SetTextures( textureSet ); | |
| 268 | + | |
| 269 | + // Set mode indicating we will use both stencil and color buffers | |
| 270 | + renderer.SetProperty( Renderer::Property::RENDER_MODE, RenderMode::COLOR_STENCIL ); | |
| 271 | + | |
| 272 | + // Stencil function - expecing drawing only when function mask matches exactly | |
| 273 | + renderer.SetProperty( Renderer::Property::STENCIL_FUNCTION, StencilFunction::EQUAL ); | |
| 274 | + renderer.SetProperty( Renderer::Property::STENCIL_FUNCTION_REFERENCE, 1 ); | |
| 275 | + renderer.SetProperty( Renderer::Property::STENCIL_FUNCTION_MASK, 0xFF ); | |
| 276 | + | |
| 277 | + // We don't want to draw to the stencil, so setting stencil draw mask to 0 | |
| 278 | + renderer.SetProperty( Renderer::Property::STENCIL_MASK, 0x00 ); | |
| 279 | + | |
| 280 | + // Make sure the quad will render after drawing to stencil buffer | |
| 281 | + renderer.SetProperty( Renderer::Property::DEPTH_INDEX, 2 ); | |
| 282 | + | |
| 283 | + return renderer; | |
| 284 | + } | |
| 285 | + | |
| 286 | +private: | |
| 287 | + | |
| 288 | + Application& mApplication; | |
| 289 | + | |
| 290 | + Actor mActor; | |
| 291 | +}; | |
| 292 | + | |
| 293 | +void RunTest( Application& application ) | |
| 294 | +{ | |
| 295 | + RadialProgressController test( application ); | |
| 296 | + | |
| 297 | + application.MainLoop(); | |
| 298 | +} | |
| 299 | + | |
| 300 | +// Entry point for Linux & Tizen applications | |
| 301 | +// | |
| 302 | +int DALI_EXPORT_API main( int argc, char **argv ) | |
| 303 | +{ | |
| 304 | + Application application = Application::New( &argc, &argv ); | |
| 305 | + | |
| 306 | + RunTest( application ); | |
| 307 | + | |
| 308 | + return 0; | |
| 309 | +} | ... | ... |
examples/text-scrolling/text-scrolling-example.cpp
| 1 | 1 | /* |
| 2 | - * Copyright (c) 2016 Samsung Electronics Co., Ltd. | |
| 2 | + * Copyright (c) 2017 Samsung Electronics Co., Ltd. | |
| 3 | 3 | * |
| 4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | 5 | * you may not use this file except in compliance with the License. |
| ... | ... | @@ -22,13 +22,13 @@ |
| 22 | 22 | |
| 23 | 23 | // EXTERNAL INCLUDES |
| 24 | 24 | #include <dali-toolkit/dali-toolkit.h> |
| 25 | +#include <dali-toolkit/devel-api/controls/buttons/button-devel.h> | |
| 25 | 26 | |
| 26 | 27 | using namespace Dali; |
| 27 | 28 | using namespace Dali::Toolkit; |
| 28 | 29 | |
| 29 | 30 | namespace |
| 30 | 31 | { |
| 31 | -const char* DESKTOP_IMAGE( DEMO_IMAGE_DIR "woodEffect.jpg" ); | |
| 32 | 32 | const Vector2 DESKTOP_SIZE( Vector2( 1440.f, 1600.f ) ); |
| 33 | 33 | const Vector2 BOX_SIZE( Vector2(330.0f, 80.0f ) ); |
| 34 | 34 | const Vector2 SCROLLING_BOX_SIZE( Vector2(330.0f, 40.0f ) ); |
| ... | ... | @@ -54,7 +54,8 @@ public: |
| 54 | 54 | TextScrollingExample( Application& application ) |
| 55 | 55 | : mApplication( application ), |
| 56 | 56 | mTargetActorPosition(), |
| 57 | - mTargetActorSize() | |
| 57 | + mTargetActorSize(), | |
| 58 | + mToggleColor( false ) | |
| 58 | 59 | { |
| 59 | 60 | // Connect to the Application's Init signal |
| 60 | 61 | mApplication.InitSignal().Connect( this, &TextScrollingExample::Create ); |
| ... | ... | @@ -78,7 +79,7 @@ public: |
| 78 | 79 | |
| 79 | 80 | Dali::Property::Map border; |
| 80 | 81 | border.Insert( Visual::Property::TYPE, Visual::BORDER ); |
| 81 | - border.Insert( BorderVisual::Property::COLOR, Color::WHITE ); | |
| 82 | + border.Insert( BorderVisual::Property::COLOR, Color::BLUE ); | |
| 82 | 83 | border.Insert( BorderVisual::Property::SIZE, 1.f ); |
| 83 | 84 | box.SetProperty( Control::Property::BACKGROUND, border ); |
| 84 | 85 | } |
| ... | ... | @@ -125,14 +126,13 @@ public: |
| 125 | 126 | |
| 126 | 127 | stage.Add( rootActor ); |
| 127 | 128 | |
| 129 | + mAnimation = Animation::New( 1.0f ); | |
| 130 | + | |
| 128 | 131 | const Size mTargetActorSize( mStageSize.width, DESKTOP_SIZE.height ); |
| 129 | 132 | |
| 130 | 133 | // Create Desktop |
| 131 | - ImageView desktop = ImageView::New(); | |
| 132 | - Property::Map imageMap; | |
| 133 | - imageMap[ "url" ] = DESKTOP_IMAGE; | |
| 134 | - imageMap[ "synchronousLoading" ] = true; | |
| 135 | - desktop.SetProperty( ImageView::Property::IMAGE, imageMap ); | |
| 134 | + Control desktop = Control::New(); | |
| 135 | + desktop.SetBackgroundColor( Color::WHITE ); | |
| 136 | 136 | desktop.SetName("desktopActor"); |
| 137 | 137 | desktop.SetAnchorPoint( AnchorPoint::TOP_LEFT ); |
| 138 | 138 | desktop.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS ); |
| ... | ... | @@ -172,9 +172,9 @@ public: |
| 172 | 172 | Toolkit::PushButton scrollSmallButton = Toolkit::PushButton::New(); |
| 173 | 173 | scrollSmallButton.ClickedSignal().Connect( this, &TextScrollingExample::OnButtonClickedSmall ); |
| 174 | 174 | CreateLabel( mSmallLabel, "A Quick Brown Fox", boxC , true, scrollSmallButton ); |
| 175 | - mSmallLabel.SetProperty( TextLabel::Property::TEXT_COLOR, Color::WHITE ); | |
| 175 | + mSmallLabel.SetProperty( TextLabel::Property::TEXT_COLOR, Color::BLACK ); | |
| 176 | 176 | mSmallLabel.SetProperty( TextLabel::Property::SHADOW_OFFSET, Vector2( 1.0f, 1.0f ) ); |
| 177 | - mSmallLabel.SetProperty( TextLabel::Property::SHADOW_COLOR, Color::BLACK ); | |
| 177 | + mSmallLabel.SetProperty( TextLabel::Property::SHADOW_COLOR, Color::CYAN ); | |
| 178 | 178 | |
| 179 | 179 | CreateBox( "boxD", boxD, desktop, SCROLLING_BOX_SIZE ); |
| 180 | 180 | boxD.SetPosition( 0.0f, -200.0f, 1.0f ); |
| ... | ... | @@ -186,12 +186,25 @@ public: |
| 186 | 186 | boxE.SetPosition( 0.0f, -100.0f, 1.0f ); |
| 187 | 187 | Toolkit::PushButton scrollRtlLongButton = Toolkit::PushButton::New(); |
| 188 | 188 | scrollRtlLongButton.ClickedSignal().Connect( this, &TextScrollingExample::OnButtonClickedRtlLong ); |
| 189 | - CreateLabel( mRtlLongLabel, " مرحبا بالعالم مرحبا بالعالم مرحبا بالعالم", boxE , false, scrollRtlLongButton ); | |
| 190 | - | |
| 189 | + CreateLabel( mRtlLongLabel, " مرحبا بالعالم مرحبا بالعالم مرحبا بالعالم مرحبا بالعالم مرحبا بالعالم مرحبا بالعالم مرحبا بالعالم مرحبا بالعالم مرحبا بالعالم", boxE , false, scrollRtlLongButton ); | |
| 190 | + mRtlLongLabel.SetProperty(TextLabel::Property::AUTO_SCROLL_SPEED, 500); | |
| 191 | + mRtlLongLabel.SetProperty(TextLabel::Property::AUTO_SCROLL_GAP, 500); | |
| 192 | + mRtlLongLabel.SetProperty(TextLabel::Property::AUTO_SCROLL_LOOP_COUNT, 3); | |
| 191 | 193 | |
| 192 | 194 | mPanGestureDetector = PanGestureDetector::New(); |
| 193 | 195 | mPanGestureDetector.DetectedSignal().Connect(this, &TextScrollingExample::OnPanGesture ); |
| 194 | 196 | mPanGestureDetector.Attach( desktop ); |
| 197 | + | |
| 198 | + Toolkit::PushButton colorButton = Toolkit::PushButton::New(); | |
| 199 | + colorButton.SetProperty( Button::Property::TOGGLABLE, true ); | |
| 200 | + colorButton.SetProperty( DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, Property::Map().Add ( Visual::Property::TYPE, Visual::COLOR ).Add( ColorVisual::Property::MIX_COLOR, Color::RED ) ); | |
| 201 | + colorButton.SetProperty( DevelButton::Property::SELECTED_BACKGROUND_VISUAL, Property::Map().Add ( Visual::Property::TYPE, Visual::COLOR ).Add( ColorVisual::Property::MIX_COLOR, Color::BLACK ) ); | |
| 202 | + colorButton.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER ); | |
| 203 | + colorButton.SetParentOrigin( ParentOrigin::BOTTOM_CENTER ); | |
| 204 | + colorButton.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS ); | |
| 205 | + colorButton.SetSize(BOX_SIZE.height,BOX_SIZE.height); | |
| 206 | + colorButton.ClickedSignal().Connect( this, &TextScrollingExample::OnColorButtonClicked ); | |
| 207 | + rootActor.Add( colorButton ); | |
| 195 | 208 | } |
| 196 | 209 | |
| 197 | 210 | void EnableScrolling( Labels labels ) |
| ... | ... | @@ -263,6 +276,28 @@ public: |
| 263 | 276 | return true; |
| 264 | 277 | } |
| 265 | 278 | |
| 279 | + bool OnColorButtonClicked( Toolkit::Button button ) | |
| 280 | + { | |
| 281 | + Vector4 color = Color::RED; | |
| 282 | + | |
| 283 | + if ( mToggleColor ) | |
| 284 | + { | |
| 285 | + color = Color::BLACK; | |
| 286 | + mToggleColor = false; | |
| 287 | + } | |
| 288 | + else | |
| 289 | + { | |
| 290 | + mToggleColor = true; | |
| 291 | + } | |
| 292 | + | |
| 293 | + mSmallLabel.SetProperty( TextLabel::Property::SHADOW_COLOR, Color::BLACK ); | |
| 294 | + mSmallLabel.SetProperty( TextLabel::Property::TEXT_COLOR, color ); | |
| 295 | + mLargeLabel.SetProperty( TextLabel::Property::TEXT_COLOR, color ); | |
| 296 | + mRtlLongLabel.SetProperty( TextLabel::Property::TEXT_COLOR, color ); | |
| 297 | + | |
| 298 | + return true; | |
| 299 | + } | |
| 300 | + | |
| 266 | 301 | /** |
| 267 | 302 | * Main key event handler |
| 268 | 303 | */ |
| ... | ... | @@ -274,6 +309,18 @@ public: |
| 274 | 309 | { |
| 275 | 310 | mApplication.Quit(); |
| 276 | 311 | } |
| 312 | + else | |
| 313 | + { | |
| 314 | + if ( event.keyPressedName == "2" ) | |
| 315 | + { | |
| 316 | + mAnimation.AnimateTo( Property( mSmallLabel, Actor::Property::SCALE ), Vector3(1.2f, 1.2f, 0.0f), AlphaFunction::BOUNCE, TimePeriod( 1.0f, 1.0f ) ); | |
| 317 | + mAnimation.AnimateTo( Property( mLargeLabel, Actor::Property::SCALE ), Vector3(1.2f, 1.2f, 0.0f), AlphaFunction::BOUNCE, TimePeriod( 1.0f, 1.0f ) ); | |
| 318 | + mAnimation.AnimateTo( Property( mRtlLabel, Actor::Property::SCALE ), Vector3(1.2f, 1.2f, 0.0f), AlphaFunction::BOUNCE, TimePeriod( 1.0f, 1.0f ) ); | |
| 319 | + mAnimation.AnimateTo( Property( mRtlLongLabel, Actor::Property::SCALE ), Vector3(1.2f, 1.2f, 0.0f), AlphaFunction::BOUNCE, TimePeriod( 1.0f, 1.0f ) ); | |
| 320 | + | |
| 321 | + mAnimation.Play(); | |
| 322 | + } | |
| 323 | + } | |
| 277 | 324 | } |
| 278 | 325 | } |
| 279 | 326 | |
| ... | ... | @@ -302,6 +349,10 @@ private: |
| 302 | 349 | TextLabel mSmallLabel; |
| 303 | 350 | TextLabel mRtlLabel; |
| 304 | 351 | TextLabel mRtlLongLabel; |
| 352 | + | |
| 353 | + Animation mAnimation; | |
| 354 | + | |
| 355 | + bool mToggleColor; | |
| 305 | 356 | }; |
| 306 | 357 | |
| 307 | 358 | void RunTest( Application& application ) | ... | ... |
packaging/com.samsung.dali-demo.spec
resources/images/RadialEffect-280x280.png
0 → 100644
32.4 KB
resources/po/as.po
resources/po/de.po
resources/po/en_GB.po
resources/po/en_US.po
resources/po/es.po
resources/po/fi.po
resources/po/ko.po
resources/po/ml.po
resources/po/ur.po
resources/po/zn_CH.po
shared/dali-demo-strings.h
| ... | ... | @@ -73,6 +73,7 @@ extern "C" |
| 73 | 73 | #define DALI_DEMO_STR_TITLE_RENDERING_DRAW_TRIANGLE dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_RENDERING_DRAW_TRIANGLE") |
| 74 | 74 | #define DALI_DEMO_STR_TITLE_RENDERING_DRAW_CUBE dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_RENDERING_DRAW_CUBE") |
| 75 | 75 | #define DALI_DEMO_STR_TITLE_RENDERING_TEXTURED_CUBE dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_RENDERING_TEXTURED_CUBE") |
| 76 | +#define DALI_DEMO_STR_TITLE_RENDERING_RADIAL_PROGRESS dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_RENDERING_RADIAL_PROGRESS") | |
| 76 | 77 | #define DALI_DEMO_STR_TITLE_REFRACTION dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_REFRACTION") |
| 77 | 78 | #define DALI_DEMO_STR_TITLE_RENDERER_STENCIL dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_RENDERER_STENCIL") |
| 78 | 79 | #define DALI_DEMO_STR_TITLE_SIMPLE_VISUALS_CONTROL dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_SIMPLE_VISUALS") |
| ... | ... | @@ -133,6 +134,7 @@ extern "C" |
| 133 | 134 | #define DALI_DEMO_STR_TITLE_RENDERING_DRAW_TRIANGLE "Draw Triangle" |
| 134 | 135 | #define DALI_DEMO_STR_TITLE_RENDERING_DRAW_CUBE "Draw Cube" |
| 135 | 136 | #define DALI_DEMO_STR_TITLE_RENDERING_TEXTURED_CUBE "Textured Cube" |
| 137 | +#define DALI_DEMO_STR_TITLE_RENDERING_RADIAL_PROGRESS "Radial Progress" | |
| 136 | 138 | #define DALI_DEMO_STR_TITLE_REFRACTION "Refract Effect" |
| 137 | 139 | #define DALI_DEMO_STR_TITLE_RENDERER_STENCIL "Renderer Stencils" |
| 138 | 140 | #define DALI_DEMO_STR_TITLE_SIMPLE_VISUALS_CONTROL "Simple Visuals Control" | ... | ... |