Commit 1a3e7b2953ab9f37ebc8355c8148db3da44b2245
[dali_1.1.44] Merge branch 'devel/master'
Change-Id: I2e9738d992cf27f36cd56c77a71a4d44e8461fe8
Showing
29 changed files
with
715 additions
and
63 deletions
com.samsung.dali-demo.xml
| @@ -160,7 +160,10 @@ | @@ -160,7 +160,10 @@ | ||
| 160 | <ui-application appid="video-view.example" exec="/usr/apps/com.samsung.dali-demo/bin/video-view.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> | 160 | <ui-application appid="video-view.example" exec="/usr/apps/com.samsung.dali-demo/bin/video-view.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> |
| 161 | <label>Video View</label> | 161 | <label>Video View</label> |
| 162 | </ui-application> | 162 | </ui-application> |
| 163 | - <ui-application appid="mesh-renderer.example" exec="/usr/apps/com.samsung.dali-demo/bin/mesh-renderer.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> | ||
| 164 | - <label>Mesh Renderer</label> | ||
| 165 | - </ui-application> | 163 | + <ui-application appid="mesh-renderer.example" exec="/usr/apps/com.samsung.dali-demo/bin/mesh-renderer.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> |
| 164 | + <label>Mesh Renderer</label> | ||
| 165 | + </ui-application> | ||
| 166 | + <ui-application appid="primitive-shapes.example" exec="/usr/apps/com.samsung.dali-demo/bin/primitive-shapes.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> | ||
| 167 | + <label>Primitive Shapes</label> | ||
| 168 | + </ui-application> | ||
| 166 | </manifest> | 169 | </manifest> |
demo/dali-demo.cpp
| @@ -79,6 +79,7 @@ int DALI_EXPORT_API main(int argc, char **argv) | @@ -79,6 +79,7 @@ int DALI_EXPORT_API main(int argc, char **argv) | ||
| 79 | demo.AddExample(Example("effects-view.example", DALI_DEMO_STR_TITLE_EFFECTS_VIEW)); | 79 | demo.AddExample(Example("effects-view.example", DALI_DEMO_STR_TITLE_EFFECTS_VIEW)); |
| 80 | demo.AddExample(Example("native-image-source.example", DALI_DEMO_STR_TITLE_NATIVE_IMAGE_SOURCE)); | 80 | demo.AddExample(Example("native-image-source.example", DALI_DEMO_STR_TITLE_NATIVE_IMAGE_SOURCE)); |
| 81 | demo.AddExample(Example("mesh-renderer.example", DALI_DEMO_STR_TITLE_MESH_RENDERER)); | 81 | demo.AddExample(Example("mesh-renderer.example", DALI_DEMO_STR_TITLE_MESH_RENDERER)); |
| 82 | + demo.AddExample(Example("primitive-shapes.example", DALI_DEMO_STR_TITLE_PRIMITIVE_SHAPES)); | ||
| 82 | 83 | ||
| 83 | demo.SortAlphabetically( true ); | 84 | demo.SortAlphabetically( true ); |
| 84 | 85 |
examples/dissolve-effect/dissolve-effect-example.cpp
| @@ -91,7 +91,7 @@ Toolkit::ImageView CreateStageFillingImageView( const char * const imagePath ) | @@ -91,7 +91,7 @@ Toolkit::ImageView CreateStageFillingImageView( const char * const imagePath ) | ||
| 91 | Size stageSize = Stage::GetCurrent().GetSize(); | 91 | Size stageSize = Stage::GetCurrent().GetSize(); |
| 92 | Toolkit::ImageView imageView = Toolkit::ImageView::New(); | 92 | Toolkit::ImageView imageView = Toolkit::ImageView::New(); |
| 93 | Property::Map map; | 93 | Property::Map map; |
| 94 | - map["rendererType"] = "image"; | 94 | + map["rendererType"] = "IMAGE"; |
| 95 | map["url"] = imagePath; | 95 | map["url"] = imagePath; |
| 96 | map["desiredWidth"] = stageSize.x; | 96 | map["desiredWidth"] = stageSize.x; |
| 97 | map["desiredHeight"] = stageSize.y; | 97 | map["desiredHeight"] = stageSize.y; |
examples/gradients/gradients-example.cpp
| @@ -16,8 +16,6 @@ | @@ -16,8 +16,6 @@ | ||
| 16 | */ | 16 | */ |
| 17 | 17 | ||
| 18 | #include <dali-toolkit/dali-toolkit.h> | 18 | #include <dali-toolkit/dali-toolkit.h> |
| 19 | -#include <dali-toolkit/devel-api/controls/renderer-factory/renderer-factory.h> | ||
| 20 | -#include <dali-toolkit/devel-api/controls/renderer-factory/control-renderer.h> | ||
| 21 | #include "shared/view.h" | 19 | #include "shared/view.h" |
| 22 | 20 | ||
| 23 | using namespace Dali; | 21 | using namespace Dali; |
| @@ -79,7 +77,7 @@ public: | @@ -79,7 +77,7 @@ public: | ||
| 79 | 77 | ||
| 80 | // ---- Gradient for background | 78 | // ---- Gradient for background |
| 81 | 79 | ||
| 82 | - mGradientMap.Insert("rendererType", "gradient"); | 80 | + mGradientMap.Insert("rendererType", "GRADIENT"); |
| 83 | 81 | ||
| 84 | Property::Array stopOffsets; | 82 | Property::Array stopOffsets; |
| 85 | stopOffsets.PushBack( 0.0f ); | 83 | stopOffsets.PushBack( 0.0f ); |
| @@ -117,7 +115,7 @@ public: | @@ -117,7 +115,7 @@ public: | ||
| 117 | Vector2 halfStageSize = Stage::GetCurrent().GetSize()*0.5f; | 115 | Vector2 halfStageSize = Stage::GetCurrent().GetSize()*0.5f; |
| 118 | gradientMap.Insert("startPosition", halfStageSize); | 116 | gradientMap.Insert("startPosition", halfStageSize); |
| 119 | gradientMap.Insert("endPosition", -halfStageSize ); | 117 | gradientMap.Insert("endPosition", -halfStageSize ); |
| 120 | - gradientMap.Insert("units", "userSpace"); | 118 | + gradientMap.Insert("units", "USER_SPACE"); |
| 121 | break; | 119 | break; |
| 122 | } | 120 | } |
| 123 | case 2: // radial gradient with units as objectBoundingBox | 121 | case 2: // radial gradient with units as objectBoundingBox |
| @@ -131,7 +129,7 @@ public: | @@ -131,7 +129,7 @@ public: | ||
| 131 | Vector2 stageSize = Stage::GetCurrent().GetSize(); | 129 | Vector2 stageSize = Stage::GetCurrent().GetSize(); |
| 132 | gradientMap.Insert("center", stageSize*0.5f); | 130 | gradientMap.Insert("center", stageSize*0.5f); |
| 133 | gradientMap.Insert("radius", stageSize.Length()); | 131 | gradientMap.Insert("radius", stageSize.Length()); |
| 134 | - gradientMap.Insert("units", "userSpace"); | 132 | + gradientMap.Insert("units", "USER_SPACE"); |
| 135 | break; | 133 | break; |
| 136 | } | 134 | } |
| 137 | } | 135 | } |
examples/image-scaling-and-filtering/image-scaling-and-filtering-example.cpp
| @@ -177,7 +177,7 @@ public: | @@ -177,7 +177,7 @@ public: | ||
| 177 | 177 | ||
| 178 | // Background image: | 178 | // Background image: |
| 179 | Dali::Property::Map backgroundImage; | 179 | Dali::Property::Map backgroundImage; |
| 180 | - backgroundImage.Insert( "rendererType", "image" ); | 180 | + backgroundImage.Insert( "rendererType", "IMAGE" ); |
| 181 | backgroundImage.Insert( "url", BACKGROUND_IMAGE ); | 181 | backgroundImage.Insert( "url", BACKGROUND_IMAGE ); |
| 182 | backgroundImage.Insert( "desiredWidth", stage.GetSize().width ); | 182 | backgroundImage.Insert( "desiredWidth", stage.GetSize().width ); |
| 183 | backgroundImage.Insert( "desiredHeight", stage.GetSize().height ); | 183 | backgroundImage.Insert( "desiredHeight", stage.GetSize().height ); |
examples/image-view-svg/image-view-svg-example.cpp
| @@ -16,8 +16,6 @@ | @@ -16,8 +16,6 @@ | ||
| 16 | */ | 16 | */ |
| 17 | 17 | ||
| 18 | #include <dali-toolkit/dali-toolkit.h> | 18 | #include <dali-toolkit/dali-toolkit.h> |
| 19 | -#include <dali-toolkit/devel-api/controls/renderer-factory/renderer-factory.h> | ||
| 20 | -#include <dali-toolkit/devel-api/controls/renderer-factory/control-renderer.h> | ||
| 21 | #include <string.h> | 19 | #include <string.h> |
| 22 | 20 | ||
| 23 | using namespace Dali; | 21 | using namespace Dali; |
examples/item-view/item-view-example.cpp
| @@ -878,7 +878,7 @@ public: // From ItemFactory | @@ -878,7 +878,7 @@ public: // From ItemFactory | ||
| 878 | borderActor.SetColorMode( USE_PARENT_COLOR ); | 878 | borderActor.SetColorMode( USE_PARENT_COLOR ); |
| 879 | 879 | ||
| 880 | Property::Map borderProperty; | 880 | Property::Map borderProperty; |
| 881 | - borderProperty.Insert( "rendererType", "border" ); | 881 | + borderProperty.Insert( "rendererType", "BORDER" ); |
| 882 | borderProperty.Insert( "borderColor", Color::WHITE ); | 882 | borderProperty.Insert( "borderColor", Color::WHITE ); |
| 883 | borderProperty.Insert( "borderSize", ITEM_BORDER_SIZE ); | 883 | borderProperty.Insert( "borderSize", ITEM_BORDER_SIZE ); |
| 884 | borderProperty.Insert( "antiAliasing", true ); | 884 | borderProperty.Insert( "antiAliasing", true ); |
| @@ -902,7 +902,7 @@ public: // From ItemFactory | @@ -902,7 +902,7 @@ public: // From ItemFactory | ||
| 902 | checkbox.SetZ( 0.1f ); | 902 | checkbox.SetZ( 0.1f ); |
| 903 | 903 | ||
| 904 | Property::Map solidColorProperty; | 904 | Property::Map solidColorProperty; |
| 905 | - solidColorProperty.Insert( "rendererType", "color" ); | 905 | + solidColorProperty.Insert( "rendererType", "COLOR" ); |
| 906 | solidColorProperty.Insert( "mixColor", Vector4(0.f, 0.f, 0.f, 0.6f) ); | 906 | solidColorProperty.Insert( "mixColor", Vector4(0.f, 0.f, 0.f, 0.6f) ); |
| 907 | checkbox.SetProperty( ImageView::Property::IMAGE, solidColorProperty ); | 907 | checkbox.SetProperty( ImageView::Property::IMAGE, solidColorProperty ); |
| 908 | 908 |
examples/mesh-renderer/mesh-renderer-example.cpp
| @@ -34,9 +34,9 @@ namespace | @@ -34,9 +34,9 @@ namespace | ||
| 34 | //Possible shader options. | 34 | //Possible shader options. |
| 35 | const char * const SHADER_TYPE[] = | 35 | const char * const SHADER_TYPE[] = |
| 36 | { | 36 | { |
| 37 | - "allTextures", | ||
| 38 | - "diffuseTexture", | ||
| 39 | - "textureless" | 37 | + "ALL_TEXTURES", |
| 38 | + "DIFFUSE_TEXTURE", | ||
| 39 | + "TEXTURELESS" | ||
| 40 | }; | 40 | }; |
| 41 | 41 | ||
| 42 | //Files for background and toolbar | 42 | //Files for background and toolbar |
| @@ -189,7 +189,7 @@ public: | @@ -189,7 +189,7 @@ public: | ||
| 189 | { | 189 | { |
| 190 | //Create mesh property map | 190 | //Create mesh property map |
| 191 | Property::Map map; | 191 | Property::Map map; |
| 192 | - map.Insert( "rendererType", "mesh" ); | 192 | + map.Insert( "rendererType", "MESH" ); |
| 193 | map.Insert( "objectUrl", MODEL_FILE[mModelIndex] ); | 193 | map.Insert( "objectUrl", MODEL_FILE[mModelIndex] ); |
| 194 | map.Insert( "materialUrl", MATERIAL_FILE[mModelIndex] ); | 194 | map.Insert( "materialUrl", MATERIAL_FILE[mModelIndex] ); |
| 195 | map.Insert( "texturesPath", TEXTURES_PATH ); | 195 | map.Insert( "texturesPath", TEXTURES_PATH ); |
examples/motion-blur/motion-blur-example.cpp
| @@ -103,7 +103,7 @@ const float ORIENTATION_DURATION = 0.5f; ///< Time to rotate to | @@ -103,7 +103,7 @@ const float ORIENTATION_DURATION = 0.5f; ///< Time to rotate to | ||
| 103 | void SetImageFittedInBox( ImageView& imageView, Property::Map& shaderEffect, const char * const imagePath, int maxWidth, int maxHeight ) | 103 | void SetImageFittedInBox( ImageView& imageView, Property::Map& shaderEffect, const char * const imagePath, int maxWidth, int maxHeight ) |
| 104 | { | 104 | { |
| 105 | Property::Map map; | 105 | Property::Map map; |
| 106 | - map["rendererType"] = "image"; | 106 | + map["rendererType"] = "IMAGE"; |
| 107 | map["url"] = imagePath; | 107 | map["url"] = imagePath; |
| 108 | // Load the image nicely scaled-down to fit within the specified max width and height: | 108 | // Load the image nicely scaled-down to fit within the specified max width and height: |
| 109 | map["desiredWidth"] = maxWidth; | 109 | map["desiredWidth"] = maxWidth; |
examples/primitive-shapes/primitive-shapes-example.cpp
0 โ 100644
| 1 | +#include <dali-toolkit/dali-toolkit.h> | ||
| 2 | +#include <dali/public-api/object/property-map.h> | ||
| 3 | +#include <dali-toolkit/public-api/controls/slider/slider.h> | ||
| 4 | + | ||
| 5 | +using namespace Dali; | ||
| 6 | +using namespace Dali::Toolkit; | ||
| 7 | + | ||
| 8 | +namespace | ||
| 9 | +{ | ||
| 10 | + //Button image urls | ||
| 11 | + const char* BUTTON_IMAGE_URL[] = | ||
| 12 | + { | ||
| 13 | + DEMO_IMAGE_DIR "sphere-button.png", | ||
| 14 | + DEMO_IMAGE_DIR "cone-button.png", | ||
| 15 | + DEMO_IMAGE_DIR "conical-frustrum-button.png", | ||
| 16 | + DEMO_IMAGE_DIR "cylinder-button.png", | ||
| 17 | + DEMO_IMAGE_DIR "cube-button.png", | ||
| 18 | + DEMO_IMAGE_DIR "bevelled-cube-button.png", | ||
| 19 | + DEMO_IMAGE_DIR "octahedron-button.png" | ||
| 20 | + }; | ||
| 21 | + | ||
| 22 | + //Shape names | ||
| 23 | + const char * const SHAPE_SPHERE = "SPHERE"; | ||
| 24 | + const char * const SHAPE_CONE = "CONE"; | ||
| 25 | + const char * const SHAPE_CONICAL_FRUSTRUM = "CONICAL_FRUSTRUM"; | ||
| 26 | + const char * const SHAPE_CYLINDER = "CYLINDER"; | ||
| 27 | + const char * const SHAPE_CUBE = "CUBE"; | ||
| 28 | + const char * const SHAPE_BEVELLED_CUBE = "BEVELLED_CUBE"; | ||
| 29 | + const char * const SHAPE_OCTAHEDRON = "OCTAHEDRON"; | ||
| 30 | + | ||
| 31 | + //Shape property defaults | ||
| 32 | + const int DEFAULT_SLICES = 32; | ||
| 33 | + const int DEFAULT_STACKS = 32; | ||
| 34 | + const float DEFAULT_SCALE_HEIGHT = 16.0f; | ||
| 35 | + const float DEFAULT_SCALE_BOTTOM_RADIUS = 8.0f; | ||
| 36 | + const float DEFAULT_SCALE_TOP_RADIUS = 4.0f; | ||
| 37 | + const float DEFAULT_SCALE_RADIUS = 8.0f; | ||
| 38 | + const float DEFAULT_BEVEL_PERCENTAGE = 0.3f; | ||
| 39 | + const float DEFAULT_BEVEL_SMOOTHNESS = 0.0f; | ||
| 40 | + | ||
| 41 | + //Shape property limits | ||
| 42 | + const int SLICES_LOWER_BOUND = 3; | ||
| 43 | + const int SLICES_UPPER_BOUND = 16; | ||
| 44 | + const int STACKS_LOWER_BOUND = 2; | ||
| 45 | + const int STACKS_UPPER_BOUND = 16; | ||
| 46 | + | ||
| 47 | + //Used to the control rate of rotation when panning an object. | ||
| 48 | + const float X_ROTATION_DISPLACEMENT_FACTOR = 60.0f; | ||
| 49 | + const float Y_ROTATION_DISPLACEMENT_FACTOR = 60.0f; | ||
| 50 | + | ||
| 51 | + const int NUM_MODELS = 7; //Total number of possible base shapes. | ||
| 52 | + const int MAX_PROPERTIES = 3; //Maximum number of properties a shape may require. (For displaying sliders.) | ||
| 53 | + | ||
| 54 | +} //End namespace | ||
| 55 | + | ||
| 56 | +class PrimitiveShapesController : public ConnectionTracker | ||
| 57 | +{ | ||
| 58 | +public: | ||
| 59 | + | ||
| 60 | + PrimitiveShapesController( Application& application ) | ||
| 61 | + : mApplication( application ), | ||
| 62 | + mColor( Vector4( 0.3f, 0.7f, 1.0f, 1.0f ) ), | ||
| 63 | + mRotation( Vector2::ZERO ) | ||
| 64 | + { | ||
| 65 | + // Connect to the Application's Init signal | ||
| 66 | + mApplication.InitSignal().Connect( this, &PrimitiveShapesController::Create ); | ||
| 67 | + } | ||
| 68 | + | ||
| 69 | + ~PrimitiveShapesController() | ||
| 70 | + { | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + // The Init signal is received once (only) during the Application lifetime | ||
| 74 | + void Create( Application& application ) | ||
| 75 | + { | ||
| 76 | + // Get a handle to the stage | ||
| 77 | + Stage stage = Stage::GetCurrent(); | ||
| 78 | + stage.SetBackgroundColor( Color::WHITE ); | ||
| 79 | + | ||
| 80 | + //Set up layer to place UI on. | ||
| 81 | + Layer layer = Layer::New(); | ||
| 82 | + layer.SetParentOrigin( ParentOrigin::CENTER ); | ||
| 83 | + layer.SetAnchorPoint( AnchorPoint::CENTER ); | ||
| 84 | + layer.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); | ||
| 85 | + layer.SetBehavior( Layer::LAYER_2D ); //We use a 2D layer as this is closer to UI work than full 3D scene creation. | ||
| 86 | + layer.SetDepthTestDisabled( false ); //Enable depth testing, as otherwise the 2D layer would not do so. | ||
| 87 | + stage.Add( layer ); | ||
| 88 | + | ||
| 89 | + //Set up model selection buttons. | ||
| 90 | + SetupButtons( layer ); | ||
| 91 | + | ||
| 92 | + //Set up model parameter sliders. | ||
| 93 | + SetupSliders( layer ); | ||
| 94 | + | ||
| 95 | + //Set up 3D model. | ||
| 96 | + SetupModel( layer ); | ||
| 97 | + | ||
| 98 | + //Allow for exiting of the application via key presses. | ||
| 99 | + stage.KeyEventSignal().Connect( this, &PrimitiveShapesController::OnKeyEvent ); | ||
| 100 | + } | ||
| 101 | + | ||
| 102 | + //Place buttons on the top of the screen, which allow for selection of the shape to be displayed. | ||
| 103 | + //The buttons are laid out like so: | ||
| 104 | + // | ||
| 105 | + // ^ +--------------------------------+ | ||
| 106 | + // | | | | ||
| 107 | + // | | +----+ +----+ +----+ +----+ | | ||
| 108 | + // | | | | | | | | | | | | ||
| 109 | + // 30% | | +----+ +----+ +----+ +----+ | | ||
| 110 | + // | | | | ||
| 111 | + // | | +----+ +----+ +----+ | | ||
| 112 | + // | | | | | | | | | | ||
| 113 | + // v | +----+ +----+ +----+ | | ||
| 114 | + // | | | ||
| 115 | + // | | | ||
| 116 | + // | | | ||
| 117 | + // | | | ||
| 118 | + // | | | ||
| 119 | + // | | | ||
| 120 | + // | | | ||
| 121 | + // | | | ||
| 122 | + // | | | ||
| 123 | + // | | | ||
| 124 | + // | | | ||
| 125 | + // | | | ||
| 126 | + // | | | ||
| 127 | + // | | | ||
| 128 | + // | | | ||
| 129 | + // | | | ||
| 130 | + // | | | ||
| 131 | + // | | | ||
| 132 | + // | | | ||
| 133 | + // +--------------------------------+ | ||
| 134 | + // | ||
| 135 | + void SetupButtons( Layer layer ) | ||
| 136 | + { | ||
| 137 | + float containerPadding = 10.0f; | ||
| 138 | + float buttonPadding = 5.0f; | ||
| 139 | + | ||
| 140 | + //Create a variable-length container that can wrap buttons around as more are added. | ||
| 141 | + FlexContainer buttonContainer = FlexContainer::New(); | ||
| 142 | + buttonContainer.SetParentOrigin( ParentOrigin::TOP_CENTER ); | ||
| 143 | + buttonContainer.SetAnchorPoint( AnchorPoint::TOP_CENTER ); | ||
| 144 | + buttonContainer.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); | ||
| 145 | + buttonContainer.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::HEIGHT ); | ||
| 146 | + buttonContainer.SetSizeModeFactor( Vector3( 0.0, 0.3, 0.0 ) ); //30% of height. | ||
| 147 | + buttonContainer.SetPadding( Padding( containerPadding, containerPadding, containerPadding, containerPadding ) ); | ||
| 148 | + buttonContainer.SetProperty( FlexContainer::Property::FLEX_DIRECTION, FlexContainer::ROW ); | ||
| 149 | + buttonContainer.SetProperty( FlexContainer::Property::FLEX_WRAP, FlexContainer::WRAP ); | ||
| 150 | + | ||
| 151 | + layer.Add( buttonContainer ); | ||
| 152 | + | ||
| 153 | + //Create buttons and place them in the container. | ||
| 154 | + for( int modelNumber = 0; modelNumber < NUM_MODELS; modelNumber++ ) | ||
| 155 | + { | ||
| 156 | + PushButton button = Toolkit::PushButton::New(); | ||
| 157 | + button.SetParentOrigin( ParentOrigin::CENTER ); | ||
| 158 | + button.SetAnchorPoint( AnchorPoint::CENTER ); | ||
| 159 | + button.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); | ||
| 160 | + button.SetPadding( Padding( buttonPadding, buttonPadding, buttonPadding, buttonPadding ) ); | ||
| 161 | + button.SetProperty( Button::Property::UNSELECTED_STATE_IMAGE, Property::Value( BUTTON_IMAGE_URL[modelNumber] ) ); | ||
| 162 | + button.SetProperty( Button::Property::SELECTED_STATE_IMAGE, Property::Value( BUTTON_IMAGE_URL[modelNumber] ) ); | ||
| 163 | + button.RegisterProperty( "modelNumber", Property::Value( modelNumber ) ); | ||
| 164 | + button.ClickedSignal().Connect( this, &PrimitiveShapesController::OnChangeShapeClicked ); | ||
| 165 | + | ||
| 166 | + buttonContainer.Add( button ); | ||
| 167 | + } | ||
| 168 | + } | ||
| 169 | + | ||
| 170 | + //Add sliders to the bottom of the screen, which allow for control of shape properties such as radius. | ||
| 171 | + //Each slider is placed next to a label that states the property it affects. | ||
| 172 | + //The sliders are laid out like so: | ||
| 173 | + // | ||
| 174 | + // +--------------------------------+ | ||
| 175 | + // | | | ||
| 176 | + // | | | ||
| 177 | + // | | | ||
| 178 | + // | | | ||
| 179 | + // | | | ||
| 180 | + // | | | ||
| 181 | + // | | | ||
| 182 | + // | | | ||
| 183 | + // | | | ||
| 184 | + // | | | ||
| 185 | + // | | | ||
| 186 | + // | | | ||
| 187 | + // | | | ||
| 188 | + // | | | ||
| 189 | + // | | | ||
| 190 | + // | | | ||
| 191 | + // | | | ||
| 192 | + // | | | ||
| 193 | + // | | | ||
| 194 | + // ^ | Label +----------O-----------+ | | ||
| 195 | + // | | | | ||
| 196 | + // | | | | ||
| 197 | + // | | Label +--O-------------------+ | | ||
| 198 | + // 30% | | | | ||
| 199 | + // | | | | ||
| 200 | + // | | Label +----------------------O | | ||
| 201 | + // | | | | ||
| 202 | + // v +--------------------------------+ | ||
| 203 | + // | ||
| 204 | + void SetupSliders( Layer layer ) | ||
| 205 | + { | ||
| 206 | + //Create table to hold sliders and their corresponding labels. | ||
| 207 | + mSliderTable = Toolkit::TableView::New( MAX_PROPERTIES, 2 ); | ||
| 208 | + mSliderTable.SetParentOrigin( ParentOrigin::BOTTOM_CENTER ); | ||
| 209 | + mSliderTable.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER ); | ||
| 210 | + mSliderTable.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS ); | ||
| 211 | + mSliderTable.SetSizeModeFactor( Vector3( 0.9, 0.3, 0.0 ) ); //90% of width, 30% of height. | ||
| 212 | + mSliderTable.SetFitWidth( 0 ); //Label column should fit to natural size of label. | ||
| 213 | + mSliderTable.SetRelativeWidth( 1, 1.0f ); //Slider column should fill remaining space. | ||
| 214 | + mSliderTable.SetCellPadding( Vector2( 10.0f, 0.0f ) ); //Leave a gap between the slider and its label. | ||
| 215 | + layer.Add( mSliderTable ); | ||
| 216 | + | ||
| 217 | + //Set up sliders, and place labels next to them. | ||
| 218 | + for( int i = 0; i < MAX_PROPERTIES; i++ ) | ||
| 219 | + { | ||
| 220 | + //Create slider | ||
| 221 | + Slider slider = Slider::New(); | ||
| 222 | + slider.SetParentOrigin( ParentOrigin::CENTER ); | ||
| 223 | + slider.SetAnchorPoint( AnchorPoint::CENTER ); | ||
| 224 | + slider.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); | ||
| 225 | + slider.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); | ||
| 226 | + slider.ValueChangedSignal().Connect( this, &PrimitiveShapesController::OnSliderValueChanged ); | ||
| 227 | + mSliders.push_back( slider ); | ||
| 228 | + | ||
| 229 | + //Setup slider cell properties | ||
| 230 | + mSliderTable.AddChild( slider, TableView::CellPosition( i, 1 ) ); | ||
| 231 | + mSliderTable.SetCellAlignment( TableView::CellPosition( i, 1 ), HorizontalAlignment::CENTER, VerticalAlignment::CENTER ); | ||
| 232 | + | ||
| 233 | + //Create slider label | ||
| 234 | + TextLabel sliderLabel = TextLabel::New(); | ||
| 235 | + sliderLabel.SetParentOrigin( ParentOrigin::CENTER ); | ||
| 236 | + sliderLabel.SetAnchorPoint( AnchorPoint::CENTER ); | ||
| 237 | + sliderLabel.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); | ||
| 238 | + mSliderLabels.push_back( sliderLabel ); | ||
| 239 | + | ||
| 240 | + //Setup slider-label cell properties | ||
| 241 | + mSliderTable.AddChild( sliderLabel, TableView::CellPosition( i, 0 ) ); | ||
| 242 | + mSliderTable.SetCellAlignment( TableView::CellPosition( i, 0 ), HorizontalAlignment::LEFT, VerticalAlignment::CENTER ); | ||
| 243 | + } | ||
| 244 | + } | ||
| 245 | + | ||
| 246 | + //Adds a control to the centre of the stage to display the 3D shapes. | ||
| 247 | + //The model is placed in the center of the screen, like so: | ||
| 248 | + // | ||
| 249 | + // +--------------------------------+ | ||
| 250 | + // | | | ||
| 251 | + // | | | ||
| 252 | + // | | | ||
| 253 | + // | | | ||
| 254 | + // | | | ||
| 255 | + // | | | ||
| 256 | + // | | | ||
| 257 | + // | | | ||
| 258 | + // | | | ||
| 259 | + // ^ | ---------- | | ||
| 260 | + // | | / \ | | ||
| 261 | + // | | / \ | | ||
| 262 | + // | | | | | | ||
| 263 | + // 30% | | | | | | ||
| 264 | + // | | | | | | ||
| 265 | + // | | \ / | | ||
| 266 | + // | | \ / | | ||
| 267 | + // v | ---------- | | ||
| 268 | + // | | | ||
| 269 | + // | | | ||
| 270 | + // | | | ||
| 271 | + // | | | ||
| 272 | + // | | | ||
| 273 | + // | | | ||
| 274 | + // | | | ||
| 275 | + // | | | ||
| 276 | + // | | | ||
| 277 | + // +--------------------------------+ | ||
| 278 | + // | ||
| 279 | + void SetupModel( Layer layer ) | ||
| 280 | + { | ||
| 281 | + //Create a container to house the renderer-holding actor, to provide a constant hitbox. | ||
| 282 | + Actor container = Actor::New(); | ||
| 283 | + container.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS ); | ||
| 284 | + container.SetSizeModeFactor( Vector3( 0.9, 0.3, 0.0 ) ); //90% of width, 30% of height. | ||
| 285 | + container.SetParentOrigin( ParentOrigin::CENTER ); | ||
| 286 | + container.SetAnchorPoint( AnchorPoint::CENTER ); | ||
| 287 | + layer.Add( container ); | ||
| 288 | + | ||
| 289 | + //Create control to display the 3D primitive. | ||
| 290 | + mModel = Control::New(); | ||
| 291 | + mModel.SetParentOrigin( ParentOrigin::CENTER ); | ||
| 292 | + mModel.SetAnchorPoint( AnchorPoint::CENTER); | ||
| 293 | + mModel.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); | ||
| 294 | + container.Add( mModel ); | ||
| 295 | + | ||
| 296 | + //Load default shape. | ||
| 297 | + LoadCube(); | ||
| 298 | + | ||
| 299 | + //Make model spin to demonstrate 3D. | ||
| 300 | + mRotationAnimation = Animation::New(15.0f); | ||
| 301 | + mRotationAnimation.AnimateBy( Property( mModel, Actor::Property::ORIENTATION ), | ||
| 302 | + Quaternion( Degree( 0.0f ), Degree( 360.0f ), Degree( 0.0f ) ) ); | ||
| 303 | + mRotationAnimation.SetLooping(true); | ||
| 304 | + mRotationAnimation.Play(); | ||
| 305 | + | ||
| 306 | + //Attach gesture detector to pan models when rotated. | ||
| 307 | + mPanGestureDetector = PanGestureDetector::New(); | ||
| 308 | + mPanGestureDetector.Attach( container ); | ||
| 309 | + mPanGestureDetector.DetectedSignal().Connect( this, &PrimitiveShapesController::OnPan ); | ||
| 310 | + } | ||
| 311 | + | ||
| 312 | + //Clears all sliders and resets the primitive renderer property map. | ||
| 313 | + void InitialiseSlidersAndModel() | ||
| 314 | + { | ||
| 315 | + //Sliders | ||
| 316 | + for( unsigned i = 0; i < mSliders.size(); i++ ) | ||
| 317 | + { | ||
| 318 | + mSliders.at( i ).SetProperty( Slider::Property::MARKS, Property::Value( 0 ) ); //Remove marks | ||
| 319 | + mSliders.at( i ).SetVisible( false ); | ||
| 320 | + mSliderLabels.at( i ).SetProperty( TextLabel::Property::TEXT, Property::Value( "Default" ) ); | ||
| 321 | + mSliderLabels.at( i ).SetVisible( false ); | ||
| 322 | + } | ||
| 323 | + | ||
| 324 | + //Renderer map for model | ||
| 325 | + mRendererMap.Clear(); | ||
| 326 | + mRendererMap[ "rendererType" ] = "PRIMITIVE"; | ||
| 327 | + mRendererMap[ "color" ] = mColor; | ||
| 328 | + } | ||
| 329 | + | ||
| 330 | + //Sets the 3D model to a sphere and modifies the sliders appropriately. | ||
| 331 | + void LoadSphere() | ||
| 332 | + { | ||
| 333 | + InitialiseSlidersAndModel(); | ||
| 334 | + | ||
| 335 | + //Set up specific renderer properties. | ||
| 336 | + mRendererMap[ "shape" ] = SHAPE_SPHERE; | ||
| 337 | + mRendererMap[ "slices" ] = DEFAULT_SLICES; | ||
| 338 | + mRendererMap[ "stacks" ] = DEFAULT_STACKS; | ||
| 339 | + | ||
| 340 | + //Set up sliders. | ||
| 341 | + SetupSlider( 0, SLICES_LOWER_BOUND, SLICES_UPPER_BOUND, DEFAULT_STACKS, "slices" ); | ||
| 342 | + SetupMarks( mSliders.at( 0 ), SLICES_LOWER_BOUND, SLICES_UPPER_BOUND ); | ||
| 343 | + SetupSlider( 1, STACKS_LOWER_BOUND, STACKS_UPPER_BOUND, DEFAULT_STACKS, "stacks" ); | ||
| 344 | + SetupMarks( mSliders.at( 1 ), STACKS_LOWER_BOUND, STACKS_UPPER_BOUND ); | ||
| 345 | + | ||
| 346 | + //Set model in control. | ||
| 347 | + mModel.SetProperty( Control::Property::BACKGROUND, Property::Value( mRendererMap ) ); | ||
| 348 | + } | ||
| 349 | + | ||
| 350 | + //Sets the 3D model to a cone and modifies the sliders appropriately. | ||
| 351 | + void LoadCone() | ||
| 352 | + { | ||
| 353 | + InitialiseSlidersAndModel(); | ||
| 354 | + | ||
| 355 | + //Set up specific renderer properties. | ||
| 356 | + mRendererMap[ "shape" ] = SHAPE_CONE; | ||
| 357 | + mRendererMap[ "scaleHeight" ] = DEFAULT_SCALE_HEIGHT; | ||
| 358 | + mRendererMap[ "scaleBottomRadius" ] = DEFAULT_SCALE_BOTTOM_RADIUS; | ||
| 359 | + mRendererMap[ "slices" ] = DEFAULT_SLICES; | ||
| 360 | + | ||
| 361 | + //Set up sliders. | ||
| 362 | + SetupSlider( 0, 1.0f, 32.0f, DEFAULT_SCALE_HEIGHT, "scaleHeight" ); | ||
| 363 | + SetupSlider( 1, 1.0f, 32.0f, DEFAULT_SCALE_BOTTOM_RADIUS, "scaleBottomRadius" ); | ||
| 364 | + SetupSlider( 2, SLICES_LOWER_BOUND, SLICES_UPPER_BOUND, DEFAULT_STACKS, "slices" ); | ||
| 365 | + SetupMarks( mSliders.at( 2 ), SLICES_LOWER_BOUND, SLICES_UPPER_BOUND ); | ||
| 366 | + | ||
| 367 | + //Set model in control. | ||
| 368 | + mModel.SetProperty( Control::Property::BACKGROUND, Property::Value( mRendererMap ) ); | ||
| 369 | + } | ||
| 370 | + | ||
| 371 | + //Sets the 3D model to a conical frustrum and modifies the sliders appropriately. | ||
| 372 | + void LoadConicalFrustrum() | ||
| 373 | + { | ||
| 374 | + InitialiseSlidersAndModel(); | ||
| 375 | + | ||
| 376 | + //Set up specific renderer properties. | ||
| 377 | + mRendererMap[ "shape" ] = SHAPE_CONICAL_FRUSTRUM; | ||
| 378 | + mRendererMap[ "scaleTopRadius" ] = DEFAULT_SCALE_TOP_RADIUS; | ||
| 379 | + mRendererMap[ "scaleBottomRadius" ] = DEFAULT_SCALE_BOTTOM_RADIUS; | ||
| 380 | + mRendererMap[ "scaleHeight" ] = DEFAULT_SCALE_HEIGHT; | ||
| 381 | + mRendererMap[ "slices" ] = DEFAULT_SLICES; | ||
| 382 | + | ||
| 383 | + //Set up used sliders. | ||
| 384 | + SetupSlider( 0, 1.0f, 32.0f, DEFAULT_SCALE_HEIGHT, "scaleHeight" ); | ||
| 385 | + SetupSlider( 1, 0.0f, 32.0f, DEFAULT_SCALE_BOTTOM_RADIUS, "scaleBottomRadius" ); | ||
| 386 | + SetupSlider( 2, 0.0f, 32.0f, DEFAULT_SCALE_TOP_RADIUS, "scaleTopRadius" ); | ||
| 387 | + | ||
| 388 | + //Set model in control. | ||
| 389 | + mModel.SetProperty( Control::Property::BACKGROUND, Property::Value( mRendererMap ) ); | ||
| 390 | + } | ||
| 391 | + | ||
| 392 | + //Sets the 3D model to a cylinder and modifies the sliders appropriately. | ||
| 393 | + void LoadCylinder() | ||
| 394 | + { | ||
| 395 | + InitialiseSlidersAndModel(); | ||
| 396 | + | ||
| 397 | + //Set up specific renderer properties. | ||
| 398 | + mRendererMap[ "shape" ] = SHAPE_CYLINDER; | ||
| 399 | + mRendererMap[ "scaleHeight" ] = DEFAULT_SCALE_HEIGHT; | ||
| 400 | + mRendererMap[ "scaleRadius" ] = DEFAULT_SCALE_RADIUS; | ||
| 401 | + mRendererMap[ "slices" ] = DEFAULT_SLICES; | ||
| 402 | + | ||
| 403 | + //Set up used sliders. | ||
| 404 | + SetupSlider( 0, 1.0f, 32.0f, DEFAULT_SCALE_HEIGHT, "scaleHeight" ); | ||
| 405 | + SetupSlider( 1, 1.0f, 32.0f, DEFAULT_SCALE_RADIUS, "scaleRadius" ); | ||
| 406 | + SetupSlider( 2, SLICES_LOWER_BOUND, SLICES_UPPER_BOUND, DEFAULT_STACKS, "slices" ); | ||
| 407 | + SetupMarks( mSliders.at( 2 ), SLICES_LOWER_BOUND, SLICES_UPPER_BOUND ); | ||
| 408 | + | ||
| 409 | + //Set model in control. | ||
| 410 | + mModel.SetProperty( Control::Property::BACKGROUND, Property::Value( mRendererMap ) ); | ||
| 411 | + } | ||
| 412 | + | ||
| 413 | + //Sets the 3D model to a cube and modifies the sliders appropriately. | ||
| 414 | + void LoadCube() | ||
| 415 | + { | ||
| 416 | + InitialiseSlidersAndModel(); | ||
| 417 | + | ||
| 418 | + //Set up specific renderer properties. | ||
| 419 | + mRendererMap[ "shape" ] = SHAPE_CUBE; | ||
| 420 | + | ||
| 421 | + //Set model in control. | ||
| 422 | + mModel.SetProperty( Control::Property::BACKGROUND, Property::Value( mRendererMap ) ); | ||
| 423 | + } | ||
| 424 | + | ||
| 425 | + //Sets the 3D model to a bevelled cube and modifies the sliders appropriately. | ||
| 426 | + void LoadBevelledCube() | ||
| 427 | + { | ||
| 428 | + InitialiseSlidersAndModel(); | ||
| 429 | + | ||
| 430 | + //Set up specific renderer properties. | ||
| 431 | + mRendererMap[ "shape" ] = SHAPE_BEVELLED_CUBE; | ||
| 432 | + mRendererMap[ "bevelPercentage" ] = DEFAULT_BEVEL_PERCENTAGE; | ||
| 433 | + mRendererMap[ "bevelSmoothness" ] = DEFAULT_BEVEL_SMOOTHNESS; | ||
| 434 | + | ||
| 435 | + //Set up used sliders. | ||
| 436 | + SetupSlider( 0, 0.0f, 1.0f, DEFAULT_BEVEL_PERCENTAGE, "bevelPercentage" ); | ||
| 437 | + SetupSlider( 1, 0.0f, 1.0f, DEFAULT_BEVEL_SMOOTHNESS, "bevelSmoothness" ); | ||
| 438 | + | ||
| 439 | + //Set model in control. | ||
| 440 | + mModel.SetProperty( Control::Property::BACKGROUND, Property::Value( mRendererMap ) ); | ||
| 441 | + } | ||
| 442 | + | ||
| 443 | + //Sets the 3D model to an octahedron and modifies the sliders appropriately. | ||
| 444 | + void LoadOctahedron() | ||
| 445 | + { | ||
| 446 | + InitialiseSlidersAndModel(); | ||
| 447 | + | ||
| 448 | + //Set up specific renderer properties. | ||
| 449 | + mRendererMap[ "shape" ] = SHAPE_OCTAHEDRON; | ||
| 450 | + | ||
| 451 | + //Set model in control. | ||
| 452 | + mModel.SetProperty( Control::Property::BACKGROUND, Property::Value( mRendererMap ) ); | ||
| 453 | + } | ||
| 454 | + | ||
| 455 | + //Sets up the slider at the given index for the supplied property, and labels it appropriately. | ||
| 456 | + // rendererPropertyLabel is the property that will be set by this slider. | ||
| 457 | + void SetupSlider( int sliderIndex, float lowerBound, float upperBound, float startPoint, | ||
| 458 | + std::string rendererPropertyLabel ) | ||
| 459 | + { | ||
| 460 | + //Set up the slider itself. | ||
| 461 | + mSliders.at( sliderIndex ).RegisterProperty( "rendererProperty", Property::Value( rendererPropertyLabel ), Property::READ_WRITE ); | ||
| 462 | + mSliders.at( sliderIndex ).SetProperty( Slider::Property::LOWER_BOUND, Property::Value( lowerBound ) ); | ||
| 463 | + mSliders.at( sliderIndex ).SetProperty( Slider::Property::UPPER_BOUND, Property::Value( upperBound ) ); | ||
| 464 | + mSliders.at( sliderIndex ).SetProperty( Slider::Property::VALUE, Property::Value( startPoint ) ); | ||
| 465 | + mSliders.at( sliderIndex ).SetVisible( true ); | ||
| 466 | + | ||
| 467 | + //Label the slider with the property. | ||
| 468 | + //We reset the TextLabel to force a relayout of the table. | ||
| 469 | + mSliderTable.RemoveChildAt( TableView::CellPosition(sliderIndex, 0) ); | ||
| 470 | + | ||
| 471 | + TextLabel sliderLabel = TextLabel::New( rendererPropertyLabel ); | ||
| 472 | + sliderLabel.SetParentOrigin( ParentOrigin::CENTER ); | ||
| 473 | + sliderLabel.SetAnchorPoint( AnchorPoint::CENTER ); | ||
| 474 | + sliderLabel.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); | ||
| 475 | + | ||
| 476 | + mSliderTable.AddChild( sliderLabel, TableView::CellPosition( sliderIndex, 0 ) ); | ||
| 477 | + mSliderTable.SetCellAlignment( TableView::CellPosition( sliderIndex, 0 ), HorizontalAlignment::LEFT, VerticalAlignment::CENTER ); | ||
| 478 | + | ||
| 479 | + mSliderLabels.at( sliderIndex ).SetVisible( true ); | ||
| 480 | + mSliderLabels.at( sliderIndex) = sliderLabel; | ||
| 481 | + } | ||
| 482 | + | ||
| 483 | + //Setup snapping to integer values between the two given values. | ||
| 484 | + void SetupMarks( Slider& slider, int lower, int upper ) | ||
| 485 | + { | ||
| 486 | + Property::Array marks; | ||
| 487 | + | ||
| 488 | + for( int mark = lower; mark <= upper; mark++ ) | ||
| 489 | + { | ||
| 490 | + marks.PushBack( Property::Value( mark ) ); | ||
| 491 | + } | ||
| 492 | + | ||
| 493 | + slider.SetProperty( Slider::Property::MARKS, Property::Value( marks ) ); | ||
| 494 | + slider.SetProperty( Slider::Property::SNAP_TO_MARKS, Property::Value( true ) ); | ||
| 495 | + } | ||
| 496 | + | ||
| 497 | + //When a shape button is tapped, switch to the corresponding shape. | ||
| 498 | + bool OnChangeShapeClicked( Button button ) | ||
| 499 | + { | ||
| 500 | + //Get the model number from the button. | ||
| 501 | + int modelNumber; | ||
| 502 | + button.GetProperty( button.GetPropertyIndex( "modelNumber" ) ).Get( modelNumber ); | ||
| 503 | + | ||
| 504 | + //Switch to the shape that corresponds to the model number. | ||
| 505 | + switch( modelNumber ) | ||
| 506 | + { | ||
| 507 | + case 0: | ||
| 508 | + { | ||
| 509 | + LoadSphere(); | ||
| 510 | + break; | ||
| 511 | + } | ||
| 512 | + case 1: | ||
| 513 | + { | ||
| 514 | + LoadCone(); | ||
| 515 | + break; | ||
| 516 | + } | ||
| 517 | + case 2: | ||
| 518 | + { | ||
| 519 | + LoadConicalFrustrum(); | ||
| 520 | + break; | ||
| 521 | + } | ||
| 522 | + case 3: | ||
| 523 | + { | ||
| 524 | + LoadCylinder(); | ||
| 525 | + break; | ||
| 526 | + } | ||
| 527 | + case 4: | ||
| 528 | + { | ||
| 529 | + LoadCube(); | ||
| 530 | + break; | ||
| 531 | + } | ||
| 532 | + case 5: | ||
| 533 | + { | ||
| 534 | + LoadBevelledCube(); | ||
| 535 | + break; | ||
| 536 | + } | ||
| 537 | + case 6: | ||
| 538 | + { | ||
| 539 | + LoadOctahedron(); | ||
| 540 | + break; | ||
| 541 | + } | ||
| 542 | + } | ||
| 543 | + | ||
| 544 | + return true; | ||
| 545 | + } | ||
| 546 | + | ||
| 547 | + //When the slider is adjusted, change the corresponding shape property accordingly. | ||
| 548 | + bool OnSliderValueChanged( Slider slider, float value ) | ||
| 549 | + { | ||
| 550 | + //Update property map to reflect the change to the specific renderer property. | ||
| 551 | + std::string rendererPropertyLabel; | ||
| 552 | + slider.GetProperty( slider.GetPropertyIndex( "rendererProperty" ) ).Get( rendererPropertyLabel ); | ||
| 553 | + mRendererMap[ rendererPropertyLabel ] = value; | ||
| 554 | + | ||
| 555 | + //Reload the model to display the change. | ||
| 556 | + mModel.SetProperty( Control::Property::BACKGROUND, Property::Value( mRendererMap ) ); | ||
| 557 | + | ||
| 558 | + return true; | ||
| 559 | + } | ||
| 560 | + | ||
| 561 | + //Panning around the shape rotates it. | ||
| 562 | + void OnPan( Actor actor, const PanGesture& gesture ) | ||
| 563 | + { | ||
| 564 | + switch( gesture.state ) | ||
| 565 | + { | ||
| 566 | + case Gesture::Started: | ||
| 567 | + { | ||
| 568 | + //Pause animation, as the gesture will be used to manually rotate the model | ||
| 569 | + mRotationAnimation.Pause(); | ||
| 570 | + | ||
| 571 | + break; | ||
| 572 | + } | ||
| 573 | + case Gesture::Continuing: | ||
| 574 | + { | ||
| 575 | + //Rotate based off the gesture. | ||
| 576 | + mRotation.x -= gesture.displacement.y / X_ROTATION_DISPLACEMENT_FACTOR; // Y displacement rotates around X axis | ||
| 577 | + mRotation.y += gesture.displacement.x / Y_ROTATION_DISPLACEMENT_FACTOR; // X displacement rotates around Y axis | ||
| 578 | + Quaternion rotation = Quaternion( Radian( mRotation.x ), Vector3::XAXIS) * | ||
| 579 | + Quaternion( Radian( mRotation.y ), Vector3::YAXIS); | ||
| 580 | + | ||
| 581 | + mModel.SetOrientation( rotation ); | ||
| 582 | + | ||
| 583 | + break; | ||
| 584 | + } | ||
| 585 | + case Gesture::Finished: | ||
| 586 | + { | ||
| 587 | + //Return to automatic animation | ||
| 588 | + mRotationAnimation.Play(); | ||
| 589 | + | ||
| 590 | + break; | ||
| 591 | + } | ||
| 592 | + case Gesture::Cancelled: | ||
| 593 | + { | ||
| 594 | + //Return to automatic animation | ||
| 595 | + mRotationAnimation.Play(); | ||
| 596 | + | ||
| 597 | + break; | ||
| 598 | + } | ||
| 599 | + default: | ||
| 600 | + { | ||
| 601 | + break; | ||
| 602 | + } | ||
| 603 | + } | ||
| 604 | + } | ||
| 605 | + | ||
| 606 | + //If escape or the back button is pressed, quit the application (and return to the launcher) | ||
| 607 | + void OnKeyEvent( const KeyEvent& event ) | ||
| 608 | + { | ||
| 609 | + if( event.state == KeyEvent::Down ) | ||
| 610 | + { | ||
| 611 | + if( IsKey( event, DALI_KEY_ESCAPE) || IsKey( event, DALI_KEY_BACK ) ) | ||
| 612 | + { | ||
| 613 | + mApplication.Quit(); | ||
| 614 | + } | ||
| 615 | + } | ||
| 616 | + } | ||
| 617 | + | ||
| 618 | +private: | ||
| 619 | + Application& mApplication; | ||
| 620 | + | ||
| 621 | + std::vector<Slider> mSliders; ///< Holds the sliders on screen that each shape accesses. | ||
| 622 | + std::vector<TextLabel> mSliderLabels; ///< Holds the labels to each slider. | ||
| 623 | + TableView mSliderTable; ///< A table to layout the sliders next to their labels. | ||
| 624 | + | ||
| 625 | + Property::Map mRendererMap; ///< Property map to create a primitive renderer. | ||
| 626 | + Control mModel; ///< Control to house the primitive renderer. | ||
| 627 | + | ||
| 628 | + PanGestureDetector mPanGestureDetector; ///< Detects pan gestures for rotation of the model. | ||
| 629 | + Animation mRotationAnimation; ///< Automatically rotates the model, unless it is being panned. | ||
| 630 | + | ||
| 631 | + Vector4 mColor; ///< Color to set all shapes. | ||
| 632 | + Vector2 mRotation; ///< Keeps track of model rotation. | ||
| 633 | +}; | ||
| 634 | + | ||
| 635 | +void RunTest( Application& application ) | ||
| 636 | +{ | ||
| 637 | + PrimitiveShapesController test( application ); | ||
| 638 | + | ||
| 639 | + application.MainLoop(); | ||
| 640 | +} | ||
| 641 | + | ||
| 642 | +// Entry point for Linux & Tizen applications | ||
| 643 | +// | ||
| 644 | +int main( int argc, char **argv ) | ||
| 645 | +{ | ||
| 646 | + Application application = Application::New( &argc, &argv ); | ||
| 647 | + | ||
| 648 | + RunTest( application ); | ||
| 649 | + | ||
| 650 | + return 0; | ||
| 651 | +} |
examples/scroll-view/scroll-view-example.cpp
| @@ -454,7 +454,7 @@ private: | @@ -454,7 +454,7 @@ private: | ||
| 454 | { | 454 | { |
| 455 | ImageView actor = ImageView::New(); | 455 | ImageView actor = ImageView::New(); |
| 456 | Property::Map map; | 456 | Property::Map map; |
| 457 | - map["rendererType"] = "image"; | 457 | + map["rendererType"] = "IMAGE"; |
| 458 | map["url"] = filename; | 458 | map["url"] = filename; |
| 459 | map["desiredWidth"] = width; | 459 | map["desiredWidth"] = width; |
| 460 | map["desiredHeight"] = height; | 460 | map["desiredHeight"] = height; |
examples/text-scrolling/text-scrolling-example.cpp
| @@ -77,7 +77,7 @@ public: | @@ -77,7 +77,7 @@ public: | ||
| 77 | parent.Add( box ); | 77 | parent.Add( box ); |
| 78 | 78 | ||
| 79 | Dali::Property::Map border; | 79 | Dali::Property::Map border; |
| 80 | - border.Insert( "rendererType", "border" ); | 80 | + border.Insert( "rendererType", "BORDER" ); |
| 81 | border.Insert( "borderColor", Color::WHITE ); | 81 | border.Insert( "borderColor", Color::WHITE ); |
| 82 | border.Insert( "borderSize", 1.f ); | 82 | border.Insert( "borderSize", 1.f ); |
| 83 | box.SetProperty( Control::Property::BACKGROUND, border ); | 83 | box.SetProperty( Control::Property::BACKGROUND, border ); |
examples/video-view/video-view-example.cpp
| @@ -211,12 +211,12 @@ class VideoViewController: public ConnectionTracker | @@ -211,12 +211,12 @@ class VideoViewController: public ConnectionTracker | ||
| 211 | 211 | ||
| 212 | Property::Map customShader; | 212 | Property::Map customShader; |
| 213 | customShader.Insert( "fragmentShader", FRAGMENT_SHADER ); | 213 | customShader.Insert( "fragmentShader", FRAGMENT_SHADER ); |
| 214 | - mCustomShader.Insert( "rendererType", "image" ); | 214 | + mCustomShader.Insert( "rendererType", "IMAGE" ); |
| 215 | mCustomShader.Insert( "shader", customShader ); | 215 | mCustomShader.Insert( "shader", customShader ); |
| 216 | 216 | ||
| 217 | Property::Map defaultShader; | 217 | Property::Map defaultShader; |
| 218 | customShader.Insert( "fragmentShader", DEFAULT_FRAGMENT_SHADER ); | 218 | customShader.Insert( "fragmentShader", DEFAULT_FRAGMENT_SHADER ); |
| 219 | - mDefaultShader.Insert( "rendererType", "image" ); | 219 | + mDefaultShader.Insert( "rendererType", "IMAGE" ); |
| 220 | mDefaultShader.Insert( "shader", defaultShader ); | 220 | mDefaultShader.Insert( "shader", defaultShader ); |
| 221 | 221 | ||
| 222 | mWindowSurfaceTarget.Insert( "RENDERING_TARGET", "windowSurfaceTarget" ); | 222 | mWindowSurfaceTarget.Insert( "RENDERING_TARGET", "windowSurfaceTarget" ); |
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.1.43 | 5 | +Version: 1.1.44 |
| 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/images/bevelled-cube-button.png
0 โ 100644
3.98 KB
resources/images/cone-button.png
0 โ 100644
3.48 KB
resources/images/conical-frustrum-button.png
0 โ 100644
3.85 KB
resources/images/cube-button.png
0 โ 100644
2.63 KB
resources/images/cylinder-button.png
0 โ 100644
3.77 KB
resources/images/octahedron-button.png
0 โ 100644
3.24 KB
resources/images/sphere-button.png
0 โ 100644
5.14 KB
resources/scripts/animated-colors.json
| @@ -42,7 +42,7 @@ | @@ -42,7 +42,7 @@ | ||
| 42 | "heightResizePolicy":"FILL_TO_PARENT", | 42 | "heightResizePolicy":"FILL_TO_PARENT", |
| 43 | "sizeAspectRatio": false, | 43 | "sizeAspectRatio": false, |
| 44 | "background": { | 44 | "background": { |
| 45 | - "rendererType": "color", | 45 | + "rendererType": "COLOR", |
| 46 | "mixColor": [1,1,1,1] | 46 | "mixColor": [1,1,1,1] |
| 47 | }, | 47 | }, |
| 48 | "color": [ | 48 | "color": [ |
| @@ -78,7 +78,7 @@ | @@ -78,7 +78,7 @@ | ||
| 78 | "heightResizePolicy":"FILL_TO_PARENT", | 78 | "heightResizePolicy":"FILL_TO_PARENT", |
| 79 | "sizeAspectRatio": false, | 79 | "sizeAspectRatio": false, |
| 80 | "background": { | 80 | "background": { |
| 81 | - "rendererType": "color", | 81 | + "rendererType": "COLOR", |
| 82 | "mixColor": [1,1,1,1] | 82 | "mixColor": [1,1,1,1] |
| 83 | }, | 83 | }, |
| 84 | "color": [ | 84 | "color": [ |
| @@ -114,7 +114,7 @@ | @@ -114,7 +114,7 @@ | ||
| 114 | "heightResizePolicy":"FILL_TO_PARENT", | 114 | "heightResizePolicy":"FILL_TO_PARENT", |
| 115 | "sizeAspectRatio": false, | 115 | "sizeAspectRatio": false, |
| 116 | "background": { | 116 | "background": { |
| 117 | - "rendererType": "color", | 117 | + "rendererType": "COLOR", |
| 118 | "mixColor": [1,1,1,1] | 118 | "mixColor": [1,1,1,1] |
| 119 | }, | 119 | }, |
| 120 | "color": [ | 120 | "color": [ |
| @@ -146,7 +146,7 @@ | @@ -146,7 +146,7 @@ | ||
| 146 | "heightResizePolicy":"FILL_TO_PARENT", | 146 | "heightResizePolicy":"FILL_TO_PARENT", |
| 147 | "sizeAspectRatio": false, | 147 | "sizeAspectRatio": false, |
| 148 | "background": { | 148 | "background": { |
| 149 | - "rendererType": "color", | 149 | + "rendererType": "COLOR", |
| 150 | "mixColor": [1,1,1,1] | 150 | "mixColor": [1,1,1,1] |
| 151 | }, | 151 | }, |
| 152 | "color": [ | 152 | "color": [ |
| @@ -182,7 +182,7 @@ | @@ -182,7 +182,7 @@ | ||
| 182 | "heightResizePolicy":"FILL_TO_PARENT", | 182 | "heightResizePolicy":"FILL_TO_PARENT", |
| 183 | "sizeAspectRatio": false, | 183 | "sizeAspectRatio": false, |
| 184 | "background": { | 184 | "background": { |
| 185 | - "rendererType": "color", | 185 | + "rendererType": "COLOR", |
| 186 | "mixColor": [1,1,1,1] | 186 | "mixColor": [1,1,1,1] |
| 187 | }, | 187 | }, |
| 188 | "color": [ | 188 | "color": [ |
| @@ -218,7 +218,7 @@ | @@ -218,7 +218,7 @@ | ||
| 218 | "heightResizePolicy":"FILL_TO_PARENT", | 218 | "heightResizePolicy":"FILL_TO_PARENT", |
| 219 | "sizeAspectRatio": false, | 219 | "sizeAspectRatio": false, |
| 220 | "background": { | 220 | "background": { |
| 221 | - "rendererType": "color", | 221 | + "rendererType": "COLOR", |
| 222 | "mixColor": [1,1,1,1] | 222 | "mixColor": [1,1,1,1] |
| 223 | }, | 223 | }, |
| 224 | "color": [ | 224 | "color": [ |
| @@ -250,7 +250,7 @@ | @@ -250,7 +250,7 @@ | ||
| 250 | "heightResizePolicy":"FILL_TO_PARENT", | 250 | "heightResizePolicy":"FILL_TO_PARENT", |
| 251 | "sizeAspectRatio": false, | 251 | "sizeAspectRatio": false, |
| 252 | "background": { | 252 | "background": { |
| 253 | - "rendererType": "color", | 253 | + "rendererType": "COLOR", |
| 254 | "mixColor": [1,1,1,1] | 254 | "mixColor": [1,1,1,1] |
| 255 | }, | 255 | }, |
| 256 | "color": [ | 256 | "color": [ |
| @@ -286,7 +286,7 @@ | @@ -286,7 +286,7 @@ | ||
| 286 | "heightResizePolicy":"FILL_TO_PARENT", | 286 | "heightResizePolicy":"FILL_TO_PARENT", |
| 287 | "sizeAspectRatio": false, | 287 | "sizeAspectRatio": false, |
| 288 | "background": { | 288 | "background": { |
| 289 | - "rendererType": "color", | 289 | + "rendererType": "COLOR", |
| 290 | "mixColor": [1,1,1,1] | 290 | "mixColor": [1,1,1,1] |
| 291 | }, | 291 | }, |
| 292 | "color": [ | 292 | "color": [ |
| @@ -322,7 +322,7 @@ | @@ -322,7 +322,7 @@ | ||
| 322 | "heightResizePolicy":"FILL_TO_PARENT", | 322 | "heightResizePolicy":"FILL_TO_PARENT", |
| 323 | "sizeAspectRatio": false, | 323 | "sizeAspectRatio": false, |
| 324 | "background": { | 324 | "background": { |
| 325 | - "rendererType": "color", | 325 | + "rendererType": "COLOR", |
| 326 | "mixColor": [1,1,1,1] | 326 | "mixColor": [1,1,1,1] |
| 327 | }, | 327 | }, |
| 328 | "color": [ | 328 | "color": [ |
| @@ -354,7 +354,7 @@ | @@ -354,7 +354,7 @@ | ||
| 354 | "heightResizePolicy":"FILL_TO_PARENT", | 354 | "heightResizePolicy":"FILL_TO_PARENT", |
| 355 | "sizeAspectRatio": false, | 355 | "sizeAspectRatio": false, |
| 356 | "background": { | 356 | "background": { |
| 357 | - "rendererType": "color", | 357 | + "rendererType": "COLOR", |
| 358 | "mixColor": [1,1,1,1] | 358 | "mixColor": [1,1,1,1] |
| 359 | }, | 359 | }, |
| 360 | "color": [ | 360 | "color": [ |
| @@ -386,7 +386,7 @@ | @@ -386,7 +386,7 @@ | ||
| 386 | "heightResizePolicy":"FILL_TO_PARENT", | 386 | "heightResizePolicy":"FILL_TO_PARENT", |
| 387 | "sizeAspectRatio": false, | 387 | "sizeAspectRatio": false, |
| 388 | "background": { | 388 | "background": { |
| 389 | - "rendererType": "color", | 389 | + "rendererType": "COLOR", |
| 390 | "mixColor": [1,1,1,1] | 390 | "mixColor": [1,1,1,1] |
| 391 | }, | 391 | }, |
| 392 | "color": [ | 392 | "color": [ |
| @@ -418,7 +418,7 @@ | @@ -418,7 +418,7 @@ | ||
| 418 | "heightResizePolicy":"FILL_TO_PARENT", | 418 | "heightResizePolicy":"FILL_TO_PARENT", |
| 419 | "sizeAspectRatio": false, | 419 | "sizeAspectRatio": false, |
| 420 | "background": { | 420 | "background": { |
| 421 | - "rendererType": "color", | 421 | + "rendererType": "COLOR", |
| 422 | "mixColor": [1,1,1,1] | 422 | "mixColor": [1,1,1,1] |
| 423 | }, | 423 | }, |
| 424 | "color": [ | 424 | "color": [ |
| @@ -450,7 +450,7 @@ | @@ -450,7 +450,7 @@ | ||
| 450 | "heightResizePolicy":"FILL_TO_PARENT", | 450 | "heightResizePolicy":"FILL_TO_PARENT", |
| 451 | "sizeAspectRatio": false, | 451 | "sizeAspectRatio": false, |
| 452 | "background": { | 452 | "background": { |
| 453 | - "rendererType": "color", | 453 | + "rendererType": "COLOR", |
| 454 | "mixColor": [1,1,1,1] | 454 | "mixColor": [1,1,1,1] |
| 455 | }, | 455 | }, |
| 456 | "color": [ | 456 | "color": [ |
| @@ -486,7 +486,7 @@ | @@ -486,7 +486,7 @@ | ||
| 486 | "heightResizePolicy":"FILL_TO_PARENT", | 486 | "heightResizePolicy":"FILL_TO_PARENT", |
| 487 | "sizeAspectRatio": false, | 487 | "sizeAspectRatio": false, |
| 488 | "background": { | 488 | "background": { |
| 489 | - "rendererType": "color", | 489 | + "rendererType": "COLOR", |
| 490 | "mixColor": [1,1,1,1] | 490 | "mixColor": [1,1,1,1] |
| 491 | }, | 491 | }, |
| 492 | "color": [ | 492 | "color": [ |
| @@ -518,7 +518,7 @@ | @@ -518,7 +518,7 @@ | ||
| 518 | "heightResizePolicy":"FILL_TO_PARENT", | 518 | "heightResizePolicy":"FILL_TO_PARENT", |
| 519 | "sizeAspectRatio": false, | 519 | "sizeAspectRatio": false, |
| 520 | "background": { | 520 | "background": { |
| 521 | - "rendererType": "color", | 521 | + "rendererType": "COLOR", |
| 522 | "mixColor": [1,1,1,1] | 522 | "mixColor": [1,1,1,1] |
| 523 | }, | 523 | }, |
| 524 | "color": [ | 524 | "color": [ |
| @@ -557,7 +557,7 @@ | @@ -557,7 +557,7 @@ | ||
| 557 | "heightResizePolicy":"FILL_TO_PARENT", | 557 | "heightResizePolicy":"FILL_TO_PARENT", |
| 558 | "sizeAspectRatio": false, | 558 | "sizeAspectRatio": false, |
| 559 | "background": { | 559 | "background": { |
| 560 | - "rendererType": "color", | 560 | + "rendererType": "COLOR", |
| 561 | "mixColor": [1,1,1,1] | 561 | "mixColor": [1,1,1,1] |
| 562 | }, | 562 | }, |
| 563 | "color": [ | 563 | "color": [ |
| @@ -589,7 +589,7 @@ | @@ -589,7 +589,7 @@ | ||
| 589 | "heightResizePolicy":"FILL_TO_PARENT", | 589 | "heightResizePolicy":"FILL_TO_PARENT", |
| 590 | "sizeAspectRatio": false, | 590 | "sizeAspectRatio": false, |
| 591 | "background": { | 591 | "background": { |
| 592 | - "rendererType": "color", | 592 | + "rendererType": "COLOR", |
| 593 | "mixColor": [1,1,1,1] | 593 | "mixColor": [1,1,1,1] |
| 594 | }, | 594 | }, |
| 595 | "color": [ | 595 | "color": [ |
| @@ -622,7 +622,7 @@ | @@ -622,7 +622,7 @@ | ||
| 622 | "heightResizePolicy":"FILL_TO_PARENT", | 622 | "heightResizePolicy":"FILL_TO_PARENT", |
| 623 | "sizeAspectRatio": false, | 623 | "sizeAspectRatio": false, |
| 624 | "background": { | 624 | "background": { |
| 625 | - "rendererType": "color", | 625 | + "rendererType": "COLOR", |
| 626 | "mixColor": [1,1,1,1] | 626 | "mixColor": [1,1,1,1] |
| 627 | }, | 627 | }, |
| 628 | "color": [ | 628 | "color": [ |
| @@ -661,7 +661,7 @@ | @@ -661,7 +661,7 @@ | ||
| 661 | "heightResizePolicy":"FILL_TO_PARENT", | 661 | "heightResizePolicy":"FILL_TO_PARENT", |
| 662 | "sizeAspectRatio": false, | 662 | "sizeAspectRatio": false, |
| 663 | "background": { | 663 | "background": { |
| 664 | - "rendererType": "color", | 664 | + "rendererType": "COLOR", |
| 665 | "mixColor": [1,1,1,1] | 665 | "mixColor": [1,1,1,1] |
| 666 | }, | 666 | }, |
| 667 | "color": [ | 667 | "color": [ |
| @@ -693,7 +693,7 @@ | @@ -693,7 +693,7 @@ | ||
| 693 | "heightResizePolicy":"FILL_TO_PARENT", | 693 | "heightResizePolicy":"FILL_TO_PARENT", |
| 694 | "sizeAspectRatio": false, | 694 | "sizeAspectRatio": false, |
| 695 | "background": { | 695 | "background": { |
| 696 | - "rendererType": "color", | 696 | + "rendererType": "COLOR", |
| 697 | "mixColor": [1,1,1,1] | 697 | "mixColor": [1,1,1,1] |
| 698 | }, | 698 | }, |
| 699 | "color": [ | 699 | "color": [ |
| @@ -726,7 +726,7 @@ | @@ -726,7 +726,7 @@ | ||
| 726 | "heightResizePolicy":"FILL_TO_PARENT", | 726 | "heightResizePolicy":"FILL_TO_PARENT", |
| 727 | "sizeAspectRatio": false, | 727 | "sizeAspectRatio": false, |
| 728 | "background": { | 728 | "background": { |
| 729 | - "rendererType": "color", | 729 | + "rendererType": "COLOR", |
| 730 | "mixColor": [1,1,1,1] | 730 | "mixColor": [1,1,1,1] |
| 731 | }, | 731 | }, |
| 732 | "color": [ | 732 | "color": [ |
| @@ -758,7 +758,7 @@ | @@ -758,7 +758,7 @@ | ||
| 758 | "heightResizePolicy":"FILL_TO_PARENT", | 758 | "heightResizePolicy":"FILL_TO_PARENT", |
| 759 | "sizeAspectRatio": false, | 759 | "sizeAspectRatio": false, |
| 760 | "background": { | 760 | "background": { |
| 761 | - "rendererType": "color", | 761 | + "rendererType": "COLOR", |
| 762 | "mixColor": [1,1,1,1] | 762 | "mixColor": [1,1,1,1] |
| 763 | }, | 763 | }, |
| 764 | "color": [ | 764 | "color": [ |
| @@ -790,7 +790,7 @@ | @@ -790,7 +790,7 @@ | ||
| 790 | "heightResizePolicy":"FILL_TO_PARENT", | 790 | "heightResizePolicy":"FILL_TO_PARENT", |
| 791 | "sizeAspectRatio": false, | 791 | "sizeAspectRatio": false, |
| 792 | "background": { | 792 | "background": { |
| 793 | - "rendererType": "color", | 793 | + "rendererType": "COLOR", |
| 794 | "mixColor": [1,1,1,1] | 794 | "mixColor": [1,1,1,1] |
| 795 | }, | 795 | }, |
| 796 | "color": [ | 796 | "color": [ |
| @@ -823,7 +823,7 @@ | @@ -823,7 +823,7 @@ | ||
| 823 | "sizeModeFactor": [0.25,0.166667,1], | 823 | "sizeModeFactor": [0.25,0.166667,1], |
| 824 | "sizeAspectRatio": false, | 824 | "sizeAspectRatio": false, |
| 825 | "background": { | 825 | "background": { |
| 826 | - "rendererType": "color", | 826 | + "rendererType": "COLOR", |
| 827 | "mixColor": [1,1,1,1] | 827 | "mixColor": [1,1,1,1] |
| 828 | }, | 828 | }, |
| 829 | "color": [ | 829 | "color": [ |
resources/scripts/background.json
| @@ -30,7 +30,7 @@ | @@ -30,7 +30,7 @@ | ||
| 30 | "heightResizePolicy":"SIZE_RELATIVE_TO_PARENT", | 30 | "heightResizePolicy":"SIZE_RELATIVE_TO_PARENT", |
| 31 | "sizeModeFactor": [ 0.5, 0.333333333333, 1 ], | 31 | "sizeModeFactor": [ 0.5, 0.333333333333, 1 ], |
| 32 | "background":{ | 32 | "background":{ |
| 33 | - "rendererType": "color", | 33 | + "rendererType": "COLOR", |
| 34 | "mixColor": [ 0.8, 0, 0.2, 1 ] | 34 | "mixColor": [ 0.8, 0, 0.2, 1 ] |
| 35 | } | 35 | } |
| 36 | }, | 36 | }, |
| @@ -45,7 +45,7 @@ | @@ -45,7 +45,7 @@ | ||
| 45 | "heightResizePolicy":"SIZE_RELATIVE_TO_PARENT", | 45 | "heightResizePolicy":"SIZE_RELATIVE_TO_PARENT", |
| 46 | "sizeModeFactor": [ 0.5, 0.333333333333, 1 ], | 46 | "sizeModeFactor": [ 0.5, 0.333333333333, 1 ], |
| 47 | "background": { | 47 | "background": { |
| 48 | - "rendererType": "image", | 48 | + "rendererType": "IMAGE", |
| 49 | "url": "{DEMO_IMAGE_DIR}Kid1.svg" | 49 | "url": "{DEMO_IMAGE_DIR}Kid1.svg" |
| 50 | } | 50 | } |
| 51 | }, | 51 | }, |
| @@ -60,7 +60,7 @@ | @@ -60,7 +60,7 @@ | ||
| 60 | "heightResizePolicy":"SIZE_RELATIVE_TO_PARENT", | 60 | "heightResizePolicy":"SIZE_RELATIVE_TO_PARENT", |
| 61 | "sizeModeFactor": [ 0.5, 0.333333333333, 1 ], | 61 | "sizeModeFactor": [ 0.5, 0.333333333333, 1 ], |
| 62 | "background": { | 62 | "background": { |
| 63 | - "rendererType" : "border", | 63 | + "rendererType" : "BORDER", |
| 64 | "borderColor" : [ 0.5, 0.5, 0.5, 1 ], | 64 | "borderColor" : [ 0.5, 0.5, 0.5, 1 ], |
| 65 | "borderSize" : 15.0 | 65 | "borderSize" : 15.0 |
| 66 | } | 66 | } |
| @@ -76,7 +76,7 @@ | @@ -76,7 +76,7 @@ | ||
| 76 | "heightResizePolicy":"SIZE_RELATIVE_TO_PARENT", | 76 | "heightResizePolicy":"SIZE_RELATIVE_TO_PARENT", |
| 77 | "sizeModeFactor": [ 0.5, 0.333333333333, 1 ], | 77 | "sizeModeFactor": [ 0.5, 0.333333333333, 1 ], |
| 78 | "background": { | 78 | "background": { |
| 79 | - "rendererType": "image", | 79 | + "rendererType": "IMAGE", |
| 80 | "url": "{DEMO_IMAGE_DIR}gallery-large-9.jpg" | 80 | "url": "{DEMO_IMAGE_DIR}gallery-large-9.jpg" |
| 81 | } | 81 | } |
| 82 | }, | 82 | }, |
| @@ -91,7 +91,7 @@ | @@ -91,7 +91,7 @@ | ||
| 91 | "heightResizePolicy":"SIZE_RELATIVE_TO_PARENT", | 91 | "heightResizePolicy":"SIZE_RELATIVE_TO_PARENT", |
| 92 | "sizeModeFactor": [ 0.5, 0.333333333333, 1 ], | 92 | "sizeModeFactor": [ 0.5, 0.333333333333, 1 ], |
| 93 | "background":{ | 93 | "background":{ |
| 94 | - "rendererType": "color", | 94 | + "rendererType": "COLOR", |
| 95 | "mixColor": [ 1, 1, 0, 1 ] | 95 | "mixColor": [ 1, 1, 0, 1 ] |
| 96 | } | 96 | } |
| 97 | }, | 97 | }, |
| @@ -106,7 +106,7 @@ | @@ -106,7 +106,7 @@ | ||
| 106 | "heightResizePolicy":"SIZE_RELATIVE_TO_PARENT", | 106 | "heightResizePolicy":"SIZE_RELATIVE_TO_PARENT", |
| 107 | "sizeModeFactor": [ 0.5, 0.333333333333, 1 ], | 107 | "sizeModeFactor": [ 0.5, 0.333333333333, 1 ], |
| 108 | "background": { | 108 | "background": { |
| 109 | - "rendererType" : "gradient", | 109 | + "rendererType" : "GRADIENT", |
| 110 | "startPosition" : [ -0.5, -0.5 ], | 110 | "startPosition" : [ -0.5, -0.5 ], |
| 111 | "endPosition": [ 0.5, 0.5 ], | 111 | "endPosition": [ 0.5, 0.5 ], |
| 112 | "stopColor" : [ | 112 | "stopColor" : [ |
resources/scripts/clock.json
| @@ -8,7 +8,7 @@ | @@ -8,7 +8,7 @@ | ||
| 8 | "parentOrigin": [0.5, 0.5, 0.5], | 8 | "parentOrigin": [0.5, 0.5, 0.5], |
| 9 | "anchorPoint": [0.5, 1, 0.5], | 9 | "anchorPoint": [0.5, 1, 0.5], |
| 10 | "background": { | 10 | "background": { |
| 11 | - "rendererType": "color", | 11 | + "rendererType": "COLOR", |
| 12 | "mixColor": [0.71, 0, 0, 1] | 12 | "mixColor": [0.71, 0, 0, 1] |
| 13 | }, | 13 | }, |
| 14 | "selected": false, | 14 | "selected": false, |
| @@ -27,7 +27,7 @@ | @@ -27,7 +27,7 @@ | ||
| 27 | "parentOrigin": [0.5, 0.5, 0.5], | 27 | "parentOrigin": [0.5, 0.5, 0.5], |
| 28 | "anchorPoint": [0.5, 1, 0.5], | 28 | "anchorPoint": [0.5, 1, 0.5], |
| 29 | "background": { | 29 | "background": { |
| 30 | - "rendererType": "color", | 30 | + "rendererType": "COLOR", |
| 31 | "mixColor": [0, 0.14200000000000013, 0.71, 0.7] | 31 | "mixColor": [0, 0.14200000000000013, 0.71, 0.7] |
| 32 | }, | 32 | }, |
| 33 | "signals": [ | 33 | "signals": [ |
| @@ -45,7 +45,7 @@ | @@ -45,7 +45,7 @@ | ||
| 45 | "parentOrigin": [0.5, 0.5, 0.5], | 45 | "parentOrigin": [0.5, 0.5, 0.5], |
| 46 | "anchorPoint": [0.5, 1, 0.5], | 46 | "anchorPoint": [0.5, 1, 0.5], |
| 47 | "background": { | 47 | "background": { |
| 48 | - "rendererType": "color", | 48 | + "rendererType": "COLOR", |
| 49 | "mixColor": [0.057450000000000064, 0.3, 0.0030000000000000027, 0.7] | 49 | "mixColor": [0.057450000000000064, 0.3, 0.0030000000000000027, 0.7] |
| 50 | }, | 50 | }, |
| 51 | "signals": [ | 51 | "signals": [ |
resources/scripts/table-view.json
| @@ -43,7 +43,7 @@ | @@ -43,7 +43,7 @@ | ||
| 43 | "name":"simpleTable", | 43 | "name":"simpleTable", |
| 44 | "type":"TableView", | 44 | "type":"TableView", |
| 45 | "background":{ | 45 | "background":{ |
| 46 | - "rendererType": "color", | 46 | + "rendererType": "COLOR", |
| 47 | "mixColor": [0.5,0.5,0,1] | 47 | "mixColor": [0.5,0.5,0,1] |
| 48 | }, | 48 | }, |
| 49 | "parentOrigin": "CENTER", | 49 | "parentOrigin": "CENTER", |
resources/style/demo-theme.json.in
| @@ -69,10 +69,10 @@ | @@ -69,10 +69,10 @@ | ||
| 69 | { | 69 | { |
| 70 | "background": | 70 | "background": |
| 71 | { | 71 | { |
| 72 | - "rendererType": "gradient", | 72 | + "rendererType": "GRADIENT", |
| 73 | "center": [240, 400], | 73 | "center": [240, 400], |
| 74 | "radius": 932, | 74 | "radius": 932, |
| 75 | - "units": "userSpace", | 75 | + "units": "USER_SPACE", |
| 76 | "stopColor": [[0.247,0.38,0.52,1.0],[0.055,0.18,0.286,1.0]] | 76 | "stopColor": [[0.247,0.38,0.52,1.0],[0.055,0.18,0.286,1.0]] |
| 77 | } | 77 | } |
| 78 | } | 78 | } |
resources/style/mobile/demo-theme.json.in
| @@ -82,10 +82,10 @@ | @@ -82,10 +82,10 @@ | ||
| 82 | { | 82 | { |
| 83 | "background": | 83 | "background": |
| 84 | { | 84 | { |
| 85 | - "rendererType": "gradient", | 85 | + "rendererType": "GRADIENT", |
| 86 | "center": [360, 640], | 86 | "center": [360, 640], |
| 87 | "radius": 1468, | 87 | "radius": 1468, |
| 88 | - "units": "userSpace", | 88 | + "units": "USER_SPACE", |
| 89 | "stopColor": [[0.247,0.38,0.52,1.0],[0.055,0.18,0.286,1.0]] | 89 | "stopColor": [[0.247,0.38,0.52,1.0],[0.055,0.18,0.286,1.0]] |
| 90 | } | 90 | } |
| 91 | } | 91 | } |
shared/dali-demo-strings.h
| @@ -108,6 +108,7 @@ extern "C" | @@ -108,6 +108,7 @@ extern "C" | ||
| 108 | #define DALI_DEMO_STR_TITLE_EFFECTS_VIEW "Effects View" | 108 | #define DALI_DEMO_STR_TITLE_EFFECTS_VIEW "Effects View" |
| 109 | #define DALI_DEMO_STR_TITLE_NATIVE_IMAGE_SOURCE "Native Image Source" | 109 | #define DALI_DEMO_STR_TITLE_NATIVE_IMAGE_SOURCE "Native Image Source" |
| 110 | #define DALI_DEMO_STR_TITLE_MESH_RENDERER "Mesh Renderer" | 110 | #define DALI_DEMO_STR_TITLE_MESH_RENDERER "Mesh Renderer" |
| 111 | +#define DALI_DEMO_STR_TITLE_PRIMITIVE_SHAPES "Primitive Shapes" | ||
| 111 | 112 | ||
| 112 | #endif | 113 | #endif |
| 113 | 114 |
shared/view.h
| @@ -131,7 +131,7 @@ Dali::Layer CreateView( Dali::Application& application, | @@ -131,7 +131,7 @@ Dali::Layer CreateView( Dali::Application& application, | ||
| 131 | if ( !backgroundImagePath.empty() ) | 131 | if ( !backgroundImagePath.empty() ) |
| 132 | { | 132 | { |
| 133 | Dali::Property::Map map; | 133 | Dali::Property::Map map; |
| 134 | - map["rendererType"] = "image"; | 134 | + map["rendererType"] = "IMAGE"; |
| 135 | map["url"] = backgroundImagePath; | 135 | map["url"] = backgroundImagePath; |
| 136 | map["desiredWidth"] = stage.GetSize().x; | 136 | map["desiredWidth"] = stage.GetSize().x; |
| 137 | map["desiredHeight"] = stage.GetSize().y; | 137 | map["desiredHeight"] = stage.GetSize().y; |