diff --git a/build/tizen/CMakeLists.txt b/build/tizen/CMakeLists.txt index 89df63b..d7bc887 100644 --- a/build/tizen/CMakeLists.txt +++ b/build/tizen/CMakeLists.txt @@ -5,17 +5,22 @@ SET(dali-demo_VERSION_MAJOR 1) SET(dali-demo_VERSION_MINOR 0) SET(ROOT_SRC_DIR ${CMAKE_SOURCE_DIR}/../..) +SET(DEMO_SHARED ${CMAKE_SOURCE_DIR}/../../shared) SET(PREFIX ${CMAKE_INSTALL_PREFIX}) IF(DEFINED DALI_APP_DIR) - SET(APP_DATA_DIR ${DALI_APP_DIR}) - SET(BINDIR ${APP_DATA_DIR}/bin) + SET(BINDIR ${DALI_APP_DIR}/bin) ELSE() - SET(APP_DATA_DIR ${PREFIX}/share/com.samsung.dali-demo) SET(BINDIR ${PREFIX}/bin) ENDIF() +IF(DEFINED DALI_APP_RES_DIR) + SET(APP_DATA_RES_DIR ${DALI_APP_RES_DIR}) +ELSE() + SET(APP_DATA_RES_DIR ${PREFIX}/share/com.samsung.dali-demo/res) +ENDIF() + MESSAGE( STATUS "CMAKE_BUILD_TYPE: " ${CMAKE_BUILD_TYPE} ) if(CMAKE_BUILD_TYPE MATCHES Debug) MESSAGE("Setting variable: DEBUG_ENABLED") @@ -31,11 +36,11 @@ IF(NOT DEFINED LOCAL_STYLE_DIR) SET(LOCAL_STYLE_DIR ${RESOURCE_DIR}/style) ENDIF() -SET(IMAGES_DIR ${APP_DATA_DIR}/images/) -SET(VIDEOS_DIR ${APP_DATA_DIR}/videos/) -SET(MODELS_DIR ${APP_DATA_DIR}/models/) -SET(SCRIPTS_DIR ${APP_DATA_DIR}/scripts/) -SET(STYLE_DIR ${APP_DATA_DIR}style/) +SET(IMAGES_DIR ${APP_DATA_RES_DIR}/images/) +SET(VIDEOS_DIR ${APP_DATA_RES_DIR}/videos/) +SET(MODELS_DIR ${APP_DATA_RES_DIR}/models/) +SET(SCRIPTS_DIR ${APP_DATA_RES_DIR}/scripts/) +SET(STYLE_DIR ${APP_DATA_RES_DIR}/style/) IF(NOT DEFINED LOCALE_DIR) SET(LOCALE_DIR ${PREFIX}/share/locale) @@ -83,6 +88,9 @@ FOREACH(flag ${LOCAL_SCRIPTS_LIST}) INSTALL(FILES ${LOCAL_SCRIPTS_DIR}/${flag} DESTINATION ${SCRIPTS_DIR}) ENDFOREACH(flag) +#Create resources location file +CONFIGURE_FILE( resources-location.in ${DEMO_SHARED}/resources-location.cpp ) + #Replace @DEMO_STYLE_IMAGE_DIR@ in following files CONFIGURE_FILE( ${LOCAL_STYLE_DIR}/demo-theme.json.in ${LOCAL_STYLE_DIR}/demo-theme.json ) CONFIGURE_FILE( ${LOCAL_STYLE_DIR}/style-example-theme-one.json.in ${LOCAL_STYLE_DIR}/style-example-theme-one.json ) diff --git a/build/tizen/demo/CMakeLists.txt b/build/tizen/demo/CMakeLists.txt index affd620..6aaf032 100644 --- a/build/tizen/demo/CMakeLists.txt +++ b/build/tizen/demo/CMakeLists.txt @@ -2,6 +2,12 @@ SET(DEMO_SRC_DIR ${ROOT_SRC_DIR}/demo) AUX_SOURCE_DIRECTORY(${DEMO_SRC_DIR} DEMO_SRCS) + +IF(NOT DEFINED DALI_APP_RES_DIR) + message([STATUS] "Setting application resource path from resource-location file") + SET( DEMO_SRCS ${DEMO_SRCS} "${ROOT_SRC_DIR}/shared/resources-location.cpp") +ENDIF() + ADD_EXECUTABLE(${PROJECT_NAME} ${DEMO_SRCS}) TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${REQUIRED_PKGS_LDFLAGS} -pie) diff --git a/build/tizen/examples/CMakeLists.txt b/build/tizen/examples/CMakeLists.txt index 7fa03fe..cc1183a 100644 --- a/build/tizen/examples/CMakeLists.txt +++ b/build/tizen/examples/CMakeLists.txt @@ -15,6 +15,9 @@ SUBDIRLIST(SUBDIRS ${EXAMPLES_SRC_DIR}) FOREACH(EXAMPLE ${SUBDIRS}) FILE(GLOB SRCS "${EXAMPLES_SRC_DIR}/${EXAMPLE}/*.cpp") + IF(NOT DEFINED DALI_APP_RES_DIR) + SET( DEMO_SRCS ${DEMO_SRCS} "${ROOT_SRC_DIR}/shared/resources-location.cpp") + ENDIF() ADD_EXECUTABLE(${EXAMPLE}.example ${SRCS}) TARGET_LINK_LIBRARIES(${EXAMPLE}.example ${REQUIRED_PKGS_LDFLAGS} -pie) INSTALL(TARGETS ${EXAMPLE}.example DESTINATION ${BINDIR}) diff --git a/build/tizen/resources-location.in b/build/tizen/resources-location.in new file mode 100644 index 0000000..89b0b87 --- /dev/null +++ b/build/tizen/resources-location.in @@ -0,0 +1,8 @@ +/** + * This file defines the location dali-demo resources + It is used exclusively for Ubuntu builds where an application resource directory is explicity defined. + */ + +#include + +int dali_demo_RESOURCE_DIR = setenv("DALI_APPLICATION_PACKAGE", "@APP_DATA_RES_DIR@" , 1); diff --git a/examples/mesh-visual/mesh-visual-example.cpp b/examples/mesh-visual/mesh-visual-example.cpp index 3340838..8376f61 100644 --- a/examples/mesh-visual/mesh-visual-example.cpp +++ b/examples/mesh-visual/mesh-visual-example.cpp @@ -39,11 +39,24 @@ namespace MeshVisual::ShadingMode::TEXTURELESS_WITH_DIFFUSE_LIGHTING }; + //Button labels. + const char * const PAUSE = " || "; + const char * const PLAY = " > "; + const char * const FIXED = "FIXED"; + const char * const MANUAL = "MANUAL"; + const char * const FRONT = "FRONT"; + const char * const BACK = "BACK"; + + //Image urls for the light. + const char * const LIGHT_URL_FRONT = DEMO_IMAGE_DIR "light-icon-front.png"; + const char * const LIGHT_URL_BACK = DEMO_IMAGE_DIR "light-icon-back.png"; + const float X_ROTATION_DISPLACEMENT_FACTOR = 60.0f; const float Y_ROTATION_DISPLACEMENT_FACTOR = 60.0f; const float MODEL_SCALE = 0.75f; const float LIGHT_SCALE = 0.15f; - const float BUTTONS_OFFSET_BOTTOM = 0.9f; + const float BUTTONS_OFFSET_BOTTOM = 0.08f; + const float BUTTONS_OFFSET_SIDE = 0.2f; const int NUM_MESHES = 2; //Used to identify actors. @@ -60,11 +73,12 @@ public: MeshVisualController( Application& application ) : mApplication( application ), //Store handle to the application. mModelIndex( 1 ), //Start with metal robot. - mShadingModeIndex( 0 ), //Start with textured with detailed specular lighting. + mShadingModeIndex( 0 ), //Start with texture and detailed specular lighting. mTag( -1 ), //Non-valid default, which will get set to a correct value when used. mSelectedModelIndex( -1 ), //Non-valid default, which will get set to a correct value when used. mPaused( false ), //Animations play by default. - mLightFixed( true ) //The light is fixed by default. + mLightFixed( true ), //The light is fixed by default. + mLightFront( true ) //The light is in front by default. { // Connect to the Application's Init signal mApplication.InitSignal().Connect( this, &MeshVisualController::Create ); @@ -163,57 +177,78 @@ public: //Place the various buttons on the bottom of the screen, with title labels where necessary. void SetupButtons( Layer layer ) { - //Text label title for changing model or shader. - TextLabel changeTitleLabel = TextLabel::New( "Switch" ); - changeTitleLabel.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); - changeTitleLabel.SetProperty( TextLabel::Property::UNDERLINE, "{\"thickness\":\"2.0\"}" ); - changeTitleLabel.SetParentOrigin( Vector3( 0.2, BUTTONS_OFFSET_BOTTOM, 0.5 ) ); - changeTitleLabel.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER ); - layer.Add( changeTitleLabel ); + //Actor for positioning model and shading mode buttons. + Actor positionActorModel = Actor::New(); + positionActorModel.SetParentOrigin( Vector3( BUTTONS_OFFSET_SIDE, 1.0 - BUTTONS_OFFSET_BOTTOM, 0.5 ) ); + positionActorModel.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER ); + layer.Add( positionActorModel ); - //Create button for model changing + //Create button for model changing. PushButton modelButton = Toolkit::PushButton::New(); modelButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); modelButton.ClickedSignal().Connect( this, &MeshVisualController::OnChangeModelClicked ); - modelButton.SetParentOrigin( ParentOrigin::BOTTOM_CENTER ); - modelButton.SetAnchorPoint( AnchorPoint::TOP_RIGHT ); + modelButton.SetParentOrigin( ParentOrigin::TOP_CENTER ); + modelButton.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER ); modelButton.SetLabelText( "Model" ); - changeTitleLabel.Add( modelButton ); - - //Create button for shader changing - PushButton shaderButton = Toolkit::PushButton::New(); - shaderButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); - shaderButton.ClickedSignal().Connect( this, &MeshVisualController::OnChangeShaderClicked ); - shaderButton.SetParentOrigin( ParentOrigin::BOTTOM_CENTER ); - shaderButton.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - shaderButton.SetLabelText( "Shader" ); - changeTitleLabel.Add( shaderButton ); - - //Create button for pausing animations + positionActorModel.Add( modelButton ); + + //Create button for shading mode changing. + PushButton shadingModeButton = Toolkit::PushButton::New(); + shadingModeButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); + shadingModeButton.ClickedSignal().Connect( this, &MeshVisualController::OnChangeShadingModeClicked ); + shadingModeButton.SetParentOrigin( ParentOrigin::BOTTOM_CENTER ); + shadingModeButton.SetAnchorPoint( AnchorPoint::TOP_CENTER ); + shadingModeButton.SetLabelText( "Shading Mode" ); + positionActorModel.Add( shadingModeButton ); + + //Text label title for changing model or shading mode. + TextLabel changeTitleLabel = TextLabel::New( "Change" ); + changeTitleLabel.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); + changeTitleLabel.SetProperty( TextLabel::Property::UNDERLINE, "{\"thickness\":\"2.0\"}" ); + changeTitleLabel.SetParentOrigin( ParentOrigin::TOP_CENTER ); + changeTitleLabel.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER ); + modelButton.Add( changeTitleLabel ); + + //Create button for pausing animations. PushButton pauseButton = Toolkit::PushButton::New(); pauseButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); pauseButton.ClickedSignal().Connect( this, &MeshVisualController::OnPauseClicked ); - pauseButton.SetParentOrigin( Vector3( 0.5, BUTTONS_OFFSET_BOTTOM, 0.5 ) ); - pauseButton.SetAnchorPoint( AnchorPoint::TOP_CENTER ); - pauseButton.SetLabelText( " || " ); + pauseButton.SetParentOrigin( Vector3( 0.5, 1.0 - BUTTONS_OFFSET_BOTTOM, 0.5 ) ); + pauseButton.SetAnchorPoint( AnchorPoint::CENTER ); + pauseButton.SetLabelText( PAUSE ); layer.Add( pauseButton ); + //Actor for positioning light position buttons. + Actor positionActorLight = Actor::New(); + positionActorLight.SetParentOrigin( Vector3( 1.0 - BUTTONS_OFFSET_SIDE, 1.0 - BUTTONS_OFFSET_BOTTOM, 0.5 ) ); + positionActorLight.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER ); + layer.Add( positionActorLight ); + + //Create button for switching between manual and fixed light position. + PushButton lightModeButton = Toolkit::PushButton::New(); + lightModeButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); + lightModeButton.ClickedSignal().Connect( this, &MeshVisualController::OnChangeLightModeClicked ); + lightModeButton.SetParentOrigin( ParentOrigin::TOP_CENTER ); + lightModeButton.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER ); + lightModeButton.SetLabelText( FIXED ); + positionActorLight.Add( lightModeButton ); + + //Create button for switching between front and back light position. + PushButton lightSideButton = Toolkit::PushButton::New(); + lightSideButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); + lightSideButton.ClickedSignal().Connect( this, &MeshVisualController::OnChangeLightSideClicked ); + lightSideButton.SetParentOrigin( ParentOrigin::BOTTOM_CENTER ); + lightSideButton.SetAnchorPoint( AnchorPoint::TOP_CENTER ); + lightSideButton.SetLabelText( FRONT ); + positionActorLight.Add( lightSideButton ); + //Text label title for light position mode. TextLabel lightTitleLabel = TextLabel::New( "Light Position" ); lightTitleLabel.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); lightTitleLabel.SetProperty( TextLabel::Property::UNDERLINE, "{\"thickness\":\"2.0\"}" ); - lightTitleLabel.SetParentOrigin( Vector3( 0.8, BUTTONS_OFFSET_BOTTOM, 0.5 ) ); + lightTitleLabel.SetParentOrigin( ParentOrigin::TOP_CENTER ); lightTitleLabel.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER ); - layer.Add( lightTitleLabel ); - - //Create button for switching between manual and fixed light position. - PushButton lightButton = Toolkit::PushButton::New(); - lightButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); - lightButton.ClickedSignal().Connect( this, &MeshVisualController::OnChangeLightModeClicked ); - lightButton.SetParentOrigin( ParentOrigin::BOTTOM_CENTER ); - lightButton.SetAnchorPoint( AnchorPoint::TOP_CENTER ); - lightButton.SetLabelText( "FIXED" ); - lightTitleLabel.Add( lightButton ); + lightModeButton.Add( lightTitleLabel ); } //Add a point light source the the scene, on a layer above the first. @@ -246,10 +281,7 @@ public: mLightSource.SetPosition( Stage::GetCurrent().GetSize().x * 0.85f, Stage::GetCurrent().GetSize().y * 0.125 ); //Supply an image to represent the light. - Property::Map lightMap; - lightMap.Insert( Visual::Property::TYPE, Visual::IMAGE ); - lightMap.Insert( ImageVisual::Property::URL, DEMO_IMAGE_DIR "light-icon.png" ); - mLightSource.SetProperty( Control::Property::BACKGROUND, Property::Value( lightMap ) ); + SetLightImage(); //Connect to touch signal for dragging. mLightSource.TouchedSignal().Connect( this, &MeshVisualController::OnTouch ); @@ -264,14 +296,27 @@ public: upperLayer.Add( mLightSource ); //Decide which light to use to begin with. - if( mLightFixed ) + SetLightMode(); + } + + //Sets the image to use for the light source depending on whether the light is in front or behind. + void SetLightImage() + { + std::string imageUrl; + + if( mLightFront ) { - UseFixedLight(); + imageUrl = LIGHT_URL_FRONT; } else { - UseManualLight(); + imageUrl = LIGHT_URL_BACK; } + + Property::Map lightMap; + lightMap.Insert( Visual::Property::TYPE, Visual::IMAGE ); + lightMap.Insert( ImageVisual::Property::URL, imageUrl ); + mLightSource.SetProperty( Control::Property::BACKGROUND, Property::Value( lightMap ) ); } //Updates the displayed models to account for parameter changes. @@ -292,16 +337,31 @@ public: } } + //Set the mode used to light the models. + void SetLightMode() + { + if( mLightFixed ) + { + UseFixedLight(); + } + else + { + UseManualLight(); + } + } + + //Make the models use a fixed, invisible light above the center of the stage. void UseFixedLight() { //Hide draggable source mLightSource.SetVisible( false ); - //Use stage dimensions to place light at center, offset outwards in z axis. + //Use stage dimensions to place light at center, offset in z axis. Stage stage = Stage::GetCurrent(); float width = stage.GetSize().width; float height = stage.GetSize().height; - Vector3 lightPosition = Vector3( width / 2.0f, height / 2.0f, std::max( width, height ) * 5.0f ); + Vector3 lightPosition = Vector3( width / 2.0f, height / 2.0f, + ( mLightFront ? 1 : -1 ) * std::max( width, height ) * 5.0f ); //Set global light position for( int i = 0; i < NUM_MESHES; ++i ) @@ -310,21 +370,23 @@ public: } } + //Make the models use a light source that the user can drag around. void UseManualLight() { //Show draggable source mLightSource.SetVisible( true ); - //Update to switch light position to that off the source. + //Update to switch light position of models to that of the source. UpdateLight(); } //Updates the light position for each model to account for changes in the source on screen. void UpdateLight() { - //Set light position to the x and y of the light control, offset out of the screen. + //Set light position to the x and y of the light control, offset into/out of the screen. Vector3 controlPosition = mLightSource.GetCurrentPosition(); - Vector3 lightPosition = Vector3( controlPosition.x, controlPosition.y, Stage::GetCurrent().GetSize().x / 2.0f ); + Vector3 lightPosition = Vector3( controlPosition.x, controlPosition.y, + ( mLightFront ? 1 : -1 ) * Stage::GetCurrent().GetSize().x / 2.0f ); for( int i = 0; i < NUM_MESHES; ++i ) { @@ -426,8 +488,8 @@ public: return true; } - //Cycle through the list of shaders. - bool OnChangeShaderClicked( Toolkit::Button button ) + //Cycle through the list of shading modes. + bool OnChangeShadingModeClicked( Toolkit::Button button ) { ++mShadingModeIndex %= 3; @@ -451,7 +513,7 @@ public: mModels[i].rotationAnimation.Pause(); } - button.SetLabelText( " > " ); + button.SetLabelText( PLAY ); } else //Unpause all animations again. { @@ -460,14 +522,14 @@ public: mModels[i].rotationAnimation.Play(); } - button.SetLabelText( " || " ); + button.SetLabelText( PAUSE ); } return true; } - //Switch between a fixed light source in front of the screen, and a light source the user can drag around. + //Switch between a fixed light source above/behind the screen, and a light source the user can drag around. bool OnChangeLightModeClicked( Toolkit::Button button ) { //Toggle state. @@ -475,17 +537,39 @@ public: if( mLightFixed ) { - UseFixedLight(); - - button.SetLabelText( "FIXED" ); + button.SetLabelText( FIXED ); } else { - UseManualLight(); + button.SetLabelText( MANUAL ); + } - button.SetLabelText( "MANUAL" ); + SetLightMode(); + + return true; + } + + //Switch between the light being in front of and behind the models. + bool OnChangeLightSideClicked( Toolkit::Button button ) + { + //Toggle state. + mLightFront = !mLightFront; + + if( mLightFront ) + { + button.SetLabelText( FRONT ); + } + else + { + button.SetLabelText( BACK ); } + //Change light image. + SetLightImage(); + + //Update light to account for the change. + SetLightMode(); + return true; } @@ -516,11 +600,12 @@ private: Vector2 mRotationStart; int mModelIndex; //Index of model to load. - int mShadingModeIndex; //Index of shader type to use. + int mShadingModeIndex; //Index of shading mode to use. int mTag; //Identifies what kind of actor has been selected in OnTouch. int mSelectedModelIndex; //Index of model selected on screen. bool mPaused; //If true, all animations are paused and should stay so. bool mLightFixed; //If false, the light is in manual. + bool mLightFront; //Bool for light being in front or behind the models. }; // Entry point for Linux & Tizen applications diff --git a/examples/text-editor/text-editor-example.cpp b/examples/text-editor/text-editor-example.cpp index eb83eec..d2a05d7 100644 --- a/examples/text-editor/text-editor-example.cpp +++ b/examples/text-editor/text-editor-example.cpp @@ -62,7 +62,6 @@ const unsigned int NUMBER_OF_COLORS = sizeof( COLORS ) / sizeof( Vector4 ); class TextEditorExample : public ConnectionTracker { public: - TextEditorExample( Application& application ) : mApplication( application ) { @@ -152,6 +151,8 @@ public: "Asšúm sapěret usu ůť.\n" "Síť ut apeirián laboramúš percipitur, sůas hařum ín éos?\n" ); + mEditor.InputStyleChangedSignal().Connect( this, &TextEditorExample::OnTextInputStyleChanged ); + contents.Add( mEditor ); } @@ -222,18 +223,36 @@ public: { const std::string& name = button.GetName(); + Vector4 color; if( "color" == name.substr( 0u, 5u ) ) { const unsigned int index = strtoul( name.substr( 5u, 1u ).c_str(), NULL, 10u ); - mEditor.SetProperty( TextEditor::Property::INPUT_COLOR, COLORS[index] ); + color = COLORS[index]; + mEditor.SetProperty( TextEditor::Property::INPUT_COLOR, color ); } + mColorButtonOption.SetProperty( Button::Property::UNSELECTED_COLOR, color ); + mColorButtonOption.SetProperty( Button::Property::SELECTED_COLOR, color ); + mButtonContainer.SetVisible( false ); mButtonContainer.SetSensitive( false ); return true; } + void OnTextInputStyleChanged( TextEditor editor, TextEditor::InputStyle::Mask mask ) + { + if( TextEditor::InputStyle::NONE != static_cast( mask & TextEditor::InputStyle::COLOR ) ) + { + const Vector4 color = editor.GetProperty( TextEditor::Property::INPUT_COLOR ).Get(); + + mColorButtonOption.SetProperty( Button::Property::UNSELECTED_COLOR, color ); + mColorButtonOption.SetProperty( Button::Property::SELECTED_COLOR, color ); + } + + editor.Reset(); + } + private: Application& mApplication; diff --git a/examples/text-label/text-label-example.cpp b/examples/text-label/text-label-example.cpp index b2ad9a5..c035ed6 100644 --- a/examples/text-label/text-label-example.cpp +++ b/examples/text-label/text-label-example.cpp @@ -34,42 +34,69 @@ using namespace MultiLanguageStrings; namespace { - const char* const BACKGROUND_IMAGE = DEMO_IMAGE_DIR "grab-handle.png"; - - const unsigned int KEY_ZERO = 10; - const unsigned int KEY_ONE = 11; - const unsigned int KEY_F = 41; - const unsigned int KEY_H = 43; - const unsigned int KEY_V = 55; - const unsigned int KEY_M = 58; - const unsigned int KEY_L = 46; - const unsigned int KEY_S = 39; - const unsigned int KEY_PLUS = 21; - const unsigned int KEY_MINUS = 20; - - const char* H_ALIGNMENT_STRING_TABLE[] = - { - "BEGIN", - "CENTER", - "END" - }; +const char* const BACKGROUND_IMAGE = DEMO_IMAGE_DIR "grab-handle.png"; + +const unsigned int KEY_ZERO = 10; +const unsigned int KEY_ONE = 11; +const unsigned int KEY_F = 41; +const unsigned int KEY_H = 43; +const unsigned int KEY_V = 55; +const unsigned int KEY_M = 58; +const unsigned int KEY_L = 46; +const unsigned int KEY_S = 39; +const unsigned int KEY_PLUS = 21; +const unsigned int KEY_MINUS = 20; + +const char* H_ALIGNMENT_STRING_TABLE[] = +{ + "BEGIN", + "CENTER", + "END" +}; + +const unsigned int H_ALIGNMENT_STRING_COUNT = sizeof( H_ALIGNMENT_STRING_TABLE ) / sizeof( H_ALIGNMENT_STRING_TABLE[0u] ); + +const char* V_ALIGNMENT_STRING_TABLE[] = +{ + "TOP", + "CENTER", + "BOTTOM" +}; + +const unsigned int V_ALIGNMENT_STRING_COUNT = sizeof( V_ALIGNMENT_STRING_TABLE ) / sizeof( V_ALIGNMENT_STRING_TABLE[0u] ); - const unsigned int H_ALIGNMENT_STRING_COUNT = sizeof( H_ALIGNMENT_STRING_TABLE ) / sizeof( H_ALIGNMENT_STRING_TABLE[0u] ); +int ConvertToEven(int value) +{ + return (value % 2 == 0) ? value : (value + 1); +} - const char* V_ALIGNMENT_STRING_TABLE[] = +struct HSVColorConstraint +{ + HSVColorConstraint(float hue, float saturation, float value) + : hue(hue), + saturation(saturation), + value(value) { - "TOP", - "CENTER", - "BOTTOM" - }; + } - const unsigned int V_ALIGNMENT_STRING_COUNT = sizeof( V_ALIGNMENT_STRING_TABLE ) / sizeof( V_ALIGNMENT_STRING_TABLE[0u] ); + void operator()(Vector4& current, const PropertyInputContainer& inputs ) + { + current = hsv2rgb(Vector4(inputs[0]->GetFloat(), saturation, value, current.a)); + } - int ConvertToEven(int value) + Vector4 hsv2rgb(Vector4 colorHSV) { - return (value % 2 == 0) ? value : (value + 1); + float r=colorHSV.z*(1+colorHSV.y*(cos(colorHSV.x)-1)); + float g=colorHSV.z*(1+colorHSV.y*(cos(colorHSV.x-2.09439)-1)); + float b=colorHSV.z*(1+colorHSV.y*(cos(colorHSV.x+2.09439)-1)); + return Vector4(r, g, b, colorHSV.a); } -} + float hue; + float saturation; + float value; +}; + +} // anonymous namespace /** * @brief The main class of the demo. @@ -134,6 +161,20 @@ public: mLabel.SetBackgroundColor( Color::WHITE ); mContainer.Add( mLabel ); + mHueAngleIndex = mLabel.RegisterProperty( "hue", 0.0f ); + Renderer bgRenderer = mLabel.GetRendererAt(0); + mOverrideMixColorIndex = bgRenderer.GetPropertyIndex( ColorVisual::Property::MIX_COLOR ); + + Constraint constraint = Constraint::New( bgRenderer, mOverrideMixColorIndex, HSVColorConstraint(0.0f, 0.5f, 0.8f)); + constraint.AddSource( Source( mLabel, mHueAngleIndex ) ); + constraint.SetRemoveAction( Constraint::Discard ); + constraint.Apply(); + + Animation anim = Animation::New(50.0f); + anim.AnimateTo(Property(mLabel, mHueAngleIndex), 6.28318f); + anim.SetLooping(true); + anim.Play(); + Property::Value labelText = mLabel.GetProperty( TextLabel::Property::TEXT ); std::cout << "Displaying text: \"" << labelText.Get< std::string >() << "\"" << std::endl; } @@ -284,6 +325,8 @@ private: unsigned int mLanguageId; unsigned int mAlignment; + Property::Index mHueAngleIndex; + Property::Index mOverrideMixColorIndex; }; void RunTest( Application& application ) diff --git a/packaging/com.samsung.dali-demo.spec b/packaging/com.samsung.dali-demo.spec index c138b83..37145d7 100755 --- a/packaging/com.samsung.dali-demo.spec +++ b/packaging/com.samsung.dali-demo.spec @@ -2,7 +2,7 @@ Name: com.samsung.dali-demo Summary: The OpenGLES Canvas Core Demo -Version: 1.2.1 +Version: 1.2.2 Release: 1 Group: System/Libraries License: Apache-2.0 @@ -53,8 +53,9 @@ of the capability of the toolkit. %define smack_rule_dir %TZ_SYS_SMACK/accesses2.d/ %endif +%define dali_app_res_dir %{dali_app_ro_dir}/res/ %define dali_app_exe_dir %{dali_app_ro_dir}/bin/ -%define locale_dir %{dali_app_ro_dir}/res/locale +%define locale_dir %{dali_app_res_dir}/locale %define local_style_dir ../../resources/style/mobile ############################## @@ -73,6 +74,7 @@ cd %{_builddir}/%{name}-%{version}/build/tizen cmake -DDALI_APP_DIR=%{dali_app_ro_dir} \ -DLOCALE_DIR=%{locale_dir} \ + -DDALI_APP_RES_DIR=%{dali_app_res_dir} \ %if 0%{?enable_debug} -DCMAKE_BUILD_TYPE=Debug \ %endif @@ -89,12 +91,13 @@ make %{?jobs:-j%jobs} rm -rf %{buildroot} cd build/tizen %make_install DALI_APP_DIR=%{dali_app_ro_dir} +%make_install DDALI_APP_RES_DIR=%{dali_app_res_dir} mkdir -p %{buildroot}%{dali_xml_file_dir} cp -f %{_builddir}/%{name}-%{version}/%{name}.xml %{buildroot}%{dali_xml_file_dir} mkdir -p %{buildroot}%{dali_icon_dir} -mv %{buildroot}/%{dali_app_ro_dir}/images/%{name}.png %{buildroot}%{dali_icon_dir} +mv %{buildroot}/%{dali_app_res_dir}/images/%{name}.png %{buildroot}%{dali_icon_dir} %if 0%{?enable_dali_smack_rules} && !%{with wayland} mkdir -p %{buildroot}%{smack_rule_dir} @@ -133,12 +136,12 @@ exit 0 %{dali_app_exe_dir}/dali-demo %{dali_app_exe_dir}/*.example %{dali_app_exe_dir}/dali-builder -%{dali_app_ro_dir}/images/* -%{dali_app_ro_dir}/videos/* -%{dali_app_ro_dir}/models/* -%{dali_app_ro_dir}/scripts/* -%{dali_app_ro_dir}/style/* -%{dali_app_ro_dir}/style/images/* +%{dali_app_res_dir}/images/* +%{dali_app_res_dir}/videos/* +%{dali_app_res_dir}/models/* +%{dali_app_res_dir}/scripts/* +%{dali_app_res_dir}/style/* +%{dali_app_res_dir}/style/images/* %{dali_xml_file_dir}/%{name}.xml %{dali_icon_dir}/* %{locale_dir}/* diff --git a/resources/images/light-icon-back.png b/resources/images/light-icon-back.png new file mode 100644 index 0000000..96b53f1 --- /dev/null +++ b/resources/images/light-icon-back.png diff --git a/resources/images/light-icon.png b/resources/images/light-icon-front.png index ff9fcf7..ff9fcf7 100644 --- a/resources/images/light-icon.png +++ b/resources/images/light-icon-front.png diff --git a/resources/po/ko.po b/resources/po/ko.po index 8e1bac0..e3d16c7 100755 --- a/resources/po/ko.po +++ b/resources/po/ko.po @@ -5,10 +5,10 @@ msgid "DALI_DEMO_STR_TITLE_BUBBLES" msgstr "방울" msgid "DALI_DEMO_STR_TITLE_BUTTONS" -msgstr "" +msgstr "버튼" msgid "DALI_DEMO_STR_TITLE_COLOR_GRADIENT" -msgstr "" +msgstr "색상 그라디언트" msgid "DALI_DEMO_STR_TITLE_CUBE_TRANSITION" msgstr "입방체 전환" @@ -17,28 +17,28 @@ msgid "DALI_DEMO_STR_TITLE_DISSOLVE_TRANSITION" msgstr "디졸브 전환" msgid "DALI_DEMO_STR_TITLE_EFFECTS_VIEW" -msgstr "" +msgstr "이펙트 뷰" msgid "DALI_DEMO_STR_TITLE_EMOJI_TEXT" -msgstr "" +msgstr "이모티콘 텍스트" msgid "DALI_DEMO_STR_TITLE_IMAGE_FITTING_SAMPLING" -msgstr "" +msgstr "이미지 조정 샘플링" msgid "DALI_DEMO_STR_TITLE_IMAGE_SCALING" msgstr "이미지 확대" msgid "DALI_DEMO_STR_TITLE_IMAGE_VIEW" -msgstr "" +msgstr "이미지 뷰" msgid "DALI_DEMO_STR_TITLE_IMAGE_VIEW_ALPHA_BLENDING" -msgstr "" +msgstr "이미지 뷰 알파 블렌딩" msgid "DALI_DEMO_STR_TITLE_IMAGE_VIEW_PIXEL_AREA" -msgstr "" +msgstr "이미지 뷰 픽셀 영역" msgid "DALI_DEMO_STR_TITLE_IMAGE_VIEW_SVG" -msgstr "" +msgstr "이미지 뷰 SVG" msgid "DALI_DEMO_STR_TITLE_ITEM_VIEW" msgstr "아이템 뷰" @@ -47,28 +47,28 @@ msgid "DALI_DEMO_STR_TITLE_LIGHTS_AND_SHADOWS" msgstr "빛과 그림자" msgid "DALI_DEMO_STR_TITLE_LINE_MESH" -msgstr "" +msgstr "라인 메쉬" msgid "DALI_DEMO_STR_TITLE_LOGGING" -msgstr "" +msgstr "로깅" msgid "DALI_DEMO_STR_TITLE_MAGNIFIER" msgstr "돋보기" msgid "DALI_DEMO_STR_TITLE_MESH_MORPH" -msgstr "" +msgstr "메쉬 형태" msgid "DALI_DEMO_STR_TITLE_MESH_SORTING" -msgstr "" +msgstr "메쉬 분류" msgid "DALI_DEMO_STR_TITLE_MESH_VISUAL" -msgstr "" +msgstr "메쉬 비주얼" msgid "DALI_DEMO_STR_TITLE_METABALL_EXPLOSION" -msgstr "" +msgstr "메타볼 폭발" msgid "DALI_DEMO_STR_TITLE_METABALL_REFRAC" -msgstr "" +msgstr "메타볼 굴절" msgid "DALI_DEMO_STR_TITLE_MOTION_BLUR" msgstr "모션 블러" @@ -77,19 +77,19 @@ msgid "DALI_DEMO_STR_TITLE_MOTION_STRETCH" msgstr "늘이기" msgid "DALI_DEMO_STR_TITLE_NATIVE_IMAGE_SOURCE" -msgstr "" +msgstr "네이티브 이미지 소스" msgid "DALI_DEMO_STR_TITLE_NEGOTIATE_SIZE" -msgstr "" +msgstr "사이즈 조절" msgid "DALI_DEMO_STR_TITLE_PAGE_TURN_VIEW" msgstr "책장 넘기기" msgid "DALI_DEMO_STR_TITLE_POPUP" -msgstr "" +msgstr "팝업" msgid "DALI_DEMO_STR_TITLE_PRIMITIVE_SHAPES" -msgstr "" +msgstr "기본 모양" msgid "DALI_DEMO_STR_TITLE_RADIAL_MENU" msgstr "레이디 얼 메뉴" @@ -98,7 +98,7 @@ msgid "DALI_DEMO_STR_TITLE_REFRACTION" msgstr "굴절 효과" msgid "DALI_DEMO_STR_TITLE_RENDERER_STENCIL" -msgstr "" +msgstr "렌더러 스텐실" msgid "DALI_DEMO_STR_TITLE_SCRIPT_BASED_UI" msgstr "스크립팅" @@ -107,28 +107,28 @@ msgid "DALI_DEMO_STR_TITLE_SCROLL_VIEW" msgstr "스크롤 뷰" msgid "DALI_DEMO_STR_TITLE_STYLING" -msgstr "" +msgstr "스타일링" msgid "DALI_DEMO_STR_TITLE_SUPER_BLUR_BLOOM" -msgstr "" +msgstr "블러링 이펙트" msgid "DALI_DEMO_STR_TITLE_TEXTURED_MESH" -msgstr "" +msgstr "텍스쳐 메쉬" msgid "DALI_DEMO_STR_TITLE_TEXT_EDITOR" -msgstr "" +msgstr "텍스트 편집기" msgid "DALI_DEMO_STR_TITLE_TEXT_FIELD" -msgstr "" +msgstr "텍스트 필드" msgid "DALI_DEMO_STR_TITLE_TEXT_LABEL" msgstr "텍스트 라벨" msgid "DALI_DEMO_STR_TITLE_TEXT_LABEL_MULTI_LANGUAGE" -msgstr "" +msgstr "다국어" msgid "DALI_DEMO_STR_TITLE_TEXT_SCROLLING" -msgstr "" +msgstr "텍스트 스크롤" msgid "DALI_DEMO_STR_TITLE_TILT_SENSOR" -msgstr "" \ No newline at end of file +msgstr "기울기 센서" diff --git a/resources/style/demo-theme.json.in b/resources/style/demo-theme.json.in index 3e680ba..21e0f2e 100644 --- a/resources/style/demo-theme.json.in +++ b/resources/style/demo-theme.json.in @@ -15,15 +15,10 @@ */ { - "constants": - { - "DEMO_IMAGE_DIR":"@DEMO_STYLE_IMAGE_DIR@" - }, - "styles": { "confirmationpopup":{ - "popupBackgroundImage":"{DEMO_IMAGE_DIR}00_popup_bg.9.png" + "popupBackgroundImage":"{APPLICATION_RESOURCE_PATH}/images/00_popup_bg.9.png" }, "textlabel-Rosemary": diff --git a/resources/style/style-example-theme-two.json.in b/resources/style/style-example-theme-two.json.in index 884d1ca..61c78a9 100644 --- a/resources/style/style-example-theme-two.json.in +++ b/resources/style/style-example-theme-two.json.in @@ -1,7 +1,7 @@ { "constants": { - "DEMO_IMAGE_DIR":"@DEMO_STYLE_IMAGE_DIR@" + "STYLE_DIR":"{APPLICATION_RESOURCE_PATH}/style" }, "styles": { @@ -25,9 +25,9 @@ // Change an icon size, see if it gets properly re-sized "radiobutton":{ - "unselectedStateImage":"{DEMO_IMAGE_DIR}/radio-button-unselected.png", - "selectedStateImage":"{DEMO_IMAGE_DIR}/radio-button-selected.png", - "disabledStateImage":"{DEMO_IMAGE_DIR}/radio-button-unselected-disabled.png", + "unselectedStateImage":"{STYLE_DIR}/images/radio-button-unselected.png", + "selectedStateImage":"{STYLE_DIR}/images/radio-button-selected.png", + "disabledStateImage":"{STYLE_DIR}/images/radio-button-unselected-disabled.png", "imageLabelGap":10, "label":{ "textColor": [0.1,1,1,1] @@ -78,19 +78,19 @@ "colorSlider1":{ "styles":["thinslider"], "progressVisual":{ - "url":"{DEMO_IMAGE_DIR}/slider-skin-progress-red.9.png" + "url":"{STYLE_DIR}/images/slider-skin-progress-red.9.png" } }, "colorSlider2":{ "styles":["thinslider"], "progressVisual":{ - "url":"{DEMO_IMAGE_DIR}/slider-skin-progress-green.9.png" + "url":"{STYLE_DIR}/images/slider-skin-progress-green.9.png" } }, "colorSlider3":{ "styles":["thinslider"], "progressVisual":{ - "url":"{DEMO_IMAGE_DIR}/slider-skin-progress-blue.9.png" + "url":"{STYLE_DIR}/images/slider-skin-progress-blue.9.png" } } }