Commit 94d678d62ca15faaced5deaf379f9ea4a6f16b7d
[dali_1.2.29] Merge branch 'devel/master'
Change-Id: I1409c2df0c9f782dfda16343b181a3088cb795c0
Showing
32 changed files
with
1950 additions
and
11 deletions
build/tizen/CMakeLists.txt
| @@ -103,6 +103,7 @@ CONFIGURE_FILE( resources-location.in ${DEMO_SHARED}/resources-location.cpp ) | @@ -103,6 +103,7 @@ CONFIGURE_FILE( resources-location.in ${DEMO_SHARED}/resources-location.cpp ) | ||
| 103 | CONFIGURE_FILE( ${LOCAL_STYLE_DIR}/demo-theme.json.in ${LOCAL_STYLE_DIR}/demo-theme.json ) | 103 | CONFIGURE_FILE( ${LOCAL_STYLE_DIR}/demo-theme.json.in ${LOCAL_STYLE_DIR}/demo-theme.json ) |
| 104 | CONFIGURE_FILE( ${LOCAL_STYLE_DIR}/contact-cards-example-theme.json.in ${LOCAL_STYLE_DIR}/contact-cards-example-theme.json ) | 104 | CONFIGURE_FILE( ${LOCAL_STYLE_DIR}/contact-cards-example-theme.json.in ${LOCAL_STYLE_DIR}/contact-cards-example-theme.json ) |
| 105 | CONFIGURE_FILE( ${LOCAL_STYLE_DIR}/progress-bar-example-theme.json.in ${LOCAL_STYLE_DIR}/progress-bar-example-theme.json ) | 105 | CONFIGURE_FILE( ${LOCAL_STYLE_DIR}/progress-bar-example-theme.json.in ${LOCAL_STYLE_DIR}/progress-bar-example-theme.json ) |
| 106 | +CONFIGURE_FILE( ${LOCAL_STYLE_DIR}/simple-example-theme.json.in ${LOCAL_STYLE_DIR}/simple-example-theme.json ) | ||
| 106 | CONFIGURE_FILE( ${LOCAL_STYLE_DIR}/style-example-theme-one.json.in ${LOCAL_STYLE_DIR}/style-example-theme-one.json ) | 107 | CONFIGURE_FILE( ${LOCAL_STYLE_DIR}/style-example-theme-one.json.in ${LOCAL_STYLE_DIR}/style-example-theme-one.json ) |
| 107 | CONFIGURE_FILE( ${LOCAL_STYLE_DIR}/style-example-theme-two.json.in ${LOCAL_STYLE_DIR}/style-example-theme-two.json ) | 108 | CONFIGURE_FILE( ${LOCAL_STYLE_DIR}/style-example-theme-two.json.in ${LOCAL_STYLE_DIR}/style-example-theme-two.json ) |
| 108 | CONFIGURE_FILE( ${LOCAL_STYLE_DIR}/style-example-theme-three.json.in ${LOCAL_STYLE_DIR}/style-example-theme-three.json ) | 109 | CONFIGURE_FILE( ${LOCAL_STYLE_DIR}/style-example-theme-three.json.in ${LOCAL_STYLE_DIR}/style-example-theme-three.json ) |
com.samsung.dali-demo.xml
| @@ -32,6 +32,9 @@ | @@ -32,6 +32,9 @@ | ||
| 32 | <ui-application appid="cube-transition-effect.example" exec="/usr/apps/com.samsung.dali-demo/bin/cube-transition-effect.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> | 32 | <ui-application appid="cube-transition-effect.example" exec="/usr/apps/com.samsung.dali-demo/bin/cube-transition-effect.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> |
| 33 | <label>Cube transition effect</label> | 33 | <label>Cube transition effect</label> |
| 34 | </ui-application> | 34 | </ui-application> |
| 35 | + <ui-application appid="simple-visuals-control.example" exec="/usr/apps/com.samsung.dali-demo/bin/simple-visuals-control.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> | ||
| 36 | + <label>Simple Control</label> | ||
| 37 | + </ui-application> | ||
| 35 | <ui-application appid="dissolve-effect.example" exec="/usr/apps/com.samsung.dali-demo/bin/dissolve-effect.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> | 38 | <ui-application appid="dissolve-effect.example" exec="/usr/apps/com.samsung.dali-demo/bin/dissolve-effect.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> |
| 36 | <label>Dissolve effect</label> | 39 | <label>Dissolve effect</label> |
| 37 | </ui-application> | 40 | </ui-application> |
examples-reel/dali-examples-reel.cpp
| @@ -61,6 +61,10 @@ int DALI_EXPORT_API main(int argc, char **argv) | @@ -61,6 +61,10 @@ int DALI_EXPORT_API main(int argc, char **argv) | ||
| 61 | demo.AddExample(Example("popup.example", DALI_DEMO_STR_TITLE_POPUP)); | 61 | demo.AddExample(Example("popup.example", DALI_DEMO_STR_TITLE_POPUP)); |
| 62 | demo.AddExample(Example("primitive-shapes.example", DALI_DEMO_STR_TITLE_PRIMITIVE_SHAPES)); | 62 | demo.AddExample(Example("primitive-shapes.example", DALI_DEMO_STR_TITLE_PRIMITIVE_SHAPES)); |
| 63 | demo.AddExample(Example("progress-bar.example", DALI_DEMO_STR_TITLE_PROGRESS_BAR)); | 63 | demo.AddExample(Example("progress-bar.example", DALI_DEMO_STR_TITLE_PROGRESS_BAR)); |
| 64 | + demo.AddExample(Example("rendering-line.example", DALI_DEMO_STR_TITLE_RENDERING_DRAW_LINE)); | ||
| 65 | + demo.AddExample(Example("rendering-triangle.example", DALI_DEMO_STR_TITLE_RENDERING_DRAW_TRIANGLE)); | ||
| 66 | + demo.AddExample(Example("rendering-cube.example", DALI_DEMO_STR_TITLE_RENDERING_DRAW_CUBE)); | ||
| 67 | + demo.AddExample(Example("rendering-textured-cube.example", DALI_DEMO_STR_TITLE_RENDERING_TEXTURED_CUBE)); | ||
| 64 | demo.AddExample(Example("scroll-view.example", DALI_DEMO_STR_TITLE_SCROLL_VIEW)); | 68 | demo.AddExample(Example("scroll-view.example", DALI_DEMO_STR_TITLE_SCROLL_VIEW)); |
| 65 | demo.AddExample(Example("size-negotiation.example", DALI_DEMO_STR_TITLE_NEGOTIATE_SIZE)); | 69 | demo.AddExample(Example("size-negotiation.example", DALI_DEMO_STR_TITLE_NEGOTIATE_SIZE)); |
| 66 | demo.AddExample(Example("styling.example", DALI_DEMO_STR_TITLE_STYLING)); | 70 | demo.AddExample(Example("styling.example", DALI_DEMO_STR_TITLE_STYLING)); |
| @@ -70,7 +74,7 @@ int DALI_EXPORT_API main(int argc, char **argv) | @@ -70,7 +74,7 @@ int DALI_EXPORT_API main(int argc, char **argv) | ||
| 70 | demo.AddExample(Example("text-label-multi-language.example", DALI_DEMO_STR_TITLE_TEXT_LABEL_MULTI_LANGUAGE)); | 74 | demo.AddExample(Example("text-label-multi-language.example", DALI_DEMO_STR_TITLE_TEXT_LABEL_MULTI_LANGUAGE)); |
| 71 | demo.AddExample(Example("text-label-emojis.example", DALI_DEMO_STR_TITLE_EMOJI_TEXT)); | 75 | demo.AddExample(Example("text-label-emojis.example", DALI_DEMO_STR_TITLE_EMOJI_TEXT)); |
| 72 | demo.AddExample(Example("text-scrolling.example", DALI_DEMO_STR_TITLE_TEXT_SCROLLING)); | 76 | demo.AddExample(Example("text-scrolling.example", DALI_DEMO_STR_TITLE_TEXT_SCROLLING)); |
| 73 | - demo.AddExample(Example("textured-mesh.example", DALI_DEMO_STR_TITLE_TEXTURED_MESH)); | 77 | + demo.AddExample(Example("texturedss-mesh.example", DALI_DEMO_STR_TITLE_TEXTURED_MESH)); |
| 74 | demo.AddExample(Example("tilt.example", DALI_DEMO_STR_TITLE_TILT_SENSOR)); | 78 | demo.AddExample(Example("tilt.example", DALI_DEMO_STR_TITLE_TILT_SENSOR)); |
| 75 | demo.AddExample(Example("tooltip.example", DALI_DEMO_STR_TITLE_TOOLTIP)); | 79 | demo.AddExample(Example("tooltip.example", DALI_DEMO_STR_TITLE_TOOLTIP)); |
| 76 | demo.AddExample(Example("transitions.example", DALI_DEMO_STR_TITLE_VISUAL_TRANSITIONS)); | 80 | demo.AddExample(Example("transitions.example", DALI_DEMO_STR_TITLE_VISUAL_TRANSITIONS)); |
examples/rendering-cube/rendering-cube.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 | +using namespace Toolkit; | ||
| 23 | + | ||
| 24 | +namespace | ||
| 25 | +{ | ||
| 26 | + | ||
| 27 | +/* | ||
| 28 | + * Vertex shader | ||
| 29 | + */ | ||
| 30 | +const char* VERTEX_SHADER = DALI_COMPOSE_SHADER( | ||
| 31 | +attribute mediump vec3 aPosition;\n // DALi shader builtin | ||
| 32 | +attribute mediump vec3 aColor;\n // DALi shader builtin | ||
| 33 | +uniform mediump mat4 uMvpMatrix;\n // DALi shader builtin | ||
| 34 | +uniform mediump vec3 uSize;\n // DALi shader builtin | ||
| 35 | +\n | ||
| 36 | +varying mediump vec4 vColor;\n | ||
| 37 | +\n | ||
| 38 | +void main()\n | ||
| 39 | +{\n | ||
| 40 | + mediump vec4 vertexPosition = vec4(aPosition, 1.0);\n | ||
| 41 | + vertexPosition.xyz *= uSize;\n | ||
| 42 | + vColor = vec4( aColor, 1.0 );\n | ||
| 43 | + gl_Position = uMvpMatrix * vertexPosition;\n | ||
| 44 | +}\n | ||
| 45 | +); | ||
| 46 | + | ||
| 47 | +/* | ||
| 48 | + * Fragment shader | ||
| 49 | + */ | ||
| 50 | +const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER( | ||
| 51 | +varying mediump vec4 vColor;\n | ||
| 52 | +\n | ||
| 53 | +void main()\n | ||
| 54 | +{\n | ||
| 55 | + gl_FragColor = vColor;\n | ||
| 56 | +}\n | ||
| 57 | +); | ||
| 58 | + | ||
| 59 | +} | ||
| 60 | + | ||
| 61 | +// This example shows how to create a cube with colors on each side | ||
| 62 | +// | ||
| 63 | +class DrawCubeController : public ConnectionTracker | ||
| 64 | +{ | ||
| 65 | +public: | ||
| 66 | + | ||
| 67 | + DrawCubeController( Application& application ) | ||
| 68 | + : mApplication( application ) | ||
| 69 | + { | ||
| 70 | + // Connect to the Application's Init signal | ||
| 71 | + mApplication.InitSignal().Connect( this, &DrawCubeController::Create ); | ||
| 72 | + } | ||
| 73 | + | ||
| 74 | + ~DrawCubeController() | ||
| 75 | + { | ||
| 76 | + // Nothing to do here; | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | + // The Init signal is received once (only) during the Application lifetime | ||
| 80 | + void Create( Application& application ) | ||
| 81 | + { | ||
| 82 | + // Get a handle to the stage | ||
| 83 | + Stage stage = Stage::GetCurrent(); | ||
| 84 | + stage.SetBackgroundColor( Color::WHITE ); | ||
| 85 | + | ||
| 86 | + // Step 1. Create shader | ||
| 87 | + CreateCubeShader(); | ||
| 88 | + | ||
| 89 | + // Step 2. Prepare geometry | ||
| 90 | + CreateCubeGeometry(); | ||
| 91 | + | ||
| 92 | + // Step 3. Create a renderer | ||
| 93 | + CreateRenderer(); | ||
| 94 | + | ||
| 95 | + // Step 4. Create an Actor | ||
| 96 | + CreateActor(); | ||
| 97 | + | ||
| 98 | + // Step 5. Play animation to rotate the cube | ||
| 99 | + PlayAnimation(); | ||
| 100 | + | ||
| 101 | + // Respond to a click anywhere on the stage | ||
| 102 | + stage.GetRootLayer().TouchSignal().Connect( this, &DrawCubeController::OnTouch ); | ||
| 103 | + } | ||
| 104 | + | ||
| 105 | + bool OnTouch( Actor actor, const TouchData& touch ) | ||
| 106 | + { | ||
| 107 | + // quit the application | ||
| 108 | + mApplication.Quit(); | ||
| 109 | + return true; | ||
| 110 | + } | ||
| 111 | + | ||
| 112 | + /** | ||
| 113 | + * This function creates a cube geometry including texture coordinates. | ||
| 114 | + * Also it demonstrates using the indexed draw feature by setting an index array. | ||
| 115 | + */ | ||
| 116 | + void CreateCubeGeometry() | ||
| 117 | + { | ||
| 118 | + struct Vertex | ||
| 119 | + { | ||
| 120 | + Vector3 aPosition; | ||
| 121 | + Vector3 aColor; | ||
| 122 | + }; | ||
| 123 | + | ||
| 124 | + const Vector3 COLOR0( 1.0f, 1.0f, 0.0f ); | ||
| 125 | + const Vector3 COLOR1( 0.0f, 1.0f, 1.0f ); | ||
| 126 | + const Vector3 COLOR2( 1.0f, 0.0f, 1.0f ); | ||
| 127 | + const Vector3 COLOR3( 0.0f, 1.0f, 0.0f ); | ||
| 128 | + const Vector3 COLOR4( 0.0f, 0.0f, 1.0f ); | ||
| 129 | + const Vector3 COLOR5( 1.0f, 0.0f, 0.0f ); | ||
| 130 | + | ||
| 131 | + Vertex vertices[] = { | ||
| 132 | + { Vector3( 1.0f,-1.0f,-1.0f ), COLOR5 }, | ||
| 133 | + { Vector3( -1.0f, 1.0f,-1.0f ), COLOR5 }, | ||
| 134 | + { Vector3( 1.0f, 1.0f,-1.0f ), COLOR5 }, | ||
| 135 | + { Vector3( -1.0f, 1.0f, 1.0f ), COLOR3 }, | ||
| 136 | + { Vector3( 1.0f,-1.0f, 1.0f ), COLOR3 }, | ||
| 137 | + { Vector3( 1.0f, 1.0f, 1.0f ), COLOR3 }, | ||
| 138 | + { Vector3( 1.0f, 1.0f, 1.0f ), COLOR4 }, | ||
| 139 | + { Vector3( 1.0f,-1.0f,-1.0f ), COLOR4 }, | ||
| 140 | + { Vector3( 1.0f, 1.0f,-1.0f ), COLOR4 }, | ||
| 141 | + { Vector3( 1.0f,-1.0f, 1.0f ), COLOR1 }, | ||
| 142 | + { Vector3( -1.0f,-1.0f,-1.0f ), COLOR1 }, | ||
| 143 | + { Vector3( 1.0f,-1.0f,-1.0f ), COLOR1 }, | ||
| 144 | + { Vector3( -1.0f,-1.0f,-1.0f ), COLOR0 }, | ||
| 145 | + { Vector3( -1.0f, 1.0f, 1.0f ), COLOR0 }, | ||
| 146 | + { Vector3( -1.0f, 1.0f,-1.0f ), COLOR0 }, | ||
| 147 | + { Vector3( 1.0f, 1.0f,-1.0f ), COLOR2 }, | ||
| 148 | + { Vector3( -1.0f, 1.0f, 1.0f ), COLOR2 }, | ||
| 149 | + { Vector3( 1.0f, 1.0f, 1.0f ), COLOR2 }, | ||
| 150 | + { Vector3( 1.0f,-1.0f,-1.0f ), COLOR5 }, | ||
| 151 | + { Vector3( -1.0f,-1.0f,-1.0f ), COLOR5 }, | ||
| 152 | + { Vector3( -1.0f, 1.0f,-1.0f ), COLOR5 }, | ||
| 153 | + { Vector3( -1.0f, 1.0f, 1.0f ), COLOR3 }, | ||
| 154 | + { Vector3( -1.0f,-1.0f, 1.0f ), COLOR3 }, | ||
| 155 | + { Vector3( 1.0f,-1.0f, 1.0f ), COLOR3 }, | ||
| 156 | + { Vector3( 1.0f, 1.0f, 1.0f ), COLOR4 }, | ||
| 157 | + { Vector3( 1.0f,-1.0f, 1.0f ), COLOR4 }, | ||
| 158 | + { Vector3( 1.0f,-1.0f,-1.0f ), COLOR4 }, | ||
| 159 | + { Vector3( 1.0f,-1.0f, 1.0f ), COLOR1 }, | ||
| 160 | + { Vector3( -1.0f,-1.0f, 1.0f ), COLOR1 }, | ||
| 161 | + { Vector3( -1.0f,-1.0f,-1.0f ), COLOR1 }, | ||
| 162 | + { Vector3( -1.0f,-1.0f,-1.0f ), COLOR0 }, | ||
| 163 | + { Vector3( -1.0f,-1.0f, 1.0f ), COLOR0 }, | ||
| 164 | + { Vector3( -1.0f, 1.0f, 1.0f ), COLOR0 }, | ||
| 165 | + { Vector3( 1.0f, 1.0f,-1.0f ), COLOR2 }, | ||
| 166 | + { Vector3( -1.0f, 1.0f,-1.0f ), COLOR2 }, | ||
| 167 | + { Vector3( -1.0f, 1.0f, 1.0f ), COLOR2 }, | ||
| 168 | + }; | ||
| 169 | + | ||
| 170 | + PropertyBuffer vertexBuffer = PropertyBuffer::New( Property::Map() | ||
| 171 | + .Add( "aPosition", Property::VECTOR3 ) | ||
| 172 | + .Add( "aColor", Property::VECTOR3 ) ); | ||
| 173 | + vertexBuffer.SetData( vertices, sizeof(vertices) / sizeof(Vertex) ); | ||
| 174 | + | ||
| 175 | + // create indices | ||
| 176 | + const unsigned short INDEX_CUBE[] = { | ||
| 177 | + 2, 1, 0, | ||
| 178 | + 5, 4, 3, | ||
| 179 | + 8, 7, 6, | ||
| 180 | + 11, 10, 9, | ||
| 181 | + 14, 13, 12, | ||
| 182 | + 17, 16, 15, | ||
| 183 | + 20, 19, 18, | ||
| 184 | + 23, 22, 21, | ||
| 185 | + 26, 25, 24, | ||
| 186 | + 29, 28, 27, | ||
| 187 | + 32, 31, 30, | ||
| 188 | + 35, 34, 33 | ||
| 189 | + }; | ||
| 190 | + mGeometry = Geometry::New(); | ||
| 191 | + mGeometry.AddVertexBuffer( vertexBuffer ); | ||
| 192 | + mGeometry.SetIndexBuffer( INDEX_CUBE, | ||
| 193 | + sizeof(INDEX_CUBE)/sizeof(INDEX_CUBE[0]) | ||
| 194 | + ); | ||
| 195 | + mGeometry.SetType( Geometry::TRIANGLES ); | ||
| 196 | + } | ||
| 197 | + | ||
| 198 | + /** | ||
| 199 | + * Creates a shader using inlined variable VERTEX_SHADER and FRAGMENT_SHADER | ||
| 200 | + * | ||
| 201 | + * Shaders are very basic and all they do is transforming vertices and interpolating | ||
| 202 | + * input per-vertex color. | ||
| 203 | + */ | ||
| 204 | + void CreateCubeShader() | ||
| 205 | + { | ||
| 206 | + mShader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER ); | ||
| 207 | + } | ||
| 208 | + | ||
| 209 | + /** | ||
| 210 | + * Function creates renderer. It turns on depth test and depth write. | ||
| 211 | + */ | ||
| 212 | + void CreateRenderer() | ||
| 213 | + { | ||
| 214 | + mRenderer = Renderer::New( mGeometry, mShader ); | ||
| 215 | + | ||
| 216 | + // Face culling is enabled to hide the backwards facing sides of the cube | ||
| 217 | + // This is sufficient to render a single object; for more complex scenes depth-testing might be required | ||
| 218 | + mRenderer.SetProperty( Renderer::Property::FACE_CULLING_MODE, FaceCullingMode::BACK ); | ||
| 219 | + } | ||
| 220 | + | ||
| 221 | + /** | ||
| 222 | + * Creates new actor and attaches renderer. | ||
| 223 | + */ | ||
| 224 | + void CreateActor() | ||
| 225 | + { | ||
| 226 | + Stage stage = Stage::GetCurrent(); | ||
| 227 | + | ||
| 228 | + float quarterStageWidth = stage.GetSize().x * 0.25f; | ||
| 229 | + mActor = Actor::New(); | ||
| 230 | + mActor.SetAnchorPoint( AnchorPoint::CENTER ); | ||
| 231 | + mActor.SetParentOrigin( ParentOrigin::CENTER ); | ||
| 232 | + mActor.SetPosition( Vector3( 0.0f, 0.0f, 0.0f ) ); | ||
| 233 | + mActor.SetSize( Vector3( quarterStageWidth, quarterStageWidth, quarterStageWidth ) ); | ||
| 234 | + mActor.AddRenderer( mRenderer ); | ||
| 235 | + stage.Add( mActor ); | ||
| 236 | + } | ||
| 237 | + | ||
| 238 | + /** | ||
| 239 | + * Plays animation | ||
| 240 | + */ | ||
| 241 | + void PlayAnimation() | ||
| 242 | + { | ||
| 243 | + mAnimation = Animation::New( 5.0f ); | ||
| 244 | + mAnimation.SetLooping( true ); | ||
| 245 | + mAnimation.AnimateBy( Property( mActor, Actor::Property::ORIENTATION ), Quaternion( Radian( Degree( 360 )), Vector3::ZAXIS ) ); | ||
| 246 | + mAnimation.AnimateBy( Property( mActor, Actor::Property::ORIENTATION ), Quaternion( Radian( Degree( 360 )), Vector3::YAXIS ) ); | ||
| 247 | + mAnimation.AnimateBy( Property( mActor, Actor::Property::ORIENTATION ), Quaternion( Radian( Degree( 360 )), Vector3::XAXIS ) ); | ||
| 248 | + mAnimation.Play(); | ||
| 249 | + } | ||
| 250 | + | ||
| 251 | +private: | ||
| 252 | + Application& mApplication; | ||
| 253 | + | ||
| 254 | + Renderer mRenderer; | ||
| 255 | + Shader mShader; | ||
| 256 | + Geometry mGeometry; | ||
| 257 | + Actor mActor; | ||
| 258 | + Animation mAnimation; | ||
| 259 | +}; | ||
| 260 | + | ||
| 261 | +void RunTest( Application& application ) | ||
| 262 | +{ | ||
| 263 | + DrawCubeController test( application ); | ||
| 264 | + | ||
| 265 | + application.MainLoop(); | ||
| 266 | +} | ||
| 267 | + | ||
| 268 | +// Entry point for Linux & Tizen applications | ||
| 269 | +// | ||
| 270 | +int DALI_EXPORT_API main( int argc, char **argv ) | ||
| 271 | +{ | ||
| 272 | + Application application = Application::New( &argc, &argv ); | ||
| 273 | + | ||
| 274 | + RunTest( application ); | ||
| 275 | + | ||
| 276 | + return 0; | ||
| 277 | +} |
examples/rendering-line/rendering-line.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 | +using namespace Toolkit; | ||
| 23 | + | ||
| 24 | +namespace | ||
| 25 | +{ | ||
| 26 | + | ||
| 27 | +/* | ||
| 28 | + * Vertex shader | ||
| 29 | + */ | ||
| 30 | +const char* VERTEX_SHADER = DALI_COMPOSE_SHADER( | ||
| 31 | +attribute mediump vec2 aPosition;\n // DALi shader builtin | ||
| 32 | +uniform mediump mat4 uMvpMatrix;\n // DALi shader builtin | ||
| 33 | +uniform mediump vec3 uSize;\n // DALi shader builtin | ||
| 34 | +\n | ||
| 35 | +void main()\n | ||
| 36 | +{\n | ||
| 37 | + mediump vec4 vertexPosition = vec4(aPosition, 0.0, 1.0);\n | ||
| 38 | + vertexPosition.xyz *= uSize;\n | ||
| 39 | + gl_Position = uMvpMatrix * vertexPosition;\n | ||
| 40 | +}\n | ||
| 41 | +); | ||
| 42 | + | ||
| 43 | +/* | ||
| 44 | + * Fragment shader | ||
| 45 | + */ | ||
| 46 | +const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER( | ||
| 47 | +uniform mediump vec4 uColor;\n | ||
| 48 | +\n | ||
| 49 | +void main()\n | ||
| 50 | +{\n | ||
| 51 | + gl_FragColor = uColor;\n | ||
| 52 | +}\n | ||
| 53 | +); | ||
| 54 | + | ||
| 55 | +} | ||
| 56 | + | ||
| 57 | +// This example shows how to draw a line in actor's color | ||
| 58 | +// | ||
| 59 | +class DrawLineController : public ConnectionTracker | ||
| 60 | +{ | ||
| 61 | +public: | ||
| 62 | + | ||
| 63 | + DrawLineController( Application& application ) | ||
| 64 | + : mApplication( application ) | ||
| 65 | + { | ||
| 66 | + // Connect to the Application's Init signal | ||
| 67 | + mApplication.InitSignal().Connect( this, &DrawLineController::Create ); | ||
| 68 | + } | ||
| 69 | + | ||
| 70 | + ~DrawLineController() | ||
| 71 | + { | ||
| 72 | + // Nothing to do here; | ||
| 73 | + } | ||
| 74 | + | ||
| 75 | + // The Init signal is received once (only) during the Application lifetime | ||
| 76 | + void Create( Application& application ) | ||
| 77 | + { | ||
| 78 | + // Get a handle to the stage | ||
| 79 | + Stage stage = Stage::GetCurrent(); | ||
| 80 | + stage.SetBackgroundColor( Color::WHITE ); | ||
| 81 | + | ||
| 82 | + // Step 1. Create shader | ||
| 83 | + CreateLineShader(); | ||
| 84 | + | ||
| 85 | + // Step 2. Prepare geometry | ||
| 86 | + CreateLineGeometry(); | ||
| 87 | + | ||
| 88 | + // Step 3. Create a renderer | ||
| 89 | + CreateRenderer(); | ||
| 90 | + | ||
| 91 | + // Step 4. Create an Actor | ||
| 92 | + CreateActor(); | ||
| 93 | + | ||
| 94 | + // Respond to a click anywhere on the stage | ||
| 95 | + stage.GetRootLayer().TouchSignal().Connect( this, &DrawLineController::OnTouch ); | ||
| 96 | + } | ||
| 97 | + | ||
| 98 | + bool OnTouch( Actor actor, const TouchData& touch ) | ||
| 99 | + { | ||
| 100 | + // quit the application | ||
| 101 | + mApplication.Quit(); | ||
| 102 | + return true; | ||
| 103 | + } | ||
| 104 | + | ||
| 105 | + /** | ||
| 106 | + * This function creates a line geometry made of two vertices in order | ||
| 107 | + * to draw a diagonal line. | ||
| 108 | + */ | ||
| 109 | + void CreateLineGeometry() | ||
| 110 | + { | ||
| 111 | + Vector2 vertices[] = { | ||
| 112 | + Vector2( -1.0f, -1.0f ), | ||
| 113 | + Vector2( 1.0f, 1.0f ) | ||
| 114 | + }; | ||
| 115 | + | ||
| 116 | + PropertyBuffer vertexBuffer = PropertyBuffer::New( Property::Map() | ||
| 117 | + .Add( "aPosition", Property::VECTOR2 ) ); | ||
| 118 | + vertexBuffer.SetData( vertices, sizeof(vertices) / sizeof(Vector2) ); | ||
| 119 | + | ||
| 120 | + mGeometry = Geometry::New(); | ||
| 121 | + mGeometry.AddVertexBuffer( vertexBuffer ); | ||
| 122 | + mGeometry.SetType( Geometry::LINES ); | ||
| 123 | + } | ||
| 124 | + | ||
| 125 | + /** | ||
| 126 | + * Creates a shader using inlined variable VERTEX_SHADER and FRAGMENT_SHADER | ||
| 127 | + * | ||
| 128 | + * Shaders are very basic and all they do is transforming vertices and applying actor's colour. | ||
| 129 | + */ | ||
| 130 | + void CreateLineShader() | ||
| 131 | + { | ||
| 132 | + mShader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER ); | ||
| 133 | + } | ||
| 134 | + | ||
| 135 | + /** | ||
| 136 | + * Function creates renderer. | ||
| 137 | + */ | ||
| 138 | + void CreateRenderer() | ||
| 139 | + { | ||
| 140 | + mRenderer = Renderer::New( mGeometry, mShader ); | ||
| 141 | + } | ||
| 142 | + | ||
| 143 | + /** | ||
| 144 | + * Creates new actor and attaches renderer. | ||
| 145 | + */ | ||
| 146 | + void CreateActor() | ||
| 147 | + { | ||
| 148 | + Stage stage = Stage::GetCurrent(); | ||
| 149 | + Size size = stage.GetSize() * 0.25f; | ||
| 150 | + mActor = Actor::New(); | ||
| 151 | + mActor.SetAnchorPoint( AnchorPoint::CENTER ); | ||
| 152 | + mActor.SetParentOrigin( ParentOrigin::CENTER ); | ||
| 153 | + mActor.SetPosition( Vector3( 0.0f, 0.0f, 0.0f ) ); | ||
| 154 | + mActor.SetColor( Color::BLACK ); | ||
| 155 | + mActor.SetSize( Vector3( size.x, size.x, size.x ) ); | ||
| 156 | + mActor.AddRenderer( mRenderer ); | ||
| 157 | + stage.Add( mActor ); | ||
| 158 | + } | ||
| 159 | + | ||
| 160 | +private: | ||
| 161 | + Application& mApplication; | ||
| 162 | + | ||
| 163 | + Renderer mRenderer; | ||
| 164 | + Shader mShader; | ||
| 165 | + Geometry mGeometry; | ||
| 166 | + Actor mActor; | ||
| 167 | +}; | ||
| 168 | + | ||
| 169 | +void RunTest( Application& application ) | ||
| 170 | +{ | ||
| 171 | + DrawLineController test( application ); | ||
| 172 | + | ||
| 173 | + application.MainLoop(); | ||
| 174 | +} | ||
| 175 | + | ||
| 176 | +// Entry point for Linux & Tizen applications | ||
| 177 | +// | ||
| 178 | +int DALI_EXPORT_API main( int argc, char **argv ) | ||
| 179 | +{ | ||
| 180 | + Application application = Application::New( &argc, &argv ); | ||
| 181 | + | ||
| 182 | + RunTest( application ); | ||
| 183 | + | ||
| 184 | + return 0; | ||
| 185 | +} |
examples/rendering-textured-cube/rendering-textured-cube.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 | +using namespace Toolkit; | ||
| 23 | + | ||
| 24 | +namespace | ||
| 25 | +{ | ||
| 26 | + | ||
| 27 | +/* | ||
| 28 | + * Vertex shader | ||
| 29 | + */ | ||
| 30 | +const char* VERTEX_SHADER = DALI_COMPOSE_SHADER( | ||
| 31 | +attribute mediump vec3 aPosition;\n // DALi shader builtin | ||
| 32 | +attribute mediump vec2 aTexCoord;\n // DALi shader builtin | ||
| 33 | +uniform mediump mat4 uMvpMatrix;\n // DALi shader builtin | ||
| 34 | +uniform mediump vec3 uSize;\n // DALi shader builtin | ||
| 35 | +\n | ||
| 36 | +varying mediump vec2 vTexCoord;\n | ||
| 37 | +void main()\n | ||
| 38 | +{\n | ||
| 39 | + mediump vec4 vertexPosition = vec4(aPosition, 1.0);\n | ||
| 40 | + vertexPosition.xyz *= uSize;\n | ||
| 41 | + vTexCoord = aTexCoord;\n | ||
| 42 | + gl_Position = uMvpMatrix * vertexPosition;\n | ||
| 43 | +}\n | ||
| 44 | +); | ||
| 45 | + | ||
| 46 | +/* | ||
| 47 | + * Fragment shader | ||
| 48 | + */ | ||
| 49 | +const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER( | ||
| 50 | +uniform sampler2D uTexture;\n | ||
| 51 | +\n | ||
| 52 | +varying mediump vec2 vTexCoord;\n | ||
| 53 | +void main()\n | ||
| 54 | +{\n | ||
| 55 | + mediump vec4 texColor = texture2D( uTexture, vTexCoord );\n | ||
| 56 | + gl_FragColor = texColor;\n | ||
| 57 | +}\n | ||
| 58 | +); | ||
| 59 | + | ||
| 60 | +const char* TEXTURE_URL = DEMO_IMAGE_DIR "wood.png"; | ||
| 61 | + | ||
| 62 | +} | ||
| 63 | + | ||
| 64 | +// This example shows how to create textured cube | ||
| 65 | +// | ||
| 66 | +class TexturedCubeController : public ConnectionTracker | ||
| 67 | +{ | ||
| 68 | +public: | ||
| 69 | + | ||
| 70 | + TexturedCubeController( Application& application ) | ||
| 71 | + : mApplication( application ) | ||
| 72 | + { | ||
| 73 | + // Connect to the Application's Init signal | ||
| 74 | + mApplication.InitSignal().Connect( this, &TexturedCubeController::Create ); | ||
| 75 | + } | ||
| 76 | + | ||
| 77 | + ~TexturedCubeController() | ||
| 78 | + { | ||
| 79 | + // Nothing to do here; | ||
| 80 | + } | ||
| 81 | + | ||
| 82 | + // The Init signal is received once (only) during the Application lifetime | ||
| 83 | + void Create( Application& application ) | ||
| 84 | + { | ||
| 85 | + // Get a handle to the stage | ||
| 86 | + Stage stage = Stage::GetCurrent(); | ||
| 87 | + stage.SetBackgroundColor( Color::WHITE ); | ||
| 88 | + | ||
| 89 | + // Step 1. Create shader | ||
| 90 | + CreateCubeShader(); | ||
| 91 | + | ||
| 92 | + // Step 2. Load a texture | ||
| 93 | + CreateTexture(); | ||
| 94 | + | ||
| 95 | + // Step 3. Prepare geometry | ||
| 96 | + CreateCubeGeometry(); | ||
| 97 | + | ||
| 98 | + // Step 4. Create a renderer | ||
| 99 | + CreateRenderer(); | ||
| 100 | + | ||
| 101 | + // Step 5. Create an Actor | ||
| 102 | + CreateActor(); | ||
| 103 | + | ||
| 104 | + // Step 6. Play animation to rotate the cube | ||
| 105 | + PlayAnimation(); | ||
| 106 | + | ||
| 107 | + // Respond to a click anywhere on the stage | ||
| 108 | + stage.GetRootLayer().TouchSignal().Connect( this, &TexturedCubeController::OnTouch ); | ||
| 109 | + } | ||
| 110 | + | ||
| 111 | + bool OnTouch( Actor actor, const TouchData& touch ) | ||
| 112 | + { | ||
| 113 | + // quit the application | ||
| 114 | + mApplication.Quit(); | ||
| 115 | + return true; | ||
| 116 | + } | ||
| 117 | + | ||
| 118 | + /** | ||
| 119 | + * @brief CreateCubeGeometry | ||
| 120 | + * This function creates a cube geometry including texture coordinates. | ||
| 121 | + * Also it demonstrates using the indexed draw feature by setting an index array. | ||
| 122 | + */ | ||
| 123 | + void CreateCubeGeometry() | ||
| 124 | + { | ||
| 125 | + struct Vertex | ||
| 126 | + { | ||
| 127 | + Vector3 aPosition; | ||
| 128 | + Vector2 aTexCoord; | ||
| 129 | + }; | ||
| 130 | + | ||
| 131 | + Vertex vertices[] = { | ||
| 132 | + { Vector3( 1.0f,-1.0f,-1.0f ), Vector2( 1.0, 1.0 ) }, | ||
| 133 | + { Vector3( -1.0f, 1.0f,-1.0f ), Vector2( 0.0, 0.0 ) }, | ||
| 134 | + { Vector3( 1.0f, 1.0f,-1.0f ), Vector2( 0.0, 1.0 ) }, | ||
| 135 | + { Vector3( -1.0f, 1.0f, 1.0f ), Vector2( 1.0, 1.0 ) }, | ||
| 136 | + { Vector3( 1.0f,-1.0f, 1.0f ), Vector2( 0.0, 0.0 ) }, | ||
| 137 | + { Vector3( 1.0f, 1.0f, 1.0f ), Vector2( 0.0, 1.0 ) }, | ||
| 138 | + { Vector3( 1.0f, 1.0f, 1.0f ), Vector2( 1.0, 1.0 ) }, | ||
| 139 | + { Vector3( 1.0f,-1.0f,-1.0f ), Vector2( 0.0, 0.0 ) }, | ||
| 140 | + { Vector3( 1.0f, 1.0f,-1.0f ), Vector2( 0.0, 1.0 ) }, | ||
| 141 | + { Vector3( 1.0f,-1.0f, 1.0f ), Vector2( 1.0, 1.0 ) }, | ||
| 142 | + { Vector3( -1.0f,-1.0f,-1.0f ), Vector2( 0.0, 0.0 ) }, | ||
| 143 | + { Vector3( 1.0f,-1.0f,-1.0f ), Vector2( 0.0, 1.0 ) }, | ||
| 144 | + { Vector3( -1.0f,-1.0f,-1.0f ), Vector2( 1.0, 1.0 ) }, | ||
| 145 | + { Vector3( -1.0f, 1.0f, 1.0f ), Vector2( 0.0, 0.0 ) }, | ||
| 146 | + { Vector3( -1.0f, 1.0f,-1.0f ), Vector2( 0.0, 1.0 ) }, | ||
| 147 | + { Vector3( 1.0f, 1.0f,-1.0f ), Vector2( 1.0, 1.0 ) }, | ||
| 148 | + { Vector3( -1.0f, 1.0f, 1.0f ), Vector2( 0.0, 0.0 ) }, | ||
| 149 | + { Vector3( 1.0f, 1.0f, 1.0f ), Vector2( 0.0, 1.0 ) }, | ||
| 150 | + { Vector3( 1.0f,-1.0f,-1.0f ), Vector2( 1.0, 1.0 ) }, | ||
| 151 | + { Vector3( -1.0f,-1.0f,-1.0f ), Vector2( 1.0, 0.0 ) }, | ||
| 152 | + { Vector3( -1.0f, 1.0f,-1.0f ), Vector2( 0.0, 0.0 ) }, | ||
| 153 | + { Vector3( -1.0f, 1.0f, 1.0f ), Vector2( 1.0, 1.0 ) }, | ||
| 154 | + { Vector3( -1.0f,-1.0f, 1.0f ), Vector2( 1.0, 0.0 ) }, | ||
| 155 | + { Vector3( 1.0f,-1.0f, 1.0f ), Vector2( 0.0, 0.0 ) }, | ||
| 156 | + { Vector3( 1.0f, 1.0f, 1.0f ), Vector2( 1.0, 1.0 ) }, | ||
| 157 | + { Vector3( 1.0f,-1.0f, 1.0f ), Vector2( 1.0, 0.0 ) }, | ||
| 158 | + { Vector3( 1.0f,-1.0f,-1.0f ), Vector2( 0.0, 0.0 ) }, | ||
| 159 | + { Vector3( 1.0f,-1.0f, 1.0f ), Vector2( 1.0, 1.0 ) }, | ||
| 160 | + { Vector3( -1.0f,-1.0f, 1.0f ), Vector2( 1.0, 0.0 ) }, | ||
| 161 | + { Vector3( -1.0f,-1.0f,-1.0f ), Vector2( 0.0, 0.0 ) }, | ||
| 162 | + { Vector3( -1.0f,-1.0f,-1.0f ), Vector2( 1.0, 1.0 ) }, | ||
| 163 | + { Vector3( -1.0f,-1.0f, 1.0f ), Vector2( 1.0, 0.0 ) }, | ||
| 164 | + { Vector3( -1.0f, 1.0f, 1.0f ), Vector2( 0.0, 0.0 ) }, | ||
| 165 | + { Vector3( 1.0f, 1.0f,-1.0f ), Vector2( 1.0, 1.0 ) }, | ||
| 166 | + { Vector3( -1.0f, 1.0f,-1.0f ), Vector2( 1.0, 0.0 ) }, | ||
| 167 | + { Vector3( -1.0f, 1.0f, 1.0f ), Vector2( 0.0, 0.0 ) }, | ||
| 168 | + }; | ||
| 169 | + | ||
| 170 | + PropertyBuffer vertexBuffer = PropertyBuffer::New( Property::Map() | ||
| 171 | + .Add( "aPosition", Property::VECTOR3 ) | ||
| 172 | + .Add( "aTexCoord", Property::VECTOR2 ) ); | ||
| 173 | + vertexBuffer.SetData( vertices, sizeof(vertices) / sizeof(Vertex) ); | ||
| 174 | + | ||
| 175 | + // create indices | ||
| 176 | + const unsigned short INDEX_CUBE[] = { | ||
| 177 | + 2, 1, 0, | ||
| 178 | + 5, 4, 3, | ||
| 179 | + 8, 7, 6, | ||
| 180 | + 11, 10, 9, | ||
| 181 | + 14, 13, 12, | ||
| 182 | + 17, 16, 15, | ||
| 183 | + 20, 19, 18, | ||
| 184 | + 23, 22, 21, | ||
| 185 | + 26, 25, 24, | ||
| 186 | + 29, 28, 27, | ||
| 187 | + 32, 31, 30, | ||
| 188 | + 35, 34, 33 | ||
| 189 | + }; | ||
| 190 | + mGeometry = Geometry::New(); | ||
| 191 | + mGeometry.AddVertexBuffer( vertexBuffer ); | ||
| 192 | + mGeometry.SetIndexBuffer( INDEX_CUBE, | ||
| 193 | + sizeof(INDEX_CUBE)/sizeof(INDEX_CUBE[0]) ); | ||
| 194 | + mGeometry.SetType( Geometry::TRIANGLES ); | ||
| 195 | + } | ||
| 196 | + | ||
| 197 | + /** | ||
| 198 | + * Creates a shader using inlined variable VERTEX_SHADER and FRAGMENT_SHADER | ||
| 199 | + * | ||
| 200 | + * Shaders are very basic and all they do is transforming vertices and sampling | ||
| 201 | + * a texture. | ||
| 202 | + */ | ||
| 203 | + void CreateCubeShader() | ||
| 204 | + { | ||
| 205 | + mShader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER ); | ||
| 206 | + } | ||
| 207 | + | ||
| 208 | + /** | ||
| 209 | + * This function loads a pixel data from a file. In order to load it we use SyncImageLoader utility. | ||
| 210 | + * If loading succeeds returned PixelData object can be used to create a texture. | ||
| 211 | + * Texture must be uploaded. In the end the texture must be set on the TextureSet object. | ||
| 212 | + */ | ||
| 213 | + void CreateTexture() | ||
| 214 | + { | ||
| 215 | + // Load image from file | ||
| 216 | + PixelData pixels = SyncImageLoader::Load( TEXTURE_URL ); | ||
| 217 | + | ||
| 218 | + Texture texture = Texture::New( TextureType::TEXTURE_2D, pixels.GetPixelFormat(), pixels.GetWidth(), pixels.GetHeight() ); | ||
| 219 | + texture.Upload( pixels, 0, 0, 0, 0, pixels.GetWidth(), pixels.GetHeight() ); | ||
| 220 | + | ||
| 221 | + // create TextureSet | ||
| 222 | + mTextureSet = TextureSet::New(); | ||
| 223 | + mTextureSet.SetTexture( 0, texture ); | ||
| 224 | + } | ||
| 225 | + | ||
| 226 | + /** | ||
| 227 | + * Function creates renderer. It turns on depth test and depth write. | ||
| 228 | + */ | ||
| 229 | + void CreateRenderer() | ||
| 230 | + { | ||
| 231 | + mRenderer = Renderer::New( mGeometry, mShader ); | ||
| 232 | + mRenderer.SetTextures( mTextureSet ); | ||
| 233 | + | ||
| 234 | + // Face culling is enabled to hide the backwards facing sides of the cube | ||
| 235 | + // This is sufficient to render a single object; for more complex scenes depth-testing might be required | ||
| 236 | + mRenderer.SetProperty( Renderer::Property::FACE_CULLING_MODE, FaceCullingMode::BACK ); | ||
| 237 | + } | ||
| 238 | + | ||
| 239 | + /** | ||
| 240 | + * Creates new actor and attaches renderer. | ||
| 241 | + */ | ||
| 242 | + void CreateActor() | ||
| 243 | + { | ||
| 244 | + Stage stage = Stage::GetCurrent(); | ||
| 245 | + | ||
| 246 | + float quarterStageWidth = stage.GetSize().x * 0.25f; | ||
| 247 | + mActor = Actor::New(); | ||
| 248 | + mActor.SetAnchorPoint( AnchorPoint::CENTER ); | ||
| 249 | + mActor.SetParentOrigin( ParentOrigin::CENTER ); | ||
| 250 | + mActor.SetPosition( Vector3( 0.0f, 0.0f, 0.0f ) ); | ||
| 251 | + mActor.SetSize( Vector3( quarterStageWidth, quarterStageWidth, quarterStageWidth ) ); | ||
| 252 | + mActor.AddRenderer( mRenderer ); | ||
| 253 | + stage.Add( mActor ); | ||
| 254 | + } | ||
| 255 | + | ||
| 256 | + /** | ||
| 257 | + * Plays animation | ||
| 258 | + */ | ||
| 259 | + void PlayAnimation() | ||
| 260 | + { | ||
| 261 | + mAnimation = Animation::New( 5.0f ); | ||
| 262 | + mAnimation.SetLooping( true ); | ||
| 263 | + mAnimation.AnimateBy( Property( mActor, Actor::Property::ORIENTATION ), Quaternion( Radian( Degree( 360 )), Vector3::ZAXIS ) ); | ||
| 264 | + mAnimation.AnimateBy( Property( mActor, Actor::Property::ORIENTATION ), Quaternion( Radian( Degree( 360 )), Vector3::YAXIS ) ); | ||
| 265 | + mAnimation.AnimateBy( Property( mActor, Actor::Property::ORIENTATION ), Quaternion( Radian( Degree( 360 )), Vector3::XAXIS ) ); | ||
| 266 | + mAnimation.Play(); | ||
| 267 | + } | ||
| 268 | + | ||
| 269 | +private: | ||
| 270 | + Application& mApplication; | ||
| 271 | + | ||
| 272 | + Renderer mRenderer; | ||
| 273 | + Shader mShader; | ||
| 274 | + Geometry mGeometry; | ||
| 275 | + TextureSet mTextureSet; | ||
| 276 | + Actor mActor; | ||
| 277 | + Animation mAnimation; | ||
| 278 | +}; | ||
| 279 | + | ||
| 280 | +void RunTest( Application& application ) | ||
| 281 | +{ | ||
| 282 | + TexturedCubeController test( application ); | ||
| 283 | + | ||
| 284 | + application.MainLoop(); | ||
| 285 | +} | ||
| 286 | + | ||
| 287 | +// Entry point for Linux & Tizen applications | ||
| 288 | +// | ||
| 289 | +int DALI_EXPORT_API main( int argc, char **argv ) | ||
| 290 | +{ | ||
| 291 | + Application application = Application::New( &argc, &argv ); | ||
| 292 | + | ||
| 293 | + RunTest( application ); | ||
| 294 | + | ||
| 295 | + return 0; | ||
| 296 | +} |
examples/rendering-triangle/rendering-triangle.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 | +using namespace Toolkit; | ||
| 23 | + | ||
| 24 | +namespace | ||
| 25 | +{ | ||
| 26 | + | ||
| 27 | +/* | ||
| 28 | + * Vertex shader | ||
| 29 | + */ | ||
| 30 | +const char* VERTEX_SHADER = DALI_COMPOSE_SHADER( | ||
| 31 | +attribute mediump vec2 aPosition;\n // DALi shader builtin | ||
| 32 | +uniform mediump mat4 uMvpMatrix;\n // DALi shader builtin | ||
| 33 | +uniform mediump vec3 uSize;\n // DALi shader builtin | ||
| 34 | +\n | ||
| 35 | +void main()\n | ||
| 36 | +{\n | ||
| 37 | + mediump vec4 vertexPosition = vec4(aPosition, 0.0, 1.0);\n | ||
| 38 | + vertexPosition.xyz *= uSize;\n | ||
| 39 | + gl_Position = uMvpMatrix * vertexPosition;\n | ||
| 40 | +}\n | ||
| 41 | +); | ||
| 42 | + | ||
| 43 | +/* | ||
| 44 | + * Fragment shader | ||
| 45 | + */ | ||
| 46 | +const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER( | ||
| 47 | +uniform mediump vec4 uColor;\n | ||
| 48 | +\n | ||
| 49 | +void main()\n | ||
| 50 | +{\n | ||
| 51 | + gl_FragColor = uColor;\n | ||
| 52 | +}\n | ||
| 53 | +); | ||
| 54 | + | ||
| 55 | +} | ||
| 56 | + | ||
| 57 | +// This example shows how to draw a triangle in actor's color | ||
| 58 | +// | ||
| 59 | +class DrawTriangleController : public ConnectionTracker | ||
| 60 | +{ | ||
| 61 | +public: | ||
| 62 | + | ||
| 63 | + DrawTriangleController( Application& application ) | ||
| 64 | + : mApplication( application ) | ||
| 65 | + { | ||
| 66 | + // Connect to the Application's Init signal | ||
| 67 | + mApplication.InitSignal().Connect( this, &DrawTriangleController::Create ); | ||
| 68 | + } | ||
| 69 | + | ||
| 70 | + ~DrawTriangleController() | ||
| 71 | + { | ||
| 72 | + // Nothing to do here; | ||
| 73 | + } | ||
| 74 | + | ||
| 75 | + // The Init signal is received once (only) during the Application lifetime | ||
| 76 | + void Create( Application& application ) | ||
| 77 | + { | ||
| 78 | + // Get a handle to the stage | ||
| 79 | + Stage stage = Stage::GetCurrent(); | ||
| 80 | + stage.SetBackgroundColor( Color::WHITE ); | ||
| 81 | + | ||
| 82 | + // Step 1. Create shader | ||
| 83 | + CreateTriangleShader(); | ||
| 84 | + | ||
| 85 | + // Step 2. Prepare geometry | ||
| 86 | + CreateTriangleGeometry(); | ||
| 87 | + | ||
| 88 | + // Step 3. Create a renderer | ||
| 89 | + CreateRenderer(); | ||
| 90 | + | ||
| 91 | + // Step 4. Create an Actor | ||
| 92 | + CreateActor(); | ||
| 93 | + | ||
| 94 | + // Respond to a click anywhere on the stage | ||
| 95 | + stage.GetRootLayer().TouchSignal().Connect( this, &DrawTriangleController::OnTouch ); | ||
| 96 | + } | ||
| 97 | + | ||
| 98 | + bool OnTouch( Actor actor, const TouchData& touch ) | ||
| 99 | + { | ||
| 100 | + // quit the application | ||
| 101 | + mApplication.Quit(); | ||
| 102 | + return true; | ||
| 103 | + } | ||
| 104 | + | ||
| 105 | + /** | ||
| 106 | + * This function creates a triangle geometry made of three vertices in order | ||
| 107 | + * to draw a coloured triangle. | ||
| 108 | + */ | ||
| 109 | + void CreateTriangleGeometry() | ||
| 110 | + { | ||
| 111 | + Vector2 vertices[] = { | ||
| 112 | + Vector2( -1.0f, -1.0f ), | ||
| 113 | + Vector2( 1.0f, 1.0f ), | ||
| 114 | + Vector2( -1.0f, 1.0f ) | ||
| 115 | + }; | ||
| 116 | + | ||
| 117 | + PropertyBuffer vertexBuffer = PropertyBuffer::New( Property::Map() | ||
| 118 | + .Add( "aPosition", Property::VECTOR2 ) ); | ||
| 119 | + vertexBuffer.SetData( vertices, sizeof(vertices) / sizeof(Vector2) ); | ||
| 120 | + | ||
| 121 | + mGeometry = Geometry::New(); | ||
| 122 | + mGeometry.AddVertexBuffer( vertexBuffer ); | ||
| 123 | + mGeometry.SetType( Geometry::TRIANGLES ); | ||
| 124 | + } | ||
| 125 | + | ||
| 126 | + /** | ||
| 127 | + * Creates a shader using inlined variable VERTEX_SHADER and FRAGMENT_SHADER | ||
| 128 | + * | ||
| 129 | + * Shaders are very basic and all they do is transforming vertices and applying actor's colour. | ||
| 130 | + */ | ||
| 131 | + void CreateTriangleShader() | ||
| 132 | + { | ||
| 133 | + mShader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER ); | ||
| 134 | + } | ||
| 135 | + | ||
| 136 | + /** | ||
| 137 | + * Function creates renderer. | ||
| 138 | + */ | ||
| 139 | + void CreateRenderer() | ||
| 140 | + { | ||
| 141 | + mRenderer = Renderer::New( mGeometry, mShader ); | ||
| 142 | + } | ||
| 143 | + | ||
| 144 | + /** | ||
| 145 | + * Creates new actor and attaches renderer. | ||
| 146 | + */ | ||
| 147 | + void CreateActor() | ||
| 148 | + { | ||
| 149 | + Stage stage = Stage::GetCurrent(); | ||
| 150 | + Size size = stage.GetSize() * 0.25f; | ||
| 151 | + mActor = Actor::New(); | ||
| 152 | + mActor.SetAnchorPoint( AnchorPoint::CENTER ); | ||
| 153 | + mActor.SetParentOrigin( ParentOrigin::CENTER ); | ||
| 154 | + mActor.SetPosition( Vector3( 0.0f, 0.0f, 0.0f ) ); | ||
| 155 | + mActor.SetColor( Color::RED ); | ||
| 156 | + mActor.SetSize( Vector3( size.x, size.x, size.x ) ); | ||
| 157 | + mActor.AddRenderer( mRenderer ); | ||
| 158 | + stage.Add( mActor ); | ||
| 159 | + } | ||
| 160 | + | ||
| 161 | +private: | ||
| 162 | + Application& mApplication; | ||
| 163 | + | ||
| 164 | + Renderer mRenderer; | ||
| 165 | + Shader mShader; | ||
| 166 | + Geometry mGeometry; | ||
| 167 | + Actor mActor; | ||
| 168 | +}; | ||
| 169 | + | ||
| 170 | +void RunTest( Application& application ) | ||
| 171 | +{ | ||
| 172 | + DrawTriangleController test( application ); | ||
| 173 | + | ||
| 174 | + application.MainLoop(); | ||
| 175 | +} | ||
| 176 | + | ||
| 177 | +// Entry point for Linux & Tizen applications | ||
| 178 | +// | ||
| 179 | +int DALI_EXPORT_API main( int argc, char **argv ) | ||
| 180 | +{ | ||
| 181 | + Application application = Application::New( &argc, &argv ); | ||
| 182 | + | ||
| 183 | + RunTest( application ); | ||
| 184 | + | ||
| 185 | + return 0; | ||
| 186 | +} |
examples/simple-visuals-control/my-control-impl.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 | +// CLASS HEADER | ||
| 18 | + | ||
| 19 | +#include "my-control-impl.h" | ||
| 20 | + | ||
| 21 | +// EXTERNAL INCLUDES | ||
| 22 | + | ||
| 23 | +#include <dali/public-api/object/type-registry-helper.h> | ||
| 24 | +#include <dali/devel-api/scripting/enum-helper.h> | ||
| 25 | +#include <dali-toolkit/dali-toolkit.h> | ||
| 26 | +#include <dali-toolkit/devel-api/focus-manager/keyinput-focus-manager.h> | ||
| 27 | +#include <dali-toolkit/devel-api/visual-factory/visual-factory.h> | ||
| 28 | +#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h> | ||
| 29 | + | ||
| 30 | +using namespace Dali; | ||
| 31 | +using namespace Dali::Toolkit; | ||
| 32 | + | ||
| 33 | +namespace Demo | ||
| 34 | +{ | ||
| 35 | +namespace Internal | ||
| 36 | +{ | ||
| 37 | + | ||
| 38 | +namespace | ||
| 39 | +{ | ||
| 40 | + | ||
| 41 | + | ||
| 42 | +Dali::BaseHandle Create() | ||
| 43 | +{ | ||
| 44 | + return Demo::MyControl::New(); | ||
| 45 | +} | ||
| 46 | + | ||
| 47 | +// Required code for Property set up. | ||
| 48 | + | ||
| 49 | +DALI_TYPE_REGISTRATION_BEGIN( MyControl, Dali::Toolkit::Control, Create ); | ||
| 50 | + | ||
| 51 | +DALI_PROPERTY_REGISTRATION( Demo, MyControl, "iconVisual", MAP, ICON_VISUAL ) | ||
| 52 | + | ||
| 53 | +DALI_TYPE_REGISTRATION_END(); | ||
| 54 | + | ||
| 55 | +// Add an enum to string conversion entry for the control's visuals. In this case just the icon visual. | ||
| 56 | +// Enables Setting of the property using enums or strings. | ||
| 57 | +DALI_ENUM_TO_STRING_TABLE_BEGIN( VISUAL_PROPERTIES ) | ||
| 58 | +{ "iconVisual", Demo::MyControl::Property::ICON_VISUAL }, | ||
| 59 | +DALI_ENUM_TO_STRING_TABLE_END( VISUAL_PROPERTIES ) | ||
| 60 | + | ||
| 61 | + | ||
| 62 | +} // anonymous namespace | ||
| 63 | + | ||
| 64 | + | ||
| 65 | +Internal::MyControl::MyControl() | ||
| 66 | +: Control( ControlBehaviour( REQUIRES_STYLE_CHANGE_SIGNALS ) ) | ||
| 67 | +{ | ||
| 68 | +} | ||
| 69 | + | ||
| 70 | +Demo::MyControl Internal::MyControl::New() | ||
| 71 | +{ | ||
| 72 | + IntrusivePtr<Internal::MyControl> impl = new Internal::MyControl(); | ||
| 73 | + Demo::MyControl handle = Demo::MyControl( *impl ); | ||
| 74 | + impl->Initialize(); | ||
| 75 | + return handle; | ||
| 76 | +} | ||
| 77 | + | ||
| 78 | +void MyControl::OnInitialize() | ||
| 79 | +{ | ||
| 80 | + Dali::Actor self = Self(); | ||
| 81 | + self.SetKeyboardFocusable( true ); | ||
| 82 | +} | ||
| 83 | + | ||
| 84 | +void MyControl::SetProperty( BaseObject* object, Property::Index index, const Property::Value& value ) | ||
| 85 | +{ | ||
| 86 | + Demo::MyControl myControl = Demo::MyControl::DownCast( Dali::BaseHandle( object ) ); | ||
| 87 | + | ||
| 88 | + if( myControl ) | ||
| 89 | + { | ||
| 90 | + MyControl& impl = GetImpl( myControl ); | ||
| 91 | + switch ( index ) | ||
| 92 | + { | ||
| 93 | + case Demo::MyControl::Property::ICON_VISUAL: | ||
| 94 | + { | ||
| 95 | + Toolkit::Visual::Base iconVisual; | ||
| 96 | + Toolkit::VisualFactory visualFactory = Toolkit::VisualFactory::Get(); | ||
| 97 | + Property::Map *map = value.GetMap(); | ||
| 98 | + if( map && !map->Empty() ) | ||
| 99 | + { | ||
| 100 | + iconVisual = visualFactory.CreateVisual( *map ); | ||
| 101 | + } | ||
| 102 | + | ||
| 103 | + if ( iconVisual ) | ||
| 104 | + { | ||
| 105 | + impl.RegisterVisual( index, iconVisual ); | ||
| 106 | + } | ||
| 107 | + break; | ||
| 108 | + } | ||
| 109 | + } | ||
| 110 | + } | ||
| 111 | +} | ||
| 112 | + | ||
| 113 | +Property::Value MyControl::GetProperty( BaseObject* object, Property::Index propertyIndex ) | ||
| 114 | +{ | ||
| 115 | + Property::Value value; | ||
| 116 | + | ||
| 117 | + Demo::MyControl myControl = Demo::MyControl::DownCast( Dali::BaseHandle( object ) ); | ||
| 118 | + | ||
| 119 | + if ( myControl ) | ||
| 120 | + { | ||
| 121 | + switch ( propertyIndex ) | ||
| 122 | + { | ||
| 123 | + case Demo::MyControl::Property::ICON_VISUAL: | ||
| 124 | + { | ||
| 125 | + Property::Map map; | ||
| 126 | + Toolkit::Visual::Base visual = GetImpl( myControl ).GetVisual( propertyIndex ); | ||
| 127 | + if ( visual ) | ||
| 128 | + { | ||
| 129 | + visual.CreatePropertyMap( map ); // Creates a Property map containing the Visual that ICON_VISUAL currently is. Can change if state changes. | ||
| 130 | + value = map; | ||
| 131 | + } | ||
| 132 | + break; | ||
| 133 | + } | ||
| 134 | + default: | ||
| 135 | + break; | ||
| 136 | + } | ||
| 137 | + } | ||
| 138 | + | ||
| 139 | + return value; | ||
| 140 | +} | ||
| 141 | + | ||
| 142 | +} // Internal | ||
| 143 | +} // Demo |
examples/simple-visuals-control/my-control-impl.h
0 → 100644
| 1 | +#ifndef DALI_DEMO_INTERNAL_MY_CONTROL_IMPL_H | ||
| 2 | +#define DALI_DEMO_INTERNAL_MY_CONTROL_IMPL_H | ||
| 3 | + | ||
| 4 | +/* | ||
| 5 | + * Copyright (c) 2017 Samsung Electronics Co., Ltd. | ||
| 6 | + * | ||
| 7 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 8 | + * you may not use this file except in compliance with the License. | ||
| 9 | + * You may obtain a copy of the License at | ||
| 10 | + * | ||
| 11 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 12 | + * | ||
| 13 | + * Unless required by applicable law or agreed to in writing, software | ||
| 14 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 15 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 16 | + * See the License for the specific language governing permissions and | ||
| 17 | + * limitations under the License. | ||
| 18 | + */ | ||
| 19 | + | ||
| 20 | +// CLASS HEADER | ||
| 21 | +#include "my-control.h" | ||
| 22 | + | ||
| 23 | +// EXTERNAL INCLUDES | ||
| 24 | +#include <dali-toolkit/public-api/controls/control-impl.h> | ||
| 25 | +#include <dali-toolkit/devel-api/visual-factory/visual-base.h> | ||
| 26 | + | ||
| 27 | +namespace Demo | ||
| 28 | +{ | ||
| 29 | + | ||
| 30 | +namespace Internal // To use TypeRegistry, handle and body classes need the same name | ||
| 31 | +{ | ||
| 32 | + | ||
| 33 | +/** | ||
| 34 | + * @brief A Simple Control to show use of visuals with a style sheet and changing visuals with a state change | ||
| 35 | + */ | ||
| 36 | + | ||
| 37 | +class MyControl : public Dali::Toolkit::Internal::Control | ||
| 38 | +{ | ||
| 39 | +public: | ||
| 40 | + /** | ||
| 41 | + * @brief Instantiate a new ContentView object | ||
| 42 | + */ | ||
| 43 | + static Demo::MyControl New(); | ||
| 44 | + | ||
| 45 | + /** | ||
| 46 | + * @brief Default constructor | ||
| 47 | + */ | ||
| 48 | + MyControl(); | ||
| 49 | + | ||
| 50 | +public: // Properties | ||
| 51 | + /** | ||
| 52 | + * @brief Called when a property of an object of this type is set. | ||
| 53 | + * | ||
| 54 | + * @param[in] object The object whose property is set. | ||
| 55 | + * @param[in] index The property index. | ||
| 56 | + * @param[in] value The new property value. | ||
| 57 | + */ | ||
| 58 | + static void SetProperty( Dali::BaseObject* object, Dali::Property::Index index, const Dali::Property::Value& value ); | ||
| 59 | + | ||
| 60 | + /** | ||
| 61 | + * @brief Called to retrieve a property of an object of this type. | ||
| 62 | + * | ||
| 63 | + * @param[in] object The object whose property is to be retrieved. | ||
| 64 | + * @param[in] index The property index. | ||
| 65 | + * @return The current value of the property. | ||
| 66 | + */ | ||
| 67 | + static Dali::Property::Value GetProperty( Dali::BaseObject* object, Dali::Property::Index propertyIndex ); | ||
| 68 | + | ||
| 69 | +private: // From Control | ||
| 70 | + /** | ||
| 71 | + * @copydoc Toolkit::Control::OnInitialize() | ||
| 72 | + */ | ||
| 73 | + virtual void OnInitialize(); | ||
| 74 | + | ||
| 75 | +private: | ||
| 76 | + /** | ||
| 77 | + * undefined constructor and operator= | ||
| 78 | + */ | ||
| 79 | + MyControl( const MyControl& ); | ||
| 80 | + MyControl& operator=( const MyControl& ); | ||
| 81 | + | ||
| 82 | +private: | ||
| 83 | +}; | ||
| 84 | + | ||
| 85 | +} // Internal | ||
| 86 | + | ||
| 87 | +inline Internal::MyControl& GetImpl( Demo::MyControl& handle ) | ||
| 88 | +{ | ||
| 89 | + DALI_ASSERT_ALWAYS( handle ); | ||
| 90 | + Dali::RefObject& object = handle.GetImplementation(); | ||
| 91 | + return static_cast<Internal::MyControl&>(object); | ||
| 92 | +} | ||
| 93 | + | ||
| 94 | +inline const Internal::MyControl& GetImpl( const Demo::MyControl& handle ) | ||
| 95 | +{ | ||
| 96 | + DALI_ASSERT_ALWAYS( handle ); | ||
| 97 | + const Dali::RefObject& object = handle.GetImplementation(); | ||
| 98 | + return static_cast<const Internal::MyControl&>(object); | ||
| 99 | +} | ||
| 100 | + | ||
| 101 | +} // Demo | ||
| 102 | + | ||
| 103 | +#endif // DALI_DEMO_INTERNAL_MY_CONTROL_IMPL_H |
examples/simple-visuals-control/my-control.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 | +// CLASS HEADER | ||
| 18 | +#include "my-control.h" | ||
| 19 | + | ||
| 20 | +// INTERNAL INCLUDES | ||
| 21 | +#include "my-control-impl.h" | ||
| 22 | + | ||
| 23 | +namespace Demo | ||
| 24 | +{ | ||
| 25 | + | ||
| 26 | +MyControl::MyControl() | ||
| 27 | +{ | ||
| 28 | +} | ||
| 29 | + | ||
| 30 | +MyControl::MyControl( const MyControl& control ) | ||
| 31 | +: Control( control ) | ||
| 32 | +{ | ||
| 33 | +} | ||
| 34 | + | ||
| 35 | +MyControl& MyControl::operator= ( const MyControl& rhs ) | ||
| 36 | +{ | ||
| 37 | + if( &rhs != this ) | ||
| 38 | + { | ||
| 39 | + Control::operator=( rhs ); | ||
| 40 | + } | ||
| 41 | + return *this; | ||
| 42 | +} | ||
| 43 | + | ||
| 44 | +MyControl::~MyControl() | ||
| 45 | +{ | ||
| 46 | +} | ||
| 47 | + | ||
| 48 | +MyControl MyControl::New() | ||
| 49 | +{ | ||
| 50 | + MyControl control = Internal::MyControl::New(); | ||
| 51 | + return control; | ||
| 52 | +} | ||
| 53 | + | ||
| 54 | +MyControl MyControl::DownCast( BaseHandle handle ) | ||
| 55 | +{ | ||
| 56 | + return Control::DownCast< MyControl, Internal::MyControl > ( handle ); | ||
| 57 | +} | ||
| 58 | + | ||
| 59 | +MyControl::MyControl( Internal::MyControl& implementation ) | ||
| 60 | +: Control( implementation ) | ||
| 61 | +{ | ||
| 62 | +} | ||
| 63 | + | ||
| 64 | +MyControl::MyControl( Dali::Internal::CustomActor* internal ) | ||
| 65 | +: Control( internal ) | ||
| 66 | +{ | ||
| 67 | + VerifyCustomActorPointer< Internal::MyControl >( internal ) ; | ||
| 68 | +} | ||
| 69 | + | ||
| 70 | + | ||
| 71 | +} //namespace Demo |
examples/simple-visuals-control/my-control.h
0 → 100644
| 1 | +#ifndef DALI_DEMO_MY_CONTROL_H | ||
| 2 | +#define DALI_DEMO_MY_CONTROL_H | ||
| 3 | + | ||
| 4 | +/* | ||
| 5 | + * Copyright (c) 2017 Samsung Electronics Co., Ltd. | ||
| 6 | + * | ||
| 7 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 8 | + * you may not use this file except in compliance with the License. | ||
| 9 | + * You may obtain a copy of the License at | ||
| 10 | + * | ||
| 11 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 12 | + * | ||
| 13 | + * Unless required by applicable law or agreed to in writing, software | ||
| 14 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 15 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 16 | + * See the License for the specific language governing permissions and | ||
| 17 | + * limitations under the License. | ||
| 18 | + */ | ||
| 19 | + | ||
| 20 | +#include <dali-toolkit/dali-toolkit.h> | ||
| 21 | +#include <string> | ||
| 22 | + | ||
| 23 | +namespace Demo | ||
| 24 | +{ | ||
| 25 | + | ||
| 26 | +namespace Internal | ||
| 27 | +{ | ||
| 28 | +class MyControl; | ||
| 29 | +} | ||
| 30 | + | ||
| 31 | +/** | ||
| 32 | + * @brief MyControl is an example control, | ||
| 33 | + * | ||
| 34 | + * @details It's purpose is to show how to create a simple control to work with the style sheet and state changes. | ||
| 35 | + * States changes includes Normal, Focused and Disabled, this example uses the style sheet to set visuals for Normal and Focused states. | ||
| 36 | + * When the Focus manager changes the control to be focused the visual displayed is changed and vice versa. | ||
| 37 | + * | ||
| 38 | + * The visual has the property name ICON_VISUAL with the style sheet string equivalent of "iconVisual" | ||
| 39 | + * | ||
| 40 | + */ | ||
| 41 | + | ||
| 42 | +class MyControl : public Dali::Toolkit::Control | ||
| 43 | +{ | ||
| 44 | +public: | ||
| 45 | + | ||
| 46 | + /** | ||
| 47 | + * The start and end property ranges for this Control | ||
| 48 | + * My control can use properties from Toolkit::Control as it is derived from it. As control is derived from Actor, MyControl can also use Dali::Actor Properties. | ||
| 49 | + * | ||
| 50 | + * To ensure that the Property indexes from MyControl do not shadow any from Control we start it's index from the end of Toolkit::Control's indexes. | ||
| 51 | + * | ||
| 52 | + * Toolkit::Control would have done the same with Actor. | ||
| 53 | + * | ||
| 54 | + * The end index for this control is set to the start index + 1000 hence MyControl can have 1000 property indexes. | ||
| 55 | + * | ||
| 56 | + * PROPERTY_END_INDEX for MyControl is public, if another control is derived from it then if can specify MyControl::PROPERTY_END_INDEX+1 to start it's | ||
| 57 | + * indexing after MyControls last index. | ||
| 58 | + */ | ||
| 59 | + enum PropertyRange | ||
| 60 | + { | ||
| 61 | + PROPERTY_START_INDEX = Dali::Toolkit::Control::CONTROL_PROPERTY_END_INDEX + 1, | ||
| 62 | + PROPERTY_END_INDEX = PROPERTY_START_INDEX + 1000, | ||
| 63 | + ANIMATABLE_PROPERTY_START_INDEX = Dali::ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX, | ||
| 64 | + ANIMATABLE_PROPERTY_END_INDEX = ANIMATABLE_PROPERTY_START_INDEX+1000 | ||
| 65 | + }; | ||
| 66 | + | ||
| 67 | + struct Property | ||
| 68 | + { | ||
| 69 | + enum | ||
| 70 | + { | ||
| 71 | + /** | ||
| 72 | + * @brief name "iconVisual", type string if it is a url, map otherwise | ||
| 73 | + * @details Sets the icon visual to be displayed by the control | ||
| 74 | + */ | ||
| 75 | + ICON_VISUAL = PROPERTY_START_INDEX | ||
| 76 | + }; | ||
| 77 | + }; | ||
| 78 | + | ||
| 79 | +public: // Construction / destruction | ||
| 80 | + | ||
| 81 | + /** | ||
| 82 | + * @brief Create an uninitialized handle | ||
| 83 | + */ | ||
| 84 | + MyControl(); | ||
| 85 | + | ||
| 86 | + /** | ||
| 87 | + * @brief Create a new MyControl | ||
| 88 | + */ | ||
| 89 | + static MyControl New(); | ||
| 90 | + | ||
| 91 | + /** | ||
| 92 | + * @brief Destructor. This is non-virtual since derived Handle types must not contain data or virtual methods | ||
| 93 | + */ | ||
| 94 | + ~MyControl(); | ||
| 95 | + | ||
| 96 | + /** | ||
| 97 | + * @brief Copy Constructor | ||
| 98 | + * | ||
| 99 | + * @param[in] shadowButton the handle of the control to copy | ||
| 100 | + */ | ||
| 101 | + MyControl( const MyControl& shadowButton ); | ||
| 102 | + | ||
| 103 | + /** | ||
| 104 | + * @brief Assignment Operator | ||
| 105 | + * | ||
| 106 | + * @param[in] shadowButton the source of the assignment | ||
| 107 | + */ | ||
| 108 | + MyControl& operator=( const MyControl& shadowButton ); | ||
| 109 | + | ||
| 110 | + /** | ||
| 111 | + * @brief Downcast | ||
| 112 | + * | ||
| 113 | + * @param[in] shadowButton the handle of control to downcast to MyControl | ||
| 114 | + */ | ||
| 115 | + static MyControl DownCast( BaseHandle handle ); | ||
| 116 | + | ||
| 117 | + | ||
| 118 | +public: // // Not intended for application developers | ||
| 119 | + | ||
| 120 | + /// @cond internal | ||
| 121 | + /** | ||
| 122 | + * @brief Create a handle from an implementation | ||
| 123 | + */ | ||
| 124 | + MyControl( Internal::MyControl& implementation ); | ||
| 125 | + | ||
| 126 | + /** | ||
| 127 | + * @brief Allow the creation of an ShadowButton handle from an internal CustomActor pointer | ||
| 128 | + */ | ||
| 129 | + MyControl( Dali::Internal::CustomActor* internal ); | ||
| 130 | + /// @endcond | ||
| 131 | +}; | ||
| 132 | + | ||
| 133 | +} // namespace Demo | ||
| 134 | + | ||
| 135 | +#endif // DALI_DEMO_MY_CONTROL_H |
examples/simple-visuals-control/simple-visuals-application.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 | +// CLASS HEADER | ||
| 18 | +#include "my-control.h" | ||
| 19 | + | ||
| 20 | +// EXTERNAL INCLUDES | ||
| 21 | +#include <dali-toolkit/dali-toolkit.h> | ||
| 22 | +#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h> | ||
| 23 | +#include <dali-toolkit/devel-api/visuals/text-visual-properties.h> | ||
| 24 | +#include <dali-toolkit/devel-api/focus-manager/keyinput-focus-manager.h> | ||
| 25 | +#include <dali/integration-api/events/touch-event-integ.h> | ||
| 26 | +#include <cstdio> | ||
| 27 | +#include <sstream> | ||
| 28 | + | ||
| 29 | +// INTERNAL INCLUDES | ||
| 30 | +#include "simple-visuals-application.h" | ||
| 31 | + | ||
| 32 | +using namespace Dali; | ||
| 33 | +using namespace Dali::Toolkit; | ||
| 34 | + | ||
| 35 | +namespace | ||
| 36 | +{ | ||
| 37 | + | ||
| 38 | +} | ||
| 39 | + | ||
| 40 | +namespace Demo | ||
| 41 | +{ | ||
| 42 | + | ||
| 43 | +const char* ICON_IMAGE( DEMO_IMAGE_DIR "application-icon-13.png" ); | ||
| 44 | + | ||
| 45 | +SimpleVisualsApplication::SimpleVisualsApplication( Application& application ) | ||
| 46 | +: mApplication( application ), | ||
| 47 | + mMyControl() | ||
| 48 | +{ | ||
| 49 | + application.InitSignal().Connect( this, &SimpleVisualsApplication::Create ); | ||
| 50 | +} | ||
| 51 | + | ||
| 52 | +Dali::Actor SimpleVisualsApplication::OnKeyboardPreFocusChange( Dali::Actor current, Dali::Actor proposed, Dali::Toolkit::Control::KeyboardFocus::Direction direction ) | ||
| 53 | +{ | ||
| 54 | + Actor nextFocusActor = proposed; | ||
| 55 | + | ||
| 56 | + if( !current && !proposed ) | ||
| 57 | + { | ||
| 58 | + // Set the initial focus to the first tile in the current page should be focused. | ||
| 59 | + nextFocusActor = mMyControl; | ||
| 60 | + } | ||
| 61 | + else | ||
| 62 | + { | ||
| 63 | + if ( current == mMyControl ) | ||
| 64 | + { | ||
| 65 | + nextFocusActor = mMyControl2; | ||
| 66 | + } | ||
| 67 | + else | ||
| 68 | + { | ||
| 69 | + nextFocusActor = mMyControl; | ||
| 70 | + } | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + return nextFocusActor; | ||
| 74 | +} | ||
| 75 | + | ||
| 76 | + | ||
| 77 | +void SimpleVisualsApplication::OnKeyEvent( const KeyEvent& keyEvent ) | ||
| 78 | +{ | ||
| 79 | + static int keyPressed = 0; | ||
| 80 | + | ||
| 81 | + if( keyEvent.state == KeyEvent::Down) | ||
| 82 | + { | ||
| 83 | + if( keyPressed == 0 ) // Is this the first down event? | ||
| 84 | + { | ||
| 85 | + printf("Key pressed: %s %d\n", keyEvent.keyPressedName.c_str(), keyEvent.keyCode ); | ||
| 86 | + | ||
| 87 | + if( IsKey( keyEvent, DALI_KEY_ESCAPE) || IsKey( keyEvent, DALI_KEY_BACK ) ) | ||
| 88 | + { | ||
| 89 | + mApplication.Quit(); | ||
| 90 | + } | ||
| 91 | + else if( keyEvent.keyPressedName.compare("Return") == 0 ) | ||
| 92 | + { | ||
| 93 | + } | ||
| 94 | + } | ||
| 95 | + keyPressed = 1; | ||
| 96 | + } | ||
| 97 | + else if( keyEvent.state == KeyEvent::Up ) | ||
| 98 | + { | ||
| 99 | + keyPressed = 0; | ||
| 100 | + } | ||
| 101 | +} | ||
| 102 | + | ||
| 103 | +void SimpleVisualsApplication::Create( Application& application ) | ||
| 104 | +{ | ||
| 105 | + Stage stage = Stage::GetCurrent(); | ||
| 106 | + stage.SetBackgroundColor( Vector4( 0.1f, 0.1f, 0.1f, 1.0f ) ); | ||
| 107 | + | ||
| 108 | + // Connect to key events so can quit application | ||
| 109 | + stage.KeyEventSignal().Connect(this, &SimpleVisualsApplication::OnKeyEvent); | ||
| 110 | + | ||
| 111 | + // Hide the indicator bar | ||
| 112 | + application.GetWindow().ShowIndicator( Dali::Window::INVISIBLE ); | ||
| 113 | + | ||
| 114 | + // Create a table view to parent the 2 MyControls | ||
| 115 | + TableView contentLayout = TableView::New( 2, 2 ); | ||
| 116 | + contentLayout.SetName("ContentLayout"); | ||
| 117 | + contentLayout.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); | ||
| 118 | + contentLayout.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::HEIGHT ); | ||
| 119 | + contentLayout.SetSizeModeFactor( Vector3( 1.0f, .5f, 1.0f ) ); | ||
| 120 | + contentLayout.SetAnchorPoint( AnchorPoint::CENTER ); | ||
| 121 | + contentLayout.SetParentOrigin( ParentOrigin::CENTER ); | ||
| 122 | + contentLayout.SetCellPadding( Vector2( 50.0f, 15.0f ) ); | ||
| 123 | + contentLayout.SetBackgroundColor( Vector4(0.949, 0.949, 0.949, 1.0) ); | ||
| 124 | + | ||
| 125 | + // Listen to focus change so can see Visual change from NORMAL to FOCUSED state | ||
| 126 | + KeyboardFocusManager::Get().PreFocusChangeSignal().Connect( this, &SimpleVisualsApplication::OnKeyboardPreFocusChange ); | ||
| 127 | + | ||
| 128 | + stage.Add( contentLayout ); | ||
| 129 | + | ||
| 130 | + // Create 2 MyControls and add to table view. | ||
| 131 | + mMyControl = MyControl::New(); | ||
| 132 | + mMyControl.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); | ||
| 133 | + mMyControl.SetParentOrigin(ParentOrigin::TOP_LEFT); | ||
| 134 | + | ||
| 135 | + mMyControl2 = MyControl::New(); | ||
| 136 | + mMyControl2.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); | ||
| 137 | + mMyControl2.SetParentOrigin(ParentOrigin::CENTER); | ||
| 138 | + | ||
| 139 | + contentLayout.AddChild( mMyControl2, TableView::CellPosition(0, 0) ); | ||
| 140 | + contentLayout.AddChild( mMyControl, TableView::CellPosition(0, 1) ); | ||
| 141 | +} | ||
| 142 | + | ||
| 143 | +} // namespace Demo |
examples/simple-visuals-control/simple-visuals-application.h
0 → 100644
| 1 | +#ifndef DALI_DEMO_SIMPLE_VISUALS_APPLICATION_H | ||
| 2 | +#define DALI_DEMO_SIMPLE_VISUALS_APPLICATION_H | ||
| 3 | + | ||
| 4 | +/* | ||
| 5 | + * Copyright (c) 2017 Samsung Electronics Co., Ltd. | ||
| 6 | + * | ||
| 7 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 8 | + * you may not use this file except in compliance with the License. | ||
| 9 | + * You may obtain a copy of the License at | ||
| 10 | + * | ||
| 11 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 12 | + * | ||
| 13 | + * Unless required by applicable law or agreed to in writing, software | ||
| 14 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 15 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 16 | + * See the License for the specific language governing permissions and | ||
| 17 | + * limitations under the License. | ||
| 18 | + */ | ||
| 19 | + | ||
| 20 | +// EXTERNAL INCLUDES | ||
| 21 | +#include <dali-toolkit/dali-toolkit.h> | ||
| 22 | +#include <cstdio> | ||
| 23 | +#include <sstream> | ||
| 24 | + | ||
| 25 | +// INTERNAL INCLUDES | ||
| 26 | +#include "my-control.h" | ||
| 27 | + | ||
| 28 | +using namespace Dali; | ||
| 29 | +using namespace Dali::Toolkit; | ||
| 30 | + | ||
| 31 | +namespace Demo | ||
| 32 | +{ | ||
| 33 | + | ||
| 34 | +/** | ||
| 35 | + * @brief An application that uses the my-control to display 2 icons, if focus is allowed ( by using a keyboard or remote ) then the icons will change | ||
| 36 | + * depending on which one is focused. | ||
| 37 | + * | ||
| 38 | + * Inherits from connection tracker to manage connection and disconnection of signals, In this case PreFocusChangeSignal | ||
| 39 | + */ | ||
| 40 | +class SimpleVisualsApplication : public ConnectionTracker | ||
| 41 | +{ | ||
| 42 | + | ||
| 43 | +public: | ||
| 44 | + | ||
| 45 | + /** | ||
| 46 | + * @brief Constructor. | ||
| 47 | + * | ||
| 48 | + * @param[in] application A reference to the Application class. | ||
| 49 | + */ | ||
| 50 | + SimpleVisualsApplication( Application& application ); | ||
| 51 | + | ||
| 52 | + | ||
| 53 | +private: | ||
| 54 | + /** | ||
| 55 | + * @brief Listen to Focus change signal | ||
| 56 | + * @param[in] current Current focused Actor | ||
| 57 | + * @param[in] proposed New actor that is requesting to be focused | ||
| 58 | + * @param[in] direction The direction of the focus event from current actor | ||
| 59 | + */ | ||
| 60 | + Dali::Actor OnKeyboardPreFocusChange( Dali::Actor current, Dali::Actor proposed, Dali::Toolkit::Control::KeyboardFocus::Direction direction ); | ||
| 61 | + | ||
| 62 | + /** | ||
| 63 | + * @brief Derived from control, enables capture of key presses | ||
| 64 | + * | ||
| 65 | + * @param[in] event In incoming key event | ||
| 66 | + */ | ||
| 67 | + void OnKeyEvent( const KeyEvent& event ); | ||
| 68 | + | ||
| 69 | + /** | ||
| 70 | + * @brief Called to initialise the application content | ||
| 71 | + * | ||
| 72 | + * @param[in] application A reference to the Application class. | ||
| 73 | + */ | ||
| 74 | + void Create( Application& application ); | ||
| 75 | + | ||
| 76 | + | ||
| 77 | +private: | ||
| 78 | + | ||
| 79 | + Application& mApplication; // Handle to the application that is created and passed in. | ||
| 80 | + | ||
| 81 | + MyControl mMyControl; // Handle to first instance of MyControl | ||
| 82 | + MyControl mMyControl2; // Handle to second instance of MyControl | ||
| 83 | + | ||
| 84 | +}; | ||
| 85 | + | ||
| 86 | +} // Namespace Demo | ||
| 87 | + | ||
| 88 | + | ||
| 89 | +#endif // DALI_DEMO_SIMPLE_VISUALS_APPLICATION_H |
examples/simple-visuals-control/simple-visuals-example.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 | + * @file transition-example.cpp | ||
| 19 | + * @brief Example of a control built with visuals | ||
| 20 | + */ | ||
| 21 | + | ||
| 22 | +// EXTERNAL INCLUDES | ||
| 23 | +#include <dali/dali.h> | ||
| 24 | + | ||
| 25 | +// INTERNAL INCLUDES | ||
| 26 | +#include "simple-visuals-application.h" | ||
| 27 | + | ||
| 28 | +namespace | ||
| 29 | +{ | ||
| 30 | +// Style sheet to be used by this application | ||
| 31 | +const char* SIMPLE_DEMO_THEME( DEMO_STYLE_DIR "simple-example-theme.json" ); | ||
| 32 | +} | ||
| 33 | + | ||
| 34 | +/// Entry point for applications | ||
| 35 | +int DALI_EXPORT_API main( int argc, char** argv ) | ||
| 36 | +{ | ||
| 37 | + Application application = Application::New( &argc, &argv, SIMPLE_DEMO_THEME ); // Use the above defined style sheet for this application. | ||
| 38 | + Demo::SimpleVisualsApplication simpleVisualsApplication( application ); | ||
| 39 | + application.MainLoop(); | ||
| 40 | + return 0; | ||
| 41 | +} |
examples/text-field/text-field-example.cpp
| @@ -43,7 +43,7 @@ namespace | @@ -43,7 +43,7 @@ namespace | ||
| 43 | 43 | ||
| 44 | const float BORDER_WIDTH = 4.0f; | 44 | const float BORDER_WIDTH = 4.0f; |
| 45 | 45 | ||
| 46 | - const Vector3 POPUP_SIZE_FACTOR_TO_PARENT = Vector3( 0.0, 0.25, 0.0 ); | 46 | + const Vector3 POPUP_SIZE_FACTOR_TO_PARENT = Vector3( 0.8, 0.25, 0.0 ); |
| 47 | 47 | ||
| 48 | } // unnamed namespace | 48 | } // unnamed namespace |
| 49 | 49 | ||
| @@ -90,10 +90,6 @@ public: | @@ -90,10 +90,6 @@ public: | ||
| 90 | button.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, FOLDER_ICON_IMAGE ); | 90 | button.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, FOLDER_ICON_IMAGE ); |
| 91 | button.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, FOLDER_OPEN_ICON_IMAGE ); | 91 | button.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, FOLDER_OPEN_ICON_IMAGE ); |
| 92 | button.SetAnchorPoint( AnchorPoint::TOP_LEFT ); | 92 | button.SetAnchorPoint( AnchorPoint::TOP_LEFT ); |
| 93 | - button.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS ); | ||
| 94 | - ImageDimensions imageSize = ResourceImage::GetImageSize( FOLDER_ICON_IMAGE ); | ||
| 95 | - button.SetSize( imageSize.GetWidth(), imageSize.GetHeight() ); | ||
| 96 | - | ||
| 97 | return button; | 93 | return button; |
| 98 | } | 94 | } |
| 99 | 95 | ||
| @@ -107,7 +103,7 @@ public: | @@ -107,7 +103,7 @@ public: | ||
| 107 | 103 | ||
| 108 | // Launch a pop-up containing TextField | 104 | // Launch a pop-up containing TextField |
| 109 | mField = CreateTextField( stageSize, mButtonLabel ); | 105 | mField = CreateTextField( stageSize, mButtonLabel ); |
| 110 | - mPopup = CreatePopup( stageSize.width * 0.8f ); | 106 | + mPopup = CreatePopup(); |
| 111 | mPopup.Add( mField ); | 107 | mPopup.Add( mField ); |
| 112 | mPopup.OutsideTouchedSignal().Connect( this, &TextFieldExample::OnPopupOutsideTouched ); | 108 | mPopup.OutsideTouchedSignal().Connect( this, &TextFieldExample::OnPopupOutsideTouched ); |
| 113 | stage.Add( mPopup ); | 109 | stage.Add( mPopup ); |
| @@ -132,13 +128,12 @@ public: | @@ -132,13 +128,12 @@ public: | ||
| 132 | return field; | 128 | return field; |
| 133 | } | 129 | } |
| 134 | 130 | ||
| 135 | - Popup CreatePopup( float width ) | 131 | + Popup CreatePopup() |
| 136 | { | 132 | { |
| 137 | Popup popup = Popup::New(); | 133 | Popup popup = Popup::New(); |
| 138 | popup.SetParentOrigin( ParentOrigin::CENTER ); | 134 | popup.SetParentOrigin( ParentOrigin::CENTER ); |
| 139 | popup.SetAnchorPoint( AnchorPoint::CENTER ); | 135 | popup.SetAnchorPoint( AnchorPoint::CENTER ); |
| 140 | - popup.SetSize( width, 0.0f ); | ||
| 141 | - popup.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::HEIGHT ); | 136 | + popup.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS ); |
| 142 | popup.SetSizeModeFactor( POPUP_SIZE_FACTOR_TO_PARENT ); | 137 | popup.SetSizeModeFactor( POPUP_SIZE_FACTOR_TO_PARENT ); |
| 143 | popup.TouchSignal().Connect( this, &TextFieldExample::OnPopupTouched ); | 138 | popup.TouchSignal().Connect( this, &TextFieldExample::OnPopupTouched ); |
| 144 | 139 |
examples/visual-transitions/transition-application.cpp
| @@ -49,6 +49,7 @@ TransitionApplication::TransitionApplication( Application& application ) | @@ -49,6 +49,7 @@ TransitionApplication::TransitionApplication( Application& application ) | ||
| 49 | mTitle(), | 49 | mTitle(), |
| 50 | mBeatControl(), | 50 | mBeatControl(), |
| 51 | mActionButtons(), | 51 | mActionButtons(), |
| 52 | + mVisualIndex( Property::INVALID_INDEX ), | ||
| 52 | mActionIndex( Property::INVALID_INDEX ) | 53 | mActionIndex( Property::INVALID_INDEX ) |
| 53 | { | 54 | { |
| 54 | application.InitSignal().Connect( this, &TransitionApplication::Create ); | 55 | application.InitSignal().Connect( this, &TransitionApplication::Create ); |
packaging/com.samsung.dali-demo.spec
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | 2 | ||
| 3 | Name: com.samsung.dali-demo | 3 | Name: com.samsung.dali-demo |
| 4 | Summary: The OpenGLES Canvas Core Demo | 4 | Summary: The OpenGLES Canvas Core Demo |
| 5 | -Version: 1.2.28 | 5 | +Version: 1.2.29 |
| 6 | Release: 1 | 6 | Release: 1 |
| 7 | Group: System/Libraries | 7 | Group: System/Libraries |
| 8 | License: Apache-2.0 | 8 | License: Apache-2.0 |
resources/po/as.po
| @@ -147,3 +147,15 @@ msgstr "Tooltip" | @@ -147,3 +147,15 @@ msgstr "Tooltip" | ||
| 147 | 147 | ||
| 148 | msgid "DALI_DEMO_STR_TITLE_FPP_GAME" | 148 | msgid "DALI_DEMO_STR_TITLE_FPP_GAME" |
| 149 | msgstr "FPP খেলা" | 149 | msgstr "FPP খেলা" |
| 150 | + | ||
| 151 | +msgid "DALI_DEMO_STR_TITLE_RENDERING_TEXTURED_CUBE" | ||
| 152 | +msgstr "ৰেণ্ডাৰিং গাঁথনি" | ||
| 153 | + | ||
| 154 | +msgid "DALI_DEMO_STR_TITLE_RENDERING_DRAW_CUBE" | ||
| 155 | +msgstr "ৰেণ্ডাৰিং ঘনক" | ||
| 156 | + | ||
| 157 | +msgid "DALI_DEMO_STR_TITLE_RENDERING_DRAW_TRIANGLE" | ||
| 158 | +msgstr "ৰেণ্ডাৰিং ত্ৰিকোণমিতি" | ||
| 159 | + | ||
| 160 | +msgid "DALI_DEMO_STR_TITLE_RENDERING_DRAW_LINE" | ||
| 161 | +msgstr "ৰেণ্ডাৰিং শাৰী" |
resources/po/de.po
| @@ -147,3 +147,15 @@ msgstr "Kurzinfo" | @@ -147,3 +147,15 @@ msgstr "Kurzinfo" | ||
| 147 | 147 | ||
| 148 | msgid "DALI_DEMO_STR_TITLE_FPP_GAME" | 148 | msgid "DALI_DEMO_STR_TITLE_FPP_GAME" |
| 149 | msgstr "FPP Spiel" | 149 | msgstr "FPP Spiel" |
| 150 | + | ||
| 151 | +msgid "DALI_DEMO_STR_TITLE_RENDERING_TEXTURED_CUBE" | ||
| 152 | +msgstr "Texturierter Würfel" | ||
| 153 | + | ||
| 154 | +msgid "DALI_DEMO_STR_TITLE_RENDERING_DRAW_CUBE" | ||
| 155 | +msgstr "Würfel zeichnen" | ||
| 156 | + | ||
| 157 | +msgid "DALI_DEMO_STR_TITLE_RENDERING_DRAW_TRIANGLE" | ||
| 158 | +msgstr "Dreieck zeichnen" | ||
| 159 | + | ||
| 160 | +msgid "DALI_DEMO_STR_TITLE_RENDERING_DRAW_LINE" | ||
| 161 | +msgstr "Zeichnen" |
resources/po/en_GB.po
| @@ -109,6 +109,9 @@ msgstr "Refraction" | @@ -109,6 +109,9 @@ msgstr "Refraction" | ||
| 109 | msgid "DALI_DEMO_STR_TITLE_RENDERER_STENCIL" | 109 | msgid "DALI_DEMO_STR_TITLE_RENDERER_STENCIL" |
| 110 | msgstr "Renderer Stencil" | 110 | msgstr "Renderer Stencil" |
| 111 | 111 | ||
| 112 | +msgid "DALI_DEMO_STR_TITLE_SIMPLE_VISUALS_CONTROL" | ||
| 113 | +msgstr "Simple Visuals Control" | ||
| 114 | + | ||
| 112 | msgid "DALI_DEMO_STR_TITLE_SCRIPT_BASED_UI" | 115 | msgid "DALI_DEMO_STR_TITLE_SCRIPT_BASED_UI" |
| 113 | msgstr "Script-based UI" | 116 | msgstr "Script-based UI" |
| 114 | 117 | ||
| @@ -150,3 +153,15 @@ msgstr "FPP Game" | @@ -150,3 +153,15 @@ msgstr "FPP Game" | ||
| 150 | 153 | ||
| 151 | msgid "DALI_DEMO_STR_TITLE_VISUAL_TRANSITIONS" | 154 | msgid "DALI_DEMO_STR_TITLE_VISUAL_TRANSITIONS" |
| 152 | msgstr "Visual Transitions" | 155 | msgstr "Visual Transitions" |
| 156 | + | ||
| 157 | +msgid "DALI_DEMO_STR_TITLE_RENDERING_TEXTURED_CUBE" | ||
| 158 | +msgstr "Textured cube" | ||
| 159 | + | ||
| 160 | +msgid "DALI_DEMO_STR_TITLE_RENDERING_DRAW_CUBE" | ||
| 161 | +msgstr "Draw cube" | ||
| 162 | + | ||
| 163 | +msgid "DALI_DEMO_STR_TITLE_RENDERING_DRAW_TRIANGLE" | ||
| 164 | +msgstr "Draw triangle" | ||
| 165 | + | ||
| 166 | +msgid "DALI_DEMO_STR_TITLE_RENDERING_DRAW_LINE" | ||
| 167 | +msgstr "Draw line" |
resources/po/en_US.po
| @@ -109,6 +109,9 @@ msgstr "Refraction" | @@ -109,6 +109,9 @@ msgstr "Refraction" | ||
| 109 | msgid "DALI_DEMO_STR_TITLE_RENDERER_STENCIL" | 109 | msgid "DALI_DEMO_STR_TITLE_RENDERER_STENCIL" |
| 110 | msgstr "Renderer Stencil" | 110 | msgstr "Renderer Stencil" |
| 111 | 111 | ||
| 112 | +msgid "DALI_DEMO_STR_TITLE_SIMPLE_VISUALS_CONTROL" | ||
| 113 | +msgstr "Simple Visuals Control" | ||
| 114 | + | ||
| 112 | msgid "DALI_DEMO_STR_TITLE_SCRIPT_BASED_UI" | 115 | msgid "DALI_DEMO_STR_TITLE_SCRIPT_BASED_UI" |
| 113 | msgstr "Script-based UI" | 116 | msgstr "Script-based UI" |
| 114 | 117 | ||
| @@ -150,3 +153,15 @@ msgstr "FPP Game" | @@ -150,3 +153,15 @@ msgstr "FPP Game" | ||
| 150 | 153 | ||
| 151 | msgid "DALI_DEMO_STR_TITLE_VISUAL_TRANSITIONS" | 154 | msgid "DALI_DEMO_STR_TITLE_VISUAL_TRANSITIONS" |
| 152 | msgstr "Visual Transitions" | 155 | msgstr "Visual Transitions" |
| 156 | + | ||
| 157 | +msgid "DALI_DEMO_STR_TITLE_RENDERING_TEXTURED_CUBE" | ||
| 158 | +msgstr "Textured cube" | ||
| 159 | + | ||
| 160 | +msgid "DALI_DEMO_STR_TITLE_RENDERING_DRAW_CUBE" | ||
| 161 | +msgstr "Draw cube" | ||
| 162 | + | ||
| 163 | +msgid "DALI_DEMO_STR_TITLE_RENDERING_DRAW_TRIANGLE" | ||
| 164 | +msgstr "Draw triangle" | ||
| 165 | + | ||
| 166 | +msgid "DALI_DEMO_STR_TITLE_RENDERING_DRAW_LINE" | ||
| 167 | +msgstr "Draw line" |
resources/po/es.po
| @@ -147,3 +147,15 @@ msgstr "Tooltip" | @@ -147,3 +147,15 @@ msgstr "Tooltip" | ||
| 147 | 147 | ||
| 148 | msgid "DALI_DEMO_STR_TITLE_FPP_GAME" | 148 | msgid "DALI_DEMO_STR_TITLE_FPP_GAME" |
| 149 | msgstr "Juego FPP" | 149 | msgstr "Juego FPP" |
| 150 | + | ||
| 151 | +msgid "DALI_DEMO_STR_TITLE_RENDERING_TEXTURED_CUBE" | ||
| 152 | +msgstr "Cubo con textura" | ||
| 153 | + | ||
| 154 | +msgid "DALI_DEMO_STR_TITLE_RENDERING_DRAW_CUBE" | ||
| 155 | +msgstr "Dibujar cubo" | ||
| 156 | + | ||
| 157 | +msgid "DALI_DEMO_STR_TITLE_RENDERING_DRAW_TRIANGLE" | ||
| 158 | +msgstr "Dibujar triángulo" | ||
| 159 | + | ||
| 160 | +msgid "DALI_DEMO_STR_TITLE_RENDERING_DRAW_LINE" | ||
| 161 | +msgstr "Dibujar linea" |
resources/po/fi.po
| @@ -147,3 +147,15 @@ msgstr "Tooltip" | @@ -147,3 +147,15 @@ msgstr "Tooltip" | ||
| 147 | 147 | ||
| 148 | msgid "DALI_DEMO_STR_TITLE_FPP_GAME" | 148 | msgid "DALI_DEMO_STR_TITLE_FPP_GAME" |
| 149 | msgstr "FPP peli" | 149 | msgstr "FPP peli" |
| 150 | + | ||
| 151 | +msgid "DALI_DEMO_STR_TITLE_RENDERING_TEXTURED_CUBE" | ||
| 152 | +msgstr "kuvioitu kuutio" | ||
| 153 | + | ||
| 154 | +msgid "DALI_DEMO_STR_TITLE_RENDERING_DRAW_CUBE" | ||
| 155 | +msgstr "piirtää kuutio" | ||
| 156 | + | ||
| 157 | +msgid "DALI_DEMO_STR_TITLE_RENDERING_DRAW_TRIANGLE" | ||
| 158 | +msgstr "Piirrä kolmio" | ||
| 159 | + | ||
| 160 | +msgid "DALI_DEMO_STR_TITLE_RENDERING_DRAW_LINE" | ||
| 161 | +msgstr "Draw linja" |
resources/po/ko.po
| @@ -147,3 +147,15 @@ msgstr "툴팁" | @@ -147,3 +147,15 @@ msgstr "툴팁" | ||
| 147 | 147 | ||
| 148 | msgid "DALI_DEMO_STR_TITLE_FPP_GAME" | 148 | msgid "DALI_DEMO_STR_TITLE_FPP_GAME" |
| 149 | msgstr "FPP Game" | 149 | msgstr "FPP Game" |
| 150 | + | ||
| 151 | +msgid "DALI_DEMO_STR_TITLE_RENDERING_TEXTURED_CUBE" | ||
| 152 | +msgstr "질감 입방체" | ||
| 153 | + | ||
| 154 | +msgid "DALI_DEMO_STR_TITLE_RENDERING_DRAW_CUBE" | ||
| 155 | +msgstr "큐브 그리기" | ||
| 156 | + | ||
| 157 | +msgid "DALI_DEMO_STR_TITLE_RENDERING_DRAW_TRIANGLE" | ||
| 158 | +msgstr "삼각형 그리기" | ||
| 159 | + | ||
| 160 | +msgid "DALI_DEMO_STR_TITLE_RENDERING_DRAW_LINE" | ||
| 161 | +msgstr "선 그리기" |
resources/po/ml.po
| @@ -147,3 +147,15 @@ msgstr "കൂടുതൽ വിവരങ്ങൾ" | @@ -147,3 +147,15 @@ msgstr "കൂടുതൽ വിവരങ്ങൾ" | ||
| 147 | 147 | ||
| 148 | msgid "DALI_DEMO_STR_TITLE_FPP_GAME" | 148 | msgid "DALI_DEMO_STR_TITLE_FPP_GAME" |
| 149 | msgstr "FPP Game" | 149 | msgstr "FPP Game" |
| 150 | + | ||
| 151 | +msgid "DALI_DEMO_STR_TITLE_RENDERING_TEXTURED_CUBE" | ||
| 152 | +msgstr "ടെക്സ്ചർ ക്യൂബ്" | ||
| 153 | + | ||
| 154 | +msgid "DALI_DEMO_STR_TITLE_RENDERING_DRAW_CUBE" | ||
| 155 | +msgstr "ക്യൂബ് വരയ്ക്കുക" | ||
| 156 | + | ||
| 157 | +msgid "DALI_DEMO_STR_TITLE_RENDERING_DRAW_TRIANGLE" | ||
| 158 | +msgstr "ത്രികോണം വരയ്ക്കുക" | ||
| 159 | + | ||
| 160 | +msgid "DALI_DEMO_STR_TITLE_RENDERING_DRAW_LINE" | ||
| 161 | +msgstr "സമനില ലൈൻ" |
resources/po/ur.po
| @@ -147,3 +147,15 @@ msgstr "مزید معلومات" | @@ -147,3 +147,15 @@ msgstr "مزید معلومات" | ||
| 147 | 147 | ||
| 148 | msgid "DALI_DEMO_STR_TITLE_FPP_GAME" | 148 | msgid "DALI_DEMO_STR_TITLE_FPP_GAME" |
| 149 | msgstr "FPP گیم" | 149 | msgstr "FPP گیم" |
| 150 | + | ||
| 151 | +msgid "DALI_DEMO_STR_TITLE_RENDERING_TEXTURED_CUBE" | ||
| 152 | +msgstr "بویک ٹوانب " | ||
| 153 | + | ||
| 154 | +msgid "DALI_DEMO_STR_TITLE_RENDERING_DRAW_CUBE" | ||
| 155 | +msgstr "ارڈ بویک " | ||
| 156 | + | ||
| 157 | +msgid "DALI_DEMO_STR_TITLE_RENDERING_DRAW_TRIANGLE" | ||
| 158 | +msgstr "ارڈ ثلثم " | ||
| 159 | + | ||
| 160 | +msgid "DALI_DEMO_STR_TITLE_RENDERING_DRAW_LINE" | ||
| 161 | +msgstr "انچنیھک ریکل " |
resources/po/zn_CH.po
| @@ -147,3 +147,15 @@ msgstr "更多信息" | @@ -147,3 +147,15 @@ msgstr "更多信息" | ||
| 147 | 147 | ||
| 148 | msgid "DALI_DEMO_STR_TITLE_FPP_GAME" | 148 | msgid "DALI_DEMO_STR_TITLE_FPP_GAME" |
| 149 | msgstr "FPP游戏" | 149 | msgstr "FPP游戏" |
| 150 | + | ||
| 151 | +msgid "DALI_DEMO_STR_TITLE_RENDERING_TEXTURED_CUBE" | ||
| 152 | +msgstr "纹理的多维数据集" | ||
| 153 | + | ||
| 154 | +msgid "DALI_DEMO_STR_TITLE_RENDERING_DRAW_CUBE" | ||
| 155 | +msgstr "绘制多维数据集" | ||
| 156 | + | ||
| 157 | +msgid "DALI_DEMO_STR_TITLE_RENDERING_DRAW_TRIANGLE" | ||
| 158 | +msgstr "绘制三角形" | ||
| 159 | + | ||
| 160 | +msgid "DALI_DEMO_STR_TITLE_RENDERING_DRAW_LINE" | ||
| 161 | +msgstr "画线" |
resources/style/.gitignore
| 1 | demo-theme.json | 1 | demo-theme.json |
| 2 | contact-cards-example-theme.json | 2 | contact-cards-example-theme.json |
| 3 | progress-bar-example-theme.json | 3 | progress-bar-example-theme.json |
| 4 | +simple-example-theme.json | ||
| 4 | style-example-theme-three.json | 5 | style-example-theme-three.json |
| 5 | style-example-theme-two.json | 6 | style-example-theme-two.json |
| 6 | style-example-theme-one.json | 7 | style-example-theme-one.json |
resources/style/demo-theme.json.in
| @@ -183,6 +183,35 @@ | @@ -183,6 +183,35 @@ | ||
| 183 | "units": "USER_SPACE", | 183 | "units": "USER_SPACE", |
| 184 | "stopColor": [[0.247,0.38,0.52,1.0],[0.055,0.18,0.286,1.0]] | 184 | "stopColor": [[0.247,0.38,0.52,1.0],[0.055,0.18,0.286,1.0]] |
| 185 | } | 185 | } |
| 186 | + }, | ||
| 187 | +// | ||
| 188 | +// Simple Visuals Application Style section | ||
| 189 | +// | ||
| 190 | + "MyControl": | ||
| 191 | + { | ||
| 192 | + "states": | ||
| 193 | + { | ||
| 194 | + "NORMAL": | ||
| 195 | + { | ||
| 196 | + "visuals": | ||
| 197 | + { | ||
| 198 | + "iconVisual": | ||
| 199 | + { | ||
| 200 | + "url":"{APPLICATION_RESOURCE_PATH}/images/application-icon-13.png" | ||
| 201 | + } | ||
| 202 | + } | ||
| 203 | + }, | ||
| 204 | + "FOCUSED": | ||
| 205 | + { | ||
| 206 | + "visuals": | ||
| 207 | + { | ||
| 208 | + "iconVisual": | ||
| 209 | + { | ||
| 210 | + "url":"{APPLICATION_RESOURCE_PATH}/images/application-icon-83.png" | ||
| 211 | + } | ||
| 212 | + } | ||
| 213 | + } | ||
| 214 | + } | ||
| 186 | } | 215 | } |
| 187 | } | 216 | } |
| 188 | } | 217 | } |
resources/style/mobile/simple-example-theme.json.in
0 → 100644
| 1 | +/* | ||
| 2 | + * Copyright (c) 2000-2017 Samsung Electronics Co., Ltd | ||
| 3 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 4 | + * you may not use this file except in compliance with the License. | ||
| 5 | + * You may obtain a copy of the License at | ||
| 6 | + * | ||
| 7 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 8 | + * | ||
| 9 | + * Unless required by applicable law or agreed to in writing, software | ||
| 10 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 11 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 12 | + * See the License for the specific language governing permissions and | ||
| 13 | + * limitations under the License. | ||
| 14 | + * | ||
| 15 | + */ | ||
| 16 | + | ||
| 17 | +{ | ||
| 18 | + "styles": | ||
| 19 | + { | ||
| 20 | + // | ||
| 21 | + // Simple Visuals Application styling | ||
| 22 | + // | ||
| 23 | + "MyControl": | ||
| 24 | + { | ||
| 25 | + "states": | ||
| 26 | + { | ||
| 27 | + "NORMAL": | ||
| 28 | + { | ||
| 29 | + "visuals": | ||
| 30 | + { | ||
| 31 | + "iconVisual": | ||
| 32 | + { | ||
| 33 | + "url":"{APPLICATION_RESOURCE_PATH}/images/application-icon-13.png" | ||
| 34 | + } | ||
| 35 | + } | ||
| 36 | + }, | ||
| 37 | + "FOCUSED": | ||
| 38 | + { | ||
| 39 | + "visuals": | ||
| 40 | + { | ||
| 41 | + "iconVisual": | ||
| 42 | + { | ||
| 43 | + "url":"{APPLICATION_RESOURCE_PATH}/images/application-icon-83.png" | ||
| 44 | + } | ||
| 45 | + } | ||
| 46 | + } | ||
| 47 | + } | ||
| 48 | + } | ||
| 49 | + } | ||
| 50 | +} |
resources/style/simple-example-theme.json.in
0 → 100644
| 1 | +/* | ||
| 2 | + * Copyright (c) 2000-2017 Samsung Electronics Co., Ltd | ||
| 3 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 4 | + * you may not use this file except in compliance with the License. | ||
| 5 | + * You may obtain a copy of the License at | ||
| 6 | + * | ||
| 7 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 8 | + * | ||
| 9 | + * Unless required by applicable law or agreed to in writing, software | ||
| 10 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 11 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 12 | + * See the License for the specific language governing permissions and | ||
| 13 | + * limitations under the License. | ||
| 14 | + * | ||
| 15 | + */ | ||
| 16 | + | ||
| 17 | +{ | ||
| 18 | + "styles": | ||
| 19 | + { | ||
| 20 | + // | ||
| 21 | + // Simple Visuals Application styling | ||
| 22 | + // | ||
| 23 | + "MyControl": | ||
| 24 | + { | ||
| 25 | + "states": | ||
| 26 | + { | ||
| 27 | + "NORMAL": | ||
| 28 | + { | ||
| 29 | + "visuals": | ||
| 30 | + { | ||
| 31 | + "iconVisual": | ||
| 32 | + { | ||
| 33 | + "url":"{APPLICATION_RESOURCE_PATH}/images/application-icon-13.png" | ||
| 34 | + } | ||
| 35 | + } | ||
| 36 | + }, | ||
| 37 | + "FOCUSED": | ||
| 38 | + { | ||
| 39 | + "visuals": | ||
| 40 | + { | ||
| 41 | + "iconVisual": | ||
| 42 | + { | ||
| 43 | + "url":"{APPLICATION_RESOURCE_PATH}/images/application-icon-83.png" | ||
| 44 | + } | ||
| 45 | + } | ||
| 46 | + } | ||
| 47 | + } | ||
| 48 | + } | ||
| 49 | + } | ||
| 50 | +} |
shared/dali-demo-strings.h
| @@ -67,8 +67,13 @@ extern "C" | @@ -67,8 +67,13 @@ extern "C" | ||
| 67 | #define DALI_DEMO_STR_TITLE_POPUP dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_POPUP") | 67 | #define DALI_DEMO_STR_TITLE_POPUP dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_POPUP") |
| 68 | #define DALI_DEMO_STR_TITLE_PRIMITIVE_SHAPES dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_PRIMITIVE_SHAPES") | 68 | #define DALI_DEMO_STR_TITLE_PRIMITIVE_SHAPES dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_PRIMITIVE_SHAPES") |
| 69 | #define DALI_DEMO_STR_TITLE_PROGRESS_BAR dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_PROGRESS_BAR") | 69 | #define DALI_DEMO_STR_TITLE_PROGRESS_BAR dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_PROGRESS_BAR") |
| 70 | +#define DALI_DEMO_STR_TITLE_RENDERING_DRAW_LINE dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_RENDERING_DRAW_LINE") | ||
| 71 | +#define DALI_DEMO_STR_TITLE_RENDERING_DRAW_TRIANGLE dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_RENDERING_DRAW_TRIANGLE") | ||
| 72 | +#define DALI_DEMO_STR_TITLE_RENDERING_DRAW_CUBE dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_RENDERING_DRAW_CUBE") | ||
| 73 | +#define DALI_DEMO_STR_TITLE_RENDERING_TEXTURED_CUBE dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_RENDERING_TEXTURED_CUBE") | ||
| 70 | #define DALI_DEMO_STR_TITLE_REFRACTION dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_REFRACTION") | 74 | #define DALI_DEMO_STR_TITLE_REFRACTION dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_REFRACTION") |
| 71 | #define DALI_DEMO_STR_TITLE_RENDERER_STENCIL dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_RENDERER_STENCIL") | 75 | #define DALI_DEMO_STR_TITLE_RENDERER_STENCIL dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_RENDERER_STENCIL") |
| 76 | +#define DALI_DEMO_STR_TITLE_SIMPLE_VISUALS_CONTROL dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_SIMPLE_VISUALS") | ||
| 72 | #define DALI_DEMO_STR_TITLE_SCRIPT_BASED_UI dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_SCRIPT_BASED_UI") | 77 | #define DALI_DEMO_STR_TITLE_SCRIPT_BASED_UI dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_SCRIPT_BASED_UI") |
| 73 | #define DALI_DEMO_STR_TITLE_SCROLL_VIEW dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_SCROLL_VIEW") | 78 | #define DALI_DEMO_STR_TITLE_SCROLL_VIEW dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_SCROLL_VIEW") |
| 74 | #define DALI_DEMO_STR_TITLE_SPARKLE dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_SPARKLE") | 79 | #define DALI_DEMO_STR_TITLE_SPARKLE dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_SPARKLE") |
| @@ -120,8 +125,13 @@ extern "C" | @@ -120,8 +125,13 @@ extern "C" | ||
| 120 | #define DALI_DEMO_STR_TITLE_POPUP "Popup" | 125 | #define DALI_DEMO_STR_TITLE_POPUP "Popup" |
| 121 | #define DALI_DEMO_STR_TITLE_PRIMITIVE_SHAPES "Primitive Shapes" | 126 | #define DALI_DEMO_STR_TITLE_PRIMITIVE_SHAPES "Primitive Shapes" |
| 122 | #define DALI_DEMO_STR_TITLE_PROGRESS_BAR "Progress Bar" | 127 | #define DALI_DEMO_STR_TITLE_PROGRESS_BAR "Progress Bar" |
| 128 | +#define DALI_DEMO_STR_TITLE_RENDERING_DRAW_LINE "Draw Line" | ||
| 129 | +#define DALI_DEMO_STR_TITLE_RENDERING_DRAW_TRIANGLE "Draw Triangle" | ||
| 130 | +#define DALI_DEMO_STR_TITLE_RENDERING_DRAW_CUBE "Draw Cube" | ||
| 131 | +#define DALI_DEMO_STR_TITLE_RENDERING_TEXTURED_CUBE "Textured Cube" | ||
| 123 | #define DALI_DEMO_STR_TITLE_REFRACTION "Refract Effect" | 132 | #define DALI_DEMO_STR_TITLE_REFRACTION "Refract Effect" |
| 124 | #define DALI_DEMO_STR_TITLE_RENDERER_STENCIL "Renderer Stencils" | 133 | #define DALI_DEMO_STR_TITLE_RENDERER_STENCIL "Renderer Stencils" |
| 134 | +#define DALI_DEMO_STR_TITLE_SIMPLE_VISUALS_CONTROL "Simple Visuals Control" | ||
| 125 | #define DALI_DEMO_STR_TITLE_SCRIPT_BASED_UI "Script Based UI" | 135 | #define DALI_DEMO_STR_TITLE_SCRIPT_BASED_UI "Script Based UI" |
| 126 | #define DALI_DEMO_STR_TITLE_SCROLL_VIEW "Scroll View" | 136 | #define DALI_DEMO_STR_TITLE_SCROLL_VIEW "Scroll View" |
| 127 | #define DALI_DEMO_STR_TITLE_SPARKLE "Sparkle" | 137 | #define DALI_DEMO_STR_TITLE_SPARKLE "Sparkle" |