Commit af6c53413323cc02dcf5985e1d856e27fa191c94

Authored by Ferran Sole
2 parents 59fe25e1 4de32de7

[dali_1.2.2] Merge branch 'devel/master'

Change-Id: I8982dceee284d864344c379961665b52f3980bfc
build/tizen/CMakeLists.txt
... ... @@ -5,17 +5,22 @@ SET(dali-demo_VERSION_MAJOR 1)
5 5 SET(dali-demo_VERSION_MINOR 0)
6 6  
7 7 SET(ROOT_SRC_DIR ${CMAKE_SOURCE_DIR}/../..)
  8 +SET(DEMO_SHARED ${CMAKE_SOURCE_DIR}/../../shared)
8 9  
9 10 SET(PREFIX ${CMAKE_INSTALL_PREFIX})
10 11  
11 12 IF(DEFINED DALI_APP_DIR)
12   - SET(APP_DATA_DIR ${DALI_APP_DIR})
13   - SET(BINDIR ${APP_DATA_DIR}/bin)
  13 + SET(BINDIR ${DALI_APP_DIR}/bin)
14 14 ELSE()
15   - SET(APP_DATA_DIR ${PREFIX}/share/com.samsung.dali-demo)
16 15 SET(BINDIR ${PREFIX}/bin)
17 16 ENDIF()
18 17  
  18 +IF(DEFINED DALI_APP_RES_DIR)
  19 + SET(APP_DATA_RES_DIR ${DALI_APP_RES_DIR})
  20 +ELSE()
  21 + SET(APP_DATA_RES_DIR ${PREFIX}/share/com.samsung.dali-demo/res)
  22 +ENDIF()
  23 +
19 24 MESSAGE( STATUS "CMAKE_BUILD_TYPE: " ${CMAKE_BUILD_TYPE} )
20 25 if(CMAKE_BUILD_TYPE MATCHES Debug)
21 26 MESSAGE("Setting variable: DEBUG_ENABLED")
... ... @@ -31,11 +36,11 @@ IF(NOT DEFINED LOCAL_STYLE_DIR)
31 36 SET(LOCAL_STYLE_DIR ${RESOURCE_DIR}/style)
32 37 ENDIF()
33 38  
34   -SET(IMAGES_DIR ${APP_DATA_DIR}/images/)
35   -SET(VIDEOS_DIR ${APP_DATA_DIR}/videos/)
36   -SET(MODELS_DIR ${APP_DATA_DIR}/models/)
37   -SET(SCRIPTS_DIR ${APP_DATA_DIR}/scripts/)
38   -SET(STYLE_DIR ${APP_DATA_DIR}style/)
  39 +SET(IMAGES_DIR ${APP_DATA_RES_DIR}/images/)
  40 +SET(VIDEOS_DIR ${APP_DATA_RES_DIR}/videos/)
  41 +SET(MODELS_DIR ${APP_DATA_RES_DIR}/models/)
  42 +SET(SCRIPTS_DIR ${APP_DATA_RES_DIR}/scripts/)
  43 +SET(STYLE_DIR ${APP_DATA_RES_DIR}/style/)
39 44  
40 45 IF(NOT DEFINED LOCALE_DIR)
41 46 SET(LOCALE_DIR ${PREFIX}/share/locale)
... ... @@ -83,6 +88,9 @@ FOREACH(flag ${LOCAL_SCRIPTS_LIST})
83 88 INSTALL(FILES ${LOCAL_SCRIPTS_DIR}/${flag} DESTINATION ${SCRIPTS_DIR})
84 89 ENDFOREACH(flag)
85 90  
  91 +#Create resources location file
  92 +CONFIGURE_FILE( resources-location.in ${DEMO_SHARED}/resources-location.cpp )
  93 +
86 94 #Replace @DEMO_STYLE_IMAGE_DIR@ in following files
87 95 CONFIGURE_FILE( ${LOCAL_STYLE_DIR}/demo-theme.json.in ${LOCAL_STYLE_DIR}/demo-theme.json )
88 96 CONFIGURE_FILE( ${LOCAL_STYLE_DIR}/style-example-theme-one.json.in ${LOCAL_STYLE_DIR}/style-example-theme-one.json )
... ...
build/tizen/demo/CMakeLists.txt
... ... @@ -2,6 +2,12 @@ SET(DEMO_SRC_DIR ${ROOT_SRC_DIR}/demo)
2 2  
3 3 AUX_SOURCE_DIRECTORY(${DEMO_SRC_DIR} DEMO_SRCS)
4 4  
  5 +
  6 +IF(NOT DEFINED DALI_APP_RES_DIR)
  7 + message([STATUS] "Setting application resource path from resource-location file")
  8 + SET( DEMO_SRCS ${DEMO_SRCS} "${ROOT_SRC_DIR}/shared/resources-location.cpp")
  9 +ENDIF()
  10 +
5 11 ADD_EXECUTABLE(${PROJECT_NAME} ${DEMO_SRCS})
6 12 TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${REQUIRED_PKGS_LDFLAGS} -pie)
7 13  
... ...
build/tizen/examples/CMakeLists.txt
... ... @@ -15,6 +15,9 @@ SUBDIRLIST(SUBDIRS ${EXAMPLES_SRC_DIR})
15 15  
16 16 FOREACH(EXAMPLE ${SUBDIRS})
17 17 FILE(GLOB SRCS "${EXAMPLES_SRC_DIR}/${EXAMPLE}/*.cpp")
  18 + IF(NOT DEFINED DALI_APP_RES_DIR)
  19 + SET( DEMO_SRCS ${DEMO_SRCS} "${ROOT_SRC_DIR}/shared/resources-location.cpp")
  20 + ENDIF()
18 21 ADD_EXECUTABLE(${EXAMPLE}.example ${SRCS})
19 22 TARGET_LINK_LIBRARIES(${EXAMPLE}.example ${REQUIRED_PKGS_LDFLAGS} -pie)
20 23 INSTALL(TARGETS ${EXAMPLE}.example DESTINATION ${BINDIR})
... ...
build/tizen/resources-location.in 0 → 100644
  1 +/**
  2 + * This file defines the location dali-demo resources
  3 + It is used exclusively for Ubuntu builds where an application resource directory is explicity defined.
  4 + */
  5 +
  6 +#include <cstdlib>
  7 +
  8 +int dali_demo_RESOURCE_DIR = setenv("DALI_APPLICATION_PACKAGE", "@APP_DATA_RES_DIR@" , 1);
... ...
examples/mesh-visual/mesh-visual-example.cpp
... ... @@ -39,11 +39,24 @@ namespace
39 39 MeshVisual::ShadingMode::TEXTURELESS_WITH_DIFFUSE_LIGHTING
40 40 };
41 41  
  42 + //Button labels.
  43 + const char * const PAUSE = " || ";
  44 + const char * const PLAY = " > ";
  45 + const char * const FIXED = "FIXED";
  46 + const char * const MANUAL = "MANUAL";
  47 + const char * const FRONT = "FRONT";
  48 + const char * const BACK = "BACK";
  49 +
  50 + //Image urls for the light.
  51 + const char * const LIGHT_URL_FRONT = DEMO_IMAGE_DIR "light-icon-front.png";
  52 + const char * const LIGHT_URL_BACK = DEMO_IMAGE_DIR "light-icon-back.png";
  53 +
42 54 const float X_ROTATION_DISPLACEMENT_FACTOR = 60.0f;
43 55 const float Y_ROTATION_DISPLACEMENT_FACTOR = 60.0f;
44 56 const float MODEL_SCALE = 0.75f;
45 57 const float LIGHT_SCALE = 0.15f;
46   - const float BUTTONS_OFFSET_BOTTOM = 0.9f;
  58 + const float BUTTONS_OFFSET_BOTTOM = 0.08f;
  59 + const float BUTTONS_OFFSET_SIDE = 0.2f;
47 60 const int NUM_MESHES = 2;
48 61  
49 62 //Used to identify actors.
... ... @@ -60,11 +73,12 @@ public:
60 73 MeshVisualController( Application& application )
61 74 : mApplication( application ), //Store handle to the application.
62 75 mModelIndex( 1 ), //Start with metal robot.
63   - mShadingModeIndex( 0 ), //Start with textured with detailed specular lighting.
  76 + mShadingModeIndex( 0 ), //Start with texture and detailed specular lighting.
64 77 mTag( -1 ), //Non-valid default, which will get set to a correct value when used.
65 78 mSelectedModelIndex( -1 ), //Non-valid default, which will get set to a correct value when used.
66 79 mPaused( false ), //Animations play by default.
67   - mLightFixed( true ) //The light is fixed by default.
  80 + mLightFixed( true ), //The light is fixed by default.
  81 + mLightFront( true ) //The light is in front by default.
68 82 {
69 83 // Connect to the Application's Init signal
70 84 mApplication.InitSignal().Connect( this, &MeshVisualController::Create );
... ... @@ -163,57 +177,78 @@ public:
163 177 //Place the various buttons on the bottom of the screen, with title labels where necessary.
164 178 void SetupButtons( Layer layer )
165 179 {
166   - //Text label title for changing model or shader.
167   - TextLabel changeTitleLabel = TextLabel::New( "Switch" );
168   - changeTitleLabel.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
169   - changeTitleLabel.SetProperty( TextLabel::Property::UNDERLINE, "{\"thickness\":\"2.0\"}" );
170   - changeTitleLabel.SetParentOrigin( Vector3( 0.2, BUTTONS_OFFSET_BOTTOM, 0.5 ) );
171   - changeTitleLabel.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER );
172   - layer.Add( changeTitleLabel );
  180 + //Actor for positioning model and shading mode buttons.
  181 + Actor positionActorModel = Actor::New();
  182 + positionActorModel.SetParentOrigin( Vector3( BUTTONS_OFFSET_SIDE, 1.0 - BUTTONS_OFFSET_BOTTOM, 0.5 ) );
  183 + positionActorModel.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER );
  184 + layer.Add( positionActorModel );
173 185  
174   - //Create button for model changing
  186 + //Create button for model changing.
175 187 PushButton modelButton = Toolkit::PushButton::New();
176 188 modelButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
177 189 modelButton.ClickedSignal().Connect( this, &MeshVisualController::OnChangeModelClicked );
178   - modelButton.SetParentOrigin( ParentOrigin::BOTTOM_CENTER );
179   - modelButton.SetAnchorPoint( AnchorPoint::TOP_RIGHT );
  190 + modelButton.SetParentOrigin( ParentOrigin::TOP_CENTER );
  191 + modelButton.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER );
180 192 modelButton.SetLabelText( "Model" );
181   - changeTitleLabel.Add( modelButton );
182   -
183   - //Create button for shader changing
184   - PushButton shaderButton = Toolkit::PushButton::New();
185   - shaderButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
186   - shaderButton.ClickedSignal().Connect( this, &MeshVisualController::OnChangeShaderClicked );
187   - shaderButton.SetParentOrigin( ParentOrigin::BOTTOM_CENTER );
188   - shaderButton.SetAnchorPoint( AnchorPoint::TOP_LEFT );
189   - shaderButton.SetLabelText( "Shader" );
190   - changeTitleLabel.Add( shaderButton );
191   -
192   - //Create button for pausing animations
  193 + positionActorModel.Add( modelButton );
  194 +
  195 + //Create button for shading mode changing.
  196 + PushButton shadingModeButton = Toolkit::PushButton::New();
  197 + shadingModeButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
  198 + shadingModeButton.ClickedSignal().Connect( this, &MeshVisualController::OnChangeShadingModeClicked );
  199 + shadingModeButton.SetParentOrigin( ParentOrigin::BOTTOM_CENTER );
  200 + shadingModeButton.SetAnchorPoint( AnchorPoint::TOP_CENTER );
  201 + shadingModeButton.SetLabelText( "Shading Mode" );
  202 + positionActorModel.Add( shadingModeButton );
  203 +
  204 + //Text label title for changing model or shading mode.
  205 + TextLabel changeTitleLabel = TextLabel::New( "Change" );
  206 + changeTitleLabel.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
  207 + changeTitleLabel.SetProperty( TextLabel::Property::UNDERLINE, "{\"thickness\":\"2.0\"}" );
  208 + changeTitleLabel.SetParentOrigin( ParentOrigin::TOP_CENTER );
  209 + changeTitleLabel.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER );
  210 + modelButton.Add( changeTitleLabel );
  211 +
  212 + //Create button for pausing animations.
193 213 PushButton pauseButton = Toolkit::PushButton::New();
194 214 pauseButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
195 215 pauseButton.ClickedSignal().Connect( this, &MeshVisualController::OnPauseClicked );
196   - pauseButton.SetParentOrigin( Vector3( 0.5, BUTTONS_OFFSET_BOTTOM, 0.5 ) );
197   - pauseButton.SetAnchorPoint( AnchorPoint::TOP_CENTER );
198   - pauseButton.SetLabelText( " || " );
  216 + pauseButton.SetParentOrigin( Vector3( 0.5, 1.0 - BUTTONS_OFFSET_BOTTOM, 0.5 ) );
  217 + pauseButton.SetAnchorPoint( AnchorPoint::CENTER );
  218 + pauseButton.SetLabelText( PAUSE );
199 219 layer.Add( pauseButton );
200 220  
  221 + //Actor for positioning light position buttons.
  222 + Actor positionActorLight = Actor::New();
  223 + positionActorLight.SetParentOrigin( Vector3( 1.0 - BUTTONS_OFFSET_SIDE, 1.0 - BUTTONS_OFFSET_BOTTOM, 0.5 ) );
  224 + positionActorLight.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER );
  225 + layer.Add( positionActorLight );
  226 +
  227 + //Create button for switching between manual and fixed light position.
  228 + PushButton lightModeButton = Toolkit::PushButton::New();
  229 + lightModeButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
  230 + lightModeButton.ClickedSignal().Connect( this, &MeshVisualController::OnChangeLightModeClicked );
  231 + lightModeButton.SetParentOrigin( ParentOrigin::TOP_CENTER );
  232 + lightModeButton.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER );
  233 + lightModeButton.SetLabelText( FIXED );
  234 + positionActorLight.Add( lightModeButton );
  235 +
  236 + //Create button for switching between front and back light position.
  237 + PushButton lightSideButton = Toolkit::PushButton::New();
  238 + lightSideButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
  239 + lightSideButton.ClickedSignal().Connect( this, &MeshVisualController::OnChangeLightSideClicked );
  240 + lightSideButton.SetParentOrigin( ParentOrigin::BOTTOM_CENTER );
  241 + lightSideButton.SetAnchorPoint( AnchorPoint::TOP_CENTER );
  242 + lightSideButton.SetLabelText( FRONT );
  243 + positionActorLight.Add( lightSideButton );
  244 +
201 245 //Text label title for light position mode.
202 246 TextLabel lightTitleLabel = TextLabel::New( "Light Position" );
203 247 lightTitleLabel.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
204 248 lightTitleLabel.SetProperty( TextLabel::Property::UNDERLINE, "{\"thickness\":\"2.0\"}" );
205   - lightTitleLabel.SetParentOrigin( Vector3( 0.8, BUTTONS_OFFSET_BOTTOM, 0.5 ) );
  249 + lightTitleLabel.SetParentOrigin( ParentOrigin::TOP_CENTER );
206 250 lightTitleLabel.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER );
207   - layer.Add( lightTitleLabel );
208   -
209   - //Create button for switching between manual and fixed light position.
210   - PushButton lightButton = Toolkit::PushButton::New();
211   - lightButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
212   - lightButton.ClickedSignal().Connect( this, &MeshVisualController::OnChangeLightModeClicked );
213   - lightButton.SetParentOrigin( ParentOrigin::BOTTOM_CENTER );
214   - lightButton.SetAnchorPoint( AnchorPoint::TOP_CENTER );
215   - lightButton.SetLabelText( "FIXED" );
216   - lightTitleLabel.Add( lightButton );
  251 + lightModeButton.Add( lightTitleLabel );
217 252 }
218 253  
219 254 //Add a point light source the the scene, on a layer above the first.
... ... @@ -246,10 +281,7 @@ public:
246 281 mLightSource.SetPosition( Stage::GetCurrent().GetSize().x * 0.85f, Stage::GetCurrent().GetSize().y * 0.125 );
247 282  
248 283 //Supply an image to represent the light.
249   - Property::Map lightMap;
250   - lightMap.Insert( Visual::Property::TYPE, Visual::IMAGE );
251   - lightMap.Insert( ImageVisual::Property::URL, DEMO_IMAGE_DIR "light-icon.png" );
252   - mLightSource.SetProperty( Control::Property::BACKGROUND, Property::Value( lightMap ) );
  284 + SetLightImage();
253 285  
254 286 //Connect to touch signal for dragging.
255 287 mLightSource.TouchedSignal().Connect( this, &MeshVisualController::OnTouch );
... ... @@ -264,14 +296,27 @@ public:
264 296 upperLayer.Add( mLightSource );
265 297  
266 298 //Decide which light to use to begin with.
267   - if( mLightFixed )
  299 + SetLightMode();
  300 + }
  301 +
  302 + //Sets the image to use for the light source depending on whether the light is in front or behind.
  303 + void SetLightImage()
  304 + {
  305 + std::string imageUrl;
  306 +
  307 + if( mLightFront )
268 308 {
269   - UseFixedLight();
  309 + imageUrl = LIGHT_URL_FRONT;
270 310 }
271 311 else
272 312 {
273   - UseManualLight();
  313 + imageUrl = LIGHT_URL_BACK;
274 314 }
  315 +
  316 + Property::Map lightMap;
  317 + lightMap.Insert( Visual::Property::TYPE, Visual::IMAGE );
  318 + lightMap.Insert( ImageVisual::Property::URL, imageUrl );
  319 + mLightSource.SetProperty( Control::Property::BACKGROUND, Property::Value( lightMap ) );
275 320 }
276 321  
277 322 //Updates the displayed models to account for parameter changes.
... ... @@ -292,16 +337,31 @@ public:
292 337 }
293 338 }
294 339  
  340 + //Set the mode used to light the models.
  341 + void SetLightMode()
  342 + {
  343 + if( mLightFixed )
  344 + {
  345 + UseFixedLight();
  346 + }
  347 + else
  348 + {
  349 + UseManualLight();
  350 + }
  351 + }
  352 +
  353 + //Make the models use a fixed, invisible light above the center of the stage.
295 354 void UseFixedLight()
296 355 {
297 356 //Hide draggable source
298 357 mLightSource.SetVisible( false );
299 358  
300   - //Use stage dimensions to place light at center, offset outwards in z axis.
  359 + //Use stage dimensions to place light at center, offset in z axis.
301 360 Stage stage = Stage::GetCurrent();
302 361 float width = stage.GetSize().width;
303 362 float height = stage.GetSize().height;
304   - Vector3 lightPosition = Vector3( width / 2.0f, height / 2.0f, std::max( width, height ) * 5.0f );
  363 + Vector3 lightPosition = Vector3( width / 2.0f, height / 2.0f,
  364 + ( mLightFront ? 1 : -1 ) * std::max( width, height ) * 5.0f );
305 365  
306 366 //Set global light position
307 367 for( int i = 0; i < NUM_MESHES; ++i )
... ... @@ -310,21 +370,23 @@ public:
310 370 }
311 371 }
312 372  
  373 + //Make the models use a light source that the user can drag around.
313 374 void UseManualLight()
314 375 {
315 376 //Show draggable source
316 377 mLightSource.SetVisible( true );
317 378  
318   - //Update to switch light position to that off the source.
  379 + //Update to switch light position of models to that of the source.
319 380 UpdateLight();
320 381 }
321 382  
322 383 //Updates the light position for each model to account for changes in the source on screen.
323 384 void UpdateLight()
324 385 {
325   - //Set light position to the x and y of the light control, offset out of the screen.
  386 + //Set light position to the x and y of the light control, offset into/out of the screen.
326 387 Vector3 controlPosition = mLightSource.GetCurrentPosition();
327   - Vector3 lightPosition = Vector3( controlPosition.x, controlPosition.y, Stage::GetCurrent().GetSize().x / 2.0f );
  388 + Vector3 lightPosition = Vector3( controlPosition.x, controlPosition.y,
  389 + ( mLightFront ? 1 : -1 ) * Stage::GetCurrent().GetSize().x / 2.0f );
328 390  
329 391 for( int i = 0; i < NUM_MESHES; ++i )
330 392 {
... ... @@ -426,8 +488,8 @@ public:
426 488 return true;
427 489 }
428 490  
429   - //Cycle through the list of shaders.
430   - bool OnChangeShaderClicked( Toolkit::Button button )
  491 + //Cycle through the list of shading modes.
  492 + bool OnChangeShadingModeClicked( Toolkit::Button button )
431 493 {
432 494 ++mShadingModeIndex %= 3;
433 495  
... ... @@ -451,7 +513,7 @@ public:
451 513 mModels[i].rotationAnimation.Pause();
452 514 }
453 515  
454   - button.SetLabelText( " > " );
  516 + button.SetLabelText( PLAY );
455 517 }
456 518 else //Unpause all animations again.
457 519 {
... ... @@ -460,14 +522,14 @@ public:
460 522 mModels[i].rotationAnimation.Play();
461 523 }
462 524  
463   - button.SetLabelText( " || " );
  525 + button.SetLabelText( PAUSE );
464 526 }
465 527  
466 528 return true;
467 529 }
468 530  
469 531  
470   - //Switch between a fixed light source in front of the screen, and a light source the user can drag around.
  532 + //Switch between a fixed light source above/behind the screen, and a light source the user can drag around.
471 533 bool OnChangeLightModeClicked( Toolkit::Button button )
472 534 {
473 535 //Toggle state.
... ... @@ -475,17 +537,39 @@ public:
475 537  
476 538 if( mLightFixed )
477 539 {
478   - UseFixedLight();
479   -
480   - button.SetLabelText( "FIXED" );
  540 + button.SetLabelText( FIXED );
481 541 }
482 542 else
483 543 {
484   - UseManualLight();
  544 + button.SetLabelText( MANUAL );
  545 + }
485 546  
486   - button.SetLabelText( "MANUAL" );
  547 + SetLightMode();
  548 +
  549 + return true;
  550 + }
  551 +
  552 + //Switch between the light being in front of and behind the models.
  553 + bool OnChangeLightSideClicked( Toolkit::Button button )
  554 + {
  555 + //Toggle state.
  556 + mLightFront = !mLightFront;
  557 +
  558 + if( mLightFront )
  559 + {
  560 + button.SetLabelText( FRONT );
  561 + }
  562 + else
  563 + {
  564 + button.SetLabelText( BACK );
487 565 }
488 566  
  567 + //Change light image.
  568 + SetLightImage();
  569 +
  570 + //Update light to account for the change.
  571 + SetLightMode();
  572 +
489 573 return true;
490 574 }
491 575  
... ... @@ -516,11 +600,12 @@ private:
516 600 Vector2 mRotationStart;
517 601  
518 602 int mModelIndex; //Index of model to load.
519   - int mShadingModeIndex; //Index of shader type to use.
  603 + int mShadingModeIndex; //Index of shading mode to use.
520 604 int mTag; //Identifies what kind of actor has been selected in OnTouch.
521 605 int mSelectedModelIndex; //Index of model selected on screen.
522 606 bool mPaused; //If true, all animations are paused and should stay so.
523 607 bool mLightFixed; //If false, the light is in manual.
  608 + bool mLightFront; //Bool for light being in front or behind the models.
524 609 };
525 610  
526 611 // Entry point for Linux & Tizen applications
... ...
examples/text-editor/text-editor-example.cpp
... ... @@ -62,7 +62,6 @@ const unsigned int NUMBER_OF_COLORS = sizeof( COLORS ) / sizeof( Vector4 );
62 62 class TextEditorExample : public ConnectionTracker
63 63 {
64 64 public:
65   -
66 65 TextEditorExample( Application& application )
67 66 : mApplication( application )
68 67 {
... ... @@ -152,6 +151,8 @@ public:
152 151 "Asšúm sapěret usu ůť.\n"
153 152 "Síť ut apeirián laboramúš percipitur, sůas hařum ín éos?\n" );
154 153  
  154 + mEditor.InputStyleChangedSignal().Connect( this, &TextEditorExample::OnTextInputStyleChanged );
  155 +
155 156 contents.Add( mEditor );
156 157 }
157 158  
... ... @@ -222,18 +223,36 @@ public:
222 223 {
223 224 const std::string& name = button.GetName();
224 225  
  226 + Vector4 color;
225 227 if( "color" == name.substr( 0u, 5u ) )
226 228 {
227 229 const unsigned int index = strtoul( name.substr( 5u, 1u ).c_str(), NULL, 10u );
228   - mEditor.SetProperty( TextEditor::Property::INPUT_COLOR, COLORS[index] );
  230 + color = COLORS[index];
  231 + mEditor.SetProperty( TextEditor::Property::INPUT_COLOR, color );
229 232 }
230 233  
  234 + mColorButtonOption.SetProperty( Button::Property::UNSELECTED_COLOR, color );
  235 + mColorButtonOption.SetProperty( Button::Property::SELECTED_COLOR, color );
  236 +
231 237 mButtonContainer.SetVisible( false );
232 238 mButtonContainer.SetSensitive( false );
233 239  
234 240 return true;
235 241 }
236 242  
  243 + void OnTextInputStyleChanged( TextEditor editor, TextEditor::InputStyle::Mask mask )
  244 + {
  245 + if( TextEditor::InputStyle::NONE != static_cast<TextEditor::InputStyle::Mask>( mask & TextEditor::InputStyle::COLOR ) )
  246 + {
  247 + const Vector4 color = editor.GetProperty( TextEditor::Property::INPUT_COLOR ).Get<Vector4>();
  248 +
  249 + mColorButtonOption.SetProperty( Button::Property::UNSELECTED_COLOR, color );
  250 + mColorButtonOption.SetProperty( Button::Property::SELECTED_COLOR, color );
  251 + }
  252 +
  253 + editor.Reset();
  254 + }
  255 +
237 256 private:
238 257  
239 258 Application& mApplication;
... ...
examples/text-label/text-label-example.cpp
... ... @@ -34,42 +34,69 @@ using namespace MultiLanguageStrings;
34 34  
35 35 namespace
36 36 {
37   - const char* const BACKGROUND_IMAGE = DEMO_IMAGE_DIR "grab-handle.png";
38   -
39   - const unsigned int KEY_ZERO = 10;
40   - const unsigned int KEY_ONE = 11;
41   - const unsigned int KEY_F = 41;
42   - const unsigned int KEY_H = 43;
43   - const unsigned int KEY_V = 55;
44   - const unsigned int KEY_M = 58;
45   - const unsigned int KEY_L = 46;
46   - const unsigned int KEY_S = 39;
47   - const unsigned int KEY_PLUS = 21;
48   - const unsigned int KEY_MINUS = 20;
49   -
50   - const char* H_ALIGNMENT_STRING_TABLE[] =
51   - {
52   - "BEGIN",
53   - "CENTER",
54   - "END"
55   - };
  37 +const char* const BACKGROUND_IMAGE = DEMO_IMAGE_DIR "grab-handle.png";
  38 +
  39 +const unsigned int KEY_ZERO = 10;
  40 +const unsigned int KEY_ONE = 11;
  41 +const unsigned int KEY_F = 41;
  42 +const unsigned int KEY_H = 43;
  43 +const unsigned int KEY_V = 55;
  44 +const unsigned int KEY_M = 58;
  45 +const unsigned int KEY_L = 46;
  46 +const unsigned int KEY_S = 39;
  47 +const unsigned int KEY_PLUS = 21;
  48 +const unsigned int KEY_MINUS = 20;
  49 +
  50 +const char* H_ALIGNMENT_STRING_TABLE[] =
  51 +{
  52 + "BEGIN",
  53 + "CENTER",
  54 + "END"
  55 +};
  56 +
  57 +const unsigned int H_ALIGNMENT_STRING_COUNT = sizeof( H_ALIGNMENT_STRING_TABLE ) / sizeof( H_ALIGNMENT_STRING_TABLE[0u] );
  58 +
  59 +const char* V_ALIGNMENT_STRING_TABLE[] =
  60 +{
  61 + "TOP",
  62 + "CENTER",
  63 + "BOTTOM"
  64 +};
  65 +
  66 +const unsigned int V_ALIGNMENT_STRING_COUNT = sizeof( V_ALIGNMENT_STRING_TABLE ) / sizeof( V_ALIGNMENT_STRING_TABLE[0u] );
56 67  
57   - const unsigned int H_ALIGNMENT_STRING_COUNT = sizeof( H_ALIGNMENT_STRING_TABLE ) / sizeof( H_ALIGNMENT_STRING_TABLE[0u] );
  68 +int ConvertToEven(int value)
  69 +{
  70 + return (value % 2 == 0) ? value : (value + 1);
  71 +}
58 72  
59   - const char* V_ALIGNMENT_STRING_TABLE[] =
  73 +struct HSVColorConstraint
  74 +{
  75 + HSVColorConstraint(float hue, float saturation, float value)
  76 + : hue(hue),
  77 + saturation(saturation),
  78 + value(value)
60 79 {
61   - "TOP",
62   - "CENTER",
63   - "BOTTOM"
64   - };
  80 + }
65 81  
66   - const unsigned int V_ALIGNMENT_STRING_COUNT = sizeof( V_ALIGNMENT_STRING_TABLE ) / sizeof( V_ALIGNMENT_STRING_TABLE[0u] );
  82 + void operator()(Vector4& current, const PropertyInputContainer& inputs )
  83 + {
  84 + current = hsv2rgb(Vector4(inputs[0]->GetFloat(), saturation, value, current.a));
  85 + }
67 86  
68   - int ConvertToEven(int value)
  87 + Vector4 hsv2rgb(Vector4 colorHSV)
69 88 {
70   - return (value % 2 == 0) ? value : (value + 1);
  89 + float r=colorHSV.z*(1+colorHSV.y*(cos(colorHSV.x)-1));
  90 + float g=colorHSV.z*(1+colorHSV.y*(cos(colorHSV.x-2.09439)-1));
  91 + float b=colorHSV.z*(1+colorHSV.y*(cos(colorHSV.x+2.09439)-1));
  92 + return Vector4(r, g, b, colorHSV.a);
71 93 }
72   -}
  94 + float hue;
  95 + float saturation;
  96 + float value;
  97 +};
  98 +
  99 +} // anonymous namespace
73 100  
74 101 /**
75 102 * @brief The main class of the demo.
... ... @@ -134,6 +161,20 @@ public:
134 161 mLabel.SetBackgroundColor( Color::WHITE );
135 162 mContainer.Add( mLabel );
136 163  
  164 + mHueAngleIndex = mLabel.RegisterProperty( "hue", 0.0f );
  165 + Renderer bgRenderer = mLabel.GetRendererAt(0);
  166 + mOverrideMixColorIndex = bgRenderer.GetPropertyIndex( ColorVisual::Property::MIX_COLOR );
  167 +
  168 + Constraint constraint = Constraint::New<Vector4>( bgRenderer, mOverrideMixColorIndex, HSVColorConstraint(0.0f, 0.5f, 0.8f));
  169 + constraint.AddSource( Source( mLabel, mHueAngleIndex ) );
  170 + constraint.SetRemoveAction( Constraint::Discard );
  171 + constraint.Apply();
  172 +
  173 + Animation anim = Animation::New(50.0f);
  174 + anim.AnimateTo(Property(mLabel, mHueAngleIndex), 6.28318f);
  175 + anim.SetLooping(true);
  176 + anim.Play();
  177 +
137 178 Property::Value labelText = mLabel.GetProperty( TextLabel::Property::TEXT );
138 179 std::cout << "Displaying text: \"" << labelText.Get< std::string >() << "\"" << std::endl;
139 180 }
... ... @@ -284,6 +325,8 @@ private:
284 325  
285 326 unsigned int mLanguageId;
286 327 unsigned int mAlignment;
  328 + Property::Index mHueAngleIndex;
  329 + Property::Index mOverrideMixColorIndex;
287 330 };
288 331  
289 332 void RunTest( Application& application )
... ...
packaging/com.samsung.dali-demo.spec
... ... @@ -2,7 +2,7 @@
2 2  
3 3 Name: com.samsung.dali-demo
4 4 Summary: The OpenGLES Canvas Core Demo
5   -Version: 1.2.1
  5 +Version: 1.2.2
6 6 Release: 1
7 7 Group: System/Libraries
8 8 License: Apache-2.0
... ... @@ -53,8 +53,9 @@ of the capability of the toolkit.
53 53 %define smack_rule_dir %TZ_SYS_SMACK/accesses2.d/
54 54 %endif
55 55  
  56 +%define dali_app_res_dir %{dali_app_ro_dir}/res/
56 57 %define dali_app_exe_dir %{dali_app_ro_dir}/bin/
57   -%define locale_dir %{dali_app_ro_dir}/res/locale
  58 +%define locale_dir %{dali_app_res_dir}/locale
58 59 %define local_style_dir ../../resources/style/mobile
59 60  
60 61 ##############################
... ... @@ -73,6 +74,7 @@ cd %{_builddir}/%{name}-%{version}/build/tizen
73 74  
74 75 cmake -DDALI_APP_DIR=%{dali_app_ro_dir} \
75 76 -DLOCALE_DIR=%{locale_dir} \
  77 + -DDALI_APP_RES_DIR=%{dali_app_res_dir} \
76 78 %if 0%{?enable_debug}
77 79 -DCMAKE_BUILD_TYPE=Debug \
78 80 %endif
... ... @@ -89,12 +91,13 @@ make %{?jobs:-j%jobs}
89 91 rm -rf %{buildroot}
90 92 cd build/tizen
91 93 %make_install DALI_APP_DIR=%{dali_app_ro_dir}
  94 +%make_install DDALI_APP_RES_DIR=%{dali_app_res_dir}
92 95  
93 96 mkdir -p %{buildroot}%{dali_xml_file_dir}
94 97 cp -f %{_builddir}/%{name}-%{version}/%{name}.xml %{buildroot}%{dali_xml_file_dir}
95 98  
96 99 mkdir -p %{buildroot}%{dali_icon_dir}
97   -mv %{buildroot}/%{dali_app_ro_dir}/images/%{name}.png %{buildroot}%{dali_icon_dir}
  100 +mv %{buildroot}/%{dali_app_res_dir}/images/%{name}.png %{buildroot}%{dali_icon_dir}
98 101  
99 102 %if 0%{?enable_dali_smack_rules} && !%{with wayland}
100 103 mkdir -p %{buildroot}%{smack_rule_dir}
... ... @@ -133,12 +136,12 @@ exit 0
133 136 %{dali_app_exe_dir}/dali-demo
134 137 %{dali_app_exe_dir}/*.example
135 138 %{dali_app_exe_dir}/dali-builder
136   -%{dali_app_ro_dir}/images/*
137   -%{dali_app_ro_dir}/videos/*
138   -%{dali_app_ro_dir}/models/*
139   -%{dali_app_ro_dir}/scripts/*
140   -%{dali_app_ro_dir}/style/*
141   -%{dali_app_ro_dir}/style/images/*
  139 +%{dali_app_res_dir}/images/*
  140 +%{dali_app_res_dir}/videos/*
  141 +%{dali_app_res_dir}/models/*
  142 +%{dali_app_res_dir}/scripts/*
  143 +%{dali_app_res_dir}/style/*
  144 +%{dali_app_res_dir}/style/images/*
142 145 %{dali_xml_file_dir}/%{name}.xml
143 146 %{dali_icon_dir}/*
144 147 %{locale_dir}/*
... ...
resources/images/light-icon-back.png 0 → 100644

129 KB

resources/images/light-icon.png renamed to resources/images/light-icon-front.png

115 KB

resources/po/ko.po
... ... @@ -5,10 +5,10 @@ msgid &quot;DALI_DEMO_STR_TITLE_BUBBLES&quot;
5 5 msgstr "방울"
6 6  
7 7 msgid "DALI_DEMO_STR_TITLE_BUTTONS"
8   -msgstr ""
  8 +msgstr "버튼"
9 9  
10 10 msgid "DALI_DEMO_STR_TITLE_COLOR_GRADIENT"
11   -msgstr ""
  11 +msgstr "색상 그라디언트"
12 12  
13 13 msgid "DALI_DEMO_STR_TITLE_CUBE_TRANSITION"
14 14 msgstr "입방체 전환"
... ... @@ -17,28 +17,28 @@ msgid &quot;DALI_DEMO_STR_TITLE_DISSOLVE_TRANSITION&quot;
17 17 msgstr "디졸브 전환"
18 18  
19 19 msgid "DALI_DEMO_STR_TITLE_EFFECTS_VIEW"
20   -msgstr ""
  20 +msgstr "이펙트 뷰"
21 21  
22 22 msgid "DALI_DEMO_STR_TITLE_EMOJI_TEXT"
23   -msgstr ""
  23 +msgstr "이모티콘 텍스트"
24 24  
25 25 msgid "DALI_DEMO_STR_TITLE_IMAGE_FITTING_SAMPLING"
26   -msgstr ""
  26 +msgstr "이미지 조정 샘플링"
27 27  
28 28 msgid "DALI_DEMO_STR_TITLE_IMAGE_SCALING"
29 29 msgstr "이미지 확대"
30 30  
31 31 msgid "DALI_DEMO_STR_TITLE_IMAGE_VIEW"
32   -msgstr ""
  32 +msgstr "이미지 뷰"
33 33  
34 34 msgid "DALI_DEMO_STR_TITLE_IMAGE_VIEW_ALPHA_BLENDING"
35   -msgstr ""
  35 +msgstr "이미지 뷰 알파 블렌딩"
36 36  
37 37 msgid "DALI_DEMO_STR_TITLE_IMAGE_VIEW_PIXEL_AREA"
38   -msgstr ""
  38 +msgstr "이미지 뷰 픽셀 영역"
39 39  
40 40 msgid "DALI_DEMO_STR_TITLE_IMAGE_VIEW_SVG"
41   -msgstr ""
  41 +msgstr "이미지 뷰 SVG"
42 42  
43 43 msgid "DALI_DEMO_STR_TITLE_ITEM_VIEW"
44 44 msgstr "아이템 뷰"
... ... @@ -47,28 +47,28 @@ msgid &quot;DALI_DEMO_STR_TITLE_LIGHTS_AND_SHADOWS&quot;
47 47 msgstr "빛과 그림자"
48 48  
49 49 msgid "DALI_DEMO_STR_TITLE_LINE_MESH"
50   -msgstr ""
  50 +msgstr "라인 메쉬"
51 51  
52 52 msgid "DALI_DEMO_STR_TITLE_LOGGING"
53   -msgstr ""
  53 +msgstr "로깅"
54 54  
55 55 msgid "DALI_DEMO_STR_TITLE_MAGNIFIER"
56 56 msgstr "돋보기"
57 57  
58 58 msgid "DALI_DEMO_STR_TITLE_MESH_MORPH"
59   -msgstr ""
  59 +msgstr "메쉬 형태"
60 60  
61 61 msgid "DALI_DEMO_STR_TITLE_MESH_SORTING"
62   -msgstr ""
  62 +msgstr "메쉬 분류"
63 63  
64 64 msgid "DALI_DEMO_STR_TITLE_MESH_VISUAL"
65   -msgstr ""
  65 +msgstr "메쉬 비주얼"
66 66  
67 67 msgid "DALI_DEMO_STR_TITLE_METABALL_EXPLOSION"
68   -msgstr ""
  68 +msgstr "메타볼 폭발"
69 69  
70 70 msgid "DALI_DEMO_STR_TITLE_METABALL_REFRAC"
71   -msgstr ""
  71 +msgstr "메타볼 굴절"
72 72  
73 73 msgid "DALI_DEMO_STR_TITLE_MOTION_BLUR"
74 74 msgstr "모션 블러"
... ... @@ -77,19 +77,19 @@ msgid &quot;DALI_DEMO_STR_TITLE_MOTION_STRETCH&quot;
77 77 msgstr "늘이기"
78 78  
79 79 msgid "DALI_DEMO_STR_TITLE_NATIVE_IMAGE_SOURCE"
80   -msgstr ""
  80 +msgstr "네이티브 이미지 소스"
81 81  
82 82 msgid "DALI_DEMO_STR_TITLE_NEGOTIATE_SIZE"
83   -msgstr ""
  83 +msgstr "사이즈 조절"
84 84  
85 85 msgid "DALI_DEMO_STR_TITLE_PAGE_TURN_VIEW"
86 86 msgstr "책장 넘기기"
87 87  
88 88 msgid "DALI_DEMO_STR_TITLE_POPUP"
89   -msgstr ""
  89 +msgstr "팝업"
90 90  
91 91 msgid "DALI_DEMO_STR_TITLE_PRIMITIVE_SHAPES"
92   -msgstr ""
  92 +msgstr "기본 모양"
93 93  
94 94 msgid "DALI_DEMO_STR_TITLE_RADIAL_MENU"
95 95 msgstr "레이디 얼 메뉴"
... ... @@ -98,7 +98,7 @@ msgid &quot;DALI_DEMO_STR_TITLE_REFRACTION&quot;
98 98 msgstr "굴절 효과"
99 99  
100 100 msgid "DALI_DEMO_STR_TITLE_RENDERER_STENCIL"
101   -msgstr ""
  101 +msgstr "렌더러 스텐실"
102 102  
103 103 msgid "DALI_DEMO_STR_TITLE_SCRIPT_BASED_UI"
104 104 msgstr "스크립팅"
... ... @@ -107,28 +107,28 @@ msgid &quot;DALI_DEMO_STR_TITLE_SCROLL_VIEW&quot;
107 107 msgstr "스크롤 뷰"
108 108  
109 109 msgid "DALI_DEMO_STR_TITLE_STYLING"
110   -msgstr ""
  110 +msgstr "스타일링"
111 111  
112 112 msgid "DALI_DEMO_STR_TITLE_SUPER_BLUR_BLOOM"
113   -msgstr ""
  113 +msgstr "블러링 이펙트"
114 114  
115 115 msgid "DALI_DEMO_STR_TITLE_TEXTURED_MESH"
116   -msgstr ""
  116 +msgstr "텍스쳐 메쉬"
117 117  
118 118 msgid "DALI_DEMO_STR_TITLE_TEXT_EDITOR"
119   -msgstr ""
  119 +msgstr "텍스트 편집기"
120 120  
121 121 msgid "DALI_DEMO_STR_TITLE_TEXT_FIELD"
122   -msgstr ""
  122 +msgstr "텍스트 필드"
123 123  
124 124 msgid "DALI_DEMO_STR_TITLE_TEXT_LABEL"
125 125 msgstr "텍스트 라벨"
126 126  
127 127 msgid "DALI_DEMO_STR_TITLE_TEXT_LABEL_MULTI_LANGUAGE"
128   -msgstr ""
  128 +msgstr "다국어"
129 129  
130 130 msgid "DALI_DEMO_STR_TITLE_TEXT_SCROLLING"
131   -msgstr ""
  131 +msgstr "텍스트 스크롤"
132 132  
133 133 msgid "DALI_DEMO_STR_TITLE_TILT_SENSOR"
134   -msgstr ""
135 134 \ No newline at end of file
  135 +msgstr "기울기 센서"
... ...
resources/style/demo-theme.json.in
... ... @@ -15,15 +15,10 @@
15 15 */
16 16  
17 17 {
18   - "constants":
19   - {
20   - "DEMO_IMAGE_DIR":"@DEMO_STYLE_IMAGE_DIR@"
21   - },
22   -
23 18 "styles":
24 19 {
25 20 "confirmationpopup":{
26   - "popupBackgroundImage":"{DEMO_IMAGE_DIR}00_popup_bg.9.png"
  21 + "popupBackgroundImage":"{APPLICATION_RESOURCE_PATH}/images/00_popup_bg.9.png"
27 22 },
28 23  
29 24 "textlabel-Rosemary":
... ...
resources/style/style-example-theme-two.json.in
1 1 {
2 2 "constants":
3 3 {
4   - "DEMO_IMAGE_DIR":"@DEMO_STYLE_IMAGE_DIR@"
  4 + "STYLE_DIR":"{APPLICATION_RESOURCE_PATH}/style"
5 5 },
6 6 "styles":
7 7 {
... ... @@ -25,9 +25,9 @@
25 25  
26 26 // Change an icon size, see if it gets properly re-sized
27 27 "radiobutton":{
28   - "unselectedStateImage":"{DEMO_IMAGE_DIR}/radio-button-unselected.png",
29   - "selectedStateImage":"{DEMO_IMAGE_DIR}/radio-button-selected.png",
30   - "disabledStateImage":"{DEMO_IMAGE_DIR}/radio-button-unselected-disabled.png",
  28 + "unselectedStateImage":"{STYLE_DIR}/images/radio-button-unselected.png",
  29 + "selectedStateImage":"{STYLE_DIR}/images/radio-button-selected.png",
  30 + "disabledStateImage":"{STYLE_DIR}/images/radio-button-unselected-disabled.png",
31 31 "imageLabelGap":10,
32 32 "label":{
33 33 "textColor": [0.1,1,1,1]
... ... @@ -78,19 +78,19 @@
78 78 "colorSlider1":{
79 79 "styles":["thinslider"],
80 80 "progressVisual":{
81   - "url":"{DEMO_IMAGE_DIR}/slider-skin-progress-red.9.png"
  81 + "url":"{STYLE_DIR}/images/slider-skin-progress-red.9.png"
82 82 }
83 83 },
84 84 "colorSlider2":{
85 85 "styles":["thinslider"],
86 86 "progressVisual":{
87   - "url":"{DEMO_IMAGE_DIR}/slider-skin-progress-green.9.png"
  87 + "url":"{STYLE_DIR}/images/slider-skin-progress-green.9.png"
88 88 }
89 89 },
90 90 "colorSlider3":{
91 91 "styles":["thinslider"],
92 92 "progressVisual":{
93   - "url":"{DEMO_IMAGE_DIR}/slider-skin-progress-blue.9.png"
  93 + "url":"{STYLE_DIR}/images/slider-skin-progress-blue.9.png"
94 94 }
95 95 }
96 96 }
... ...