2. Building for Ubuntu desktop
2.1. Minimum Requirements
2.2. Building the Repository
-
+ 3. Creating an example
1. GBS Builds
cmake -DCMAKE_INSTALL_PREFIX=$DESKTOP_PREFIX .
make install -j8
+
+
+3. Creating an example
+======================
+
+ - Make a directory in the "examples" directory. Only one example will be created per directory.
+ - The executable installed will have a ".example" appended to it, e.g. a "blocks" directory produces "blocks.example".
+ - Add all source files for the required example in this directory.
+ - Modify "com.samsung.dali-demo.xml" to include your example so that it can be launched on target.
+ - No changes are required to the make system as long as the above is followed, your example will be automatically built & installed.
+
/demo/dali-performance
/demo/performance.core
/docs/dali.doxy
+/builder/dali-builder
/examples/*.demo
-/performance/dali-performance
-/performance/performance.*
SET(BINDIR ${PREFIX}/bin)
ENDIF()
-SET(LOCAL_IMAGES_DIR ${ROOT_SRC_DIR}/demo/images)
-SET(LOCAL_MODELS_DIR ${ROOT_SRC_DIR}/demo/models)
-SET(LOCAL_SCRIPTS_DIR ${ROOT_SRC_DIR}/demo/scripts)
+SET(RESOURCE_DIR ${ROOT_SRC_DIR}/resources)
+SET(LOCAL_IMAGES_DIR ${RESOURCE_DIR}/images)
+SET(LOCAL_MODELS_DIR ${RESOURCE_DIR}/models)
+SET(LOCAL_SCRIPTS_DIR ${RESOURCE_DIR}/scripts)
SET(IMAGES_DIR ${APP_DATA_DIR}/images/)
SET(MODELS_DIR ${APP_DATA_DIR}/models/)
SET(LOCAL_IMAGES_LIST ${LOCAL_IMAGES_PNG};${LOCAL_IMAGES_JPG};${LOCAL_IMAGES_GIF};${LOCAL_IMAGES_BMP};${LOCAL_IMAGES_ICO};${LOCAL_IMAGES_WBMP})
FOREACH(flag ${LOCAL_IMAGES_LIST})
- INSTALL(FILES ../../demo/images/${flag} DESTINATION ${IMAGES_DIR})
+ INSTALL(FILES ${LOCAL_IMAGES_DIR}/${flag} DESTINATION ${IMAGES_DIR})
ENDFOREACH(flag)
FILE(GLOB LOCAL_MODELS_LIST RELATIVE "${LOCAL_MODELS_DIR}" "${LOCAL_MODELS_DIR}/*")
FOREACH(flag ${LOCAL_MODELS_LIST})
- INSTALL(FILES ../../demo/models/${flag} DESTINATION ${MODELS_DIR})
+ INSTALL(FILES ${LOCAL_MODELS_DIR}/${flag} DESTINATION ${MODELS_DIR})
ENDFOREACH(flag)
FILE(GLOB LOCAL_SCRIPTS_LIST RELATIVE "${LOCAL_SCRIPTS_DIR}" "${LOCAL_SCRIPTS_DIR}/*")
FOREACH(flag ${LOCAL_SCRIPTS_LIST})
- INSTALL(FILES ../../demo/scripts/${flag} DESTINATION ${SCRIPTS_DIR})
+ INSTALL(FILES ${LOCAL_SCRIPTS_DIR}/${flag} DESTINATION ${SCRIPTS_DIR})
ENDFOREACH(flag)
SET(PKG_LIST dali
ADD_SUBDIRECTORY(demo)
ADD_SUBDIRECTORY(examples)
+ADD_SUBDIRECTORY(builder)
--- /dev/null
+SET(BUILDER_SRC_DIR ${ROOT_SRC_DIR}/builder)
+
+SET(DALI_BUILDER_SRCS ${BUILDER_SRC_DIR}/dali-builder.cpp)
+ADD_EXECUTABLE(dali-builder ${DALI_BUILDER_SRCS})
+TARGET_LINK_LIBRARIES(dali-builder ${REQUIRED_PKGS_LDFLAGS})
+INSTALL(TARGETS dali-builder DESTINATION ${BINDIR})
SET(EXAMPLES_SRC_DIR ${ROOT_SRC_DIR}/examples)
-SET(BLOCKS_SRCS ${EXAMPLES_SRC_DIR}/blocks/blocks-example.cpp)
-ADD_EXECUTABLE(blocks.example ${BLOCKS_SRCS})
-TARGET_LINK_LIBRARIES(blocks.example ${REQUIRED_PKGS_LDFLAGS})
-INSTALL(TARGETS blocks.example DESTINATION ${BINDIR})
-
-SET(BUBBLE_EFFECT_SRCS ${EXAMPLES_SRC_DIR}/shader-effect/bubble-effect-example.cpp)
-ADD_EXECUTABLE(bubble-effect.example ${BUBBLE_EFFECT_SRCS})
-TARGET_LINK_LIBRARIES(bubble-effect.example ${REQUIRED_PKGS_LDFLAGS})
-INSTALL(TARGETS bubble-effect.example DESTINATION ${BINDIR})
-
-SET(CLUSTER_SRCS ${EXAMPLES_SRC_DIR}/cluster/cluster-example.cpp)
-ADD_EXECUTABLE(cluster.example ${CLUSTER_SRCS})
-TARGET_LINK_LIBRARIES(cluster.example ${REQUIRED_PKGS_LDFLAGS})
-INSTALL(TARGETS cluster.example DESTINATION ${BINDIR})
-
-SET(CUBE_TRANSITION_EFFECT_SRCS ${EXAMPLES_SRC_DIR}/transition/cube-transition-effect-example.cpp)
-ADD_EXECUTABLE(cube-transition-effect.example ${CUBE_TRANSITION_EFFECT_SRCS})
-TARGET_LINK_LIBRARIES(cube-transition-effect.example ${REQUIRED_PKGS_LDFLAGS})
-INSTALL(TARGETS cube-transition-effect.example DESTINATION ${BINDIR})
-
-SET(DISSOLVE_EFFECT_SRCS ${EXAMPLES_SRC_DIR}/shader-effect/dissolve-effect-example.cpp)
-ADD_EXECUTABLE(dissolve-effect.example ${DISSOLVE_EFFECT_SRCS})
-TARGET_LINK_LIBRARIES(dissolve-effect.example ${REQUIRED_PKGS_LDFLAGS})
-INSTALL(TARGETS dissolve-effect.example DESTINATION ${BINDIR})
-
-SET(HELLO_WORLD_SRCS ${EXAMPLES_SRC_DIR}/hello-world/hello-world-example.cpp)
-ADD_EXECUTABLE(hello-world.example ${HELLO_WORLD_SRCS})
-TARGET_LINK_LIBRARIES(hello-world.example ${REQUIRED_PKGS_LDFLAGS})
-INSTALL(TARGETS hello-world.example DESTINATION ${BINDIR})
-
-SET(ITEM_VIEW_SRCS ${EXAMPLES_SRC_DIR}/item-view/item-view-example.cpp)
-ADD_EXECUTABLE(item-view.example ${ITEM_VIEW_SRCS})
-TARGET_LINK_LIBRARIES(item-view.example ${REQUIRED_PKGS_LDFLAGS})
-INSTALL(TARGETS item-view.example DESTINATION ${BINDIR})
-
-SET(MAGNIFIER_SRCS ${EXAMPLES_SRC_DIR}/magnifier/magnifier-example.cpp)
-ADD_EXECUTABLE(magnifier.example ${MAGNIFIER_SRCS})
-TARGET_LINK_LIBRARIES(magnifier.example ${REQUIRED_PKGS_LDFLAGS})
-INSTALL(TARGETS magnifier.example DESTINATION ${BINDIR})
-
-SET(MOTION_BLUR_SRCS ${EXAMPLES_SRC_DIR}/motion/motion-blur-example.cpp)
-ADD_EXECUTABLE(motion-blur.example ${MOTION_BLUR_SRCS})
-TARGET_LINK_LIBRARIES(motion-blur.example ${REQUIRED_PKGS_LDFLAGS})
-INSTALL(TARGETS motion-blur.example DESTINATION ${BINDIR})
-
-SET(MOTION_STRETCH_SRCS ${EXAMPLES_SRC_DIR}/motion/motion-stretch-example.cpp)
-ADD_EXECUTABLE(motion-stretch.example ${MOTION_STRETCH_SRCS})
-TARGET_LINK_LIBRARIES(motion-stretch.example ${REQUIRED_PKGS_LDFLAGS})
-INSTALL(TARGETS motion-stretch.example DESTINATION ${BINDIR})
-
-SET(NEW_WINDOW_SRCS ${EXAMPLES_SRC_DIR}/new-window/new-window-example.cpp)
-ADD_EXECUTABLE(new-window.example ${NEW_WINDOW_SRCS})
-TARGET_LINK_LIBRARIES(new-window.example ${REQUIRED_PKGS_LDFLAGS})
-INSTALL(TARGETS new-window.example DESTINATION ${BINDIR})
-
-SET(PAGE_TURN_VIEW_SRCS ${EXAMPLES_SRC_DIR}/page-turn-view/page-turn-view-example.cpp)
-ADD_EXECUTABLE(page-turn-view.example ${PAGE_TURN_VIEW_SRCS})
-TARGET_LINK_LIBRARIES(page-turn-view.example ${REQUIRED_PKGS_LDFLAGS})
-INSTALL(TARGETS page-turn-view.example DESTINATION ${BINDIR})
-
-AUX_SOURCE_DIRECTORY(${EXAMPLES_SRC_DIR}/radial-menu RADIAL_MENU_SRCS)
-ADD_EXECUTABLE(radial-menu.example ${RADIAL_MENU_SRCS})
-TARGET_LINK_LIBRARIES(radial-menu.example ${REQUIRED_PKGS_LDFLAGS})
-INSTALL(TARGETS radial-menu.example DESTINATION ${BINDIR})
-
-SET(REFRACTION_EFFECT_SRCS ${EXAMPLES_SRC_DIR}/shader-effect/refraction-effect-example.cpp)
-ADD_EXECUTABLE(refraction-effect.example ${REFRACTION_EFFECT_SRCS})
-TARGET_LINK_LIBRARIES(refraction-effect.example ${REQUIRED_PKGS_LDFLAGS})
-INSTALL(TARGETS refraction-effect.example DESTINATION ${BINDIR})
-
-SET(SCROLL_VIEW_SRCS ${EXAMPLES_SRC_DIR}/scroll-view/scroll-view-example.cpp)
-ADD_EXECUTABLE(scroll-view.example ${SCROLL_VIEW_SRCS})
-TARGET_LINK_LIBRARIES(scroll-view.example ${REQUIRED_PKGS_LDFLAGS})
-INSTALL(TARGETS scroll-view.example DESTINATION ${BINDIR})
-
-SET(SHADOW_BONE_LIGHTING_SRCS ${EXAMPLES_SRC_DIR}/shadows/shadow-bone-lighting-example.cpp)
-ADD_EXECUTABLE(shadow-bone-lighting.example ${SHADOW_BONE_LIGHTING_SRCS})
-TARGET_LINK_LIBRARIES(shadow-bone-lighting.example ${REQUIRED_PKGS_LDFLAGS})
-INSTALL(TARGETS shadow-bone-lighting.example DESTINATION ${BINDIR})
-
-SET(DALI_BUILDER_SRCS ${EXAMPLES_SRC_DIR}/builder/dali-builder.cpp)
-ADD_EXECUTABLE(dali-builder ${DALI_BUILDER_SRCS})
-TARGET_LINK_LIBRARIES(dali-builder ${REQUIRED_PKGS_LDFLAGS})
-INSTALL(TARGETS dali-builder DESTINATION ${BINDIR})
-
-SET(BUILDER_SRCS ${EXAMPLES_SRC_DIR}/builder/examples.cpp)
-ADD_EXECUTABLE(builder.example ${BUILDER_SRCS})
-TARGET_LINK_LIBRARIES(builder.example ${REQUIRED_PKGS_LDFLAGS})
-INSTALL(TARGETS builder.example DESTINATION ${BINDIR})
-
-SET(IMAGE_SCALING_IRREGULAR_GRID_SRCS ${EXAMPLES_SRC_DIR}/image/image-scaling-irregular-grid/image-scaling-irregular-grid-example.cpp)
-ADD_EXECUTABLE(image-scaling-irregular-grid.example ${IMAGE_SCALING_IRREGULAR_GRID_SRCS})
-TARGET_LINK_LIBRARIES(image-scaling-irregular-grid.example ${REQUIRED_PKGS_LDFLAGS})
-INSTALL(TARGETS image-scaling-irregular-grid.example DESTINATION ${BINDIR})
-
-SET(BUTTONS_SRCS ${EXAMPLES_SRC_DIR}/buttons/buttons-example.cpp)
-ADD_EXECUTABLE(buttons.example ${BUTTONS_SRCS})
-TARGET_LINK_LIBRARIES(buttons.example ${REQUIRED_PKGS_LDFLAGS})
-INSTALL(TARGETS buttons.example DESTINATION ${BINDIR})
-
-SET(LOGGING_SRCS ${EXAMPLES_SRC_DIR}/logging/logging-example.cpp)
-ADD_EXECUTABLE(logging.example ${LOGGING_SRCS})
-TARGET_LINK_LIBRARIES(logging.example ${REQUIRED_PKGS_LDFLAGS})
-INSTALL(TARGETS logging.example DESTINATION ${BINDIR})
-
-SET(TEXT_LABEL_SRCS ${EXAMPLES_SRC_DIR}/text/text-label-example.cpp ${EXAMPLES_SRC_DIR}/text/center-layout.cpp ${EXAMPLES_SRC_DIR}/text/center-layout-impl.cpp)
-ADD_EXECUTABLE(text-label.example ${TEXT_LABEL_SRCS})
-TARGET_LINK_LIBRARIES(text-label.example ${REQUIRED_PKGS_LDFLAGS})
-INSTALL(TARGETS text-label.example DESTINATION ${BINDIR})
-
-SET(TEXT_LABEL_MULTI_LANGUAGE_SRCS ${EXAMPLES_SRC_DIR}/text/text-label-multi-language-example.cpp ${EXAMPLES_SRC_DIR}/text/vertical-layout.cpp ${EXAMPLES_SRC_DIR}/text/vertical-layout-impl.cpp)
-ADD_EXECUTABLE(text-label-multi-language.example ${TEXT_LABEL_MULTI_LANGUAGE_SRCS})
-TARGET_LINK_LIBRARIES(text-label-multi-language.example ${REQUIRED_PKGS_LDFLAGS})
-INSTALL(TARGETS text-label-multi-language.example DESTINATION ${BINDIR})
-
-SET(TEXT_FIELD_SRCS ${EXAMPLES_SRC_DIR}/text/text-field-example.cpp ${EXAMPLES_SRC_DIR}/text/edit-layout.cpp ${EXAMPLES_SRC_DIR}/text/edit-layout-impl.cpp)
-ADD_EXECUTABLE(text-field.example ${TEXT_FIELD_SRCS})
-TARGET_LINK_LIBRARIES(text-field.example ${REQUIRED_PKGS_LDFLAGS})
-INSTALL(TARGETS text-field.example DESTINATION ${BINDIR})
+# Get all subdirectory names from EXAMPLES_SRC_DIR
+MACRO(SUBDIRLIST result curdir)
+ FILE(GLOB children RELATIVE ${curdir} ${curdir}/*)
+ SET(dirlist "")
+ FOREACH(child ${children})
+ IF(IS_DIRECTORY ${curdir}/${child})
+ LIST(APPEND dirlist ${child})
+ ENDIF()
+ ENDFOREACH()
+ SET(${result} ${dirlist})
+ENDMACRO()
+SUBDIRLIST(SUBDIRS ${EXAMPLES_SRC_DIR})
+
+FOREACH(EXAMPLE ${SUBDIRS})
+ FILE(GLOB SRCS "${EXAMPLES_SRC_DIR}/${EXAMPLE}/*.cpp")
+ ADD_EXECUTABLE(${EXAMPLE}.example ${SRCS})
+ TARGET_LINK_LIBRARIES(${EXAMPLE}.example ${REQUIRED_PKGS_LDFLAGS})
+ INSTALL(TARGETS ${EXAMPLE}.example DESTINATION ${BINDIR})
+ENDFOREACH(EXAMPLE)
#include <string>
#include <fstream>
#include <streambuf>
-#include <boost/scoped_ptr.hpp>
-//#include <boost/regex.hpp>
#include "sys/stat.h"
#include <ctime>
<ui-application appid="logging.example" exec="/usr/apps/com.samsung.dali-demo/bin/logging.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true">
<label>Logging</label>
</ui-application>
+ <ui-application appid="animated-shapes.example" exec="/usr/apps/com.samsung.dali-demo/bin/animated-shapes.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true">
+ <label>Animated shapes</label>
+ </ui-application>
+ <ui-application appid="path-animation.example" exec="/usr/apps/com.samsung.dali-demo/bin/path-animation.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true">
+ <label>Path Animation</label>
+ </ui-application>
</manifest>
*/
#include "dali-table-view.h"
-#include "examples/shared/dali-demo-strings.h"
+#include "shared/dali-demo-strings.h"
using namespace Dali;
demo.AddExample(Example("image-scaling-irregular-grid.example", DALI_DEMO_STR_TITLE_IMAGE_SCALING));
demo.AddExample(Example("text-label.example", DALI_DEMO_STR_TITLE_TEXT_LABEL));
demo.AddExample(Example("text-label-multi-language.example", DALI_DEMO_STR_TITLE_TEXT_LABEL)/*TODO - new string*/);
+ demo.AddExample(Example("animated-shapes.example", "Animated Shapes"));
+ demo.AddExample(Example("path-animation.example", "Path Animation"));
app.MainLoop();
return 0;
// CLASS HEADER
#include "dali-table-view.h"
-#include "examples/shared/view.h"
// EXTERNAL INCLUDES
#include <algorithm>
#include <sstream>
-#include<unistd.h>
+#include <unistd.h>
+
+// INTERNAL INCLUDES
+#include "shared/view.h"
using namespace Dali;
using namespace Dali::Toolkit;
mScrollView.SetParentOrigin( ParentOrigin::CENTER );
// Note: Currently, changing mScrollView to use SizeMode RELATIVE_TO_PARENT
// will cause scroll ends to appear in the wrong position.
- mScrollView.ApplyConstraint( Dali::Constraint::New<Dali::Vector3>( Dali::Actor::SIZE, Dali::ParentSource( Dali::Actor::SIZE ), Dali::RelativeToConstraint( SCROLLVIEW_RELATIVE_SIZE ) ) );
+ mScrollView.ApplyConstraint( Dali::Constraint::New<Dali::Vector3>( Dali::Actor::Property::Size, Dali::ParentSource( Dali::Actor::Property::Size ), Dali::RelativeToConstraint( SCROLLVIEW_RELATIVE_SIZE ) ) );
mScrollView.SetAxisAutoLock( true );
mScrollView.ScrollCompletedSignal().Connect( this, &DaliTableView::OnScrollComplete );
mScrollView.ScrollStartedSignal().Connect( this, &DaliTableView::OnScrollStart );
void DaliTableView::SetupBackground( Actor bubbleContainer, Actor backgroundLayer, const Vector2& size )
{
// Create distance field shape.
- BitmapImage distanceField;
+ BufferImage distanceField;
Size imageSize( 512, 512 );
CreateShapeImage( CIRCLE, imageSize, distanceField );
AddBackgroundActors( bubbleContainer, NUM_BACKGROUND_IMAGES, distanceField, size );
}
-void DaliTableView::AddBackgroundActors( Actor layer, int count, BitmapImage distanceField, const Dali::Vector2& size )
+void DaliTableView::AddBackgroundActors( Actor layer, int count, BufferImage distanceField, const Dali::Vector2& size )
{
for( int i = 0; i < count; ++i )
{
dfActor.SetPosition( actorPos );
// Define bubble horizontal parallax and vertical wrapping
- Constraint animConstraint = Constraint::New < Vector3 > ( Actor::POSITION,
+ Constraint animConstraint = Constraint::New < Vector3 > ( Actor::Property::Position,
Source( mScrollView, mScrollView.GetPropertyIndex( ScrollView::SCROLL_POSITION_PROPERTY_NAME ) ),
- Dali::ParentSource( Dali::Actor::SIZE ),
+ Dali::ParentSource( Dali::Actor::Property::Size ),
AnimateBubbleConstraint( actorPos, Random::Range( -0.85f, 0.25f ), randSize ) );
dfActor.ApplyConstraint( animConstraint );
Vector3 toPos( actorPos );
toPos.y -= ( size.y + randSize );
keyframes.Add( 1.0f, toPos );
- animation.AnimateBetween( Property( dfActor, Actor::POSITION ), keyframes );
+ animation.AnimateBetween( Property( dfActor, Actor::Property::Position ), keyframes );
animation.SetLooping( true );
animation.Play();
mBackgroundAnimations.push_back( animation );
}
}
-void DaliTableView::CreateShapeImage( ShapeType shapeType, const Size& size, BitmapImage& distanceFieldOut )
+void DaliTableView::CreateShapeImage( ShapeType shapeType, const Size& size, BufferImage& distanceFieldOut )
{
// this bitmap will hold the alpha map for the distance field shader
- distanceFieldOut = BitmapImage::New( size.width, size.height, Pixel::A8 );
+ distanceFieldOut = BufferImage::New( size.width, size.height, Pixel::A8 );
// Generate bit pattern
std::vector< unsigned char > imageDataA8;
* @param[in] distanceField The distance field bitmap to use
* @param[in] size The size of the actor
*/
- void AddBackgroundActors( Dali::Actor layer, int count, Dali::BitmapImage distanceField, const Dali::Vector2& size );
+ void AddBackgroundActors( Dali::Actor layer, int count, Dali::BufferImage distanceField, const Dali::Vector2& size );
/**
* Create a bitmap with the specified shape and also output a distance field
*
* @param[in] shapeType The shape to generate
* @param[in] size The size of the bitmap to create
- * @param[out] imageOut The return bitmap
* @param[out] distanceFieldOut The return depth field alpha map
*/
- void CreateShapeImage( ShapeType shapeType, const Dali::Size& size, Dali::BitmapImage& distanceFieldOut );
+ void CreateShapeImage( ShapeType shapeType, const Dali::Size& size, Dali::BufferImage& distanceFieldOut );
/**
* Generate a square bit pattern and depth field
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <dali/dali.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+using namespace Dali;
+
+namespace
+{
+const char* BACKGROUND_IMAGE( DALI_IMAGE_DIR "background-gradient.jpg" );
+
+}
+
+// This example shows resolution independent rendering and animation of curves using the gpu.
+//
+class AnimatedShapesExample : public ConnectionTracker
+{
+public:
+
+ AnimatedShapesExample( Application& application )
+: mApplication( application )
+{
+ // Connect to the Application's Init signal
+ mApplication.InitSignal().Connect( this, &AnimatedShapesExample::Create );
+}
+
+ ~AnimatedShapesExample()
+ {
+ // Nothing to do here;
+ }
+
+ // The Init signal is received once (only) during the Application lifetime
+ void Create( Application& application )
+ {
+ // Get a handle to the stage
+ Stage stage = Stage::GetCurrent();
+
+ //Create a view
+ mView = Dali::Toolkit::View::New();
+ stage.Add( mView );
+
+ //Set background image for the view
+ ImageAttributes attributes;
+ Image image = ResourceImage::New( BACKGROUND_IMAGE, attributes );
+
+
+ Dali::ImageActor backgroundImageActor = Dali::ImageActor::New( image );
+ mView.SetBackground( backgroundImageActor );
+
+ CreateTriangleMorph(Vector3( stage.GetSize().x*0.5f,stage.GetSize().y*0.15f,0.0f), 100.0f );
+ CreateCircleMorph( Vector3( stage.GetSize().x*0.5f,stage.GetSize().y*0.85f,0.0f), 60.0f );
+ CreatePathMorph( Vector3( stage.GetSize().x*0.5f,stage.GetSize().y*0.5f,0.0f), 55.0f );
+
+
+ stage.KeyEventSignal().Connect(this, &AnimatedShapesExample::OnKeyEvent);
+ }
+
+ void CreateCircleMorph( Vector3 center, float radius )
+ {
+ Toolkit::QuadraticBezier shader = Toolkit::QuadraticBezier::New(16, true);
+
+ shader.SetPoint(0, Vector3(-radius,-radius,0.0f));
+ shader.SetPoint(1, Vector3( 0.0f,-radius,0.0f));
+ shader.SetPoint(2, Vector3(radius,-radius,0.0f));
+
+ shader.SetPoint(3, Vector3(radius,-radius,0.0f));
+ shader.SetPoint(4, Vector3( radius,0.0f,0.0f));
+ shader.SetPoint(5, Vector3(radius,radius,0.0f));
+
+ shader.SetPoint(6, Vector3(radius,radius,0.0f));
+ shader.SetPoint(7, Vector3( 0.0f,radius,0.0f));
+ shader.SetPoint(8, Vector3( -radius,radius,0.0f));
+
+ shader.SetPoint(9, Vector3( -radius,radius,0.0f));
+ shader.SetPoint(10, Vector3( -radius,0.0f,0.0f));
+ shader.SetPoint(11, Vector3(-radius,-radius,0.0f));
+
+ shader.SetPoint(12, Vector3(-radius,-radius,0.0f));
+ shader.SetPoint(13, Vector3(radius,-radius,0.0f));
+ shader.SetPoint(14, Vector3(radius,radius,0.0f));
+ shader.SetPoint(15, Vector3( -radius,radius,0.0f));
+
+ shader.SetColor(Vector4(1.0f,0.0f,0.0f,1.0f) );
+ shader.SetLineWidth(2.0f);
+
+ ////Generate the mesh
+ Dali::MeshData::VertexContainer vertices;
+ for( unsigned int i(0); i<12; i+=3 )
+ {
+ vertices.push_back( MeshData::Vertex( Vector3::ZERO, Vector2::ZERO, Vector3(0.0f,0.0f,i) ));
+ vertices.push_back( MeshData::Vertex( Vector3::ZERO, Vector2::ZERO, Vector3(0.5f,0.0f,i+1)));
+ vertices.push_back( MeshData::Vertex( Vector3::ZERO, Vector2::ZERO, Vector3(1.0f,1.0f,i+2)));
+ }
+ vertices.push_back( MeshData::Vertex( Vector3::ZERO, Vector2::ZERO, Vector3(0.0f,1.0f,12) ));
+ vertices.push_back( MeshData::Vertex( Vector3::ZERO, Vector2::ZERO, Vector3(0.0f,1.0f,13)));
+ vertices.push_back( MeshData::Vertex( Vector3::ZERO, Vector2::ZERO, Vector3(0.0f,1.0f,14)));
+ vertices.push_back( MeshData::Vertex( Vector3::ZERO, Vector2::ZERO, Vector3(0.0f,1.0f,15)));
+
+ short unsigned int indexArray[] = { 0,2,1, 3,5,4,6,8,7, 9, 11, 10, 12,15,14,12,14,13};
+ Dali::MeshData::FaceIndices index( indexArray, indexArray + sizeof(indexArray)/sizeof(short unsigned int) );
+
+ //Material
+ Dali::Material material = Material::New("Material");
+ material.SetDiffuseColor( Vector4(1.0f,1.0f,1.0f,1.0f));
+
+ //Create the Mesh object
+ Dali::MeshData data;
+ data.SetVertices(vertices);
+ data.SetFaceIndices( index );
+ data.SetMaterial( material );
+ data.SetHasNormals( true );
+ Mesh mesh = Mesh::New( data );
+
+ //Create the mesh actor
+ MeshActor meshActor = MeshActor::New(mesh);
+ meshActor.SetAnchorPoint( AnchorPoint::CENTER );
+ meshActor.SetShaderEffect(shader);
+ meshActor.SetPosition( center );
+ meshActor.SetBlendMode(BlendingMode::ON );
+ mView.Add( meshActor );
+
+
+ //Animation
+ Animation animation = Animation::New(5.0f);
+ KeyFrames k0 = KeyFrames::New();
+ k0.Add( 0.0f, Vector3( 0.0f,-radius, 0.0f) );
+ k0.Add( 0.5f, Vector3(0.0f, -radius*4.0f, 0.0f));
+ k0.Add( 1.0f, Vector3( 0.0f,-radius, 0.0f) );
+ animation.AnimateBetween( Property(shader, shader.GetPointPropertyName(1)),k0,AlphaFunctions::EaseInOutSine );
+
+ k0 = KeyFrames::New();
+ k0.Add( 0.0f, Vector3( radius, 0.0f, 0.0f) );
+ k0.Add( 0.5f, Vector3(radius*4.0f,0.0f, 0.0f));
+ k0.Add( 1.0f, Vector3( radius,0.0f, 0.0f));
+ animation.AnimateBetween( Property(shader, shader.GetPointPropertyName(4)),k0,AlphaFunctions::EaseInOutSine );
+
+ k0 = KeyFrames::New();
+ k0.Add( 0.0f, Vector3(0.0f,radius, 0.0f) );
+ k0.Add( 0.5f, Vector3(0.0f,radius*4.0f, 0.0f));
+ k0.Add( 1.0f, Vector3(0.0f,radius, 0.0f) );
+ animation.AnimateBetween( Property(shader, shader.GetPointPropertyName(7)),k0,AlphaFunctions::EaseInOutSine );
+
+ k0 = KeyFrames::New();
+ k0.Add( 0.0f, Vector3( -radius, 0.0f, 0.0f) );
+ k0.Add( 0.5f, Vector3(-radius*4.0f,0.0f, 0.0f));
+ k0.Add( 1.0f, Vector3( -radius, 0.0f, 0.0f) );
+ animation.AnimateBetween( Property(shader, shader.GetPointPropertyName(10)),k0,AlphaFunctions::EaseInOutSine );
+
+ animation.RotateBy(meshActor,Degree(90.0f), Vector3::ZAXIS );
+ animation.SetLooping( true );
+ animation.Play();
+ }
+
+ void CreateTriangleMorph( Vector3 center, float side )
+ {
+ float h = (side *0.5f)/0.866f;
+
+ Vector3 v0 = Vector3(-h,h,0.0f);
+ Vector3 v1 = Vector3(0.0f,-(side*0.366f),0.0f );
+ Vector3 v2 = Vector3(h,h,0.0f);
+
+ Vector3 v3 = v0 + ((v1-v0) * 0.5f);
+ Vector3 v4 = v1 + ((v2-v1) * 0.5f);
+ Vector3 v5 = v2 + ((v0-v2) * 0.5f);
+
+ Toolkit::QuadraticBezier shader = Toolkit::QuadraticBezier::New(12, true);
+
+ shader.SetPoint(0,v0);
+ shader.SetPoint(1,v3);
+ shader.SetPoint(2,v1);
+
+ shader.SetPoint(3,v1);
+ shader.SetPoint(4,v4);
+ shader.SetPoint(5,v2);
+
+ shader.SetPoint(6,v2);
+ shader.SetPoint(7,v5);
+ shader.SetPoint(8,v0);
+
+ shader.SetPoint(9, v0);
+ shader.SetPoint(10,v1);
+ shader.SetPoint(11,v2);
+
+ shader.SetColor(Vector4(0.0f,1.0f,0.0f,1.0f));
+ shader.SetLineWidth(2.0f);
+
+ ////Generate the mesh
+ Dali::MeshData::VertexContainer vertices;
+ for( unsigned int i(0);i<9;i+=3 )
+ {
+ vertices.push_back( MeshData::Vertex( Vector3::ZERO, Vector2::ZERO, Vector3(0.0f,0.0f,i)) );
+ vertices.push_back( MeshData::Vertex( Vector3::ZERO, Vector2::ZERO,Vector3(0.5f,0.0f,i+1) ) );
+ vertices.push_back( MeshData::Vertex( Vector3::ZERO, Vector2::ZERO, Vector3(1.0f,1.0f,i+2) ) );
+ }
+
+ vertices.push_back( MeshData::Vertex( Vector3::ZERO, Vector2::ZERO, Vector3(0.0f,1.0f,9)) );
+ vertices.push_back( MeshData::Vertex( Vector3::ZERO, Vector2::ZERO,Vector3(0.0f,1.0f,10) ) );
+ vertices.push_back( MeshData::Vertex( Vector3::ZERO, Vector2::ZERO, Vector3(0.0f,1.0f,11) ) );
+
+ short unsigned int indexArray[] = { 0,2,1,3,5,4,6,8,7,9,11,10 };
+ Dali::MeshData::FaceIndices index( indexArray, indexArray + sizeof(indexArray)/sizeof(short unsigned int) );
+
+ //Material
+ Dali::Material material = Material::New("Material");
+ material.SetDiffuseColor( Vector4(1.0f,1.0f,1.0f,1.0f));
+
+ //Create the Mesh object
+ Dali::MeshData data;
+ data.SetVertices(vertices);
+ data.SetFaceIndices( index );
+ data.SetMaterial( material );
+ data.SetHasNormals( true );
+ Mesh mesh = Mesh::New( data );
+
+// //Create the mesh actor
+ MeshActor meshActor = MeshActor::New(mesh);
+ meshActor.SetAnchorPoint( AnchorPoint::CENTER );
+ meshActor.SetShaderEffect(shader);
+ meshActor.SetPosition( center );
+ meshActor.SetBlendMode(BlendingMode::ON );
+ mView.Add( meshActor );
+
+ //Animation
+ Animation animation = Animation::New(5.0f);
+
+ KeyFrames k0 = KeyFrames::New();
+ k0.Add( 0.0f,v3 );
+ k0.Add( 0.5f, v3 + Vector3(-200.0f,-200.0f,0.0f));
+ k0.Add( 1.0f, v3 );
+ animation.AnimateBetween( Property(shader, shader.GetPointPropertyName(1)),k0,AlphaFunctions::EaseInOutSine );
+
+ k0 = KeyFrames::New();
+ k0.Add( 0.0f,v4 );
+ k0.Add( 0.5f, v4 + Vector3(200.0f,-200.0f,0.0f));
+ k0.Add( 1.0f, v4 );
+ animation.AnimateBetween( Property(shader, shader.GetPointPropertyName(4)),k0,AlphaFunctions::EaseInOutSine );
+
+ k0 = KeyFrames::New();
+ k0.Add( 0.0f,v5 );
+ k0.Add( 0.5f, v5 + Vector3(0.0,200.0f,0.0f));
+ k0.Add( 1.0f, v5 );
+ animation.AnimateBetween( Property(shader, shader.GetPointPropertyName(7)),k0,AlphaFunctions::EaseInOutSine );
+ animation.SetLooping( true );
+ animation.Play();
+ }
+
+ void CreatePathMorph( Vector3 center, float radius )
+ {
+ Toolkit::QuadraticBezier shader = Toolkit::QuadraticBezier::New(12, false);
+
+ shader.SetPoint(0, Vector3(-radius,-radius,0.0f));
+ shader.SetPoint(1, Vector3( 0.0f,-radius,0.0f));
+ shader.SetPoint(2, Vector3(radius,-radius,0.0f));
+
+ shader.SetPoint(3, Vector3(radius,-radius,0.0f));
+ shader.SetPoint(4, Vector3( radius,0.0f,0.0f));
+ shader.SetPoint(5, Vector3(radius,radius,0.0f));
+
+ shader.SetPoint(6, Vector3(radius,radius,0.0f));
+ shader.SetPoint(7, Vector3( 0.0f,radius,0.0f));
+ shader.SetPoint(8, Vector3( -radius,radius,0.0f));
+
+ shader.SetPoint(9, Vector3( -radius,radius,0.0f));
+ shader.SetPoint(10, Vector3( -radius,0.0f,0.0f));
+ shader.SetPoint(11, Vector3(-radius,-radius,0.0f));
+
+ shader.SetColor(Vector4(1.0f,1.0f,0.0f,1.0f) );
+ shader.SetLineWidth(1.5f);
+
+ ////Generate the mesh/S
+ Dali::MeshData::VertexContainer vertices;
+ for( unsigned int i(0); i<12; i+=3 )
+ {
+ vertices.push_back( MeshData::Vertex( Vector3::ZERO, Vector2::ZERO, Vector3(0.0f,0.0f,i) ));
+ vertices.push_back( MeshData::Vertex( Vector3::ZERO, Vector2::ZERO, Vector3(0.5f,0.0f,i+1)));
+ vertices.push_back( MeshData::Vertex( Vector3::ZERO, Vector2::ZERO, Vector3(1.0f,1.0f,i+2)));
+ }
+
+
+ short unsigned int indexArray[] = { 0,2,1, 3,5,4,6,8,7, 9, 11, 10 };
+ Dali::MeshData::FaceIndices index( indexArray, indexArray + sizeof(indexArray)/sizeof(short unsigned int) );
+
+ //Material
+ Dali::Material material = Material::New("Material");
+ material.SetDiffuseColor( Vector4(1.0f,1.0f,1.0f,1.0f));
+
+ //Create the Mesh object
+ Dali::MeshData data;
+ data.SetVertices(vertices);
+ data.SetFaceIndices( index );
+ data.SetMaterial( material );
+ data.SetHasNormals( true );
+ Mesh mesh = Mesh::New( data );
+
+ //Create the mesh actor
+ MeshActor meshActor = MeshActor::New(mesh);
+ meshActor.SetAnchorPoint( AnchorPoint::CENTER );
+ meshActor.SetShaderEffect(shader);
+ meshActor.SetPosition( center );
+ meshActor.SetBlendMode(BlendingMode::ON );
+ mView.Add( meshActor );
+
+
+ //Animation
+ Animation animation = Animation::New(5.0f);
+ KeyFrames k0 = KeyFrames::New();
+ k0.Add( 0.0f, Vector3( 0.0f,-radius*2.0, 0.0f) );
+ k0.Add( 0.5f, Vector3(-radius*2.0, -radius*3.0f, 0.0f));
+ k0.Add( 1.0f, Vector3( 0.0f,-radius*2.0, 0.0f) );
+ animation.AnimateBetween( Property(shader, shader.GetPointPropertyName(1)),k0,AlphaFunctions::EaseInOutSine );
+
+ k0 = KeyFrames::New();
+ k0.Add( 0.0f, Vector3( radius*2.0, 0.0f, 0.0f) );
+ k0.Add( 0.5f, Vector3(radius*3.0f,-radius*2.0, 0.0f));
+ k0.Add( 1.0f, Vector3( radius*2.0,0.0f, 0.0f));
+ animation.AnimateBetween( Property(shader, shader.GetPointPropertyName(4)),k0,AlphaFunctions::EaseInOutSine );
+
+ k0 = KeyFrames::New();
+ k0.Add( 0.0f, Vector3(0.0f,radius*2.0, 0.0f) );
+ k0.Add( 0.5f, Vector3(radius*2.0,radius*3.0f, 0.0f));
+ k0.Add( 1.0f, Vector3(0.0f,radius*2.0, 0.0f) );
+ animation.AnimateBetween( Property(shader, shader.GetPointPropertyName(7)),k0,AlphaFunctions::EaseInOutSine );
+
+ k0 = KeyFrames::New();
+ k0.Add( 0.0f, Vector3( -radius*2.0, 0.0f, 0.0f) );
+ k0.Add( 0.5f, Vector3(-radius*3.0f,radius*2.0, 0.0f));
+ k0.Add( 1.0f, Vector3( -radius*2.0, 0.0f, 0.0f) );
+ animation.AnimateBetween( Property(shader, shader.GetPointPropertyName(10)),k0,AlphaFunctions::EaseInOutSine );
+
+ animation.RotateBy(meshActor,Degree(-90.0f), Vector3::ZAXIS );
+ animation.SetLooping( true );
+ animation.Play();
+ }
+
+ /**
+ * Main key event handler
+ */
+ void OnKeyEvent(const KeyEvent& event)
+ {
+ if( event.state == KeyEvent::Down && (IsKey( event, DALI_KEY_ESCAPE) || IsKey( event, DALI_KEY_BACK )) )
+ {
+ mApplication.Quit();
+ }
+ }
+
+private:
+ Application& mApplication;
+ Toolkit::View mView;
+};
+
+void RunTest( Application& application )
+{
+ AnimatedShapesExample test( application );
+ application.MainLoop();
+}
+
+int main( int argc, char **argv )
+{
+ Application application = Application::New( &argc, &argv );
+ RunTest( application );
+
+ return 0;
+}
#include <map>
#include <algorithm>
-#include <boost/any.hpp>
-#include <boost/function.hpp>
#include <dali/dali.h>
#include <dali-toolkit/dali-toolkit.h>
-#include "../shared/view.h"
+#include "shared/view.h"
using namespace Dali;
using namespace Dali::Toolkit;
mPaddleImage.SetSize( mPaddleFullSize );
mWobbleProperty = mPaddle.RegisterProperty(WOBBLE_PROPERTY_NAME, 0.0f);
- Constraint wobbleConstraint = Constraint::New<Quaternion>( Actor::ROTATION,
+ Constraint wobbleConstraint = Constraint::New<Quaternion>( Actor::Property::Rotation,
LocalSource(mWobbleProperty),
WobbleConstraint(10.0f));
mPaddle.ApplyConstraint(wobbleConstraint);
const float margin(BALL_SIZE.width * stageSize.width * 0.5f);
// Set up notifications for ball's collisions against walls.
- PropertyNotification leftNotification = mBall.AddPropertyNotification( Actor::POSITION_X, LessThanCondition(margin) );
+ PropertyNotification leftNotification = mBall.AddPropertyNotification( Actor::Property::PositionX, LessThanCondition(margin) );
leftNotification.NotifySignal().Connect( this, &ExampleController::OnHitLeftWall );
- PropertyNotification rightNotification = mBall.AddPropertyNotification( Actor::POSITION_X, GreaterThanCondition(stageSize.width - margin) );
+ PropertyNotification rightNotification = mBall.AddPropertyNotification( Actor::Property::PositionX, GreaterThanCondition(stageSize.width - margin) );
rightNotification.NotifySignal().Connect( this, &ExampleController::OnHitRightWall );
- PropertyNotification topNotification = mBall.AddPropertyNotification( Actor::POSITION_Y, LessThanCondition(margin) );
+ PropertyNotification topNotification = mBall.AddPropertyNotification( Actor::Property::PositionY, LessThanCondition(margin) );
topNotification.NotifySignal().Connect( this, &ExampleController::OnHitTopWall );
- PropertyNotification bottomNotification = mBall.AddPropertyNotification( Actor::POSITION_Y, GreaterThanCondition(stageSize.height + margin) );
+ PropertyNotification bottomNotification = mBall.AddPropertyNotification( Actor::Property::PositionY, GreaterThanCondition(stageSize.height + margin) );
bottomNotification.NotifySignal().Connect( this, &ExampleController::OnHitBottomWall );
// Set up notification for ball colliding against paddle.
stage.Add(delegate);
Property::Index property = delegate.RegisterProperty(COLLISION_PROPERTY_NAME, Vector3::ZERO);
Constraint constraint = Constraint::New<Vector3>( property,
- Source(mBall, Actor::POSITION),
- Source(mPaddle, Actor::POSITION),
- Source(mBall, Actor::SIZE),
- Source(mPaddle, Actor::SIZE),
+ Source(mBall, Actor::Property::Position),
+ Source(mPaddle, Actor::Property::Position),
+ Source(mBall, Actor::Property::Size),
+ Source(mPaddle, Actor::Property::Size),
CollisionCircleRectangleConstraint( -Vector3(0.0f, mPaddleHitMargin.height * 0.575f, 0.0f),-Vector3(mPaddleHitMargin) ));
delegate.ApplyConstraint(constraint);
// Add a constraint on the brick between it and the ball generating a collision-property
Property::Index property = brick.RegisterProperty(COLLISION_PROPERTY_NAME, Vector3::ZERO);
Constraint constraint = Constraint::New<Vector3>( property,
- Source(mBall, Actor::POSITION),
- Source(brick, Actor::POSITION),
- Source(mBall, Actor::SIZE),
- Source(brick, Actor::SIZE),
+ Source(mBall, Actor::Property::Position),
+ Source(brick, Actor::Property::Position),
+ Source(mBall, Actor::Property::Size),
+ Source(brick, Actor::Property::Size),
CollisionCircleRectangleConstraint(BRICK_COLLISION_MARGIN));
brick.ApplyConstraint(constraint);
}
mBallAnimation = Animation::New(MAX_ANIMATION_DURATION);
- mBallAnimation.AnimateBy( Property( mBall, Actor::POSITION ), mBallVelocity * MAX_ANIMATION_DURATION);
+ mBallAnimation.AnimateBy( Property( mBall, Actor::Property::Position ), mBallVelocity * MAX_ANIMATION_DURATION);
mBallAnimation.Play();
}
mDragActor = actor;
mDragAnimation = Animation::New(0.25f);
- mDragAnimation.AnimateTo( Property(mDragActor, Actor::SCALE), Vector3(1.1f, 1.1f, 1.0f), AlphaFunctions::EaseOut);
- mDragAnimation.AnimateTo( Property(mPaddleHandle, Actor::COLOR), Vector4(1.0f, 1.0f, 1.0f, 0.0f), AlphaFunctions::EaseOut);
+ mDragAnimation.AnimateTo( Property(mDragActor, Actor::Property::Scale), Vector3(1.1f, 1.1f, 1.0f), AlphaFunctions::EaseOut);
+ mDragAnimation.AnimateTo( Property(mPaddleHandle, Actor::Property::Color), Vector4(1.0f, 1.0f, 1.0f, 0.0f), AlphaFunctions::EaseOut);
mDragAnimation.Play();
}
}
if(point.state==TouchPoint::Up) // Stop dragging
{
mDragAnimation = Animation::New(0.25f);
- mDragAnimation.AnimateTo( Property(mDragActor, Actor::SCALE), Vector3(1.0f, 1.0f, 1.0f), AlphaFunctions::EaseIn);
- mDragAnimation.AnimateTo( Property(mPaddleHandle, Actor::COLOR), Vector4(1.0f, 1.0f, 1.0f, 1.0f), AlphaFunctions::EaseOut);
+ mDragAnimation.AnimateTo( Property(mDragActor, Actor::Property::Scale), Vector3(1.0f, 1.0f, 1.0f), AlphaFunctions::EaseIn);
+ mDragAnimation.AnimateTo( Property(mPaddleHandle, Actor::Property::Color), Vector4(1.0f, 1.0f, 1.0f, 1.0f), AlphaFunctions::EaseOut);
mDragAnimation.Play();
mDragActor.Reset();
}
mBallVelocity = Vector3::ZERO;
Animation shrink = Animation::New(0.5f);
- shrink.AnimateTo( Property(mPaddle, Actor::SIZE_WIDTH), mPaddleFullSize.x * f + mPaddleHitMargin.x);
- shrink.AnimateTo( Property(mPaddleImage, Actor::SIZE_WIDTH), mPaddleFullSize.x * f );
+ shrink.AnimateTo( Property(mPaddle, Actor::Property::SizeWidth), mPaddleFullSize.x * f + mPaddleHitMargin.x);
+ shrink.AnimateTo( Property(mPaddleImage, Actor::Property::SizeWidth), mPaddleFullSize.x * f );
shrink.FinishedSignal().Connect( this, &ExampleController::OnPaddleShrunk );
shrink.Play();
mBall.SetPosition( mBallStartPosition );
mBall.SetColor( Vector4(1.0f, 1.0f, 1.0f, 0.1f) );
Animation appear = Animation::New(0.5f);
- appear.AnimateTo( Property(mBall, Actor::COLOR), Vector4(1.0f, 1.0f, 1.0f, 1.0f) );
+ appear.AnimateTo( Property(mBall, Actor::Property::Color), Vector4(1.0f, 1.0f, 1.0f, 1.0f) );
appear.Play();
if(!mLives)
// fade brick (destroy)
Animation destroyAnimation = Animation::New(0.5f);
- destroyAnimation.AnimateTo( Property( brick, Actor::COLOR_ALPHA ), 0.0f, AlphaFunctions::EaseIn );
+ destroyAnimation.AnimateTo( Property( brick, Actor::Property::ColorAlpha ), 0.0f, AlphaFunctions::EaseIn );
destroyAnimation.Play();
destroyAnimation.FinishedSignal().Connect( this, &ExampleController::OnBrickDestroyed );
mDestroyAnimationMap[destroyAnimation] = brick;
#include <dali/dali.h>
#include <dali-toolkit/dali-toolkit.h>
-#include "../shared/view.h"
+#include "shared/view.h"
using namespace Dali;
#include <fstream>
#include <streambuf>
#include <sstream>
-#include <boost/scoped_ptr.hpp>
#include <dirent.h>
#include <stdio.h>
#include <iostream>
-//#include <boost/regex.hpp>
#include "sys/stat.h"
#include <ctime>
#include <dali/integration-api/debug.h>
-#include "../shared/view.h"
+#include "shared/view.h"
#define TOKEN_STRING(x) #x
*
*/
-#include "../shared/view.h"
+#include "shared/view.h"
#include <dali/dali.h>
#include <dali-toolkit/dali-toolkit.h>
checkBox.SetAnchorPoint( AnchorPoint::TOP_LEFT );
checkBox.SetBackgroundImage( unselected );
checkBox.SetSelectedImage( selected );
- checkBox.SetSize( DP(48), DP(48) );
+ checkBox.SetLabel( "CheckBox1 is unselected" );
checkBox.StateChangedSignal().Connect( this, &ButtonsController::OnCheckBoxesSelected );
checkBoxBackground.Add( checkBox );
checkBox.SetAnchorPoint( AnchorPoint::TOP_LEFT );
checkBox.SetBackgroundImage( unselected );
checkBox.SetSelectedImage( selected );
- checkBox.SetSize( DP(48), DP(48) );
+ checkBox.SetLabel( "CheckBox2 is selected" );
checkBox.SetSelected( true );
checkBox.StateChangedSignal().Connect( this, &ButtonsController::OnCheckBoxesSelected );
checkBox.SetAnchorPoint( AnchorPoint::TOP_LEFT );
checkBox.SetBackgroundImage( unselected );
checkBox.SetSelectedImage( selected );
- checkBox.SetSize( DP(48), DP(48) );
+ checkBox.SetLabel( "CheckBox3 is unselected" );
checkBox.StateChangedSignal().Connect( this, &ButtonsController::OnCheckBoxesSelected );
checkBoxBackground.Add( checkBox );
}
+ // Create togglabe button
yPos += GROUP3_HEIGHT + MARGIN_SIZE;
Actor toggleBackground = Toolkit::CreateSolidColorActor( BACKGROUND_COLOUR );
#include <sstream>
#include <iomanip>
-#include "../shared/view.h"
+#include "shared/view.h"
#include <dali/dali.h>
#include <dali-toolkit/dali-toolkit.h>
Vector2 shearCenter( Vector2(position.x + size.width * shearAnchor.x, position.y + size.height * shearAnchor.y) );
Property::Index centerProperty = shaderEffect.GetPropertyIndex(shaderEffect.GetCenterPropertyName());
Constraint constraint = Constraint::New<Vector2>( centerProperty,
- Source(mView, Actor::SIZE),
+ Source(mView, Actor::Property::Size),
ShearEffectCenterConstraint(stageSize, shearCenter) );
shaderEffect.ApplyConstraint(constraint);
constraint = Constraint::New<float>( angleXAxisProperty,
Source(mScrollView, scrollOvershootProperty),
- Source(mView, Actor::ROTATION),
+ Source(mView, Actor::Property::Rotation),
ShearEffectConstraint(stageSize, SHEAR_EFFECT_MAX_OVERSHOOT, Vector2::XAXIS) );
shaderEffect.ApplyConstraint(constraint);
constraint = Constraint::New<float>( angleYAxisProperty,
Source(mScrollView, scrollOvershootProperty),
- Source(mView, Actor::ROTATION),
+ Source(mView, Actor::Property::Rotation),
ShearEffectConstraint(stageSize, SHEAR_EFFECT_MAX_OVERSHOOT, Vector2::YAXIS) );
shaderEffect.ApplyConstraint(constraint);
Property::Index anglePerUnit = shaderEffect.GetPropertyIndex( shaderEffect.GetAnglePerUnitPropertyName() );
shaderEffect.ApplyConstraint( Constraint::New<Vector2>( anglePerUnit,
- Source(mView, Actor::ROTATION),
+ Source(mView, Actor::Property::Rotation),
CarouselEffectOrientationConstraint( angleSweep ) ) );
break;
// dont apply shader effect to scrollview as it might override internal shaders for bounce effect etc
for( std::vector<ClusterInfo>::iterator i = mClusterInfo.begin(); i != mClusterInfo.end(); ++i )
{
- Constraint constraint = Constraint::New<float>(Actor::POSITION_Z, SphereEffectOffsetConstraint(SPHERE_EFFECT_POSITION_Z));
+ Constraint constraint = Constraint::New<float>(Actor::Property::PositionZ, SphereEffectOffsetConstraint(SPHERE_EFFECT_POSITION_Z));
constraint.SetRemoveAction(Constraint::Discard);
Cluster cluster = i->mCluster;
SetShaderEffectRecursively( cluster, shaderEffect );
#include <math.h>
// INTERNAL INCLUDES
-#include "../shared/view.h"
+#include "shared/view.h"
#include <dali/dali.h>
#include <dali-toolkit/dali-toolkit.h>
mViewTimer.TickSignal().Connect( this, &CubeTransitionApp::OnTimerTick );
// show the first image
- mImageConstraint = Constraint::New<Vector3>( Actor::SCALE, LocalSource( Actor::SIZE ), ParentSource( Actor::SIZE ), ScaleToFitKeepAspectRatioConstraint() );
+ mImageConstraint = Constraint::New<Vector3>( Actor::Property::Scale, LocalSource( Actor::Property::Size ), ParentSource( Actor::Property::Size ), ScaleToFitKeepAspectRatioConstraint() );
mCurrentImage = ImageActor::New( ResourceImage::New( IMAGES[mIndex] ) );
mCurrentImage.SetPositionInheritanceMode( USE_PARENT_POSITION );
#include <math.h>
// INTERNAL INCLUDES
-#include "../shared/view.h"
+#include "shared/view.h"
#include <dali/dali.h>
#include <dali-toolkit/dali-toolkit.h>
mParent.SetPositionInheritanceMode( USE_PARENT_POSITION );
mContent.Add( mParent );
- mSizeConstraint= Constraint::New<Vector3>( Actor::SCALE, LocalSource( Actor::SIZE ), ParentSource( Actor::SIZE ), ScaleToFitKeepAspectRatioConstraint() );
+ mSizeConstraint= Constraint::New<Vector3>( Actor::Property::Scale, LocalSource( Actor::Property::Size ), ParentSource( Actor::Property::Size ), ScaleToFitKeepAspectRatioConstraint() );
// show the first image
mCurrentImage = ImageActor::New( ResourceImage::New( IMAGES[mIndex] ) );
// INTERNAL INCLUDES
#include "grid-flags.h"
-#include "../../shared/view.h"
+#include "shared/view.h"
using namespace Dali;
using namespace Dali::Toolkit;
#include <string>
#include <algorithm>
#include <cstdlib> // rand
-#include "../shared/view.h"
+#include "shared/view.h"
#include <dali/dali.h>
#include <dali-toolkit/dali-toolkit.h>
SetLayoutImage();
// Store one 1x1 white image for multiple items to share for backgrounds:
- mWhiteImage = BitmapImage::WHITE();
+ mWhiteImage = BufferImage::WHITE();
}
Actor OnKeyboardPreFocusChange( Actor current, Actor proposed, Control::KeyboardFocusNavigationDirection direction )
Toolkit::PushButton mReplaceButton;
unsigned int mAlphaFuncIndex;
- BitmapImage mWhiteImage;
+ BufferImage mWhiteImage;
};
void RunTest(Application& app)
*
*/
-#include "../shared/view.h"
+#include "shared/view.h"
#include <dali/dali.h>
#include <dali-toolkit/dali-toolkit.h>
// EXTERNAL INCLUDES
// INTERNAL INCLUDES
-#include "../shared/view.h"
+#include "shared/view.h"
#include <dali-toolkit/dali-toolkit.h>
overlay.Add( mMagnifier );
// Apply constraint to animate the position of the magnifier.
- Constraint constraint = Constraint::New<Vector3>(Actor::POSITION,
- LocalSource(Actor::SIZE),
- LocalSource(Actor::PARENT_ORIGIN),
- LocalSource(Actor::ANCHOR_POINT),
- ParentSource(Actor::SIZE),
+ Constraint constraint = Constraint::New<Vector3>(Actor::Property::Position,
+ LocalSource(Actor::Property::Size),
+ LocalSource(Actor::Property::ParentOrigin),
+ LocalSource(Actor::Property::AnchorPoint),
+ ParentSource(Actor::Property::Size),
ConfinementConstraint(ParentOrigin::CENTER, Vector2::ONE * MAGNIFIER_INDENT, Vector2::ONE * MAGNIFIER_INDENT));
constraint.SetRemoveAction(Constraint::Discard);
mMagnifier.ApplyConstraint( constraint );
ContinueAnimation();
// Apply constraint to animate the position of the magnifier.
- constraint = Constraint::New<Vector3>(Actor::POSITION,
- LocalSource(Actor::SIZE),
+ constraint = Constraint::New<Vector3>(Actor::Property::Position,
+ LocalSource(Actor::Property::Size),
LocalSource(mAnimationTimeProperty),
MagnifierPathConstraint(mStageSize, mStageSize * 0.5f));
mBouncingMagnifier.ApplyConstraint( constraint );
// Apply constraint to animate the source of the magnifier.
constraint = Constraint::New<Vector3>(mBouncingMagnifier.GetPropertyIndex( Toolkit::Magnifier::SOURCE_POSITION_PROPERTY_NAME ),
- LocalSource(Actor::SIZE),
+ LocalSource(Actor::Property::Size),
LocalSource(mAnimationTimeProperty),
MagnifierPathConstraint(mStageSize));
mBouncingMagnifier.ApplyConstraint( constraint );
if(!mMagnifierShown)
{
Animation animation = Animation::New(MAGNIFIER_DISPLAY_DURATION);
- animation.AnimateTo(Property(mMagnifier, Actor::SCALE), Vector3::ONE, AlphaFunctions::EaseIn);
+ animation.AnimateTo(Property(mMagnifier, Actor::Property::Scale), Vector3::ONE, AlphaFunctions::EaseIn);
animation.Play();
mMagnifierShown = true;
}
if(mMagnifierShown)
{
Animation animation = Animation::New(MAGNIFIER_DISPLAY_DURATION);
- animation.AnimateTo(Property(mMagnifier, Actor::SCALE), Vector3::ZERO, AlphaFunctions::EaseOut);
+ animation.AnimateTo(Property(mMagnifier, Actor::Property::Scale), Vector3::ZERO, AlphaFunctions::EaseOut);
animation.Play();
mMagnifierShown = false;
}
#include <sstream>
#include <iomanip>
-#include "../shared/view.h"
+#include "shared/view.h"
#include <dali/dali.h>
#include <dali-toolkit/dali-toolkit.h>
mActorTapMovementAnimation = Animation::New( animDuration );
if ( mMotionBlurImageActor )
{
- mActorTapMovementAnimation.AnimateTo( Property(mMotionBlurImageActor, Actor::POSITION), destPos, AlphaFunctions::EaseInOutSine, TimePeriod(animDuration) );
+ mActorTapMovementAnimation.AnimateTo( Property(mMotionBlurImageActor, Actor::Property::Position), destPos, AlphaFunctions::EaseInOutSine, TimePeriod(animDuration) );
}
mActorTapMovementAnimation.SetEndAction( Animation::Bake );
mActorTapMovementAnimation.Play();
#include <sstream>
#include <iomanip>
-#include "../shared/view.h"
+#include "shared/view.h"
#include <dali/dali.h>
#include <dali-toolkit/dali-toolkit.h>
mActorTapMovementAnimation = Animation::New( animDuration );
if ( mMotionStretchImageActor )
{
- mActorTapMovementAnimation.AnimateTo( Property(mMotionStretchImageActor, Actor::POSITION), destPos, AlphaFunctions::EaseInOutSine, TimePeriod(animDuration) );
+ mActorTapMovementAnimation.AnimateTo( Property(mMotionStretchImageActor, Actor::Property::Position), destPos, AlphaFunctions::EaseInOutSine, TimePeriod(animDuration) );
}
mActorTapMovementAnimation.SetEndAction( Animation::Bake );
mActorTapMovementAnimation.Play();
*/
#include <dali-toolkit/dali-toolkit.h>
-#include "../shared/view.h"
+#include "shared/view.h"
#include <cstdio>
#include <iostream>
namespace
{
-const char * gModelFile = DALI_MODEL_DIR "AlbumCute.dali-bin";
const char * const BACKGROUND_IMAGE( DALI_IMAGE_DIR "background-2.jpg" );
const char * const TOOLBAR_IMAGE( DALI_IMAGE_DIR "top-bar.png" );
const char * const LOSE_CONTEXT_IMAGE( DALI_IMAGE_DIR "icon-cluster-wobble.png" );
void CreateBubbles(Vector2 stageSize);
void CreateBlending();
void CreateText();
- void CreateModel();
- void OnModelLoaded(Model model);
bool OnTrackTimerTick();
bool OnExplodeTimerTick();
void SetUpAnimation( Vector2 emitPosition, Vector2 direction );
private:
Application mApplication;
- Animation mModelAnimation;
- Actor mModelActor;
Actor mCastingLight;
ImageActor mImageActor;
ImageActor mBlendActor;
Image mEffectImage;
Image mBaseImage;
- LightActor mKeyLightActor;
MeshActor mMeshActor;
MeshActor mAnimatedMeshActor;
- Model mModel;
Toolkit::View mView; ///< The View instance.
Toolkit::ToolBar mToolBar; ///< The View's Toolbar.
CreateMeshActor();
CreateBlending();
CreateText();
- CreateModel();
stage.ContextLostSignal().Connect(this, &NewWindowController::OnContextLost);
stage.ContextRegainedSignal().Connect(this, &NewWindowController::OnContextRegained);
bool NewWindowController::OnLoseContextButtonClicked( Toolkit::Button button )
{
// Add as an idle callback to avoid ProcessEvents being recursively called.
- mApplication.AddIdle(NewWindowController::NewWindow);
+ mApplication.AddIdle( MakeCallback( NewWindowController::NewWindow ) );
return true;
}
meshActor.SetScale( 100.0f );
meshActor.SetParentOrigin( ParentOrigin::CENTER );
meshActor.SetPosition(Vector3( -150.0f, 200.0f, 0.0f ));
- meshActor.SetAffectedByLighting( false );
meshActor.SetName("MeshActor");
mContentLayer.Add( meshActor );
meshActor2.SetScale( 100.0f );
meshActor2.SetParentOrigin( ParentOrigin::CENTER );
meshActor2.SetPosition(Vector3( -150.0f, 310.0f, 0.0f ));
- meshActor2.SetAffectedByLighting( false );
meshActor2.SetName("MeshActor");
mContentLayer.Add( meshActor2 );
}
return mesh;
}
-void NewWindowController::CreateModel()
-{
- mModel = Model::New(gModelFile);
- mModel.LoadingFinishedSignal().Connect(this, &NewWindowController::OnModelLoaded);
-
- //Create a Key light
- Light keylight = Light::New("KeyLight");
- keylight.SetFallOff(Vector2(10000.0f, 10000.0f));
-
- mCastingLight = Actor::New();
- mCastingLight.SetParentOrigin(ParentOrigin::CENTER);
- mCastingLight.SetAnchorPoint(AnchorPoint::CENTER);
- mCastingLight.SetPosition( Vector3( 0.0f, 0.0f, 800.0f ) );
- mContentLayer.Add( mCastingLight );
-
- mKeyLightActor = LightActor::New();
- mKeyLightActor.SetParentOrigin(ParentOrigin::CENTER);
- mKeyLightActor.SetName(keylight.GetName());
-
- //Add all the actors to the stage
- mCastingLight.Add(mKeyLightActor);
- mKeyLightActor.SetLight(keylight);
-}
-
-void NewWindowController::OnModelLoaded( Model model )
-{
- if( model.GetLoadingState() == ResourceLoadingSucceeded )
- {
- std::cout << "Succeeded loading model" << std::endl;
- mModelActor = ModelActorFactory::BuildActorTree(mModel, ""); // Gets root actor
- mModelActor.SetSize(250.0f, 250.0f);
- mModelActor.SetPosition(0.0f, 200.0f, 70.0f);
- mModelActor.SetScale(0.5f);
- mModelActor.SetRotation(Radian(Math::PI*0.25f), Vector3(1.0, 0.7, 0.0));
-
- mContentLayer.Add( mModelActor );
-
- if (mModel.NumberOfAnimations())
- {
- mModelAnimation = ModelActorFactory::BuildAnimation(mModel, mModelActor, 0);
- mModelAnimation.SetDuration(4.0f);
- mModelAnimation.SetLooping(true);
- mModelAnimation.Play();
- }
- }
- else
- {
- std::cout << "Failed loading model" << std::endl;
- mApplication.Quit();
- }
-}
-
void NewWindowController::NewWindow(void)
{
PositionSize posSize(0, 0, 720, 1280);
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+/**
+ * This example shows how to use path animations in DALi
+ */
+
+// EXTERNAL INCLUDES
+#include <dali-toolkit/dali-toolkit.h>
+
+// INTERNAL INCLUDES
+#include "shared/view.h"
+
+using namespace Dali;
+using namespace Dali::Toolkit;
+
+
+namespace
+{
+const char* BACKGROUND_IMAGE( DALI_IMAGE_DIR "background-default.png" );
+const char* ACTOR_IMAGE( DALI_IMAGE_DIR "dali-logo.png" );
+const char* TOOLBAR_IMAGE( DALI_IMAGE_DIR "top-bar.png" );
+}; //Unnamed namespace
+
+/**
+ * @brief The main class of the demo.
+ */
+class PathController : public ConnectionTracker
+{
+public:
+
+ PathController( Application& application )
+ : mApplication( application )
+ {
+ // Connect to the Application's Init signal
+ mApplication.InitSignal().Connect( this, &PathController::Create );
+ }
+
+ ~PathController()
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * One-time setup in response to Application InitSignal.
+ */
+ void Create( Application& application )
+ {
+ // Get a handle to the stage:
+ Stage stage = Stage::GetCurrent();
+
+ // Connect to input event signals:
+ stage.KeyEventSignal().Connect(this, &PathController::OnKeyEvent);
+
+ // Create a default view with a default tool bar:
+ Toolkit::View view; ///< The View instance.
+ Toolkit::ToolBar toolBar; ///< The View's Toolbar.
+ mContentLayer = DemoHelper::CreateView( mApplication,
+ view,
+ toolBar,
+ BACKGROUND_IMAGE,
+ TOOLBAR_IMAGE,
+ "" );
+
+ mContentLayer.TouchedSignal().Connect(this, &PathController::OnTouchLayer);
+
+ //Path
+ mPath = Dali::Path::New();
+ mPath.AddPoint( Vector3( 10.0f, stage.GetSize().y*0.5f, 0.0f ));
+ mPath.AddPoint( Vector3( stage.GetSize().x*0.5f, stage.GetSize().y*0.3f, 0.0f ));
+ mPath.GenerateControlPoints(0.25f);
+ DrawPath( 200u );
+
+ //Actor
+ ImageAttributes attributes;
+ Image img = ResourceImage::New(ACTOR_IMAGE, attributes );
+ mActor = ImageActor::New( img );
+ mActor.SetPosition( Vector3( 10.0f, stage.GetSize().y*0.5f, 0.0f ) );
+ mActor.SetAnchorPoint( AnchorPoint::CENTER );
+ mActor.SetSize( 100, 50, 1 );
+ stage.Add( mActor );
+
+ mForward = Vector3::XAXIS;
+ CreateAnimation();
+ }
+
+ /**
+ * Create an actor representing a control point of the curve
+ * @param[in] name Name of the actor
+ * @param[in] size Size of the containing actor
+ * @param[in] imageSize Size of the imageActor
+ * @param[in] color Color of the imageActor
+ */
+ Actor CreateControlPoint(const std::string& name, const Vector3& size, const Vector3& imageSize, const Vector4& color )
+ {
+ Actor actor = Actor::New();
+ actor.SetParentOrigin( ParentOrigin::TOP_LEFT);
+ actor.SetAnchorPoint( AnchorPoint::CENTER );
+ actor.SetSize( size );
+ actor.SetName( name );
+ actor.TouchedSignal().Connect(this, &PathController::OnTouchPoint);
+
+ ImageActor imageActor = Toolkit::CreateSolidColorActor(color);
+ imageActor.SetColor(Vector4(1.0f,0.0f,0.0f,1.0f));
+ imageActor.SetParentOrigin( ParentOrigin::CENTER);
+ imageActor.SetAnchorPoint( AnchorPoint::CENTER );
+ imageActor.SetSize( imageSize );
+ actor.Add(imageActor );
+
+ return actor;
+ }
+
+ /**
+ * Draws the path and the control points for the path
+ * @param[in] resolution Number of segments for the path.
+ */
+ void DrawPath( unsigned int resolution )
+ {
+ Stage stage = Dali::Stage::GetCurrent();
+
+ //Create path mesh actor
+ Dali::MeshData meshData = MeshFactory::NewPath( mPath, resolution );
+ Dali::Material material = Material::New("LineMaterial");
+ material.SetDiffuseColor( Vector4(0.0f,0.0f,0.0f,1.0f));
+ meshData.SetMaterial(material);
+ Dali::Mesh mesh = Dali::Mesh::New( meshData );
+ if( mMeshPath )
+ {
+ stage.Remove( mMeshPath );
+ }
+ mMeshPath = Dali::MeshActor::New( mesh );
+ mMeshPath.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+ mMeshPath.SetParentOrigin( ParentOrigin::TOP_LEFT );
+ stage.Add( mMeshPath );
+
+
+ ////Create mesh connecting interpolation points and control points
+ std::vector<Dali::MeshData::Vertex> vVertex;
+ std::vector<unsigned short> vIndex;
+ size_t pointCount = mPath.GetPointCount();
+ size_t controlPointIndex = 0;
+ for( size_t i(0); i<pointCount; ++i )
+ {
+ vVertex.push_back( MeshData::Vertex(mPath.GetPoint(i),Vector2::ZERO, Vector3::ZERO ) );
+ if( i<pointCount-1)
+ {
+ vVertex.push_back( MeshData::Vertex(mPath.GetControlPoint(controlPointIndex),Vector2::ZERO, Vector3::ZERO ));
+ vVertex.push_back( MeshData::Vertex(mPath.GetControlPoint(controlPointIndex+1),Vector2::ZERO, Vector3::ZERO ));
+ }
+ controlPointIndex += 2;
+ }
+
+ size_t segmentCount = 2*(pointCount-2)+2;
+ unsigned short index=0;
+ for( size_t i(0); i<segmentCount; ++i, ++index )
+ {
+ vIndex.push_back(index);
+ vIndex.push_back(index+1);
+
+ if( ~i & 1 )
+ {
+ index++;
+ }
+ }
+
+ meshData.SetLineData( vVertex, vIndex, material );
+ meshData.SetMaterial(material);
+ mesh = Dali::Mesh::New( meshData );
+ if( mMeshHandlers )
+ {
+ stage.Remove( mMeshHandlers );
+ }
+ mMeshHandlers = Dali::MeshActor::New( mesh );
+ mMeshHandlers.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+ mMeshHandlers.SetParentOrigin( ParentOrigin::TOP_LEFT );
+ stage.Add( mMeshHandlers );
+
+
+ //Create actors representing interpolation points
+ for( size_t i(0); i<pointCount; ++i )
+ {
+ if( !mKnot[i] )
+ {
+ std::string name( "Knot");
+ name.push_back(i);
+ mKnot[i] = CreateControlPoint( name, Vector3(150.0f,150.0f,0.0f), Vector3(20.0f,20.0f,0.0f), Vector4(0.0f,0.0f,0.0f,1.0f) );
+ mContentLayer.Add(mKnot[i] );
+ }
+
+ mKnot[i].SetPosition( mPath.GetPoint(i) );
+ }
+
+ //Create actors representing control points
+ size_t controlPointCount=2*(pointCount-1);
+ for( size_t i(0); i<controlPointCount; ++i )
+ {
+ if( !mControlPoint[i])
+ {
+ std::string name( "ControlPoint");
+ name.push_back(i);
+ mControlPoint[i] = CreateControlPoint( name, Vector3(150.0f,150.0f,0.0f), Vector3(20.0f,20.0f,0.0f), Vector4(1.0f,0.0f,0.0f,1.0f) );
+ mContentLayer.Add(mControlPoint[i] );
+ }
+
+ mControlPoint[i].SetPosition( mPath.GetControlPoint(i) );
+ }
+ }
+
+ bool OnTouchPoint(Actor actor, const TouchEvent& event)
+ {
+ if(event.GetPointCount()>0)
+ {
+ const TouchPoint& point = event.GetPoint(0);
+
+ if(point.state==TouchPoint::Down)
+ {
+ // Start dragging
+ mDragActor = actor;
+ }
+ }
+ return false;
+ }
+
+ bool OnTouchLayer(Actor actor, const TouchEvent& event)
+ {
+ if(event.GetPointCount()>0)
+ {
+ const TouchPoint& point = event.GetPoint(0);
+
+ if(point.state==TouchPoint::Up)
+ {
+ //Stop dragging
+ mDragActor.Reset();
+ }
+ else if(!mDragActor && point.state==TouchPoint::Down && mPath.GetPointCount()<10 )
+ {
+ // Add new point
+ const TouchPoint& point = event.GetPoint(0);
+ Vector3 newPoint = Vector3(point.screen.x, point.screen.y, 0.0f);
+
+ size_t pointCount = mPath.GetPointCount();
+ Vector3 lastPoint = mPath.GetPoint( pointCount-1);
+ mPath.AddPoint( newPoint );
+
+ Vector3 displacement = (newPoint-lastPoint)/8;
+
+ mPath.AddControlPoint( lastPoint + displacement );
+ mPath.AddControlPoint( newPoint - displacement);
+
+ DrawPath( 200u );
+ CreateAnimation();
+ }
+ else
+ {
+ if( mDragActor )
+ {
+ const TouchPoint& point = event.GetPoint(0);
+ Vector3 newPosition = Vector3(point.screen.x, point.screen.y, 0.0f);
+
+ std::string actorName(mDragActor.GetName());
+
+ if( actorName.compare(0, 4, "Knot") == 0)
+ {
+ int index = actorName[4];
+ mPath.GetPoint(index) = newPosition;
+ }
+ else
+ {
+ int index = actorName[12];
+ mPath.GetControlPoint(index) = newPosition;
+ }
+
+ DrawPath( 200u );
+ CreateAnimation();
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Main key event handler.
+ * Quit on escape key.
+ */
+ void OnKeyEvent(const KeyEvent& event)
+ {
+ if( event.state == KeyEvent::Down )
+ {
+ if( IsKey( event, Dali::DALI_KEY_ESCAPE ) ||
+ IsKey( event, Dali::DALI_KEY_BACK ) )
+ {
+ mApplication.Quit();
+ }
+ }
+ }
+
+ /**
+ * Create the path animation.
+ */
+ void CreateAnimation()
+ {
+ if( !mAnimation )
+ {
+ mAnimation = Animation::New( 2.0f );
+ }
+ else
+ {
+ mAnimation.Pause();
+ mAnimation.Clear();
+ mActor.SetRotation( Quaternion() );
+ }
+
+ mAnimation.Animate( mActor, mPath, mForward );
+ mAnimation.SetLooping( true );
+ mAnimation.Play();
+ }
+
+private:
+ Application& mApplication;
+
+ Layer mContentLayer; ///< The content layer
+
+ Path mPath; ///< The path used in the animation
+ ImageActor mActor; ///< Actor being animated
+ Vector3 mForward; ///< Current forward vector
+ Animation mAnimation; ///< Path animation
+
+ MeshActor mMeshPath; ///< Mesh actor for the path
+ MeshActor mMeshHandlers; ///< Mesh actor for the segments connecting points and control points
+ Actor mKnot[10]; ///< ImageActors for the interpolation points
+ Actor mControlPoint[18]; ///< ImageActors for the control points
+
+ Actor mDragActor; ///< Reference to the actor currently being dragged
+};
+
+void RunTest( Application& application )
+{
+ PathController test( application );
+
+ application.MainLoop();
+}
+
+/** Entry point for Linux & Tizen applications */
+int main( int argc, char **argv )
+{
+ Application application = Application::New( &argc, &argv );
+
+ RunTest( application );
+
+ return 0;
+}
#include <dali/dali.h>
#include <dali-toolkit/dali-toolkit.h>
-#include "../shared/view.h"
+#include "shared/view.h"
#include "radial-sweep-view.h"
#include "radial-sweep-view-impl.h"
mMesh[0].SetPosition( Vector3( 0.0f, 0.0f, 0.0f ) ); // Center pt
mStencilActor = MeshActor::New(mMesh);
- mStencilActor.SetAffectedByLighting(false);
mStencilActor.SetCullFace(CullNone); // Allow clockwise & anticlockwise faces
mStartAngleIndex = mStencilActor.RegisterProperty("start-angle", Property::Value(0.0f));
// Constrain the vertices of the square mesh to sweep out a sector as the
// rotation angle is animated.
- mMesh.ApplyConstraint(Constraint::New<Vector3>( mMesh.GetPropertyIndex(1, AnimatableVertex::POSITION),
+ mMesh.ApplyConstraint(Constraint::New<Vector3>( mMesh.GetPropertyIndex(1, AnimatableVertex::Property::Position),
srcStart, srcStart, SquareFanConstraint(0)));
- mMesh.ApplyConstraint(Constraint::New<Vector3>( mMesh.GetPropertyIndex(2, AnimatableVertex::POSITION),
+ mMesh.ApplyConstraint(Constraint::New<Vector3>( mMesh.GetPropertyIndex(2, AnimatableVertex::Property::Position),
srcStart, srcRot, SquareFanConstraint(0)));
- mMesh.ApplyConstraint(Constraint::New<Vector3>( mMesh.GetPropertyIndex(3, AnimatableVertex::POSITION),
+ mMesh.ApplyConstraint(Constraint::New<Vector3>( mMesh.GetPropertyIndex(3, AnimatableVertex::Property::Position),
srcStart, srcRot, SquareFanConstraint(1)));
- mMesh.ApplyConstraint(Constraint::New<Vector3>( mMesh.GetPropertyIndex(4, AnimatableVertex::POSITION),
+ mMesh.ApplyConstraint(Constraint::New<Vector3>( mMesh.GetPropertyIndex(4, AnimatableVertex::Property::Position),
srcStart, srcRot, SquareFanConstraint(2)));
- mMesh.ApplyConstraint(Constraint::New<Vector3>( mMesh.GetPropertyIndex(5, AnimatableVertex::POSITION),
+ mMesh.ApplyConstraint(Constraint::New<Vector3>( mMesh.GetPropertyIndex(5, AnimatableVertex::Property::Position),
srcStart, srcRot, SquareFanConstraint(3)));
- mMesh.ApplyConstraint(Constraint::New<Vector3>( mMesh.GetPropertyIndex(6, AnimatableVertex::POSITION),
+ mMesh.ApplyConstraint(Constraint::New<Vector3>( mMesh.GetPropertyIndex(6, AnimatableVertex::Property::Position),
srcStart, srcRot, SquareFanConstraint(4)));
mStencilActor.SetDrawMode( DrawMode::STENCIL );
#include <dali/dali.h>
#include <dali-toolkit/dali-toolkit.h>
-#include "../shared/view.h"
+#include "shared/view.h"
#include <fstream>
#include <sstream>
handle.SetUniform( "uEffectStrength", 0.f );
handle.SetUniform( "uLightIntensity", 2.5f );
- Property::Index index = handle.RegisterProperty( "uSpinAngle", 0.f );
+ Dali::Property::Index index = handle.RegisterProperty( "uSpinAngle", 0.f );
Constraint constraint = Constraint::New<Vector2>( handle.GetPropertyIndex("uLightSpinOffset"),
LocalSource(index),
LightOffsetConstraint(stageSize.x*0.1f));
meshData.SetHasNormals(true);
mMeshActor = MeshActor::New( Mesh::New( meshData ) );
mMeshActor.SetParentOrigin(ParentOrigin::CENTER);
- mMeshActor.SetAffectedByLighting( false );
mMeshActor.SetShaderEffect( mNoEffect );
mContent.Add( mMeshActor );
}
#include <sstream>
// INTERNAL INCLUDES
-#include "../shared/view.h"
+#include "shared/view.h"
#include <dali/dali.h>
#include <dali-toolkit/dali-toolkit.h>
// Hack to force screen refresh.
Animation animation = Animation::New(1.0f);
- animation.AnimateTo(Property(mContentLayer, Actor::POSITION), Vector3::ZERO );
+ animation.AnimateTo(Property(mContentLayer, Actor::Property::Position), Vector3::ZERO );
animation.Play();
}
*/
// INTERNAL INCLUDES
-#include "../shared/view.h"
+#include "shared/view.h"
#include <dali/dali.h>
#include <dali-toolkit/dali-toolkit.h>
mPinchGestureDetector.Attach( mView );
mPinchGestureDetector.DetectedSignal().Connect(this, &TestApp::OnPinch);
- mTapGestureDetector = TapGestureDetector::New(1, 1);
+ mTapGestureDetector = TapGestureDetector::New();
mTapGestureDetector.Attach( mView );
mTapGestureDetector.DetectedSignal().Connect(this, &TestApp::OnTap);
}
Property::Index angleIndex = mImageActor2.RegisterProperty("angle", Property::Value(30.0f));
Source angleSrc( mImageActor2, angleIndex );
- mImageActor1.ApplyConstraint(Constraint::New<Quaternion>( Actor::ROTATION, angleSrc,
+ mImageActor1.ApplyConstraint(Constraint::New<Quaternion>( Actor::Property::Rotation, angleSrc,
RotationConstraint(-1.0f)));
- mImageActor3.ApplyConstraint(Constraint::New<Quaternion>( Actor::ROTATION, angleSrc,
+ mImageActor3.ApplyConstraint(Constraint::New<Quaternion>( Actor::Property::Rotation, angleSrc,
RotationConstraint(+1.0f)));
mSceneAnimation = Animation::New(2.5f);
Name: com.samsung.dali-demo
Summary: The OpenGLES Canvas Core Demo
-Version: 1.0.30
+Version: 1.0.32
Release: 1
Group: System/Libraries
License: Apache-2.0
Requires: dali-adaptor
Requires: dali-toolkit
BuildRequires: cmake
-BuildRequires: boost-devel
BuildRequires: pkgconfig
BuildRequires: pkgconfig(capi-appfw-application)
BuildRequires: pkgconfig(capi-media-player)
Dali::Layer toolBarLayer = Dali::Layer::New();
toolBarLayer.SetAnchorPoint( Dali::AnchorPoint::TOP_CENTER );
toolBarLayer.SetParentOrigin( Dali::ParentOrigin::TOP_CENTER );
- toolBarLayer.ApplyConstraint( Dali::Constraint::New<Dali::Vector3>( Dali::Actor::SIZE, Dali::ParentSource( Dali::Actor::SIZE ), Dali::SourceWidthFixedHeight( style.mToolBarHeight ) ) );
+ toolBarLayer.ApplyConstraint( Dali::Constraint::New<Dali::Vector3>( Dali::Actor::Property::Size, Dali::ParentSource( Dali::Actor::Property::Size ), Dali::SourceWidthFixedHeight( style.mToolBarHeight ) ) );
toolBarLayer.SetSize( 0.0f, style.mToolBarHeight );
// Raise tool bar layer to the top.