Commit 28946d814d1f11fddcc23a887a0e318133147549
[dali_1.1.31] Merge branch 'devel/master'
Change-Id: I8e33dff765707e009f85c8d98d791a435ac5ef4a
Showing
59 changed files
with
1210 additions
and
193 deletions
build/tizen/CMakeLists.txt
| @@ -86,7 +86,7 @@ ENDFOREACH(flag) | @@ -86,7 +86,7 @@ ENDFOREACH(flag) | ||
| 86 | 86 | ||
| 87 | SET(DALI_DEMO_CFLAGS "-DDEMO_IMAGE_DIR=${DEMO_IMAGE_DIR} -DDEMO_MODEL_DIR=${DEMO_MODEL_DIR} -DDEMO_SCRIPT_DIR=${DEMO_SCRIPT_DIR} -DDEMO_THEME_PATH=${DEMO_THEME_PATH} -DDEMO_EXAMPLE_BIN=${DEMO_EXAMPLE_BIN} -DDEMO_LOCALE_DIR=${DEMO_LOCALE_DIR} -fvisibility=hidden -DHIDE_DALI_INTERNALS -DDEMO_LANG=${DEMO_LANG}") | 87 | SET(DALI_DEMO_CFLAGS "-DDEMO_IMAGE_DIR=${DEMO_IMAGE_DIR} -DDEMO_MODEL_DIR=${DEMO_MODEL_DIR} -DDEMO_SCRIPT_DIR=${DEMO_SCRIPT_DIR} -DDEMO_THEME_PATH=${DEMO_THEME_PATH} -DDEMO_EXAMPLE_BIN=${DEMO_EXAMPLE_BIN} -DDEMO_LOCALE_DIR=${DEMO_LOCALE_DIR} -fvisibility=hidden -DHIDE_DALI_INTERNALS -DDEMO_LANG=${DEMO_LANG}") |
| 88 | 88 | ||
| 89 | -SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${REQUIRED_CFLAGS} ${DALI_DEMO_CFLAGS} -Werror -Wall") | 89 | +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${REQUIRED_CFLAGS} ${DALI_DEMO_CFLAGS} -Werror -Wall -fPIE") |
| 90 | SET(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS}") | 90 | SET(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS}") |
| 91 | 91 | ||
| 92 | INCLUDE_DIRECTORIES(${ROOT_SRC_DIR}) | 92 | INCLUDE_DIRECTORIES(${ROOT_SRC_DIR}) |
build/tizen/demo/CMakeLists.txt
| @@ -3,7 +3,7 @@ SET(DEMO_SRC_DIR ${ROOT_SRC_DIR}/demo) | @@ -3,7 +3,7 @@ SET(DEMO_SRC_DIR ${ROOT_SRC_DIR}/demo) | ||
| 3 | AUX_SOURCE_DIRECTORY(${DEMO_SRC_DIR} DEMO_SRCS) | 3 | AUX_SOURCE_DIRECTORY(${DEMO_SRC_DIR} DEMO_SRCS) |
| 4 | 4 | ||
| 5 | ADD_EXECUTABLE(${PROJECT_NAME} ${DEMO_SRCS}) | 5 | ADD_EXECUTABLE(${PROJECT_NAME} ${DEMO_SRCS}) |
| 6 | -TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${REQUIRED_PKGS_LDFLAGS}) | 6 | +TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${REQUIRED_PKGS_LDFLAGS} -pie) |
| 7 | 7 | ||
| 8 | INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${BINDIR}) | 8 | INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${BINDIR}) |
| 9 | 9 |
build/tizen/examples/CMakeLists.txt
| @@ -16,6 +16,6 @@ SUBDIRLIST(SUBDIRS ${EXAMPLES_SRC_DIR}) | @@ -16,6 +16,6 @@ SUBDIRLIST(SUBDIRS ${EXAMPLES_SRC_DIR}) | ||
| 16 | FOREACH(EXAMPLE ${SUBDIRS}) | 16 | FOREACH(EXAMPLE ${SUBDIRS}) |
| 17 | FILE(GLOB SRCS "${EXAMPLES_SRC_DIR}/${EXAMPLE}/*.cpp") | 17 | FILE(GLOB SRCS "${EXAMPLES_SRC_DIR}/${EXAMPLE}/*.cpp") |
| 18 | ADD_EXECUTABLE(${EXAMPLE}.example ${SRCS}) | 18 | ADD_EXECUTABLE(${EXAMPLE}.example ${SRCS}) |
| 19 | - TARGET_LINK_LIBRARIES(${EXAMPLE}.example ${REQUIRED_PKGS_LDFLAGS}) | 19 | + TARGET_LINK_LIBRARIES(${EXAMPLE}.example ${REQUIRED_PKGS_LDFLAGS} -pie) |
| 20 | INSTALL(TARGETS ${EXAMPLE}.example DESTINATION ${BINDIR}) | 20 | INSTALL(TARGETS ${EXAMPLE}.example DESTINATION ${BINDIR}) |
| 21 | ENDFOREACH(EXAMPLE) | 21 | ENDFOREACH(EXAMPLE) |
com.samsung.dali-demo.xml
| @@ -142,10 +142,16 @@ | @@ -142,10 +142,16 @@ | ||
| 142 | <ui-application appid="tilt.example" exec="/usr/apps/com.samsung.dali-demo/bin/tilt.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> | 142 | <ui-application appid="tilt.example" exec="/usr/apps/com.samsung.dali-demo/bin/tilt.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> |
| 143 | <label>Tilt sensor</label> | 143 | <label>Tilt sensor</label> |
| 144 | </ui-application> | 144 | </ui-application> |
| 145 | - <ui-application appid="effectse-view.example" exec="/usr/apps/com.samsung.dali-demo/bin/effects-view.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> | 145 | + <ui-application appid="effects-view.example" exec="/usr/apps/com.samsung.dali-demo/bin/effects-view.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> |
| 146 | <label>Effects View</label> | 146 | <label>Effects View</label> |
| 147 | </ui-application> | 147 | </ui-application> |
| 148 | <ui-application appid="native-image-source.example" exec="/usr/apps/com.samsung.dali-demo/bin/native-image-source.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> | 148 | <ui-application appid="native-image-source.example" exec="/usr/apps/com.samsung.dali-demo/bin/native-image-source.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> |
| 149 | <label>Native Image Source</label> | 149 | <label>Native Image Source</label> |
| 150 | </ui-application> | 150 | </ui-application> |
| 151 | + <ui-application appid="perf-scroll.example" exec="/usr/apps/com.samsung.dali-demo/bin/perf-scroll.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> | ||
| 152 | + <label>perf-scroll</label> | ||
| 153 | + </ui-application> | ||
| 154 | + <ui-application appid="flex-container.example" exec="/usr/apps/com.samsung.dali-demo/bin/flex-container.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> | ||
| 155 | + <label>Flex Container</label> | ||
| 156 | + </ui-application> | ||
| 151 | </manifest> | 157 | </manifest> |
demo/dali-demo.cpp
| @@ -24,7 +24,7 @@ | @@ -24,7 +24,7 @@ | ||
| 24 | 24 | ||
| 25 | using namespace Dali; | 25 | using namespace Dali; |
| 26 | 26 | ||
| 27 | -int main(int argc, char **argv) | 27 | +int DALI_EXPORT_API main(int argc, char **argv) |
| 28 | { | 28 | { |
| 29 | // Configure gettext for internalization | 29 | // Configure gettext for internalization |
| 30 | bindtextdomain(DALI_DEMO_DOMAIN_LOCAL, DEMO_LOCALE_DIR); | 30 | bindtextdomain(DALI_DEMO_DOMAIN_LOCAL, DEMO_LOCALE_DIR); |
examples/atlas/atlas-example.cpp
| @@ -234,7 +234,7 @@ void RunTest( Application& application ) | @@ -234,7 +234,7 @@ void RunTest( Application& application ) | ||
| 234 | 234 | ||
| 235 | // Entry point for Linux & Tizen applications | 235 | // Entry point for Linux & Tizen applications |
| 236 | // | 236 | // |
| 237 | -int main( int argc, char **argv ) | 237 | +int DALI_EXPORT_API main( int argc, char **argv ) |
| 238 | { | 238 | { |
| 239 | gApplication = Application::New( &argc, &argv, DEMO_THEME_PATH ); | 239 | gApplication = Application::New( &argc, &argv, DEMO_THEME_PATH ); |
| 240 | 240 |
examples/benchmark/benchmark.cpp
| @@ -225,9 +225,10 @@ Renderer CreateRenderer( unsigned int index ) | @@ -225,9 +225,10 @@ Renderer CreateRenderer( unsigned int index ) | ||
| 225 | 225 | ||
| 226 | const char* imagePath = !gNinePatch ? IMAGE_PATH[index] : NINEPATCH_IMAGE_PATH[index]; | 226 | const char* imagePath = !gNinePatch ? IMAGE_PATH[index] : NINEPATCH_IMAGE_PATH[index]; |
| 227 | Image image = ResourceImage::New(imagePath); | 227 | Image image = ResourceImage::New(imagePath); |
| 228 | - Material material = Material::New( shader ); | ||
| 229 | - material.AddTexture( image, "sTexture" ); | ||
| 230 | - renderers[index] = Renderer::New( QuadMesh(), material ); | 228 | + TextureSet textureSet = TextureSet::New(); |
| 229 | + textureSet.SetImage( 0u, image ); | ||
| 230 | + renderers[index] = Renderer::New( QuadMesh(), shader ); | ||
| 231 | + renderers[index].SetTextures( textureSet ); | ||
| 231 | renderers[index].SetProperty( Renderer::Property::BLENDING_MODE, BlendingMode::OFF ); | 232 | renderers[index].SetProperty( Renderer::Property::BLENDING_MODE, BlendingMode::OFF ); |
| 232 | } | 233 | } |
| 233 | return renderers[index]; | 234 | return renderers[index]; |
| @@ -524,7 +525,7 @@ void RunTest( Application& application ) | @@ -524,7 +525,7 @@ void RunTest( Application& application ) | ||
| 524 | 525 | ||
| 525 | // Entry point for Linux & Tizen applications | 526 | // Entry point for Linux & Tizen applications |
| 526 | // | 527 | // |
| 527 | -int main( int argc, char **argv ) | 528 | +int DALI_EXPORT_API main( int argc, char **argv ) |
| 528 | { | 529 | { |
| 529 | Application application = Application::New( &argc, &argv ); | 530 | Application application = Application::New( &argc, &argv ); |
| 530 | 531 |
examples/blocks/blocks-example.cpp
| @@ -836,7 +836,7 @@ void RunTest(Application& app) | @@ -836,7 +836,7 @@ void RunTest(Application& app) | ||
| 836 | app.MainLoop(); | 836 | app.MainLoop(); |
| 837 | } | 837 | } |
| 838 | 838 | ||
| 839 | -int main(int argc, char **argv) | 839 | +int DALI_EXPORT_API main(int argc, char **argv) |
| 840 | { | 840 | { |
| 841 | Application app = Application::New(&argc, &argv, DEMO_THEME_PATH); | 841 | Application app = Application::New(&argc, &argv, DEMO_THEME_PATH); |
| 842 | 842 |
examples/bubble-effect/bubble-effect-example.cpp
| @@ -319,8 +319,7 @@ RunTest(Application& app) | @@ -319,8 +319,7 @@ RunTest(Application& app) | ||
| 319 | 319 | ||
| 320 | /*****************************************************************************/ | 320 | /*****************************************************************************/ |
| 321 | 321 | ||
| 322 | -int | ||
| 323 | -main(int argc, char **argv) | 322 | +int DALI_EXPORT_API main(int argc, char **argv) |
| 324 | { | 323 | { |
| 325 | Application app = Application::New(&argc, &argv, DEMO_THEME_PATH); | 324 | Application app = Application::New(&argc, &argv, DEMO_THEME_PATH); |
| 326 | 325 |
examples/builder/examples.cpp
| @@ -607,7 +607,7 @@ private: | @@ -607,7 +607,7 @@ private: | ||
| 607 | // | 607 | // |
| 608 | // | 608 | // |
| 609 | //------------------------------------------------------------------------------ | 609 | //------------------------------------------------------------------------------ |
| 610 | -int main(int argc, char **argv) | 610 | +int DALI_EXPORT_API main(int argc, char **argv) |
| 611 | { | 611 | { |
| 612 | if(argc > 2) | 612 | if(argc > 2) |
| 613 | { | 613 | { |
examples/buttons/buttons-example.cpp
| @@ -544,7 +544,7 @@ void RunTest( Application& application ) | @@ -544,7 +544,7 @@ void RunTest( Application& application ) | ||
| 544 | 544 | ||
| 545 | // Entry point for Linux & Tizen applications | 545 | // Entry point for Linux & Tizen applications |
| 546 | // | 546 | // |
| 547 | -int main( int argc, char **argv ) | 547 | +int DALI_EXPORT_API main( int argc, char **argv ) |
| 548 | { | 548 | { |
| 549 | Application application = Application::New( &argc, &argv, DEMO_THEME_PATH ); | 549 | Application application = Application::New( &argc, &argv, DEMO_THEME_PATH ); |
| 550 | 550 |
examples/compressed-texture-formats/compressed-texture-formats-example.cpp
| @@ -131,7 +131,7 @@ void RunTest( Application& application ) | @@ -131,7 +131,7 @@ void RunTest( Application& application ) | ||
| 131 | 131 | ||
| 132 | // Entry point for Linux & Tizen applications | 132 | // Entry point for Linux & Tizen applications |
| 133 | // | 133 | // |
| 134 | -int main( int argc, char **argv ) | 134 | +int DALI_EXPORT_API main( int argc, char **argv ) |
| 135 | { | 135 | { |
| 136 | Application application = Application::New( &argc, &argv ); | 136 | Application application = Application::New( &argc, &argv ); |
| 137 | 137 |
examples/cube-transition-effect/cube-transition-effect-example.cpp
| @@ -430,7 +430,7 @@ void CubeTransitionApp::OnKeyEvent(const KeyEvent& event) | @@ -430,7 +430,7 @@ void CubeTransitionApp::OnKeyEvent(const KeyEvent& event) | ||
| 430 | } | 430 | } |
| 431 | 431 | ||
| 432 | // Entry point for Linux & Tizen applications | 432 | // Entry point for Linux & Tizen applications |
| 433 | -int main( int argc, char **argv ) | 433 | +int DALI_EXPORT_API main( int argc, char **argv ) |
| 434 | { | 434 | { |
| 435 | Application application = Application::New( &argc, &argv, DEMO_THEME_PATH ); | 435 | Application application = Application::New( &argc, &argv, DEMO_THEME_PATH ); |
| 436 | CubeTransitionApp test( application ); | 436 | CubeTransitionApp test( application ); |
examples/dissolve-effect/dissolve-effect-example.cpp
| @@ -441,7 +441,7 @@ bool DissolveEffectApp::OnTimerTick() | @@ -441,7 +441,7 @@ bool DissolveEffectApp::OnTimerTick() | ||
| 441 | } | 441 | } |
| 442 | 442 | ||
| 443 | // Entry point for Linux & Tizen applications | 443 | // Entry point for Linux & Tizen applications |
| 444 | -int main( int argc, char **argv ) | 444 | +int DALI_EXPORT_API main( int argc, char **argv ) |
| 445 | { | 445 | { |
| 446 | Application application = Application::New( &argc, &argv, DEMO_THEME_PATH ); | 446 | Application application = Application::New( &argc, &argv, DEMO_THEME_PATH ); |
| 447 | DissolveEffectApp test( application ); | 447 | DissolveEffectApp test( application ); |
examples/effects-view/effects-view-example.cpp
| @@ -253,7 +253,7 @@ static void RunTest( Application& application ) | @@ -253,7 +253,7 @@ static void RunTest( Application& application ) | ||
| 253 | 253 | ||
| 254 | /*****************************************************************************/ | 254 | /*****************************************************************************/ |
| 255 | 255 | ||
| 256 | -int main(int argc, char **argv) | 256 | +int DALI_EXPORT_API main(int argc, char **argv) |
| 257 | { | 257 | { |
| 258 | Application application = Application::New(&argc, &argv, DEMO_THEME_PATH); | 258 | Application application = Application::New(&argc, &argv, DEMO_THEME_PATH); |
| 259 | 259 |
examples/flex-container/flex-container-example.cpp
0 โ 100644
| 1 | +/* | ||
| 2 | + * Copyright (c) 2016 Samsung Electronics Co., Ltd. | ||
| 3 | + * | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + * | ||
| 16 | + */ | ||
| 17 | + | ||
| 18 | +#include <sstream> | ||
| 19 | +#include "shared/view.h" | ||
| 20 | + | ||
| 21 | +#include <dali/dali.h> | ||
| 22 | +#include <dali-toolkit/dali-toolkit.h> | ||
| 23 | +#include <dali-toolkit/devel-api/controls/flex-container/flex-container.h> | ||
| 24 | + | ||
| 25 | +using namespace Dali; | ||
| 26 | +using namespace Dali::Toolkit; | ||
| 27 | + | ||
| 28 | +namespace | ||
| 29 | +{ | ||
| 30 | + | ||
| 31 | +const int NUM_FLEX_ITEMS = 8; | ||
| 32 | + | ||
| 33 | +const char* BACKGROUND_IMAGE( DEMO_IMAGE_DIR "background-default.png" ); | ||
| 34 | +const char* TOOLBAR_IMAGE( DEMO_IMAGE_DIR "top-bar.png" ); | ||
| 35 | + | ||
| 36 | +const DemoHelper::ViewStyle VIEW_STYLE( 0.08f, 0.45f, 80.f, 4.f ); | ||
| 37 | + | ||
| 38 | +const std::string FLEX_DIRECTION[] = { | ||
| 39 | + "column", | ||
| 40 | + "columnReverse", | ||
| 41 | + "row", | ||
| 42 | + "rowReverse" | ||
| 43 | +}; | ||
| 44 | + | ||
| 45 | +const unsigned int NUM_FLEX_DIRECTION = sizeof(FLEX_DIRECTION) / sizeof(std::string); | ||
| 46 | + | ||
| 47 | +const std::string FLEX_WRAP[] = { | ||
| 48 | + "noWrap", | ||
| 49 | + "Wrap" | ||
| 50 | +}; | ||
| 51 | + | ||
| 52 | +const unsigned int NUM_FLEX_WRAP = sizeof(FLEX_WRAP) / sizeof(std::string); | ||
| 53 | + | ||
| 54 | +const std::string CONTENT_DIRECTION[] = { | ||
| 55 | + "inherit", | ||
| 56 | + "LTR", | ||
| 57 | + "RTL" | ||
| 58 | +}; | ||
| 59 | + | ||
| 60 | +const unsigned int NUM_CONTENT_DIRECTION = sizeof(CONTENT_DIRECTION) / sizeof(std::string); | ||
| 61 | + | ||
| 62 | +const std::string JUSTIFY_CONTENT[] = { | ||
| 63 | + "flexStart", | ||
| 64 | + "center", | ||
| 65 | + "flexEnd", | ||
| 66 | + "spaceBetween", | ||
| 67 | + "spaceAround" | ||
| 68 | +}; | ||
| 69 | + | ||
| 70 | +const unsigned int NUM_JUSTIFY_CONTENT = sizeof(JUSTIFY_CONTENT) / sizeof(std::string); | ||
| 71 | + | ||
| 72 | +const std::string ALIGN_ITEMS[] = { | ||
| 73 | + "flexStart", | ||
| 74 | + "center", | ||
| 75 | + "flexEnd", | ||
| 76 | + "stretch" | ||
| 77 | +}; | ||
| 78 | + | ||
| 79 | +const unsigned int NUM_ALIGN_ITEMS = sizeof(ALIGN_ITEMS) / sizeof(std::string); | ||
| 80 | + | ||
| 81 | +const std::string ALIGN_CONTENT[] = { | ||
| 82 | + "flexStart", | ||
| 83 | + "center", | ||
| 84 | + "flexEnd", | ||
| 85 | + "stretch" | ||
| 86 | +}; | ||
| 87 | + | ||
| 88 | +const unsigned int NUM_ALIGN_CONTENT = sizeof(ALIGN_CONTENT) / sizeof(std::string); | ||
| 89 | + | ||
| 90 | +} // unnamed namespace | ||
| 91 | + | ||
| 92 | +/** | ||
| 93 | + * This example demonstrates a proof of concept for FlexContainer UI control. | ||
| 94 | + * The flexbox properties can be changed by pressing different buttons in the | ||
| 95 | + * toolbar. | ||
| 96 | + */ | ||
| 97 | +class FlexContainerExample : public ConnectionTracker | ||
| 98 | +{ | ||
| 99 | +public: | ||
| 100 | + | ||
| 101 | + /** | ||
| 102 | + * Constructor | ||
| 103 | + * @param application class, stored as reference | ||
| 104 | + */ | ||
| 105 | + FlexContainerExample( Application& application ) | ||
| 106 | + : mApplication( application ), | ||
| 107 | + mCurrentFlexDirection( FlexContainer::ROW ), | ||
| 108 | + mCurrentFlexWrap( FlexContainer::WRAP ), | ||
| 109 | + mCurrentContentDirection( FlexContainer::INHERIT), | ||
| 110 | + mCurrentJustifyContent( FlexContainer::JUSTIFY_FLEX_START ), | ||
| 111 | + mCurrentAlignItems( FlexContainer::ALIGN_FLEX_START ), | ||
| 112 | + mCurrentAlignContent( FlexContainer::ALIGN_FLEX_START ) | ||
| 113 | + { | ||
| 114 | + // Connect to the Application's Init signal | ||
| 115 | + mApplication.InitSignal().Connect(this, &FlexContainerExample::OnInit); | ||
| 116 | + } | ||
| 117 | + | ||
| 118 | + /** | ||
| 119 | + * This method gets called once the main loop of application is up and running | ||
| 120 | + */ | ||
| 121 | + void OnInit(Application& app) | ||
| 122 | + { | ||
| 123 | + Stage stage = Dali::Stage::GetCurrent(); | ||
| 124 | + stage.KeyEventSignal().Connect(this, &FlexContainerExample::OnKeyEvent); | ||
| 125 | + stage.GetRootLayer().SetBehavior(Layer::LAYER_3D); | ||
| 126 | + | ||
| 127 | + Vector2 stageSize = Stage::GetCurrent().GetSize(); | ||
| 128 | + | ||
| 129 | + // Creates a default view with a default tool bar. | ||
| 130 | + // The view is added to the stage. | ||
| 131 | + Layer contents = DemoHelper::CreateView( mApplication, | ||
| 132 | + mView, | ||
| 133 | + mToolBar, | ||
| 134 | + BACKGROUND_IMAGE, | ||
| 135 | + TOOLBAR_IMAGE, | ||
| 136 | + "" ); | ||
| 137 | + | ||
| 138 | + // Create a flex direction toggle button. (left of toolbar) | ||
| 139 | + mFlexDirectionButton = Toolkit::PushButton::New(); | ||
| 140 | + mFlexDirectionButton.SetName("mFlexDirectionButton"); | ||
| 141 | + mFlexDirectionButton.SetUnselectedImage( DEMO_IMAGE_DIR "icon-change.png" ); | ||
| 142 | + mFlexDirectionButton.SetSelectedImage( DEMO_IMAGE_DIR "icon-change-selected.png" ); | ||
| 143 | + mFlexDirectionButton.ClickedSignal().Connect( this, &FlexContainerExample::OnFlexDirectionButtonClicked); | ||
| 144 | + mFlexDirectionButton.SetLeaveRequired( true ); | ||
| 145 | + mToolBar.AddControl( mFlexDirectionButton, VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalLeft, DemoHelper::DEFAULT_MODE_SWITCH_PADDING ); | ||
| 146 | + | ||
| 147 | + // Create a flex wrap toggle button. (left of toolbar) | ||
| 148 | + mFlexWrapButton = Toolkit::PushButton::New(); | ||
| 149 | + mFlexWrapButton.SetName("mFlexWrapButton"); | ||
| 150 | + mFlexWrapButton.SetUnselectedImage( DEMO_IMAGE_DIR "icon-edit.png" ); | ||
| 151 | + mFlexWrapButton.SetSelectedImage( DEMO_IMAGE_DIR "icon-edit-selected.png" ); | ||
| 152 | + mFlexWrapButton.ClickedSignal().Connect( this, &FlexContainerExample::OnFlexWrapButtonClicked); | ||
| 153 | + mFlexWrapButton.SetLeaveRequired( true ); | ||
| 154 | + mToolBar.AddControl( mFlexWrapButton, VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalLeft, DemoHelper::DEFAULT_MODE_SWITCH_PADDING ); | ||
| 155 | + | ||
| 156 | + // Create a content direction toggle button. (left of toolbar) | ||
| 157 | + mContentDirectionButton = Toolkit::PushButton::New(); | ||
| 158 | + mContentDirectionButton.SetName("mContentDirectionButton"); | ||
| 159 | + mContentDirectionButton.SetUnselectedImage( DEMO_IMAGE_DIR "icon-replace.png" ); | ||
| 160 | + mContentDirectionButton.SetSelectedImage( DEMO_IMAGE_DIR "icon-replace-selected.png" ); | ||
| 161 | + mContentDirectionButton.ClickedSignal().Connect( this, &FlexContainerExample::OnContentDirectionButtonClicked); | ||
| 162 | + mContentDirectionButton.SetLeaveRequired( true ); | ||
| 163 | + mToolBar.AddControl( mContentDirectionButton, VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalLeft, DemoHelper::DEFAULT_MODE_SWITCH_PADDING ); | ||
| 164 | + | ||
| 165 | + // Create a justify content toggle button. (right of toolbar) | ||
| 166 | + mJustifyContentButton = Toolkit::PushButton::New(); | ||
| 167 | + mJustifyContentButton.SetName("mJustifyContentButton"); | ||
| 168 | + mJustifyContentButton.SetUnselectedImage( DEMO_IMAGE_DIR "icon-reset.png" ); | ||
| 169 | + mJustifyContentButton.SetSelectedImage( DEMO_IMAGE_DIR "icon-reset-selected.png" ); | ||
| 170 | + mJustifyContentButton.ClickedSignal().Connect( this, &FlexContainerExample::OnJustifyContentButtonClicked); | ||
| 171 | + mJustifyContentButton.SetLeaveRequired( true ); | ||
| 172 | + mToolBar.AddControl( mJustifyContentButton, VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight, DemoHelper::DEFAULT_MODE_SWITCH_PADDING ); | ||
| 173 | + | ||
| 174 | + // Create a align items toggle button. (right of toolbar) | ||
| 175 | + mAlignItemsButton = Toolkit::PushButton::New(); | ||
| 176 | + mAlignItemsButton.SetName("mAlignItemsButton"); | ||
| 177 | + mAlignItemsButton.SetUnselectedImage( DEMO_IMAGE_DIR "icon-highp.png" ); | ||
| 178 | + mAlignItemsButton.SetSelectedImage( DEMO_IMAGE_DIR "icon-highp-selected.png" ); | ||
| 179 | + mAlignItemsButton.ClickedSignal().Connect( this, &FlexContainerExample::OnAlignItemsButtonClicked); | ||
| 180 | + mAlignItemsButton.SetLeaveRequired( true ); | ||
| 181 | + mToolBar.AddControl( mAlignItemsButton, VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight, DemoHelper::DEFAULT_MODE_SWITCH_PADDING ); | ||
| 182 | + | ||
| 183 | + // Create a align content toggle button. (right of toolbar) | ||
| 184 | + mAlignContentButton = Toolkit::PushButton::New(); | ||
| 185 | + mAlignContentButton.SetName("mAlignContentButton"); | ||
| 186 | + mAlignContentButton.SetUnselectedImage( DEMO_IMAGE_DIR "icon-effect-cross.png" ); | ||
| 187 | + mAlignContentButton.SetSelectedImage( DEMO_IMAGE_DIR "icon-effect-cross-selected.png" ); | ||
| 188 | + mAlignContentButton.ClickedSignal().Connect( this, &FlexContainerExample::OnAlignContentButtonClicked); | ||
| 189 | + mAlignContentButton.SetLeaveRequired( true ); | ||
| 190 | + mToolBar.AddControl( mAlignContentButton, VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight, DemoHelper::DEFAULT_MODE_SWITCH_PADDING ); | ||
| 191 | + | ||
| 192 | + // Create the base flex container | ||
| 193 | + mFlexContainer = FlexContainer::New(); | ||
| 194 | + mFlexContainer.SetParentOrigin(ParentOrigin::TOP_LEFT); | ||
| 195 | + mFlexContainer.SetAnchorPoint(AnchorPoint::TOP_LEFT); | ||
| 196 | + mFlexContainer.SetSize( stageSize.width, stageSize.height - VIEW_STYLE.mToolBarHeight ); | ||
| 197 | + mFlexContainer.SetY(VIEW_STYLE.mToolBarHeight); | ||
| 198 | + mFlexContainer.SetProperty(FlexContainer::Property::FLEX_DIRECTION, FlexContainer::COLUMN); // column as main axis | ||
| 199 | + contents.Add(mFlexContainer); | ||
| 200 | + | ||
| 201 | + // Add a text label to the container for showing the recently updated flexbox property value | ||
| 202 | + mFlexPropertyLabel = TextLabel::New( FLEX_DIRECTION[mCurrentFlexDirection] ); | ||
| 203 | + mFlexPropertyLabel.RegisterProperty("flexMargin", Vector4(10.0f, 10.0f, 10.0f, 10.0f), Property::READ_WRITE); | ||
| 204 | + mFlexPropertyLabel.RegisterProperty("flex", 0.05f, Property::READ_WRITE); // 5 pecent of the container size in the main axis | ||
| 205 | + mFlexPropertyLabel.SetProperty(TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER"); | ||
| 206 | + mFlexPropertyLabel.SetProperty(TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER"); | ||
| 207 | + mFlexContainer.Add( mFlexPropertyLabel ); | ||
| 208 | + | ||
| 209 | + // Create the flex container for the flex items and add it to the base flex container | ||
| 210 | + mFlexItemContainer = FlexContainer::New(); | ||
| 211 | + mFlexItemContainer.SetParentOrigin(ParentOrigin::TOP_LEFT); | ||
| 212 | + mFlexItemContainer.SetAnchorPoint(AnchorPoint::TOP_LEFT); | ||
| 213 | + mFlexItemContainer.SetBackgroundColor( Color::YELLOW ); | ||
| 214 | + mFlexItemContainer.RegisterProperty("flex", 0.95f, Property::READ_WRITE); // 95 pecent of the container size in the main axis | ||
| 215 | + mFlexItemContainer.SetProperty(FlexContainer::Property::FLEX_DIRECTION, mCurrentFlexDirection); | ||
| 216 | + mFlexItemContainer.SetProperty(FlexContainer::Property::FLEX_WRAP, mCurrentFlexWrap); | ||
| 217 | + mFlexContainer.Add(mFlexItemContainer); | ||
| 218 | + | ||
| 219 | + // Create flex items and add them to the container | ||
| 220 | + for (int i = 0; i < NUM_FLEX_ITEMS; i++) | ||
| 221 | + { | ||
| 222 | + PushButton flexItem = PushButton::New(); | ||
| 223 | + flexItem.SetAnchorPoint( AnchorPoint::TOP_LEFT ); | ||
| 224 | + flexItem.SetParentOrigin( ParentOrigin::TOP_LEFT ); | ||
| 225 | + | ||
| 226 | + // Set different background colour to help to identify different items | ||
| 227 | + flexItem.SetBackgroundColor(Vector4(static_cast<float>(i) / NUM_FLEX_ITEMS, static_cast<float>(NUM_FLEX_ITEMS - i) / NUM_FLEX_ITEMS, 1.0f, 1.0f)); | ||
| 228 | + flexItem.SetUnselectedImage(""); | ||
| 229 | + flexItem.SetSelectedImage(""); | ||
| 230 | + | ||
| 231 | + // Add a label to the button so that we can identify each item more easily | ||
| 232 | + std::ostringstream index; | ||
| 233 | + index << i + 1; | ||
| 234 | + flexItem.SetLabelText(index.str()); | ||
| 235 | + flexItem.SetName("FlexItem " + index.str()); | ||
| 236 | + | ||
| 237 | + // Set a fixed size to the items so that we can wrap the line and test these | ||
| 238 | + // flex properties that only work when there are multiple lines in the layout | ||
| 239 | + flexItem.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS); | ||
| 240 | + // Make sure there are still extra space in the line after wrapping | ||
| 241 | + flexItem.SetSize(stageSize.width / NUM_FLEX_ITEMS * 1.25f, (stageSize.height - VIEW_STYLE.mToolBarHeight) * 0.95f / NUM_FLEX_ITEMS * 1.25f); | ||
| 242 | + | ||
| 243 | + mFlexItemContainer.Add( flexItem ); | ||
| 244 | + } | ||
| 245 | + | ||
| 246 | + // Update the title | ||
| 247 | + SetTitle( "Flex direction", FLEX_DIRECTION[mCurrentFlexDirection] ); | ||
| 248 | + } | ||
| 249 | + | ||
| 250 | + bool OnFlexDirectionButtonClicked( Toolkit::Button button ) | ||
| 251 | + { | ||
| 252 | + mCurrentFlexDirection = static_cast<FlexContainer::FlexDirection>( ( mCurrentFlexDirection + 1 ) % NUM_FLEX_DIRECTION ); | ||
| 253 | + mFlexItemContainer.SetProperty(FlexContainer::Property::FLEX_DIRECTION, mCurrentFlexDirection); | ||
| 254 | + SetTitle( "Flex direction", FLEX_DIRECTION[mCurrentFlexDirection] ); | ||
| 255 | + | ||
| 256 | + return true; | ||
| 257 | + } | ||
| 258 | + | ||
| 259 | + bool OnFlexWrapButtonClicked( Toolkit::Button button ) | ||
| 260 | + { | ||
| 261 | + mCurrentFlexWrap = static_cast<FlexContainer::WrapType>( ( mCurrentFlexWrap + 1 ) % NUM_FLEX_WRAP ); | ||
| 262 | + mFlexItemContainer.SetProperty(FlexContainer::Property::FLEX_WRAP, mCurrentFlexWrap); | ||
| 263 | + SetTitle( "Flex wrap", FLEX_WRAP[mCurrentFlexWrap] ); | ||
| 264 | + | ||
| 265 | + return true; | ||
| 266 | + } | ||
| 267 | + | ||
| 268 | + bool OnContentDirectionButtonClicked( Toolkit::Button button ) | ||
| 269 | + { | ||
| 270 | + mCurrentContentDirection = static_cast<FlexContainer::ContentDirection>( ( mCurrentContentDirection + 1 ) % NUM_CONTENT_DIRECTION ); | ||
| 271 | + mFlexItemContainer.SetProperty(FlexContainer::Property::CONTENT_DIRECTION, mCurrentContentDirection); | ||
| 272 | + SetTitle( "Content direction", CONTENT_DIRECTION[mCurrentContentDirection] ); | ||
| 273 | + | ||
| 274 | + return true; | ||
| 275 | + } | ||
| 276 | + | ||
| 277 | + bool OnJustifyContentButtonClicked( Toolkit::Button button ) | ||
| 278 | + { | ||
| 279 | + mCurrentJustifyContent = static_cast<FlexContainer::Justification>( ( mCurrentJustifyContent + 1 ) % NUM_JUSTIFY_CONTENT ); | ||
| 280 | + mFlexItemContainer.SetProperty(FlexContainer::Property::JUSTIFY_CONTENT, mCurrentJustifyContent); | ||
| 281 | + SetTitle( "Justify content", JUSTIFY_CONTENT[mCurrentJustifyContent] ); | ||
| 282 | + | ||
| 283 | + return true; | ||
| 284 | + } | ||
| 285 | + | ||
| 286 | + bool OnAlignItemsButtonClicked( Toolkit::Button button ) | ||
| 287 | + { | ||
| 288 | + mCurrentAlignItems = static_cast<FlexContainer::Alignment>( ( mCurrentAlignItems + 1 ) % ( NUM_ALIGN_ITEMS + 1 ) ); | ||
| 289 | + mCurrentAlignItems = mCurrentAlignItems < FlexContainer::ALIGN_FLEX_START ? FlexContainer::ALIGN_FLEX_START : mCurrentAlignItems; // skip auto as it is invalid for alignItems property | ||
| 290 | + mFlexItemContainer.SetProperty(FlexContainer::Property::ALIGN_ITEMS, mCurrentAlignItems ); | ||
| 291 | + SetTitle( "Align Items", ALIGN_ITEMS[mCurrentAlignItems - 1] ); | ||
| 292 | + | ||
| 293 | + return true; | ||
| 294 | + } | ||
| 295 | + | ||
| 296 | + bool OnAlignContentButtonClicked( Toolkit::Button button ) | ||
| 297 | + { | ||
| 298 | + mCurrentAlignContent = static_cast<FlexContainer::Alignment>( ( mCurrentAlignContent + 1 ) % (NUM_ALIGN_CONTENT + 1 ) ); | ||
| 299 | + mCurrentAlignContent = mCurrentAlignContent < FlexContainer::ALIGN_FLEX_START ? FlexContainer::ALIGN_FLEX_START : mCurrentAlignContent; // skip auto as it is invalid for alignContent property | ||
| 300 | + mFlexItemContainer.SetProperty(FlexContainer::Property::ALIGN_CONTENT, mCurrentAlignContent); | ||
| 301 | + SetTitle( "Align content", ALIGN_CONTENT[mCurrentAlignContent - 1] ); | ||
| 302 | + | ||
| 303 | + return true; | ||
| 304 | + } | ||
| 305 | + | ||
| 306 | +private: | ||
| 307 | + | ||
| 308 | + /** | ||
| 309 | + * Sets/Updates the title of the View and the value of the recently updated | ||
| 310 | + * flexbox property. | ||
| 311 | + * | ||
| 312 | + * @param[in] title The new title for the view. | ||
| 313 | + * @param[in] propertyValue The value of the flexbox property. | ||
| 314 | + */ | ||
| 315 | + void SetTitle(const std::string& title, const std::string& propertyValue) | ||
| 316 | + { | ||
| 317 | + if(!mTitleActor) | ||
| 318 | + { | ||
| 319 | + mTitleActor = DemoHelper::CreateToolBarLabel( "" ); | ||
| 320 | + // Add title to the tool bar. | ||
| 321 | + mToolBar.AddControl( mTitleActor, VIEW_STYLE.mToolBarTitlePercentage, Alignment::HorizontalCenter ); | ||
| 322 | + } | ||
| 323 | + | ||
| 324 | + // Update the title and property value | ||
| 325 | + mTitleActor.SetProperty( TextLabel::Property::TEXT, title ); | ||
| 326 | + mFlexPropertyLabel.SetProperty( TextLabel::Property::TEXT, propertyValue ); | ||
| 327 | + } | ||
| 328 | + | ||
| 329 | + /** | ||
| 330 | + * Main key event handler | ||
| 331 | + */ | ||
| 332 | + void OnKeyEvent(const KeyEvent& event) | ||
| 333 | + { | ||
| 334 | + if(event.state == KeyEvent::Down) | ||
| 335 | + { | ||
| 336 | + if( IsKey( event, DALI_KEY_ESCAPE) || IsKey( event, DALI_KEY_BACK ) ) | ||
| 337 | + { | ||
| 338 | + mApplication.Quit(); | ||
| 339 | + } | ||
| 340 | + } | ||
| 341 | + } | ||
| 342 | + | ||
| 343 | +private: | ||
| 344 | + | ||
| 345 | + Application& mApplication; | ||
| 346 | + | ||
| 347 | + Toolkit::Control mView; | ||
| 348 | + Toolkit::ToolBar mToolBar; | ||
| 349 | + TextLabel mTitleActor; ///< The Toolbar's Title. | ||
| 350 | + | ||
| 351 | + FlexContainer mFlexContainer; | ||
| 352 | + FlexContainer mFlexItemContainer; | ||
| 353 | + TextLabel mFlexPropertyLabel; | ||
| 354 | + | ||
| 355 | + FlexContainer::FlexDirection mCurrentFlexDirection; | ||
| 356 | + FlexContainer::WrapType mCurrentFlexWrap; | ||
| 357 | + FlexContainer::ContentDirection mCurrentContentDirection; | ||
| 358 | + FlexContainer::Justification mCurrentJustifyContent; | ||
| 359 | + FlexContainer::Alignment mCurrentAlignItems; | ||
| 360 | + FlexContainer::Alignment mCurrentAlignContent; | ||
| 361 | + | ||
| 362 | + Toolkit::PushButton mFlexDirectionButton; | ||
| 363 | + Toolkit::PushButton mFlexWrapButton; | ||
| 364 | + Toolkit::PushButton mContentDirectionButton; | ||
| 365 | + Toolkit::PushButton mJustifyContentButton; | ||
| 366 | + Toolkit::PushButton mAlignItemsButton; | ||
| 367 | + Toolkit::PushButton mAlignContentButton; | ||
| 368 | +}; | ||
| 369 | + | ||
| 370 | +void RunTest(Application& app) | ||
| 371 | +{ | ||
| 372 | + FlexContainerExample test(app); | ||
| 373 | + | ||
| 374 | + app.MainLoop(); | ||
| 375 | +} | ||
| 376 | + | ||
| 377 | +int DALI_EXPORT_API main(int argc, char **argv) | ||
| 378 | +{ | ||
| 379 | + Application app = Application::New(&argc, &argv, DEMO_THEME_PATH); | ||
| 380 | + | ||
| 381 | + RunTest(app); | ||
| 382 | + | ||
| 383 | + return 0; | ||
| 384 | +} |
examples/gradients/gradients-example.cpp
| @@ -178,7 +178,7 @@ void RunTest( Application& application ) | @@ -178,7 +178,7 @@ void RunTest( Application& application ) | ||
| 178 | 178 | ||
| 179 | // Entry point for Linux & Tizen applications | 179 | // Entry point for Linux & Tizen applications |
| 180 | // | 180 | // |
| 181 | -int main( int argc, char **argv ) | 181 | +int DALI_EXPORT_API main( int argc, char **argv ) |
| 182 | { | 182 | { |
| 183 | Application application = Application::New( &argc, &argv ); | 183 | Application application = Application::New( &argc, &argv ); |
| 184 | 184 |
examples/hello-world/hello-world-example.cpp
| @@ -74,7 +74,7 @@ void RunTest( Application& application ) | @@ -74,7 +74,7 @@ void RunTest( Application& application ) | ||
| 74 | 74 | ||
| 75 | // Entry point for Linux & Tizen applications | 75 | // Entry point for Linux & Tizen applications |
| 76 | // | 76 | // |
| 77 | -int main( int argc, char **argv ) | 77 | +int DALI_EXPORT_API main( int argc, char **argv ) |
| 78 | { | 78 | { |
| 79 | Application application = Application::New( &argc, &argv ); | 79 | Application application = Application::New( &argc, &argv ); |
| 80 | 80 |
examples/homescreen-benchmark/homescreen-benchmark.cpp
| @@ -677,7 +677,7 @@ void RunTest( Application& application, const HomescreenBenchmark::Config& confi | @@ -677,7 +677,7 @@ void RunTest( Application& application, const HomescreenBenchmark::Config& confi | ||
| 677 | 677 | ||
| 678 | // Entry point for Linux & Tizen applications | 678 | // Entry point for Linux & Tizen applications |
| 679 | // | 679 | // |
| 680 | -int main( int argc, char **argv ) | 680 | +int DALI_EXPORT_API main( int argc, char **argv ) |
| 681 | { | 681 | { |
| 682 | // default settings | 682 | // default settings |
| 683 | HomescreenBenchmark::Config config; | 683 | HomescreenBenchmark::Config config; |
examples/image-scaling-and-filtering/image-scaling-and-filtering-example.cpp
| @@ -759,7 +759,7 @@ void RunTest( Application& application ) | @@ -759,7 +759,7 @@ void RunTest( Application& application ) | ||
| 759 | } | 759 | } |
| 760 | 760 | ||
| 761 | // Entry point for Linux & Tizen applications | 761 | // Entry point for Linux & Tizen applications |
| 762 | -int main( int argc, char **argv ) | 762 | +int DALI_EXPORT_API main( int argc, char **argv ) |
| 763 | { | 763 | { |
| 764 | Application application = Application::New( &argc, &argv, DEMO_THEME_PATH ); | 764 | Application application = Application::New( &argc, &argv, DEMO_THEME_PATH ); |
| 765 | 765 |
examples/image-scaling-irregular-grid/image-scaling-irregular-grid-example.cpp
| @@ -614,7 +614,7 @@ void RunTest( Application& application ) | @@ -614,7 +614,7 @@ void RunTest( Application& application ) | ||
| 614 | } | 614 | } |
| 615 | 615 | ||
| 616 | /** Entry point for Linux & Tizen applications */ | 616 | /** Entry point for Linux & Tizen applications */ |
| 617 | -int main( int argc, char **argv ) | 617 | +int DALI_EXPORT_API main( int argc, char **argv ) |
| 618 | { | 618 | { |
| 619 | Application application = Application::New( &argc, &argv, DEMO_THEME_PATH ); | 619 | Application application = Application::New( &argc, &argv, DEMO_THEME_PATH ); |
| 620 | 620 |
examples/image-view-alpha-blending/image-view-alpha-blending-example.cpp
| @@ -122,7 +122,7 @@ void RunTest( Application& application ) | @@ -122,7 +122,7 @@ void RunTest( Application& application ) | ||
| 122 | 122 | ||
| 123 | // Entry point for Linux & Tizen applications | 123 | // Entry point for Linux & Tizen applications |
| 124 | // | 124 | // |
| 125 | -int main( int argc, char **argv ) | 125 | +int DALI_EXPORT_API main( int argc, char **argv ) |
| 126 | { | 126 | { |
| 127 | Application application = Application::New( &argc, &argv ); | 127 | Application application = Application::New( &argc, &argv ); |
| 128 | 128 |
examples/image-view-pixel-area/image-view-pixel-area-example.cpp
| @@ -118,7 +118,7 @@ void RunTest( Application& application ) | @@ -118,7 +118,7 @@ void RunTest( Application& application ) | ||
| 118 | 118 | ||
| 119 | // Entry point for Linux & Tizen applications | 119 | // Entry point for Linux & Tizen applications |
| 120 | // | 120 | // |
| 121 | -int main( int argc, char **argv ) | 121 | +int DALI_EXPORT_API main( int argc, char **argv ) |
| 122 | { | 122 | { |
| 123 | Application application = Application::New( &argc, &argv ); | 123 | Application application = Application::New( &argc, &argv ); |
| 124 | 124 |
examples/image-view-svg/image-view-svg-example.cpp
| @@ -234,7 +234,7 @@ void RunTest( Application& application ) | @@ -234,7 +234,7 @@ void RunTest( Application& application ) | ||
| 234 | 234 | ||
| 235 | // Entry point for Linux & Tizen applications | 235 | // Entry point for Linux & Tizen applications |
| 236 | // | 236 | // |
| 237 | -int main( int argc, char **argv ) | 237 | +int DALI_EXPORT_API main( int argc, char **argv ) |
| 238 | { | 238 | { |
| 239 | Application application = Application::New( &argc, &argv ); | 239 | Application application = Application::New( &argc, &argv ); |
| 240 | 240 |
examples/image-view/image-view-example.cpp
| @@ -263,7 +263,7 @@ void RunTest( Application& application ) | @@ -263,7 +263,7 @@ void RunTest( Application& application ) | ||
| 263 | 263 | ||
| 264 | // Entry point for Linux & Tizen applications | 264 | // Entry point for Linux & Tizen applications |
| 265 | // | 265 | // |
| 266 | -int main( int argc, char **argv ) | 266 | +int DALI_EXPORT_API main( int argc, char **argv ) |
| 267 | { | 267 | { |
| 268 | Application application = Application::New( &argc, &argv, DEMO_THEME_PATH ); | 268 | Application application = Application::New( &argc, &argv, DEMO_THEME_PATH ); |
| 269 | 269 |
examples/item-view/item-view-example.cpp
| @@ -983,7 +983,7 @@ void RunTest(Application& app) | @@ -983,7 +983,7 @@ void RunTest(Application& app) | ||
| 983 | app.MainLoop(); | 983 | app.MainLoop(); |
| 984 | } | 984 | } |
| 985 | 985 | ||
| 986 | -int main(int argc, char **argv) | 986 | +int DALI_EXPORT_API main(int argc, char **argv) |
| 987 | { | 987 | { |
| 988 | Application app = Application::New(&argc, &argv, DEMO_THEME_PATH); | 988 | Application app = Application::New(&argc, &argv, DEMO_THEME_PATH); |
| 989 | 989 |
examples/line-mesh/line-mesh-example.cpp
| @@ -32,14 +32,18 @@ namespace | @@ -32,14 +32,18 @@ namespace | ||
| 32 | const char* VERTEX_SHADER = MAKE_SHADER( | 32 | const char* VERTEX_SHADER = MAKE_SHADER( |
| 33 | attribute mediump vec2 aPosition1; | 33 | attribute mediump vec2 aPosition1; |
| 34 | attribute mediump vec2 aPosition2; | 34 | attribute mediump vec2 aPosition2; |
| 35 | +attribute lowp vec3 aColor; | ||
| 35 | uniform mediump mat4 uMvpMatrix; | 36 | uniform mediump mat4 uMvpMatrix; |
| 36 | uniform mediump vec3 uSize; | 37 | uniform mediump vec3 uSize; |
| 37 | uniform mediump float uMorphAmount; | 38 | uniform mediump float uMorphAmount; |
| 38 | 39 | ||
| 40 | +varying lowp vec3 vColor; | ||
| 41 | + | ||
| 39 | void main() | 42 | void main() |
| 40 | { | 43 | { |
| 41 | mediump vec2 morphPosition = mix(aPosition1, aPosition2, uMorphAmount); | 44 | mediump vec2 morphPosition = mix(aPosition1, aPosition2, uMorphAmount); |
| 42 | mediump vec4 vertexPosition = vec4(morphPosition, 0.0, 1.0); | 45 | mediump vec4 vertexPosition = vec4(morphPosition, 0.0, 1.0); |
| 46 | + vColor = aColor; | ||
| 43 | vertexPosition.xyz *= uSize; | 47 | vertexPosition.xyz *= uSize; |
| 44 | vertexPosition = uMvpMatrix * vertexPosition; | 48 | vertexPosition = uMvpMatrix * vertexPosition; |
| 45 | gl_Position = vertexPosition; | 49 | gl_Position = vertexPosition; |
| @@ -50,59 +54,87 @@ const char* FRAGMENT_SHADER = MAKE_SHADER( | @@ -50,59 +54,87 @@ const char* FRAGMENT_SHADER = MAKE_SHADER( | ||
| 50 | uniform lowp vec4 uColor; | 54 | uniform lowp vec4 uColor; |
| 51 | uniform sampler2D sTexture; | 55 | uniform sampler2D sTexture; |
| 52 | 56 | ||
| 57 | +varying lowp vec3 vColor; | ||
| 58 | + | ||
| 53 | void main() | 59 | void main() |
| 54 | { | 60 | { |
| 55 | - gl_FragColor = uColor; | 61 | + gl_FragColor = uColor * vec4( vColor, 1.0 ); |
| 56 | } | 62 | } |
| 57 | ); | 63 | ); |
| 58 | 64 | ||
| 65 | +PropertyBuffer CreateIndexBuffer( Geometry::GeometryType geometryType ) | ||
| 66 | +{ | ||
| 67 | + // Create indices | ||
| 68 | + const unsigned int indexDataLines[] = { 0, 1, 1, 2, 2, 3, 3, 4, 4, 0 }; | ||
| 69 | + const unsigned int indexDataLoops[] = { 0, 1, 2, 3, 4 }; | ||
| 70 | + const unsigned int indexDataStrips[] = { 0, 1, 2, 3, 4, 0 }; | ||
| 71 | + | ||
| 72 | + // Create index buffer if doesn't exist | ||
| 73 | + Property::Map indexFormat; | ||
| 74 | + indexFormat["indices"] = Property::INTEGER; | ||
| 75 | + PropertyBuffer indices = PropertyBuffer::New( indexFormat ); | ||
| 76 | + | ||
| 77 | + // Update buffer | ||
| 78 | + switch( geometryType ) | ||
| 79 | + { | ||
| 80 | + case Geometry::LINES: | ||
| 81 | + { | ||
| 82 | + indices.SetData( indexDataLines, sizeof(indexDataLines)/sizeof(indexDataLines[0]) ); | ||
| 83 | + break; | ||
| 84 | + } | ||
| 85 | + case Geometry::LINE_LOOP: | ||
| 86 | + { | ||
| 87 | + indices.SetData( indexDataLoops, sizeof(indexDataLoops)/sizeof(indexDataLoops[0]) ); | ||
| 88 | + break; | ||
| 89 | + } | ||
| 90 | + case Geometry::LINE_STRIP: | ||
| 91 | + { | ||
| 92 | + indices.SetData( indexDataStrips, sizeof(indexDataStrips)/sizeof(indexDataStrips[0]) ); | ||
| 93 | + break; | ||
| 94 | + } | ||
| 95 | + default: // this will never happen, but compilers yells | ||
| 96 | + { | ||
| 97 | + } | ||
| 98 | + } | ||
| 99 | + | ||
| 100 | + return indices; | ||
| 101 | +} | ||
| 102 | + | ||
| 59 | Geometry CreateGeometry() | 103 | Geometry CreateGeometry() |
| 60 | { | 104 | { |
| 61 | // Create vertices | 105 | // Create vertices |
| 62 | - struct Vertex { Vector2 position; }; | ||
| 63 | - Vertex pentagonVertexData[5] = | ||
| 64 | - { | ||
| 65 | - { Vector2( 0.0f, 1.00f) }, // 0 | ||
| 66 | - { Vector2( -0.95f, 0.31f) }, // 1 | ||
| 67 | - { Vector2( -0.59f, -0.81f) }, // 2 | ||
| 68 | - { Vector2( 0.59f, -0.81f) }, // 3 | ||
| 69 | - { Vector2( 0.95f, 0.31f) }, // 4 | ||
| 70 | - }; | 106 | + struct Vertex |
| 107 | + { | ||
| 108 | + Vector2 position1; | ||
| 109 | + Vector2 position2; | ||
| 110 | + Vector3 color; | ||
| 111 | + }; | ||
| 71 | 112 | ||
| 72 | - Vertex pentacleVertexData[5] = | 113 | + // Create new geometry object |
| 114 | + Vertex pentagonVertexData[5] = | ||
| 73 | { | 115 | { |
| 74 | - { Vector2( 0.0f, -1.00f) }, // | ||
| 75 | - { Vector2( 0.59f, 0.81f) }, // | ||
| 76 | - { Vector2( -0.95f, -0.31f) }, // | ||
| 77 | - { Vector2( 0.95f, -0.31f) }, // | ||
| 78 | - { Vector2( -0.59f, 0.81f) }, // | 116 | + { Vector2( 0.0f, 1.00f), Vector2( 0.0f, -1.00f), Vector3( 1.0f, 1.0f, 1.0f ) }, // 0 |
| 117 | + { Vector2( -0.95f, 0.31f), Vector2( 0.59f, 0.81f), Vector3( 1.0f, 0.0f, 0.0f ) }, // 1 | ||
| 118 | + { Vector2( -0.59f, -0.81f), Vector2( -0.95f, -0.31f), Vector3( 0.0f, 1.0f, 0.0f ) }, // 2 | ||
| 119 | + { Vector2( 0.59f, -0.81f), Vector2( 0.95f, -0.31f), Vector3( 0.0f, 0.0f, 1.0f ) }, // 3 | ||
| 120 | + { Vector2( 0.95f, 0.31f), Vector2( -0.59f, 0.81f), Vector3( 1.0f, 1.0f, 0.0f ) }, // 4 | ||
| 79 | }; | 121 | }; |
| 80 | 122 | ||
| 81 | Property::Map pentagonVertexFormat; | 123 | Property::Map pentagonVertexFormat; |
| 82 | pentagonVertexFormat["aPosition1"] = Property::VECTOR2; | 124 | pentagonVertexFormat["aPosition1"] = Property::VECTOR2; |
| 125 | + pentagonVertexFormat["aPosition2"] = Property::VECTOR2; | ||
| 126 | + pentagonVertexFormat["aColor"] = Property::VECTOR3; | ||
| 83 | PropertyBuffer pentagonVertices = PropertyBuffer::New( pentagonVertexFormat ); | 127 | PropertyBuffer pentagonVertices = PropertyBuffer::New( pentagonVertexFormat ); |
| 84 | pentagonVertices.SetData(pentagonVertexData, 5); | 128 | pentagonVertices.SetData(pentagonVertexData, 5); |
| 85 | 129 | ||
| 86 | - Property::Map pentacleVertexFormat; | ||
| 87 | - pentacleVertexFormat["aPosition2"] = Property::VECTOR2; | ||
| 88 | - PropertyBuffer pentacleVertices = PropertyBuffer::New( pentacleVertexFormat ); | ||
| 89 | - pentacleVertices.SetData( pentacleVertexData, 5 ); | ||
| 90 | - | ||
| 91 | // Create indices | 130 | // Create indices |
| 92 | - unsigned int indexData[10] = { 0, 1, 1, 2, 2, 3, 3, 4, 4, 0 }; | ||
| 93 | - Property::Map indexFormat; | ||
| 94 | - indexFormat["indices"] = Property::INTEGER; | ||
| 95 | - PropertyBuffer indices = PropertyBuffer::New( indexFormat ); | ||
| 96 | - indices.SetData( indexData, sizeof(indexData)/sizeof(indexData[0]) ); | 131 | + PropertyBuffer indices = CreateIndexBuffer( Geometry::LINES ); |
| 97 | 132 | ||
| 98 | // Create the geometry object | 133 | // Create the geometry object |
| 99 | Geometry pentagonGeometry = Geometry::New(); | 134 | Geometry pentagonGeometry = Geometry::New(); |
| 100 | pentagonGeometry.AddVertexBuffer( pentagonVertices ); | 135 | pentagonGeometry.AddVertexBuffer( pentagonVertices ); |
| 101 | - pentagonGeometry.AddVertexBuffer( pentacleVertices ); | ||
| 102 | pentagonGeometry.SetIndexBuffer( indices ); | 136 | pentagonGeometry.SetIndexBuffer( indices ); |
| 103 | - | ||
| 104 | pentagonGeometry.SetGeometryType( Geometry::LINES ); | 137 | pentagonGeometry.SetGeometryType( Geometry::LINES ); |
| 105 | - | ||
| 106 | return pentagonGeometry; | 138 | return pentagonGeometry; |
| 107 | } | 139 | } |
| 108 | 140 | ||
| @@ -140,22 +172,40 @@ public: | @@ -140,22 +172,40 @@ public: | ||
| 140 | void Create( Application& application ) | 172 | void Create( Application& application ) |
| 141 | { | 173 | { |
| 142 | Stage stage = Stage::GetCurrent(); | 174 | Stage stage = Stage::GetCurrent(); |
| 175 | + | ||
| 176 | + CreateRadioButtons(); | ||
| 177 | + | ||
| 143 | stage.KeyEventSignal().Connect(this, &ExampleController::OnKeyEvent); | 178 | stage.KeyEventSignal().Connect(this, &ExampleController::OnKeyEvent); |
| 144 | 179 | ||
| 145 | mStageSize = stage.GetSize(); | 180 | mStageSize = stage.GetSize(); |
| 146 | 181 | ||
| 147 | // The Init signal is received once (only) during the Application lifetime | 182 | // The Init signal is received once (only) during the Application lifetime |
| 183 | + ReInitialise( Geometry::LINES ); | ||
| 148 | 184 | ||
| 149 | // Hide the indicator bar | 185 | // Hide the indicator bar |
| 150 | application.GetWindow().ShowIndicator( Dali::Window::INVISIBLE ); | 186 | application.GetWindow().ShowIndicator( Dali::Window::INVISIBLE ); |
| 151 | 187 | ||
| 152 | - mShader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER ); | 188 | + stage.SetBackgroundColor(Vector4(0.0f, 0.2f, 0.2f, 1.0f)); |
| 189 | + } | ||
| 153 | 190 | ||
| 154 | - mMaterial = Material::New( mShader ); | 191 | + /** |
| 192 | + * Invoked whenever application changes the type of geometry drawn | ||
| 193 | + * @param[in] type of geometry | ||
| 194 | + */ | ||
| 195 | + void ReInitialise( Geometry::GeometryType geometryType ) | ||
| 196 | + { | ||
| 197 | + Stage stage = Stage::GetCurrent(); | ||
| 155 | 198 | ||
| 156 | - mGeometry = CreateGeometry(); | 199 | + // destroy mesh actor and its resources if already exists |
| 200 | + if( mMeshActor ) | ||
| 201 | + { | ||
| 202 | + stage.Remove( mMeshActor ); | ||
| 203 | + mMeshActor.Reset(); | ||
| 204 | + } | ||
| 157 | 205 | ||
| 158 | - mRenderer = Renderer::New( mGeometry, mMaterial ); | 206 | + mShader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER ); |
| 207 | + mGeometry = CreateGeometry(); | ||
| 208 | + mRenderer = Renderer::New( mGeometry, mShader ); | ||
| 159 | 209 | ||
| 160 | mMeshActor = Actor::New(); | 210 | mMeshActor = Actor::New(); |
| 161 | mMeshActor.AddRenderer( mRenderer ); | 211 | mMeshActor.AddRenderer( mRenderer ); |
| @@ -177,8 +227,48 @@ public: | @@ -177,8 +227,48 @@ public: | ||
| 177 | animation.AnimateBetween( Property( mMeshActor, morphAmountIndex ), keyFrames, AlphaFunction(AlphaFunction::SIN) ); | 227 | animation.AnimateBetween( Property( mMeshActor, morphAmountIndex ), keyFrames, AlphaFunction(AlphaFunction::SIN) ); |
| 178 | animation.SetLooping(true); | 228 | animation.SetLooping(true); |
| 179 | animation.Play(); | 229 | animation.Play(); |
| 230 | + } | ||
| 180 | 231 | ||
| 181 | - stage.SetBackgroundColor(Vector4(0.0f, 0.2f, 0.2f, 1.0f)); | 232 | + /** |
| 233 | + * Invoked on create | ||
| 234 | + */ | ||
| 235 | + void CreateRadioButtons() | ||
| 236 | + { | ||
| 237 | + Stage stage = Stage::GetCurrent(); | ||
| 238 | + | ||
| 239 | + Toolkit::TableView modeSelectTableView = Toolkit::TableView::New( 3, 1 ); | ||
| 240 | + modeSelectTableView.SetParentOrigin( ParentOrigin::TOP_LEFT ); | ||
| 241 | + modeSelectTableView.SetAnchorPoint( AnchorPoint::TOP_LEFT ); | ||
| 242 | + modeSelectTableView.SetFitHeight( 0 ); | ||
| 243 | + modeSelectTableView.SetFitHeight( 1 ); | ||
| 244 | + modeSelectTableView.SetFitHeight( 2 ); | ||
| 245 | + modeSelectTableView.SetCellPadding( Vector2( 6.0f, 0.0f ) ); | ||
| 246 | + modeSelectTableView.SetScale( Vector3( 0.5f, 0.5f, 0.5f )); | ||
| 247 | + | ||
| 248 | + const char* labels[] = | ||
| 249 | + { | ||
| 250 | + "LINES", | ||
| 251 | + "LINE_LOOP", | ||
| 252 | + "LINE_STRIP" | ||
| 253 | + }; | ||
| 254 | + | ||
| 255 | + for( int i = 0; i < 3; ++i ) | ||
| 256 | + { | ||
| 257 | + Property::Map labelMap; | ||
| 258 | + labelMap[ "text" ] = labels[i]; | ||
| 259 | + labelMap[ "textColor" ] = Vector4( 0.8f, 0.8f, 0.8f, 1.0f ); | ||
| 260 | + | ||
| 261 | + Dali::Toolkit::RadioButton radio = Dali::Toolkit::RadioButton::New(); | ||
| 262 | + | ||
| 263 | + radio.SetProperty( Dali::Toolkit::RadioButton::Property::LABEL, labelMap ); | ||
| 264 | + radio.SetParentOrigin( ParentOrigin::TOP_LEFT ); | ||
| 265 | + radio.SetAnchorPoint( AnchorPoint::TOP_LEFT ); | ||
| 266 | + radio.SetSelected( i == 0 ); | ||
| 267 | + radio.PressedSignal().Connect( this, &ExampleController::OnButtonPressed ); | ||
| 268 | + mButtons[i] = radio; | ||
| 269 | + modeSelectTableView.AddChild( radio, Toolkit::TableView::CellPosition( i, 0 ) ); | ||
| 270 | + } | ||
| 271 | + stage.Add(modeSelectTableView); | ||
| 182 | } | 272 | } |
| 183 | 273 | ||
| 184 | /** | 274 | /** |
| @@ -203,16 +293,48 @@ public: | @@ -203,16 +293,48 @@ public: | ||
| 203 | } | 293 | } |
| 204 | } | 294 | } |
| 205 | 295 | ||
| 296 | + bool OnButtonPressed( Toolkit::Button button ) | ||
| 297 | + { | ||
| 298 | + const Geometry::GeometryType geomTypes[] = | ||
| 299 | + { | ||
| 300 | + Geometry::LINES, | ||
| 301 | + Geometry::LINE_LOOP, | ||
| 302 | + Geometry::LINE_STRIP | ||
| 303 | + }; | ||
| 304 | + | ||
| 305 | + size_t index; | ||
| 306 | + if( button == mButtons[0] ) | ||
| 307 | + { | ||
| 308 | + index = 0; | ||
| 309 | + } | ||
| 310 | + else if( button == mButtons[1] ) | ||
| 311 | + { | ||
| 312 | + index = 1; | ||
| 313 | + } | ||
| 314 | + else | ||
| 315 | + { | ||
| 316 | + index = 2; | ||
| 317 | + } | ||
| 318 | + | ||
| 319 | + PropertyBuffer indices = CreateIndexBuffer( geomTypes[ index ] ); | ||
| 320 | + mGeometry.SetIndexBuffer( indices ); | ||
| 321 | + mGeometry.SetGeometryType( geomTypes[ index ] ); | ||
| 322 | + | ||
| 323 | + return true; | ||
| 324 | + } | ||
| 325 | + | ||
| 326 | + | ||
| 327 | + | ||
| 206 | private: | 328 | private: |
| 207 | 329 | ||
| 208 | Application& mApplication; ///< Application instance | 330 | Application& mApplication; ///< Application instance |
| 209 | Vector3 mStageSize; ///< The size of the stage | 331 | Vector3 mStageSize; ///< The size of the stage |
| 210 | 332 | ||
| 211 | Shader mShader; | 333 | Shader mShader; |
| 212 | - Material mMaterial; | ||
| 213 | Geometry mGeometry; | 334 | Geometry mGeometry; |
| 214 | Renderer mRenderer; | 335 | Renderer mRenderer; |
| 215 | Actor mMeshActor; | 336 | Actor mMeshActor; |
| 337 | + Toolkit::RadioButton mButtons[3]; | ||
| 216 | }; | 338 | }; |
| 217 | 339 | ||
| 218 | void RunTest( Application& application ) | 340 | void RunTest( Application& application ) |
| @@ -224,7 +346,7 @@ void RunTest( Application& application ) | @@ -224,7 +346,7 @@ void RunTest( Application& application ) | ||
| 224 | 346 | ||
| 225 | // Entry point for Linux & SLP applications | 347 | // Entry point for Linux & SLP applications |
| 226 | // | 348 | // |
| 227 | -int main( int argc, char **argv ) | 349 | +int DALI_EXPORT_API main( int argc, char **argv ) |
| 228 | { | 350 | { |
| 229 | Application application = Application::New( &argc, &argv ); | 351 | Application application = Application::New( &argc, &argv ); |
| 230 | 352 |
examples/logging/logging-example.cpp
| @@ -710,7 +710,7 @@ void RunTest( Application& application ) | @@ -710,7 +710,7 @@ void RunTest( Application& application ) | ||
| 710 | 710 | ||
| 711 | // Entry point for Linux & Tizen applications | 711 | // Entry point for Linux & Tizen applications |
| 712 | // | 712 | // |
| 713 | -int main( int argc, char **argv ) | 713 | +int DALI_EXPORT_API main( int argc, char **argv ) |
| 714 | { | 714 | { |
| 715 | Application application = Application::New( &argc, &argv, DEMO_THEME_PATH ); | 715 | Application application = Application::New( &argc, &argv, DEMO_THEME_PATH ); |
| 716 | 716 |
examples/magnifier/magnifier-example.cpp
| @@ -411,7 +411,7 @@ void RunTest( Application& application ) | @@ -411,7 +411,7 @@ void RunTest( Application& application ) | ||
| 411 | 411 | ||
| 412 | // Entry point for Linux & Tizen applications | 412 | // Entry point for Linux & Tizen applications |
| 413 | // | 413 | // |
| 414 | -int main( int argc, char **argv ) | 414 | +int DALI_EXPORT_API main( int argc, char **argv ) |
| 415 | { | 415 | { |
| 416 | Application application = Application::New( &argc, &argv, DEMO_THEME_PATH ); | 416 | Application application = Application::New( &argc, &argv, DEMO_THEME_PATH ); |
| 417 | 417 |
examples/mesh-morph/mesh-morph-example.cpp
| @@ -292,11 +292,8 @@ public: | @@ -292,11 +292,8 @@ public: | ||
| 292 | application.GetWindow().ShowIndicator( Dali::Window::INVISIBLE ); | 292 | application.GetWindow().ShowIndicator( Dali::Window::INVISIBLE ); |
| 293 | 293 | ||
| 294 | mShader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER ); | 294 | mShader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER ); |
| 295 | - | ||
| 296 | - mMaterial = Material::New( mShader ); | ||
| 297 | mGeometry = CreateGeometry(); | 295 | mGeometry = CreateGeometry(); |
| 298 | - | ||
| 299 | - mRenderer = Renderer::New( mGeometry, mMaterial ); | 296 | + mRenderer = Renderer::New( mGeometry, mShader ); |
| 300 | 297 | ||
| 301 | mMeshActor = Actor::New(); | 298 | mMeshActor = Actor::New(); |
| 302 | mMeshActor.AddRenderer( mRenderer ); | 299 | mMeshActor.AddRenderer( mRenderer ); |
| @@ -346,7 +343,6 @@ private: | @@ -346,7 +343,6 @@ private: | ||
| 346 | Vector3 mStageSize; ///< The size of the stage | 343 | Vector3 mStageSize; ///< The size of the stage |
| 347 | 344 | ||
| 348 | Shader mShader; | 345 | Shader mShader; |
| 349 | - Material mMaterial; | ||
| 350 | Geometry mGeometry; | 346 | Geometry mGeometry; |
| 351 | Renderer mRenderer; | 347 | Renderer mRenderer; |
| 352 | Actor mMeshActor; | 348 | Actor mMeshActor; |
| @@ -362,7 +358,7 @@ void RunTest( Application& application ) | @@ -362,7 +358,7 @@ void RunTest( Application& application ) | ||
| 362 | 358 | ||
| 363 | // Entry point for Linux & SLP applications | 359 | // Entry point for Linux & SLP applications |
| 364 | // | 360 | // |
| 365 | -int main( int argc, char **argv ) | 361 | +int DALI_EXPORT_API main( int argc, char **argv ) |
| 366 | { | 362 | { |
| 367 | Application application = Application::New( &argc, &argv ); | 363 | Application application = Application::New( &argc, &argv ); |
| 368 | 364 |
examples/mesh-sorting/mesh-sorting-example.cpp
| @@ -30,7 +30,7 @@ using namespace Dali; | @@ -30,7 +30,7 @@ using namespace Dali; | ||
| 30 | namespace | 30 | namespace |
| 31 | { | 31 | { |
| 32 | 32 | ||
| 33 | -const char* MATERIAL_SAMPLES[] = | 33 | +const char* IMAGES[] = |
| 34 | { | 34 | { |
| 35 | DEMO_IMAGE_DIR "people-medium-1.jpg", | 35 | DEMO_IMAGE_DIR "people-medium-1.jpg", |
| 36 | DEMO_IMAGE_DIR "people-medium-4.jpg", | 36 | DEMO_IMAGE_DIR "people-medium-4.jpg", |
| @@ -39,7 +39,7 @@ const char* MATERIAL_SAMPLES[] = | @@ -39,7 +39,7 @@ const char* MATERIAL_SAMPLES[] = | ||
| 39 | DEMO_IMAGE_DIR "people-medium-15.jpg", | 39 | DEMO_IMAGE_DIR "people-medium-15.jpg", |
| 40 | DEMO_IMAGE_DIR "people-medium-6.jpg", | 40 | DEMO_IMAGE_DIR "people-medium-6.jpg", |
| 41 | }; | 41 | }; |
| 42 | -const unsigned int NUMBER_OF_SAMPLES(sizeof(MATERIAL_SAMPLES)/sizeof(const char*)); | 42 | +const unsigned int NUMBER_OF_SAMPLES(sizeof(IMAGES)/sizeof(const char*)); |
| 43 | 43 | ||
| 44 | 44 | ||
| 45 | #define MAKE_SHADER(A)#A | 45 | #define MAKE_SHADER(A)#A |
| @@ -164,16 +164,17 @@ public: | @@ -164,16 +164,17 @@ public: | ||
| 164 | mShader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER ); | 164 | mShader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER ); |
| 165 | mGeometry = CreateGeometry(); | 165 | mGeometry = CreateGeometry(); |
| 166 | 166 | ||
| 167 | - Material firstMat; | 167 | + TextureSet firstTextureSet; |
| 168 | 168 | ||
| 169 | for( unsigned i=0; i<NUMBER_OF_SAMPLES; ++i) | 169 | for( unsigned i=0; i<NUMBER_OF_SAMPLES; ++i) |
| 170 | { | 170 | { |
| 171 | - Image image = ResourceImage::New( MATERIAL_SAMPLES[i] ); | ||
| 172 | - Material material = Material::New( mShader ); | ||
| 173 | - material.AddTexture(image, "sTexture"); | ||
| 174 | - if( i==0 ) { firstMat = material; } | 171 | + Image image = ResourceImage::New( IMAGES[i] ); |
| 172 | + TextureSet textureSet = TextureSet::New(); | ||
| 173 | + textureSet.SetImage( 0u, image ); | ||
| 174 | + if( i==0 ) { firstTextureSet = textureSet; } | ||
| 175 | 175 | ||
| 176 | - Renderer renderer = Renderer::New( mGeometry, material ); | 176 | + Renderer renderer = Renderer::New( mGeometry, mShader ); |
| 177 | + renderer.SetTextures( textureSet ); | ||
| 177 | Actor meshActor = Actor::New(); | 178 | Actor meshActor = Actor::New(); |
| 178 | mActors[i] = meshActor; | 179 | mActors[i] = meshActor; |
| 179 | meshActor.AddRenderer( renderer ); | 180 | meshActor.AddRenderer( renderer ); |
| @@ -197,7 +198,7 @@ public: | @@ -197,7 +198,7 @@ public: | ||
| 197 | stage.Add( meshActor ); | 198 | stage.Add( meshActor ); |
| 198 | } | 199 | } |
| 199 | 200 | ||
| 200 | - mActors[NUMBER_OF_SAMPLES-2].GetRendererAt(0).SetMaterial( firstMat ); | 201 | + mActors[NUMBER_OF_SAMPLES-2].GetRendererAt(0).SetTextures( firstTextureSet ); |
| 201 | 202 | ||
| 202 | stage.GetRootLayer().TouchedSignal().Connect(this, &ExampleController::OnStageTouched); | 203 | stage.GetRootLayer().TouchedSignal().Connect(this, &ExampleController::OnStageTouched); |
| 203 | } | 204 | } |
| @@ -335,7 +336,7 @@ void RunTest( Application& application ) | @@ -335,7 +336,7 @@ void RunTest( Application& application ) | ||
| 335 | 336 | ||
| 336 | // Entry point for Linux & SLP applications | 337 | // Entry point for Linux & SLP applications |
| 337 | // | 338 | // |
| 338 | -int main( int argc, char **argv ) | 339 | +int DALI_EXPORT_API main( int argc, char **argv ) |
| 339 | { | 340 | { |
| 340 | Application application = Application::New( &argc, &argv ); | 341 | Application application = Application::New( &argc, &argv ); |
| 341 | 342 |
examples/metaball-explosion/metaball-explosion-example.cpp
| @@ -474,9 +474,10 @@ void MetaballExplosionController::CreateMetaballActors() | @@ -474,9 +474,10 @@ void MetaballExplosionController::CreateMetaballActors() | ||
| 474 | //Create the shader for the metaballs | 474 | //Create the shader for the metaballs |
| 475 | Shader shader = Shader::New( METABALL_VERTEX_SHADER, METABALL_FRAG_SHADER ); | 475 | Shader shader = Shader::New( METABALL_VERTEX_SHADER, METABALL_FRAG_SHADER ); |
| 476 | 476 | ||
| 477 | - Material material = Material::New( shader ); | ||
| 478 | Geometry metaballGeom = CreateGeometry(); | 477 | Geometry metaballGeom = CreateGeometry(); |
| 479 | - | 478 | + Renderer renderer = Renderer::New( metaballGeom, shader ); |
| 479 | + renderer.SetProperty( Renderer::Property::BLENDING_MODE, BlendingMode::ON ); | ||
| 480 | + renderer.SetBlendFunc(BlendingFactor::ONE, BlendingFactor::ONE, BlendingFactor::ONE, BlendingFactor::ONE); | ||
| 480 | //Initialization of each of the metaballs | 481 | //Initialization of each of the metaballs |
| 481 | for( int i = 0; i < METABALL_NUMBER; i++ ) | 482 | for( int i = 0; i < METABALL_NUMBER; i++ ) |
| 482 | { | 483 | { |
| @@ -487,11 +488,6 @@ void MetaballExplosionController::CreateMetaballActors() | @@ -487,11 +488,6 @@ void MetaballExplosionController::CreateMetaballActors() | ||
| 487 | mMetaballs[i].actor.SetName("Metaball"); | 488 | mMetaballs[i].actor.SetName("Metaball"); |
| 488 | mMetaballs[i].actor.SetScale( 1.0f ); | 489 | mMetaballs[i].actor.SetScale( 1.0f ); |
| 489 | mMetaballs[i].actor.SetParentOrigin( ParentOrigin::CENTER ); | 490 | mMetaballs[i].actor.SetParentOrigin( ParentOrigin::CENTER ); |
| 490 | - | ||
| 491 | - Renderer renderer = Renderer::New( metaballGeom, material ); | ||
| 492 | - renderer.SetProperty( Renderer::Property::BLENDING_MODE, BlendingMode::ON ); | ||
| 493 | - renderer.SetBlendFunc(BlendingFactor::ONE, BlendingFactor::ONE, BlendingFactor::ONE, BlendingFactor::ONE); | ||
| 494 | - | ||
| 495 | mMetaballs[i].actor.AddRenderer( renderer ); | 491 | mMetaballs[i].actor.AddRenderer( renderer ); |
| 496 | 492 | ||
| 497 | mMetaballs[i].positionIndex = mMetaballs[i].actor.RegisterProperty( "uPositionMetaball", mMetaballs[i].position ); | 493 | mMetaballs[i].positionIndex = mMetaballs[i].actor.RegisterProperty( "uPositionMetaball", mMetaballs[i].position ); |
| @@ -557,17 +553,17 @@ void MetaballExplosionController::AddRefractionImage() | @@ -557,17 +553,17 @@ void MetaballExplosionController::AddRefractionImage() | ||
| 557 | 553 | ||
| 558 | //Create new shader | 554 | //Create new shader |
| 559 | Shader shader = Shader::New( METABALL_VERTEX_SHADER, REFRACTION_FRAG_SHADER ); | 555 | Shader shader = Shader::New( METABALL_VERTEX_SHADER, REFRACTION_FRAG_SHADER ); |
| 560 | - //Create new material | ||
| 561 | - Material material = Material::New( shader ); | ||
| 562 | 556 | ||
| 563 | - //Add Textures | ||
| 564 | - material.AddTexture(mBackImage, "sTexture"); | ||
| 565 | - material.AddTexture(fbo, "sEffect"); | 557 | + //Create new texture set |
| 558 | + TextureSet textureSet = TextureSet::New(); | ||
| 559 | + textureSet.SetImage( 0u, mBackImage ); | ||
| 560 | + textureSet.SetImage( 1u, fbo ); | ||
| 566 | 561 | ||
| 567 | //Create geometry | 562 | //Create geometry |
| 568 | Geometry metaballGeom = CreateGeometryComposition(); | 563 | Geometry metaballGeom = CreateGeometryComposition(); |
| 569 | 564 | ||
| 570 | - Renderer mRenderer = Renderer::New( metaballGeom, material ); | 565 | + Renderer mRenderer = Renderer::New( metaballGeom, shader ); |
| 566 | + mRenderer.SetTextures( textureSet ); | ||
| 571 | 567 | ||
| 572 | mCompositionActor = Actor::New( ); | 568 | mCompositionActor = Actor::New( ); |
| 573 | mCompositionActor.SetParentOrigin(ParentOrigin::CENTER); | 569 | mCompositionActor.SetParentOrigin(ParentOrigin::CENTER); |
| @@ -753,7 +749,7 @@ void RunTest( Application& application ) | @@ -753,7 +749,7 @@ void RunTest( Application& application ) | ||
| 753 | 749 | ||
| 754 | // Entry point for Linux & Tizen applications | 750 | // Entry point for Linux & Tizen applications |
| 755 | // | 751 | // |
| 756 | -int main( int argc, char **argv ) | 752 | +int DALI_EXPORT_API main( int argc, char **argv ) |
| 757 | { | 753 | { |
| 758 | Application application = Application::New( &argc, &argv ); | 754 | Application application = Application::New( &argc, &argv ); |
| 759 | 755 |
examples/metaball-refrac/metaball-refrac-example.cpp
| @@ -196,8 +196,10 @@ private: | @@ -196,8 +196,10 @@ private: | ||
| 196 | Vector2 mGravityVar; | 196 | Vector2 mGravityVar; |
| 197 | 197 | ||
| 198 | Renderer mRendererRefraction; | 198 | Renderer mRendererRefraction; |
| 199 | - Material mMaterialRefraction; | ||
| 200 | - Material mMaterialNormal; | 199 | + TextureSet mTextureSetRefraction; |
| 200 | + Shader mShaderRefraction; | ||
| 201 | + TextureSet mTextureSetNormal; | ||
| 202 | + Shader mShaderNormal; | ||
| 201 | 203 | ||
| 202 | //Animations | 204 | //Animations |
| 203 | Animation mGravityAnimation[METABALL_NUMBER]; | 205 | Animation mGravityAnimation[METABALL_NUMBER]; |
| @@ -444,13 +446,12 @@ void MetaballRefracController::CreateMetaballActors() | @@ -444,13 +446,12 @@ void MetaballRefracController::CreateMetaballActors() | ||
| 444 | //With MeshData Textured | 446 | //With MeshData Textured |
| 445 | float aspect = (float)mScreenSize.y / (float)mScreenSize.x; | 447 | float aspect = (float)mScreenSize.y / (float)mScreenSize.x; |
| 446 | 448 | ||
| 447 | - //Create the shader for the metaballs | ||
| 448 | - | 449 | + //Create the renderer for the metaballs |
| 449 | Shader shader = Shader::New( METABALL_VERTEX_SHADER, METABALL_FRAG_SHADER ); | 450 | Shader shader = Shader::New( METABALL_VERTEX_SHADER, METABALL_FRAG_SHADER ); |
| 450 | - | ||
| 451 | - Material material = Material::New( shader ); | ||
| 452 | - | ||
| 453 | Geometry metaballGeom = CreateGeometry(); | 451 | Geometry metaballGeom = CreateGeometry(); |
| 452 | + Renderer renderer = Renderer::New( metaballGeom, shader ); | ||
| 453 | + renderer.SetProperty( Renderer::Property::BLENDING_MODE, BlendingMode::ON ); | ||
| 454 | + renderer.SetBlendFunc(BlendingFactor::ONE, BlendingFactor::ONE, BlendingFactor::ONE, BlendingFactor::ONE); | ||
| 454 | 455 | ||
| 455 | //Each metaball has a different radius | 456 | //Each metaball has a different radius |
| 456 | mMetaballs[0].radius = mMetaballs[0].initRadius = 0.0145f; | 457 | mMetaballs[0].radius = mMetaballs[0].initRadius = 0.0145f; |
| @@ -468,9 +469,7 @@ void MetaballRefracController::CreateMetaballActors() | @@ -468,9 +469,7 @@ void MetaballRefracController::CreateMetaballActors() | ||
| 468 | mMetaballs[i].actor.SetScale( 1.0f ); | 469 | mMetaballs[i].actor.SetScale( 1.0f ); |
| 469 | mMetaballs[i].actor.SetParentOrigin( ParentOrigin::CENTER ); | 470 | mMetaballs[i].actor.SetParentOrigin( ParentOrigin::CENTER ); |
| 470 | 471 | ||
| 471 | - Renderer renderer = Renderer::New( metaballGeom, material ); | ||
| 472 | - renderer.SetProperty( Renderer::Property::BLENDING_MODE, BlendingMode::ON ); | ||
| 473 | - renderer.SetBlendFunc(BlendingFactor::ONE, BlendingFactor::ONE, BlendingFactor::ONE, BlendingFactor::ONE); | 472 | + |
| 474 | mMetaballs[i].actor.AddRenderer( renderer ); | 473 | mMetaballs[i].actor.AddRenderer( renderer ); |
| 475 | 474 | ||
| 476 | mMetaballs[i].positionIndex = mMetaballs[i].actor.RegisterProperty( "uPositionMetaball", mMetaballs[i].position ); | 475 | mMetaballs[i].positionIndex = mMetaballs[i].actor.RegisterProperty( "uPositionMetaball", mMetaballs[i].position ); |
| @@ -536,22 +535,19 @@ void MetaballRefracController::AddRefractionImage() | @@ -536,22 +535,19 @@ void MetaballRefracController::AddRefractionImage() | ||
| 536 | Geometry metaballGeom = CreateGeometryComposition(); | 535 | Geometry metaballGeom = CreateGeometryComposition(); |
| 537 | 536 | ||
| 538 | //Create Refraction shader and renderer | 537 | //Create Refraction shader and renderer |
| 539 | - Shader shader = Shader::New( METABALL_VERTEX_SHADER, REFRACTION_FRAG_SHADER ); | ||
| 540 | - //Create new material | ||
| 541 | - mMaterialRefraction = Material::New( shader ); | 538 | + mShaderRefraction = Shader::New( METABALL_VERTEX_SHADER, REFRACTION_FRAG_SHADER ); |
| 542 | 539 | ||
| 543 | - //Add Textures | ||
| 544 | - mMaterialRefraction.AddTexture(mBackImage, "sTexture"); | ||
| 545 | - mMaterialRefraction.AddTexture(mMetaballFBO, "sEffect"); | 540 | + //Create new texture set |
| 541 | + mTextureSetRefraction = TextureSet::New(); | ||
| 542 | + mTextureSetRefraction.SetImage( 0u, mBackImage ); | ||
| 543 | + mTextureSetRefraction.SetImage( 1u, mMetaballFBO ); | ||
| 546 | 544 | ||
| 547 | //Create normal shader | 545 | //Create normal shader |
| 548 | - Shader shaderNormal = Shader::New( METABALL_VERTEX_SHADER, FRAG_SHADER ); | ||
| 549 | - //Create new material | ||
| 550 | - mMaterialNormal = Material::New( shaderNormal ); | ||
| 551 | - | ||
| 552 | - //Add samplers | ||
| 553 | - mMaterialNormal.AddTexture(mBackImage, "sTexture"); | 546 | + mShaderNormal = Shader::New( METABALL_VERTEX_SHADER, FRAG_SHADER ); |
| 554 | 547 | ||
| 548 | + //Create new texture set | ||
| 549 | + mTextureSetNormal = TextureSet::New(); | ||
| 550 | + mTextureSetNormal.SetImage( 0u, mBackImage ); | ||
| 555 | 551 | ||
| 556 | //Create actor | 552 | //Create actor |
| 557 | mCompositionActor = Actor::New( ); | 553 | mCompositionActor = Actor::New( ); |
| @@ -559,8 +555,8 @@ void MetaballRefracController::AddRefractionImage() | @@ -559,8 +555,8 @@ void MetaballRefracController::AddRefractionImage() | ||
| 559 | mCompositionActor.SetPosition(Vector3(0.0f, 0.0f, 0.0f)); | 555 | mCompositionActor.SetPosition(Vector3(0.0f, 0.0f, 0.0f)); |
| 560 | mCompositionActor.SetSize(mScreenSize.x, mScreenSize.y); | 556 | mCompositionActor.SetSize(mScreenSize.x, mScreenSize.y); |
| 561 | 557 | ||
| 562 | - | ||
| 563 | - mRendererRefraction = Renderer::New( metaballGeom, mMaterialNormal ); | 558 | + mRendererRefraction = Renderer::New( metaballGeom, mShaderNormal ); |
| 559 | + mRendererRefraction.SetTextures( mTextureSetNormal ); | ||
| 564 | mCompositionActor.AddRenderer( mRendererRefraction ); | 560 | mCompositionActor.AddRenderer( mRendererRefraction ); |
| 565 | 561 | ||
| 566 | Stage stage = Stage::GetCurrent(); | 562 | Stage stage = Stage::GetCurrent(); |
| @@ -743,7 +739,8 @@ void MetaballRefracController::StopAfterClickAnimations() | @@ -743,7 +739,8 @@ void MetaballRefracController::StopAfterClickAnimations() | ||
| 743 | */ | 739 | */ |
| 744 | void MetaballRefracController::ResetMetaballsState() | 740 | void MetaballRefracController::ResetMetaballsState() |
| 745 | { | 741 | { |
| 746 | - mRendererRefraction.SetMaterial(mMaterialNormal); | 742 | + mRendererRefraction.SetTextures(mTextureSetNormal); |
| 743 | + mRendererRefraction.SetShader( mShaderNormal ); | ||
| 747 | 744 | ||
| 748 | for (int i = 0 ; i < METABALL_NUMBER ; i++) | 745 | for (int i = 0 ; i < METABALL_NUMBER ; i++) |
| 749 | { | 746 | { |
| @@ -785,8 +782,8 @@ bool MetaballRefracController::OnTouch( Actor actor, const TouchEvent& touch ) | @@ -785,8 +782,8 @@ bool MetaballRefracController::OnTouch( Actor actor, const TouchEvent& touch ) | ||
| 785 | mRadiusVarAnimation[3].Play(); | 782 | mRadiusVarAnimation[3].Play(); |
| 786 | 783 | ||
| 787 | //We draw with the refraction-composition shader | 784 | //We draw with the refraction-composition shader |
| 788 | - mRendererRefraction.SetMaterial(mMaterialRefraction); | ||
| 789 | - | 785 | + mRendererRefraction.SetTextures(mTextureSetRefraction); |
| 786 | + mRendererRefraction.SetShader( mShaderRefraction ); | ||
| 790 | mCurrentTouchPosition = point.screen; | 787 | mCurrentTouchPosition = point.screen; |
| 791 | 788 | ||
| 792 | //we use the click position for the metaballs | 789 | //we use the click position for the metaballs |
| @@ -866,7 +863,7 @@ void RunTest( Application& application ) | @@ -866,7 +863,7 @@ void RunTest( Application& application ) | ||
| 866 | 863 | ||
| 867 | // Entry point for Linux & Tizen applications | 864 | // Entry point for Linux & Tizen applications |
| 868 | // | 865 | // |
| 869 | -int main( int argc, char **argv ) | 866 | +int DALI_EXPORT_API main( int argc, char **argv ) |
| 870 | { | 867 | { |
| 871 | Application application = Application::New( &argc, &argv ); | 868 | Application application = Application::New( &argc, &argv ); |
| 872 | 869 |
examples/model3d-view/model3d-view-example.cpp
| @@ -306,7 +306,7 @@ void RunTest( Application& application ) | @@ -306,7 +306,7 @@ void RunTest( Application& application ) | ||
| 306 | 306 | ||
| 307 | // Entry point for Linux & Tizen applications | 307 | // Entry point for Linux & Tizen applications |
| 308 | // | 308 | // |
| 309 | -int main( int argc, char **argv ) | 309 | +int DALI_EXPORT_API main( int argc, char **argv ) |
| 310 | { | 310 | { |
| 311 | Application application = Application::New( &argc, &argv ); | 311 | Application application = Application::New( &argc, &argv ); |
| 312 | 312 |
examples/motion-blur/motion-blur-example.cpp
| @@ -558,7 +558,7 @@ void RunTest(Application& app) | @@ -558,7 +558,7 @@ void RunTest(Application& app) | ||
| 558 | 558 | ||
| 559 | // Entry point for Linux & Tizen applications | 559 | // Entry point for Linux & Tizen applications |
| 560 | // | 560 | // |
| 561 | -int main(int argc, char **argv) | 561 | +int DALI_EXPORT_API main(int argc, char **argv) |
| 562 | { | 562 | { |
| 563 | Application app = Application::New(&argc, &argv, DEMO_THEME_PATH); | 563 | Application app = Application::New(&argc, &argv, DEMO_THEME_PATH); |
| 564 | 564 |
examples/motion-stretch/motion-stretch-example.cpp
| @@ -441,7 +441,7 @@ void RunTest(Application& app) | @@ -441,7 +441,7 @@ void RunTest(Application& app) | ||
| 441 | 441 | ||
| 442 | // Entry point for Linux & Tizen applications | 442 | // Entry point for Linux & Tizen applications |
| 443 | // | 443 | // |
| 444 | -int main(int argc, char **argv) | 444 | +int DALI_EXPORT_API main(int argc, char **argv) |
| 445 | { | 445 | { |
| 446 | Application app = Application::New(&argc, &argv, DEMO_THEME_PATH); | 446 | Application app = Application::New(&argc, &argv, DEMO_THEME_PATH); |
| 447 | 447 |
examples/native-image-source/native-image-source-example.cpp
| @@ -195,7 +195,7 @@ void RunTest( Application& application ) | @@ -195,7 +195,7 @@ void RunTest( Application& application ) | ||
| 195 | 195 | ||
| 196 | // Entry point for Linux & Tizen applications | 196 | // Entry point for Linux & Tizen applications |
| 197 | // | 197 | // |
| 198 | -int main( int argc, char **argv ) | 198 | +int DALI_EXPORT_API main( int argc, char **argv ) |
| 199 | { | 199 | { |
| 200 | Application application = Application::New( &argc, &argv ); | 200 | Application application = Application::New( &argc, &argv ); |
| 201 | 201 |
examples/new-window/new-window-example.cpp
| @@ -263,8 +263,7 @@ void NewWindowController::AddMeshActor( Actor& parentActor ) | @@ -263,8 +263,7 @@ void NewWindowController::AddMeshActor( Actor& parentActor ) | ||
| 263 | 263 | ||
| 264 | // Create a coloured mesh | 264 | // Create a coloured mesh |
| 265 | Shader shaderColorMesh = Shader::New( VERTEX_COLOR_MESH, FRAGMENT_COLOR_MESH ); | 265 | Shader shaderColorMesh = Shader::New( VERTEX_COLOR_MESH, FRAGMENT_COLOR_MESH ); |
| 266 | - Material colorMeshmaterial = Material::New( shaderColorMesh ); | ||
| 267 | - Renderer colorMeshRenderer = Renderer::New( meshGeometry, colorMeshmaterial ); | 266 | + Renderer colorMeshRenderer = Renderer::New( meshGeometry, shaderColorMesh ); |
| 268 | 267 | ||
| 269 | Actor colorMeshActor = Actor::New(); | 268 | Actor colorMeshActor = Actor::New(); |
| 270 | colorMeshActor.AddRenderer( colorMeshRenderer ); | 269 | colorMeshActor.AddRenderer( colorMeshRenderer ); |
| @@ -278,9 +277,10 @@ void NewWindowController::AddMeshActor( Actor& parentActor ) | @@ -278,9 +277,10 @@ void NewWindowController::AddMeshActor( Actor& parentActor ) | ||
| 278 | // Create a textured mesh | 277 | // Create a textured mesh |
| 279 | Image effectImage = ResourceImage::New(EFFECT_IMAGE); | 278 | Image effectImage = ResourceImage::New(EFFECT_IMAGE); |
| 280 | Shader shaderTextureMesh = Shader::New( VERTEX_TEXTURE_MESH, FRAGMENT_TEXTURE_MESH ); | 279 | Shader shaderTextureMesh = Shader::New( VERTEX_TEXTURE_MESH, FRAGMENT_TEXTURE_MESH ); |
| 281 | - Material textureMeshMaterial = Material::New( shaderTextureMesh ); | ||
| 282 | - textureMeshMaterial.AddTexture(effectImage, "sTexture"); | ||
| 283 | - Renderer textureMeshRenderer = Renderer::New( meshGeometry, textureMeshMaterial ); | 280 | + TextureSet textureSet = TextureSet::New(); |
| 281 | + textureSet.SetImage( 0u, effectImage ); | ||
| 282 | + Renderer textureMeshRenderer = Renderer::New( meshGeometry, shaderTextureMesh ); | ||
| 283 | + textureMeshRenderer.SetTextures( textureSet ); | ||
| 284 | 284 | ||
| 285 | Actor textureMeshActor = Actor::New(); | 285 | Actor textureMeshActor = Actor::New(); |
| 286 | textureMeshActor.AddRenderer( textureMeshRenderer ); | 286 | textureMeshActor.AddRenderer( textureMeshRenderer ); |
| @@ -331,7 +331,7 @@ void NewWindowController::AddBlendingImageActor( Actor& parentActor ) | @@ -331,7 +331,7 @@ void NewWindowController::AddBlendingImageActor( Actor& parentActor ) | ||
| 331 | blendActor.SetSize(140, 140); | 331 | blendActor.SetSize(140, 140); |
| 332 | parentActor.Add(blendActor); | 332 | parentActor.Add(blendActor); |
| 333 | 333 | ||
| 334 | - blendActor.GetRendererAt(0u).GetMaterial().AddTexture(fb2, "sEffect"); | 334 | + blendActor.GetRendererAt(0u).GetTextures().SetImage( 1u, fb2 ); |
| 335 | } | 335 | } |
| 336 | 336 | ||
| 337 | void NewWindowController::AddTextLabel( Actor& parentActor ) | 337 | void NewWindowController::AddTextLabel( Actor& parentActor ) |
| @@ -561,7 +561,7 @@ void RunTest(Application& app) | @@ -561,7 +561,7 @@ void RunTest(Application& app) | ||
| 561 | 561 | ||
| 562 | // Entry point for Linux & Tizen applications | 562 | // Entry point for Linux & Tizen applications |
| 563 | // | 563 | // |
| 564 | -int main(int argc, char **argv) | 564 | +int DALI_EXPORT_API main(int argc, char **argv) |
| 565 | { | 565 | { |
| 566 | gApplication = Application::New(&argc, &argv, DEMO_THEME_PATH); | 566 | gApplication = Application::New(&argc, &argv, DEMO_THEME_PATH); |
| 567 | RunTest(gApplication); | 567 | RunTest(gApplication); |
examples/page-turn-view/page-turn-view-example.cpp
| @@ -353,7 +353,7 @@ void PageTurnController::OnPageFinishedPan( PageTurnView pageTurnView ) | @@ -353,7 +353,7 @@ void PageTurnController::OnPageFinishedPan( PageTurnView pageTurnView ) | ||
| 353 | } | 353 | } |
| 354 | 354 | ||
| 355 | // Entry point for applications | 355 | // Entry point for applications |
| 356 | -int main( int argc, char **argv ) | 356 | +int DALI_EXPORT_API main( int argc, char **argv ) |
| 357 | { | 357 | { |
| 358 | Application app = Application::New(&argc, &argv, DEMO_THEME_PATH); | 358 | Application app = Application::New(&argc, &argv, DEMO_THEME_PATH); |
| 359 | PageTurnController test ( app ); | 359 | PageTurnController test ( app ); |
examples/perf-scroll/perf-scroll.cpp
0 โ 100644
| 1 | +/* | ||
| 2 | + * Copyright (c) 2015 Samsung Electronics Co., Ltd. | ||
| 3 | + * | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + * | ||
| 16 | + */ | ||
| 17 | + | ||
| 18 | +#include <dali-toolkit/dali-toolkit.h> | ||
| 19 | +#include <dali/devel-api/rendering/renderer.h> | ||
| 20 | +#include <dali/devel-api/rendering/sampler.h> | ||
| 21 | +#include <dali/public-api/common/dali-common.h> | ||
| 22 | +#include <dali/integration-api/resource-policies.h> | ||
| 23 | +#include <dali/integration-api/debug.h> | ||
| 24 | +#include <iostream> | ||
| 25 | + | ||
| 26 | +using namespace Dali; | ||
| 27 | +using namespace Dali::Toolkit; | ||
| 28 | + | ||
| 29 | + | ||
| 30 | +namespace | ||
| 31 | +{ | ||
| 32 | +const char* IMAGE_PATH[] = { | ||
| 33 | + DEMO_IMAGE_DIR "gallery-medium-1.jpg", | ||
| 34 | + DEMO_IMAGE_DIR "gallery-medium-2.jpg", | ||
| 35 | + DEMO_IMAGE_DIR "gallery-medium-3.jpg", | ||
| 36 | + DEMO_IMAGE_DIR "gallery-medium-4.jpg", | ||
| 37 | + DEMO_IMAGE_DIR "gallery-medium-5.jpg", | ||
| 38 | + DEMO_IMAGE_DIR "gallery-medium-6.jpg", | ||
| 39 | + DEMO_IMAGE_DIR "gallery-medium-7.jpg", | ||
| 40 | + DEMO_IMAGE_DIR "gallery-medium-8.jpg", | ||
| 41 | + DEMO_IMAGE_DIR "gallery-medium-9.jpg", | ||
| 42 | + DEMO_IMAGE_DIR "gallery-medium-10.jpg", | ||
| 43 | + DEMO_IMAGE_DIR "gallery-medium-11.jpg", | ||
| 44 | + DEMO_IMAGE_DIR "gallery-medium-12.jpg", | ||
| 45 | + DEMO_IMAGE_DIR "gallery-medium-13.jpg", | ||
| 46 | + DEMO_IMAGE_DIR "gallery-medium-14.jpg", | ||
| 47 | + DEMO_IMAGE_DIR "gallery-medium-15.jpg", | ||
| 48 | + DEMO_IMAGE_DIR "gallery-medium-16.jpg", | ||
| 49 | + DEMO_IMAGE_DIR "gallery-medium-17.jpg", | ||
| 50 | + DEMO_IMAGE_DIR "gallery-medium-18.jpg", | ||
| 51 | + DEMO_IMAGE_DIR "gallery-medium-19.jpg", | ||
| 52 | + DEMO_IMAGE_DIR "gallery-medium-20.jpg", | ||
| 53 | + DEMO_IMAGE_DIR "gallery-medium-21.jpg", | ||
| 54 | + DEMO_IMAGE_DIR "gallery-medium-22.jpg", | ||
| 55 | + DEMO_IMAGE_DIR "gallery-medium-23.jpg", | ||
| 56 | + DEMO_IMAGE_DIR "gallery-medium-24.jpg", | ||
| 57 | + DEMO_IMAGE_DIR "gallery-medium-25.jpg", | ||
| 58 | + DEMO_IMAGE_DIR "gallery-medium-26.jpg", | ||
| 59 | + DEMO_IMAGE_DIR "gallery-medium-27.jpg", | ||
| 60 | + DEMO_IMAGE_DIR "gallery-medium-28.jpg", | ||
| 61 | + DEMO_IMAGE_DIR "gallery-medium-29.jpg", | ||
| 62 | + DEMO_IMAGE_DIR "gallery-medium-30.jpg", | ||
| 63 | + DEMO_IMAGE_DIR "gallery-medium-31.jpg", | ||
| 64 | + DEMO_IMAGE_DIR "gallery-medium-32.jpg", | ||
| 65 | + DEMO_IMAGE_DIR "gallery-medium-33.jpg", | ||
| 66 | + DEMO_IMAGE_DIR "gallery-medium-34.jpg", | ||
| 67 | + DEMO_IMAGE_DIR "gallery-medium-35.jpg", | ||
| 68 | + DEMO_IMAGE_DIR "gallery-medium-36.jpg", | ||
| 69 | + DEMO_IMAGE_DIR "gallery-medium-37.jpg", | ||
| 70 | + DEMO_IMAGE_DIR "gallery-medium-38.jpg", | ||
| 71 | + DEMO_IMAGE_DIR "gallery-medium-39.jpg", | ||
| 72 | + DEMO_IMAGE_DIR "gallery-medium-40.jpg", | ||
| 73 | + DEMO_IMAGE_DIR "gallery-medium-41.jpg", | ||
| 74 | + DEMO_IMAGE_DIR "gallery-medium-42.jpg", | ||
| 75 | + DEMO_IMAGE_DIR "gallery-medium-43.jpg", | ||
| 76 | + DEMO_IMAGE_DIR "gallery-medium-44.jpg", | ||
| 77 | + DEMO_IMAGE_DIR "gallery-medium-45.jpg", | ||
| 78 | + DEMO_IMAGE_DIR "gallery-medium-46.jpg", | ||
| 79 | + DEMO_IMAGE_DIR "gallery-medium-47.jpg", | ||
| 80 | + DEMO_IMAGE_DIR "gallery-medium-48.jpg", | ||
| 81 | + DEMO_IMAGE_DIR "gallery-medium-49.jpg", | ||
| 82 | + DEMO_IMAGE_DIR "gallery-medium-50.jpg", | ||
| 83 | + DEMO_IMAGE_DIR "gallery-medium-51.jpg", | ||
| 84 | + DEMO_IMAGE_DIR "gallery-medium-52.jpg", | ||
| 85 | + DEMO_IMAGE_DIR "gallery-medium-53.jpg", | ||
| 86 | +}; | ||
| 87 | + | ||
| 88 | +const char* NINEPATCH_IMAGE_PATH[] = { | ||
| 89 | + DEMO_IMAGE_DIR "selection-popup-bg.1.9.png", | ||
| 90 | + DEMO_IMAGE_DIR "selection-popup-bg.2.9.png", | ||
| 91 | + DEMO_IMAGE_DIR "selection-popup-bg.3.9.png", | ||
| 92 | + DEMO_IMAGE_DIR "selection-popup-bg.4.9.png", | ||
| 93 | + DEMO_IMAGE_DIR "selection-popup-bg.5.9.png", | ||
| 94 | + DEMO_IMAGE_DIR "selection-popup-bg.6.9.png", | ||
| 95 | + DEMO_IMAGE_DIR "selection-popup-bg.7.9.png", | ||
| 96 | + DEMO_IMAGE_DIR "selection-popup-bg.8.9.png", | ||
| 97 | + DEMO_IMAGE_DIR "selection-popup-bg.9.9.png", | ||
| 98 | + DEMO_IMAGE_DIR "selection-popup-bg.10.9.png", | ||
| 99 | + DEMO_IMAGE_DIR "selection-popup-bg.11.9.png", | ||
| 100 | + DEMO_IMAGE_DIR "selection-popup-bg.12.9.png", | ||
| 101 | + DEMO_IMAGE_DIR "selection-popup-bg.13.9.png", | ||
| 102 | + DEMO_IMAGE_DIR "selection-popup-bg.14.9.png", | ||
| 103 | + DEMO_IMAGE_DIR "selection-popup-bg.15.9.png", | ||
| 104 | + DEMO_IMAGE_DIR "selection-popup-bg.16.9.png", | ||
| 105 | + DEMO_IMAGE_DIR "selection-popup-bg.17.9.png", | ||
| 106 | + DEMO_IMAGE_DIR "selection-popup-bg.18.9.png", | ||
| 107 | + DEMO_IMAGE_DIR "selection-popup-bg.19.9.png", | ||
| 108 | + DEMO_IMAGE_DIR "selection-popup-bg.20.9.png", | ||
| 109 | + DEMO_IMAGE_DIR "selection-popup-bg.21.9.png", | ||
| 110 | + DEMO_IMAGE_DIR "selection-popup-bg.22.9.png", | ||
| 111 | + DEMO_IMAGE_DIR "selection-popup-bg.23.9.png", | ||
| 112 | + DEMO_IMAGE_DIR "selection-popup-bg.24.9.png", | ||
| 113 | + DEMO_IMAGE_DIR "selection-popup-bg.25.9.png", | ||
| 114 | + DEMO_IMAGE_DIR "selection-popup-bg.26.9.png", | ||
| 115 | + DEMO_IMAGE_DIR "selection-popup-bg.27.9.png", | ||
| 116 | + DEMO_IMAGE_DIR "selection-popup-bg.28.9.png", | ||
| 117 | + DEMO_IMAGE_DIR "selection-popup-bg.29.9.png", | ||
| 118 | + DEMO_IMAGE_DIR "selection-popup-bg.30.9.png", | ||
| 119 | + DEMO_IMAGE_DIR "selection-popup-bg.31.9.png", | ||
| 120 | + DEMO_IMAGE_DIR "selection-popup-bg.32.9.png", | ||
| 121 | + DEMO_IMAGE_DIR "selection-popup-bg.33.9.png", | ||
| 122 | + DEMO_IMAGE_DIR "button-disabled.9.png", | ||
| 123 | + DEMO_IMAGE_DIR "button-down.9.png", | ||
| 124 | + DEMO_IMAGE_DIR "button-down-disabled.9.png", | ||
| 125 | + DEMO_IMAGE_DIR "button-up-1.9.png", | ||
| 126 | + DEMO_IMAGE_DIR "button-up-2.9.png", | ||
| 127 | + DEMO_IMAGE_DIR "button-up-3.9.png", | ||
| 128 | + DEMO_IMAGE_DIR "button-up-4.9.png", | ||
| 129 | + DEMO_IMAGE_DIR "button-up-5.9.png", | ||
| 130 | + DEMO_IMAGE_DIR "button-up-6.9.png", | ||
| 131 | + DEMO_IMAGE_DIR "button-up-7.9.png", | ||
| 132 | + DEMO_IMAGE_DIR "button-up-8.9.png", | ||
| 133 | + DEMO_IMAGE_DIR "button-up-9.9.png", | ||
| 134 | + DEMO_IMAGE_DIR "button-up-10.9.png", | ||
| 135 | + DEMO_IMAGE_DIR "button-up-11.9.png", | ||
| 136 | + DEMO_IMAGE_DIR "button-up-12.9.png", | ||
| 137 | + DEMO_IMAGE_DIR "button-up-13.9.png", | ||
| 138 | + DEMO_IMAGE_DIR "button-up-14.9.png", | ||
| 139 | + DEMO_IMAGE_DIR "button-up-15.9.png", | ||
| 140 | + DEMO_IMAGE_DIR "button-up-16.9.png", | ||
| 141 | + DEMO_IMAGE_DIR "button-up-17.9.png", | ||
| 142 | +}; | ||
| 143 | + | ||
| 144 | +const unsigned int NUM_IMAGES = sizeof(IMAGE_PATH) / sizeof(char*); | ||
| 145 | +const unsigned int NUM_NINEPATCH_IMAGES = sizeof(NINEPATCH_IMAGE_PATH) / sizeof(char*); | ||
| 146 | + | ||
| 147 | +const float ANIMATION_TIME ( 5.0f ); // animation length in seconds | ||
| 148 | + | ||
| 149 | +struct VertexWithTexture | ||
| 150 | +{ | ||
| 151 | + Vector2 position; | ||
| 152 | + Vector2 texCoord; | ||
| 153 | +}; | ||
| 154 | + | ||
| 155 | +VertexWithTexture gQuadWithTexture[] = { | ||
| 156 | + { Vector2( -0.5f, -0.5f ), Vector2( 0.0f, 0.0f ) }, | ||
| 157 | + { Vector2( 0.5f, -0.5f ), Vector2( 1.0f, 0.0f ) }, | ||
| 158 | + { Vector2( -0.5f, 0.5f ), Vector2( 0.0f, 1.0f ) }, | ||
| 159 | + { Vector2( 0.5f, 0.5f ), Vector2( 1.0f, 1.0f ) } | ||
| 160 | +}; | ||
| 161 | + | ||
| 162 | +const char* VERTEX_SHADER_TEXTURE = DALI_COMPOSE_SHADER( | ||
| 163 | + attribute mediump vec2 aPosition;\n | ||
| 164 | + attribute mediump vec2 aTexCoord;\n | ||
| 165 | + uniform mediump mat4 uMvpMatrix;\n | ||
| 166 | + uniform mediump vec3 uSize;\n | ||
| 167 | + varying mediump vec2 vTexCoord;\n | ||
| 168 | + void main()\n | ||
| 169 | + {\n | ||
| 170 | + vec4 position = vec4(aPosition,0.0,1.0)*vec4(uSize,1.0);\n | ||
| 171 | + gl_Position = uMvpMatrix * position;\n | ||
| 172 | + vTexCoord = aTexCoord;\n | ||
| 173 | + }\n | ||
| 174 | +); | ||
| 175 | + | ||
| 176 | +const char* FRAGMENT_SHADER_TEXTURE = DALI_COMPOSE_SHADER( | ||
| 177 | + uniform lowp vec4 uColor;\n | ||
| 178 | + uniform sampler2D sTexture;\n | ||
| 179 | + varying mediump vec2 vTexCoord;\n | ||
| 180 | + | ||
| 181 | + void main()\n | ||
| 182 | + {\n | ||
| 183 | + gl_FragColor = texture2D( sTexture, vTexCoord ) * uColor;\n | ||
| 184 | + }\n | ||
| 185 | +); | ||
| 186 | + | ||
| 187 | + | ||
| 188 | +Geometry& QuadMesh() | ||
| 189 | +{ | ||
| 190 | + static Geometry mesh; | ||
| 191 | + if( !mesh ) | ||
| 192 | + { | ||
| 193 | + PropertyBuffer vertexBuffer; | ||
| 194 | + Property::Map vertexFormat; | ||
| 195 | + vertexFormat["aPosition"] = Property::VECTOR2; | ||
| 196 | + vertexFormat["aTexCoord"] = Property::VECTOR2; | ||
| 197 | + | ||
| 198 | + //Create a vertex buffer for vertex positions and texture coordinates | ||
| 199 | + vertexBuffer = PropertyBuffer::New( vertexFormat ); | ||
| 200 | + vertexBuffer.SetData( gQuadWithTexture, 4u ); | ||
| 201 | + | ||
| 202 | + //Create the geometry | ||
| 203 | + mesh = Geometry::New(); | ||
| 204 | + mesh.AddVertexBuffer( vertexBuffer ); | ||
| 205 | + mesh.SetGeometryType( Geometry::TRIANGLE_STRIP ); | ||
| 206 | + } | ||
| 207 | + return mesh; | ||
| 208 | +} | ||
| 209 | + | ||
| 210 | +bool gUseMesh(false); | ||
| 211 | +bool gNinePatch(false); | ||
| 212 | +unsigned int gRowsPerPage(15); | ||
| 213 | +unsigned int gColumnsPerPage(15); | ||
| 214 | +unsigned int gPageCount(10); | ||
| 215 | +float gDuration(10.0f); | ||
| 216 | + | ||
| 217 | +Renderer CreateRenderer( unsigned int index ) | ||
| 218 | +{ | ||
| 219 | + | ||
| 220 | + int numImages = !gNinePatch ? NUM_IMAGES : NUM_NINEPATCH_IMAGES; | ||
| 221 | + static Renderer* renderers = new Renderer[numImages]; | ||
| 222 | + if( !renderers[index] ) | ||
| 223 | + { | ||
| 224 | + //Create the renderer | ||
| 225 | + Shader shader = Shader::New( VERTEX_SHADER_TEXTURE, FRAGMENT_SHADER_TEXTURE ); | ||
| 226 | + | ||
| 227 | + const char* imagePath = !gNinePatch ? IMAGE_PATH[index] : NINEPATCH_IMAGE_PATH[index]; | ||
| 228 | + Image image = ResourceImage::New( imagePath ); | ||
| 229 | + | ||
| 230 | + TextureSet textureSet = TextureSet::New(); | ||
| 231 | + textureSet.SetImage( 0u, image ); | ||
| 232 | + renderers[index] = Renderer::New( QuadMesh(), shader ); | ||
| 233 | + renderers[index].SetTextures( textureSet ); | ||
| 234 | + renderers[index].SetProperty( Renderer::Property::BLENDING_MODE, BlendingMode::OFF ); | ||
| 235 | + | ||
| 236 | + } | ||
| 237 | + return renderers[index]; | ||
| 238 | +} | ||
| 239 | + | ||
| 240 | +Actor CreateMeshActor( unsigned int index) | ||
| 241 | +{ | ||
| 242 | + Renderer renderer = CreateRenderer( index ); | ||
| 243 | + Actor meshActor = Actor::New(); | ||
| 244 | + meshActor.AddRenderer( renderer ); | ||
| 245 | + return meshActor; | ||
| 246 | +} | ||
| 247 | + | ||
| 248 | +} | ||
| 249 | +// Test application to compare performance between ImageActor and ImageView | ||
| 250 | +// By default, the application consist of 10 pages of 25x25 ImageActors, this can be modified using the following command line arguments: | ||
| 251 | +// -t duration (sec ) | ||
| 252 | +// --use-imageview ( Use ImageView instead of ImageActor ) | ||
| 253 | +// --use-mesh ( Use new renderer API (as ImageView) but shares renderers between actors when possible ) | ||
| 254 | + | ||
| 255 | +// | ||
| 256 | +class PerfScroll : public ConnectionTracker | ||
| 257 | +{ | ||
| 258 | +public: | ||
| 259 | + | ||
| 260 | + PerfScroll( Application& application ) | ||
| 261 | + : mApplication( application ), | ||
| 262 | + mRowsPerPage( gRowsPerPage ), | ||
| 263 | + mColumnsPerPage( gColumnsPerPage ), | ||
| 264 | + mPageCount( gPageCount ) | ||
| 265 | + { | ||
| 266 | + // Connect to the Application's Init signal | ||
| 267 | + mApplication.InitSignal().Connect( this, &PerfScroll::Create ); | ||
| 268 | + } | ||
| 269 | + | ||
| 270 | + ~PerfScroll() | ||
| 271 | + { | ||
| 272 | + // Nothing to do here; | ||
| 273 | + } | ||
| 274 | + | ||
| 275 | + // The Init signal is received once (only) during the Application lifetime | ||
| 276 | + void Create( Application& application ) | ||
| 277 | + { | ||
| 278 | + // Get a handle to the stage | ||
| 279 | + Stage stage = Stage::GetCurrent(); | ||
| 280 | + stage.SetBackgroundColor( Color::WHITE ); | ||
| 281 | + Vector2 stageSize = stage.GetSize(); | ||
| 282 | + | ||
| 283 | + stage.GetRootLayer().SetDepthTestDisabled(true); | ||
| 284 | + | ||
| 285 | + mSize = Vector3( stageSize.x / mColumnsPerPage, stageSize.y / mRowsPerPage, 0.0f ); | ||
| 286 | + | ||
| 287 | + // Respond to a click anywhere on the stage | ||
| 288 | + stage.GetRootLayer().TouchedSignal().Connect( this, &PerfScroll::OnTouch ); | ||
| 289 | + | ||
| 290 | + mParent = Actor::New(); | ||
| 291 | + mParent.SetAnchorPoint( AnchorPoint::TOP_LEFT ); | ||
| 292 | + stage.Add(mParent); | ||
| 293 | + | ||
| 294 | + if( gUseMesh ) | ||
| 295 | + { | ||
| 296 | + CreateMeshActors(); | ||
| 297 | + } | ||
| 298 | + else | ||
| 299 | + { | ||
| 300 | + CreateImageViews(); | ||
| 301 | + } | ||
| 302 | + | ||
| 303 | + ShowAnimation(); | ||
| 304 | + } | ||
| 305 | + | ||
| 306 | + bool OnTouch( Actor actor, const TouchEvent& touch ) | ||
| 307 | + { | ||
| 308 | + // quit the application | ||
| 309 | + mApplication.Quit(); | ||
| 310 | + return true; | ||
| 311 | + } | ||
| 312 | + | ||
| 313 | + const char* ImagePath( int i ) | ||
| 314 | + { | ||
| 315 | + return !gNinePatch ? IMAGE_PATH[i % NUM_IMAGES] : NINEPATCH_IMAGE_PATH[i % NUM_NINEPATCH_IMAGES]; | ||
| 316 | + } | ||
| 317 | + | ||
| 318 | + void CreateImageViews() | ||
| 319 | + { | ||
| 320 | + Stage stage = Stage::GetCurrent(); | ||
| 321 | + unsigned int actorCount( mRowsPerPage*mColumnsPerPage * mPageCount ); | ||
| 322 | + mImageView.resize( actorCount ); | ||
| 323 | + | ||
| 324 | + for( size_t i(0); i<actorCount; ++i ) | ||
| 325 | + { | ||
| 326 | + mImageView[i] = ImageView::New( ImagePath(i) ); | ||
| 327 | + mImageView[i].SetSize( Vector3(0.0f,0.0f,0.0f) ); | ||
| 328 | + mImageView[i].SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS ); | ||
| 329 | + mParent.Add( mImageView[i] ); | ||
| 330 | + } | ||
| 331 | + } | ||
| 332 | + | ||
| 333 | + void CreateMeshActors() | ||
| 334 | + { | ||
| 335 | + Stage stage = Stage::GetCurrent(); | ||
| 336 | + | ||
| 337 | + unsigned int actorCount( mRowsPerPage * mColumnsPerPage * mPageCount ); | ||
| 338 | + mActor.resize( actorCount ); | ||
| 339 | + | ||
| 340 | + for( size_t i(0); i<actorCount; ++i ) | ||
| 341 | + { | ||
| 342 | + size_t numImages = !gNinePatch ? NUM_IMAGES : NUM_NINEPATCH_IMAGES; | ||
| 343 | + mActor[i] = CreateMeshActor( i % numImages ); | ||
| 344 | + mActor[i].SetSize(0.0f,0.0f,0.0f); | ||
| 345 | + | ||
| 346 | + mParent.Add( mActor[i] ); | ||
| 347 | + } | ||
| 348 | + } | ||
| 349 | + | ||
| 350 | + void OnAnimationEnd( Animation& source ) | ||
| 351 | + { | ||
| 352 | + if( source == mShow ) | ||
| 353 | + { | ||
| 354 | + ScrollAnimation(); | ||
| 355 | + } | ||
| 356 | + else if( source == mScroll ) | ||
| 357 | + { | ||
| 358 | + HideAnimation(); | ||
| 359 | + } | ||
| 360 | + else | ||
| 361 | + { | ||
| 362 | + mApplication.Quit(); | ||
| 363 | + } | ||
| 364 | + } | ||
| 365 | + | ||
| 366 | + void ShowAnimation() | ||
| 367 | + { | ||
| 368 | + Stage stage = Stage::GetCurrent(); | ||
| 369 | + Vector3 initialPosition( stage.GetSize().x * 0.5f, stage.GetSize().y*0.5f, 1000.0f ); | ||
| 370 | + | ||
| 371 | + unsigned int totalColumns = mColumnsPerPage * mPageCount; | ||
| 372 | + | ||
| 373 | + size_t count(0); | ||
| 374 | + float xpos, ypos; | ||
| 375 | + mShow = Animation::New( 0.0f ); | ||
| 376 | + | ||
| 377 | + float totalDuration( 0.0f ); | ||
| 378 | + float durationPerActor( 0.0f ); | ||
| 379 | + float delayBetweenActors = ( totalDuration - durationPerActor ) / ( mRowsPerPage * mColumnsPerPage ); | ||
| 380 | + | ||
| 381 | + for( size_t i(0); i<totalColumns; ++i ) | ||
| 382 | + { | ||
| 383 | + xpos = mSize.x * i; | ||
| 384 | + | ||
| 385 | + for( size_t j(0); j<mRowsPerPage; ++j ) | ||
| 386 | + { | ||
| 387 | + | ||
| 388 | + ypos = mSize.y * j; | ||
| 389 | + | ||
| 390 | + float delay = 0.0f; | ||
| 391 | + float duration = 0.0f; | ||
| 392 | + if( count < mRowsPerPage*mColumnsPerPage ) | ||
| 393 | + { | ||
| 394 | + duration = durationPerActor; | ||
| 395 | + delay = delayBetweenActors * count; | ||
| 396 | + } | ||
| 397 | + if( gUseMesh ) | ||
| 398 | + { | ||
| 399 | + mActor[count].SetPosition( initialPosition ); | ||
| 400 | + mActor[count].SetSize( Vector3(0.0f,0.0f,0.0f) ); | ||
| 401 | + mActor[count].SetOrientation( Quaternion( Radian( 0.0f ), Vector3::XAXIS ) ); | ||
| 402 | + mShow.AnimateTo( Property( mActor[count], Actor::Property::POSITION ), Vector3( xpos+mSize.x*0.5f, ypos+mSize.y*0.5f, 0.0f), AlphaFunction::EASE_OUT_BACK, TimePeriod( delay, duration ) ); | ||
| 403 | + mShow.AnimateTo( Property( mActor[count], Actor::Property::SIZE ), mSize, AlphaFunction::EASE_OUT_BACK, TimePeriod( delay, duration ) ); | ||
| 404 | + } | ||
| 405 | + else | ||
| 406 | + { | ||
| 407 | + mImageView[count].SetPosition( initialPosition ); | ||
| 408 | + mImageView[count].SetSize( Vector3(0.0f,0.0f,0.0f) ); | ||
| 409 | + mImageView[count].SetOrientation( Quaternion( Radian(0.0f),Vector3::XAXIS ) ); | ||
| 410 | + mShow.AnimateTo( Property( mImageView[count], Actor::Property::POSITION ), Vector3( xpos+mSize.x*0.5f, ypos+mSize.y*0.5f, 0.0f ), AlphaFunction::EASE_OUT_BACK, TimePeriod( delay, duration ) ); | ||
| 411 | + mShow.AnimateTo( Property( mImageView[count], Actor::Property::SIZE ), mSize, AlphaFunction::EASE_OUT_BACK, TimePeriod( delay, duration ) ); | ||
| 412 | + } | ||
| 413 | + ++count; | ||
| 414 | + } | ||
| 415 | + } | ||
| 416 | + mShow.Play(); | ||
| 417 | + mShow.FinishedSignal().Connect( this, &PerfScroll::OnAnimationEnd ); | ||
| 418 | + } | ||
| 419 | + | ||
| 420 | + void ScrollAnimation() | ||
| 421 | + { | ||
| 422 | + Stage stage = Stage::GetCurrent(); | ||
| 423 | + Vector3 stageSize( stage.GetSize() ); | ||
| 424 | + | ||
| 425 | + mScroll = Animation::New( gDuration ); | ||
| 426 | + | ||
| 427 | + mScroll.AnimateBy( Property( mParent, Actor::Property::POSITION ), Vector3( -(gPageCount-1.)*stageSize.x,0.0f, 0.0f) ); | ||
| 428 | + mScroll.Play(); | ||
| 429 | + mScroll.FinishedSignal().Connect( this, &PerfScroll::OnAnimationEnd ); | ||
| 430 | + } | ||
| 431 | + | ||
| 432 | + void HideAnimation() | ||
| 433 | + { | ||
| 434 | + size_t count(0); | ||
| 435 | + unsigned int actorsPerPage( mRowsPerPage*mColumnsPerPage ); | ||
| 436 | + mHide = Animation::New( 0.0f ); | ||
| 437 | + | ||
| 438 | + unsigned int totalColumns = mColumnsPerPage * mPageCount; | ||
| 439 | + | ||
| 440 | + float totalDuration( 0.0f ); | ||
| 441 | + float durationPerActor( 0.0f ); | ||
| 442 | + float delayBetweenActors = ( totalDuration - durationPerActor ) / ( mRowsPerPage * mColumnsPerPage ); | ||
| 443 | + for( size_t i(0); i<mRowsPerPage; ++i ) | ||
| 444 | + { | ||
| 445 | + for( size_t j(0); j<totalColumns; ++j ) | ||
| 446 | + { | ||
| 447 | + float delay = 0.0f; | ||
| 448 | + float duration = 0.0f; | ||
| 449 | + if( count < actorsPerPage ) | ||
| 450 | + { | ||
| 451 | + duration = durationPerActor; | ||
| 452 | + delay = delayBetweenActors * count; | ||
| 453 | + } | ||
| 454 | + | ||
| 455 | + if( gUseMesh ) | ||
| 456 | + { | ||
| 457 | + mHide.AnimateTo( Property( mActor[count], Actor::Property::ORIENTATION ), Quaternion( Radian( Degree( 70.0f ) ), Vector3::XAXIS ), AlphaFunction::EASE_OUT, TimePeriod( delay, duration ) ); | ||
| 458 | + mHide.AnimateBy( Property( mActor[count], Actor::Property::POSITION_Z ), 1000.0f, AlphaFunction::EASE_OUT_BACK, TimePeriod( delay +delayBetweenActors*actorsPerPage + duration, duration ) ); | ||
| 459 | + } | ||
| 460 | + else | ||
| 461 | + { | ||
| 462 | + mHide.AnimateTo( Property( mImageView[count], Actor::Property::ORIENTATION ), Quaternion( Radian( Degree( 70.0f ) ), Vector3::XAXIS ), AlphaFunction::EASE_OUT, TimePeriod( delay, duration ) ); | ||
| 463 | + mHide.AnimateBy( Property( mImageView[count], Actor::Property::POSITION_Z ), 1000.0f, AlphaFunction::EASE_OUT_BACK, TimePeriod( delay +delayBetweenActors*actorsPerPage + duration, duration ) ); | ||
| 464 | + } | ||
| 465 | + ++count; | ||
| 466 | + } | ||
| 467 | + } | ||
| 468 | + | ||
| 469 | + mHide.Play(); | ||
| 470 | + mHide.FinishedSignal().Connect( this, &PerfScroll::OnAnimationEnd ); | ||
| 471 | + } | ||
| 472 | + | ||
| 473 | +private: | ||
| 474 | + Application& mApplication; | ||
| 475 | + | ||
| 476 | + std::vector<Actor> mActor; | ||
| 477 | + std::vector<ImageView> mImageView; | ||
| 478 | + Actor mParent; | ||
| 479 | + | ||
| 480 | + Vector3 mSize; | ||
| 481 | + unsigned int mRowsPerPage; | ||
| 482 | + unsigned int mColumnsPerPage; | ||
| 483 | + unsigned int mPageCount; | ||
| 484 | + | ||
| 485 | + Animation mShow; | ||
| 486 | + Animation mScroll; | ||
| 487 | + Animation mHide; | ||
| 488 | +}; | ||
| 489 | + | ||
| 490 | +void RunTest( Application& application ) | ||
| 491 | +{ | ||
| 492 | + PerfScroll test( application ); | ||
| 493 | + | ||
| 494 | + application.MainLoop(); | ||
| 495 | +} | ||
| 496 | + | ||
| 497 | +// Entry point for Linux & Tizen applications | ||
| 498 | +// | ||
| 499 | +int DALI_EXPORT_API main( int argc, char **argv ) | ||
| 500 | +{ | ||
| 501 | + Application application = Application::New( &argc, &argv ); | ||
| 502 | + | ||
| 503 | + for( int i(1) ; i < argc; ++i ) | ||
| 504 | + { | ||
| 505 | + std::string arg( argv[i] ); | ||
| 506 | + if( arg.compare("--use-mesh") == 0) | ||
| 507 | + { | ||
| 508 | + gUseMesh = true; | ||
| 509 | + } | ||
| 510 | + else if( arg.compare("--nine-patch" ) == 0) | ||
| 511 | + { | ||
| 512 | + gNinePatch = true; | ||
| 513 | + } | ||
| 514 | + else if( arg.compare(0, 2, "-t" ) == 0) | ||
| 515 | + { | ||
| 516 | + gDuration = atof( arg.substr( 2, arg.size()).c_str()); | ||
| 517 | + } | ||
| 518 | + } | ||
| 519 | + | ||
| 520 | + RunTest( application ); | ||
| 521 | + | ||
| 522 | + return 0; | ||
| 523 | +} |
examples/point-mesh/point-mesh-example.cpp
| @@ -152,18 +152,19 @@ public: | @@ -152,18 +152,19 @@ public: | ||
| 152 | // Hide the indicator bar | 152 | // Hide the indicator bar |
| 153 | application.GetWindow().ShowIndicator( Dali::Window::INVISIBLE ); | 153 | application.GetWindow().ShowIndicator( Dali::Window::INVISIBLE ); |
| 154 | 154 | ||
| 155 | - mImage = ResourceImage::New( MATERIAL_SAMPLE ); | ||
| 156 | - Image image = ResourceImage::New( MATERIAL_SAMPLE2 ); | 155 | + Image image0 = ResourceImage::New( MATERIAL_SAMPLE ); |
| 156 | + Image image1 = ResourceImage::New( MATERIAL_SAMPLE2 ); | ||
| 157 | 157 | ||
| 158 | - mShader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER ); | 158 | + Shader shader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER ); |
| 159 | 159 | ||
| 160 | - mMaterial = Material::New( mShader ); | ||
| 161 | - mMaterial.AddTexture(mImage, "sTexture1"); | ||
| 162 | - mMaterial.AddTexture(image, "sTexture2"); | 160 | + TextureSet textureSet = TextureSet::New(); |
| 161 | + textureSet.SetImage( 0u, image0 ); | ||
| 162 | + textureSet.SetImage( 1u, image1 ); | ||
| 163 | 163 | ||
| 164 | - mGeometry = CreateGeometry(); | 164 | + Geometry geometry = CreateGeometry(); |
| 165 | 165 | ||
| 166 | - mRenderer = Renderer::New( mGeometry, mMaterial ); | 166 | + mRenderer = Renderer::New( geometry, shader ); |
| 167 | + mRenderer.SetTextures( textureSet ); | ||
| 167 | 168 | ||
| 168 | mMeshActor = Actor::New(); | 169 | mMeshActor = Actor::New(); |
| 169 | mMeshActor.AddRenderer( mRenderer ); | 170 | mMeshActor.AddRenderer( mRenderer ); |
| @@ -219,10 +220,6 @@ private: | @@ -219,10 +220,6 @@ private: | ||
| 219 | Application& mApplication; ///< Application instance | 220 | Application& mApplication; ///< Application instance |
| 220 | Vector3 mStageSize; ///< The size of the stage | 221 | Vector3 mStageSize; ///< The size of the stage |
| 221 | 222 | ||
| 222 | - Image mImage; | ||
| 223 | - Shader mShader; | ||
| 224 | - Material mMaterial; | ||
| 225 | - Geometry mGeometry; | ||
| 226 | Renderer mRenderer; | 223 | Renderer mRenderer; |
| 227 | Actor mMeshActor; | 224 | Actor mMeshActor; |
| 228 | Renderer mRenderer2; | 225 | Renderer mRenderer2; |
| @@ -239,7 +236,7 @@ void RunTest( Application& application ) | @@ -239,7 +236,7 @@ void RunTest( Application& application ) | ||
| 239 | 236 | ||
| 240 | // Entry point for Linux & SLP applications | 237 | // Entry point for Linux & SLP applications |
| 241 | // | 238 | // |
| 242 | -int main( int argc, char **argv ) | 239 | +int DALI_EXPORT_API main( int argc, char **argv ) |
| 243 | { | 240 | { |
| 244 | Application application = Application::New( &argc, &argv ); | 241 | Application application = Application::New( &argc, &argv ); |
| 245 | 242 |
examples/popup/popup-example.cpp
| @@ -731,7 +731,7 @@ void RunTest( Application& application ) | @@ -731,7 +731,7 @@ void RunTest( Application& application ) | ||
| 731 | } | 731 | } |
| 732 | 732 | ||
| 733 | // Entry point for Linux & SLP applications | 733 | // Entry point for Linux & SLP applications |
| 734 | -int main( int argc, char **argv ) | 734 | +int DALI_EXPORT_API main( int argc, char **argv ) |
| 735 | { | 735 | { |
| 736 | Application application = Application::New( &argc, &argv, DEMO_THEME_PATH ); | 736 | Application application = Application::New( &argc, &argv, DEMO_THEME_PATH ); |
| 737 | 737 |
examples/radial-menu/radial-menu-example.cpp
| @@ -299,7 +299,7 @@ void RunTest(Application app) | @@ -299,7 +299,7 @@ void RunTest(Application app) | ||
| 299 | } | 299 | } |
| 300 | 300 | ||
| 301 | // Entry point for Linux & Tizen applications | 301 | // Entry point for Linux & Tizen applications |
| 302 | -int main(int argc, char **argv) | 302 | +int DALI_EXPORT_API main(int argc, char **argv) |
| 303 | { | 303 | { |
| 304 | Application app = Application::New(&argc, &argv, DEMO_THEME_PATH); | 304 | Application app = Application::New(&argc, &argv, DEMO_THEME_PATH); |
| 305 | 305 |
examples/radial-menu/radial-sweep-view-impl.cpp
| @@ -302,10 +302,6 @@ void RadialSweepViewImpl::Deactivate() | @@ -302,10 +302,6 @@ void RadialSweepViewImpl::Deactivate() | ||
| 302 | { | 302 | { |
| 303 | mAnim.Stop(); | 303 | mAnim.Stop(); |
| 304 | } | 304 | } |
| 305 | - // mLayer.Remove( mStencilActor ); | ||
| 306 | - // mStencilActor.Reset(); | ||
| 307 | - // mMesh.Reset(); | ||
| 308 | - // mMaterial.Reset(); | ||
| 309 | } | 305 | } |
| 310 | 306 | ||
| 311 | void RadialSweepViewImpl::CreateStencil( Radian initialSector ) | 307 | void RadialSweepViewImpl::CreateStencil( Radian initialSector ) |
| @@ -344,14 +340,13 @@ void RadialSweepViewImpl::CreateStencil( Radian initialSector ) | @@ -344,14 +340,13 @@ void RadialSweepViewImpl::CreateStencil( Radian initialSector ) | ||
| 344 | meshGeometry.AddVertexBuffer( vertices ); | 340 | meshGeometry.AddVertexBuffer( vertices ); |
| 345 | meshGeometry.SetIndexBuffer( indices ); | 341 | meshGeometry.SetIndexBuffer( indices ); |
| 346 | 342 | ||
| 347 | - // Create material | 343 | + // Create shader |
| 348 | std::ostringstream vertexShaderStringStream; | 344 | std::ostringstream vertexShaderStringStream; |
| 349 | vertexShaderStringStream<<VERTEX_SHADER_PREFIX<<VERTEX_SHADER; | 345 | vertexShaderStringStream<<VERTEX_SHADER_PREFIX<<VERTEX_SHADER; |
| 350 | Shader shader = Shader::New( vertexShaderStringStream.str(), FRAGMENT_SHADER ); | 346 | Shader shader = Shader::New( vertexShaderStringStream.str(), FRAGMENT_SHADER ); |
| 351 | - Material material = Material::New( shader ); | ||
| 352 | 347 | ||
| 353 | // Create renderer | 348 | // Create renderer |
| 354 | - Renderer renderer = Renderer::New( meshGeometry, material ); | 349 | + Renderer renderer = Renderer::New( meshGeometry, shader ); |
| 355 | 350 | ||
| 356 | mStencilActor = Actor::New(); | 351 | mStencilActor = Actor::New(); |
| 357 | mStencilActor.AddRenderer( renderer ); | 352 | mStencilActor.AddRenderer( renderer ); |
examples/refraction-effect/refraction-effect-example.cpp
| @@ -281,10 +281,11 @@ private: | @@ -281,10 +281,11 @@ private: | ||
| 281 | mGeometry = CreateGeometry( MESH_FILES[mCurrentMeshId] ); | 281 | mGeometry = CreateGeometry( MESH_FILES[mCurrentMeshId] ); |
| 282 | 282 | ||
| 283 | Image texture = LoadStageFillingImage( TEXTURE_IMAGES[mCurrentTextureId] ); | 283 | Image texture = LoadStageFillingImage( TEXTURE_IMAGES[mCurrentTextureId] ); |
| 284 | - mMaterial = Material::New( mShaderFlat ); | ||
| 285 | - mMaterial.AddTexture( texture, "sTexture" ); | 284 | + mTextureSet = TextureSet::New(); |
| 285 | + mTextureSet.SetImage( 0u, texture ); | ||
| 286 | 286 | ||
| 287 | - mRenderer = Renderer::New( mGeometry, mMaterial ); | 287 | + mRenderer = Renderer::New( mGeometry, mShaderFlat ); |
| 288 | + mRenderer.SetTextures( mTextureSet ); | ||
| 288 | 289 | ||
| 289 | mMeshActor = Actor::New(); | 290 | mMeshActor = Actor::New(); |
| 290 | mMeshActor.AddRenderer( mRenderer ); | 291 | mMeshActor.AddRenderer( mRenderer ); |
| @@ -343,7 +344,7 @@ private: | @@ -343,7 +344,7 @@ private: | ||
| 343 | { | 344 | { |
| 344 | mCurrentTextureId = ( mCurrentTextureId + 1 ) % NUM_TEXTURE_IMAGES; | 345 | mCurrentTextureId = ( mCurrentTextureId + 1 ) % NUM_TEXTURE_IMAGES; |
| 345 | Image texture = LoadStageFillingImage( TEXTURE_IMAGES[mCurrentTextureId] ); | 346 | Image texture = LoadStageFillingImage( TEXTURE_IMAGES[mCurrentTextureId] ); |
| 346 | - mMaterial.SetTextureImage( 0, texture ); | 347 | + mTextureSet.SetImage( 0u, texture ); |
| 347 | return true; | 348 | return true; |
| 348 | } | 349 | } |
| 349 | 350 | ||
| @@ -354,7 +355,7 @@ private: | @@ -354,7 +355,7 @@ private: | ||
| 354 | { | 355 | { |
| 355 | case TouchPoint::Down: | 356 | case TouchPoint::Down: |
| 356 | { | 357 | { |
| 357 | - mMaterial.SetShader( mShaderRefraction ); | 358 | + mRenderer.SetShader( mShaderRefraction ); |
| 358 | 359 | ||
| 359 | SetLightXYOffset( point.screen ); | 360 | SetLightXYOffset( point.screen ); |
| 360 | 361 | ||
| @@ -406,7 +407,7 @@ private: | @@ -406,7 +407,7 @@ private: | ||
| 406 | 407 | ||
| 407 | void OnTouchFinished( Animation& source ) | 408 | void OnTouchFinished( Animation& source ) |
| 408 | { | 409 | { |
| 409 | - mMaterial.SetShader( mShaderFlat ); | 410 | + mRenderer.SetShader( mShaderFlat ); |
| 410 | SetLightXYOffset( Vector2::ZERO ); | 411 | SetLightXYOffset( Vector2::ZERO ); |
| 411 | } | 412 | } |
| 412 | 413 | ||
| @@ -563,7 +564,7 @@ private: | @@ -563,7 +564,7 @@ private: | ||
| 563 | 564 | ||
| 564 | Application& mApplication; | 565 | Application& mApplication; |
| 565 | Layer mContent; | 566 | Layer mContent; |
| 566 | - Material mMaterial; | 567 | + TextureSet mTextureSet; |
| 567 | Geometry mGeometry; | 568 | Geometry mGeometry; |
| 568 | Renderer mRenderer; | 569 | Renderer mRenderer; |
| 569 | Actor mMeshActor; | 570 | Actor mMeshActor; |
| @@ -596,8 +597,7 @@ RunTest(Application& app) | @@ -596,8 +597,7 @@ RunTest(Application& app) | ||
| 596 | 597 | ||
| 597 | /*****************************************************************************/ | 598 | /*****************************************************************************/ |
| 598 | 599 | ||
| 599 | -int | ||
| 600 | -main(int argc, char **argv) | 600 | +int DALI_EXPORT_API main(int argc, char **argv) |
| 601 | { | 601 | { |
| 602 | Application app = Application::New(&argc, &argv, DEMO_THEME_PATH); | 602 | Application app = Application::New(&argc, &argv, DEMO_THEME_PATH); |
| 603 | 603 |
examples/scripting/scripting-example.cpp
| @@ -38,7 +38,7 @@ bool CheckIfFileExists( const std::string& filename ) | @@ -38,7 +38,7 @@ bool CheckIfFileExists( const std::string& filename ) | ||
| 38 | } | 38 | } |
| 39 | 39 | ||
| 40 | } | 40 | } |
| 41 | -int main( int argc, char* argv[] ) | 41 | +int DALI_EXPORT_API main( int argc, char* argv[] ) |
| 42 | { | 42 | { |
| 43 | // pull out the JSON file and JavaScript file from the command line arguments | 43 | // pull out the JSON file and JavaScript file from the command line arguments |
| 44 | std::string javaScriptFileName; | 44 | std::string javaScriptFileName; |
examples/scroll-view/scroll-view-example.cpp
| @@ -579,7 +579,7 @@ private: | @@ -579,7 +579,7 @@ private: | ||
| 579 | Toolkit::PushButton mEffectChangeButton; ///< Effect Change Button | 579 | Toolkit::PushButton mEffectChangeButton; ///< Effect Change Button |
| 580 | }; | 580 | }; |
| 581 | 581 | ||
| 582 | -int main(int argc, char **argv) | 582 | +int DALI_EXPORT_API main(int argc, char **argv) |
| 583 | { | 583 | { |
| 584 | Application app = Application::New(&argc, &argv, DEMO_THEME_PATH); | 584 | Application app = Application::New(&argc, &argv, DEMO_THEME_PATH); |
| 585 | ExampleController test(app); | 585 | ExampleController test(app); |
examples/shadow-bone-lighting/shadow-bone-lighting-example.cpp
| @@ -500,8 +500,7 @@ RunTest(Application& app) | @@ -500,8 +500,7 @@ RunTest(Application& app) | ||
| 500 | 500 | ||
| 501 | /*****************************************************************************/ | 501 | /*****************************************************************************/ |
| 502 | 502 | ||
| 503 | -int | ||
| 504 | -main(int argc, char **argv) | 503 | +int DALI_EXPORT_API main(int argc, char **argv) |
| 505 | { | 504 | { |
| 506 | Application app = Application::New(&argc, &argv, DEMO_THEME_PATH); | 505 | Application app = Application::New(&argc, &argv, DEMO_THEME_PATH); |
| 507 | 506 |
examples/size-negotiation/size-negotiation-example.cpp
| @@ -813,7 +813,7 @@ void RunTest( Application& application ) | @@ -813,7 +813,7 @@ void RunTest( Application& application ) | ||
| 813 | } | 813 | } |
| 814 | 814 | ||
| 815 | // Entry point for Linux & SLP applications | 815 | // Entry point for Linux & SLP applications |
| 816 | -int main( int argc, char **argv ) | 816 | +int DALI_EXPORT_API main( int argc, char **argv ) |
| 817 | { | 817 | { |
| 818 | Application application = Application::New( &argc, &argv, DEMO_THEME_PATH ); | 818 | Application application = Application::New( &argc, &argv, DEMO_THEME_PATH ); |
| 819 | 819 |
examples/super-blur-bloom/super-blur-bloom-example.cpp
| @@ -311,8 +311,7 @@ RunTest(Application& app) | @@ -311,8 +311,7 @@ RunTest(Application& app) | ||
| 311 | 311 | ||
| 312 | /*****************************************************************************/ | 312 | /*****************************************************************************/ |
| 313 | 313 | ||
| 314 | -int | ||
| 315 | -main(int argc, char **argv) | 314 | +int DALI_EXPORT_API main(int argc, char **argv) |
| 316 | { | 315 | { |
| 317 | Application app = Application::New(&argc, &argv, DEMO_THEME_PATH); | 316 | Application app = Application::New(&argc, &argv, DEMO_THEME_PATH); |
| 318 | 317 |
examples/text-field/text-field-example.cpp
| @@ -224,7 +224,7 @@ void RunTest( Application& application ) | @@ -224,7 +224,7 @@ void RunTest( Application& application ) | ||
| 224 | } | 224 | } |
| 225 | 225 | ||
| 226 | /** Entry point for Linux & Tizen applications */ | 226 | /** Entry point for Linux & Tizen applications */ |
| 227 | -int main( int argc, char **argv ) | 227 | +int DALI_EXPORT_API main( int argc, char **argv ) |
| 228 | { | 228 | { |
| 229 | // DALI_DEMO_THEME_PATH not passed to Application so TextField example uses default Toolkit style sheet. | 229 | // DALI_DEMO_THEME_PATH not passed to Application so TextField example uses default Toolkit style sheet. |
| 230 | Application application = Application::New( &argc, &argv ); | 230 | Application application = Application::New( &argc, &argv ); |
examples/text-fonts/text-fonts-example.cpp
| @@ -253,7 +253,7 @@ void RunTest( Application& application ) | @@ -253,7 +253,7 @@ void RunTest( Application& application ) | ||
| 253 | } | 253 | } |
| 254 | 254 | ||
| 255 | /** Entry point for Linux & Tizen applications */ | 255 | /** Entry point for Linux & Tizen applications */ |
| 256 | -int main( int argc, char **argv ) | 256 | +int DALI_EXPORT_API main( int argc, char **argv ) |
| 257 | { | 257 | { |
| 258 | Application application = Application::New( &argc, &argv, DEMO_THEME_PATH ); | 258 | Application application = Application::New( &argc, &argv, DEMO_THEME_PATH ); |
| 259 | 259 |
examples/text-label-emojis/text-label-emojis.cpp
| @@ -140,7 +140,7 @@ void RunTest( Application& application ) | @@ -140,7 +140,7 @@ void RunTest( Application& application ) | ||
| 140 | 140 | ||
| 141 | // Entry point for Linux & SLP applications | 141 | // Entry point for Linux & SLP applications |
| 142 | // | 142 | // |
| 143 | -int main( int argc, char **argv ) | 143 | +int DALI_EXPORT_API main( int argc, char **argv ) |
| 144 | { | 144 | { |
| 145 | Application application = Application::New( &argc, &argv, DEMO_THEME_PATH ); | 145 | Application application = Application::New( &argc, &argv, DEMO_THEME_PATH ); |
| 146 | 146 |
examples/text-label-multi-language/text-label-multi-language-example.cpp
| @@ -142,7 +142,7 @@ void RunTest( Application& application ) | @@ -142,7 +142,7 @@ void RunTest( Application& application ) | ||
| 142 | } | 142 | } |
| 143 | 143 | ||
| 144 | /** Entry point for Linux & Tizen applications */ | 144 | /** Entry point for Linux & Tizen applications */ |
| 145 | -int main( int argc, char **argv ) | 145 | +int DALI_EXPORT_API main( int argc, char **argv ) |
| 146 | { | 146 | { |
| 147 | Application application = Application::New( &argc, &argv, DEMO_THEME_PATH ); | 147 | Application application = Application::New( &argc, &argv, DEMO_THEME_PATH ); |
| 148 | 148 |
examples/text-label/text-label-example.cpp
| @@ -295,7 +295,7 @@ void RunTest( Application& application ) | @@ -295,7 +295,7 @@ void RunTest( Application& application ) | ||
| 295 | } | 295 | } |
| 296 | 296 | ||
| 297 | /** Entry point for Linux & Tizen applications */ | 297 | /** Entry point for Linux & Tizen applications */ |
| 298 | -int main( int argc, char **argv ) | 298 | +int DALI_EXPORT_API main( int argc, char **argv ) |
| 299 | { | 299 | { |
| 300 | Application application = Application::New( &argc, &argv, DEMO_THEME_PATH ); | 300 | Application application = Application::New( &argc, &argv, DEMO_THEME_PATH ); |
| 301 | 301 |
examples/text-message-field/text-message-field-example.cpp
| @@ -161,7 +161,7 @@ void RunTest( Application& application ) | @@ -161,7 +161,7 @@ void RunTest( Application& application ) | ||
| 161 | } | 161 | } |
| 162 | 162 | ||
| 163 | /** Entry point for Linux & Tizen applications */ | 163 | /** Entry point for Linux & Tizen applications */ |
| 164 | -int main( int argc, char **argv ) | 164 | +int DALI_EXPORT_API main( int argc, char **argv ) |
| 165 | { | 165 | { |
| 166 | Application application = Application::New( &argc, &argv, DEMO_THEME_PATH ); | 166 | Application application = Application::New( &argc, &argv, DEMO_THEME_PATH ); |
| 167 | 167 |
examples/textured-mesh/textured-mesh-example.cpp
| @@ -148,15 +148,16 @@ public: | @@ -148,15 +148,16 @@ public: | ||
| 148 | Image image = ResourceImage::New( MATERIAL_SAMPLE2 ); | 148 | Image image = ResourceImage::New( MATERIAL_SAMPLE2 ); |
| 149 | 149 | ||
| 150 | mShader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER ); | 150 | mShader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER ); |
| 151 | - mMaterial1 = Material::New( mShader ); | ||
| 152 | - mMaterial1.AddTexture(mImage, "sTexture"); | 151 | + mTextureSet1 = TextureSet::New(); |
| 152 | + mTextureSet1.SetImage( 0u, mImage ); | ||
| 153 | 153 | ||
| 154 | - mMaterial2 = Material::New( mShader ); | ||
| 155 | - mMaterial2.AddTexture(image, "sTexture"); | 154 | + mTextureSet2 = TextureSet::New(); |
| 155 | + mTextureSet2.SetImage( 0u, image ); | ||
| 156 | 156 | ||
| 157 | mGeometry = CreateGeometry(); | 157 | mGeometry = CreateGeometry(); |
| 158 | 158 | ||
| 159 | - mRenderer = Renderer::New( mGeometry, mMaterial1 ); | 159 | + mRenderer = Renderer::New( mGeometry, mShader ); |
| 160 | + mRenderer.SetTextures( mTextureSet1 ); | ||
| 160 | 161 | ||
| 161 | mMeshActor = Actor::New(); | 162 | mMeshActor = Actor::New(); |
| 162 | mMeshActor.AddRenderer( mRenderer ); | 163 | mMeshActor.AddRenderer( mRenderer ); |
| @@ -169,7 +170,8 @@ public: | @@ -169,7 +170,8 @@ public: | ||
| 169 | mMeshActor.SetAnchorPoint( AnchorPoint::TOP_CENTER ); | 170 | mMeshActor.SetAnchorPoint( AnchorPoint::TOP_CENTER ); |
| 170 | stage.Add( mMeshActor ); | 171 | stage.Add( mMeshActor ); |
| 171 | 172 | ||
| 172 | - mRenderer2 = Renderer::New( mGeometry, mMaterial2 ); | 173 | + mRenderer2 = Renderer::New( mGeometry, mShader ); |
| 174 | + mRenderer2.SetTextures( mTextureSet2 ); | ||
| 173 | 175 | ||
| 174 | mMeshActor2 = Actor::New(); | 176 | mMeshActor2 = Actor::New(); |
| 175 | mMeshActor2.AddRenderer( mRenderer2 ); | 177 | mMeshActor2.AddRenderer( mRenderer2 ); |
| @@ -262,8 +264,8 @@ private: | @@ -262,8 +264,8 @@ private: | ||
| 262 | 264 | ||
| 263 | Image mImage; | 265 | Image mImage; |
| 264 | Shader mShader; | 266 | Shader mShader; |
| 265 | - Material mMaterial1; | ||
| 266 | - Material mMaterial2; | 267 | + TextureSet mTextureSet1; |
| 268 | + TextureSet mTextureSet2; | ||
| 267 | Geometry mGeometry; | 269 | Geometry mGeometry; |
| 268 | Renderer mRenderer; | 270 | Renderer mRenderer; |
| 269 | Actor mMeshActor; | 271 | Actor mMeshActor; |
| @@ -281,7 +283,7 @@ void RunTest( Application& application ) | @@ -281,7 +283,7 @@ void RunTest( Application& application ) | ||
| 281 | 283 | ||
| 282 | // Entry point for Linux & SLP applications | 284 | // Entry point for Linux & SLP applications |
| 283 | // | 285 | // |
| 284 | -int main( int argc, char **argv ) | 286 | +int DALI_EXPORT_API main( int argc, char **argv ) |
| 285 | { | 287 | { |
| 286 | Application application = Application::New( &argc, &argv ); | 288 | Application application = Application::New( &argc, &argv ); |
| 287 | 289 |
examples/tilt/tilt-example.cpp
| @@ -96,7 +96,7 @@ private: | @@ -96,7 +96,7 @@ private: | ||
| 96 | 96 | ||
| 97 | // Entry point for Linux & Tizen applications | 97 | // Entry point for Linux & Tizen applications |
| 98 | // | 98 | // |
| 99 | -int main( int argc, char **argv ) | 99 | +int DALI_EXPORT_API main( int argc, char **argv ) |
| 100 | { | 100 | { |
| 101 | Application application = Application::New( &argc, &argv ); | 101 | Application application = Application::New( &argc, &argv ); |
| 102 | TiltController test( application ); | 102 | TiltController test( application ); |
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.30 | 5 | +Version: 1.1.31 |
| 6 | Release: 1 | 6 | Release: 1 |
| 7 | Group: System/Libraries | 7 | Group: System/Libraries |
| 8 | License: Apache-2.0 | 8 | License: Apache-2.0 |
| @@ -64,7 +64,7 @@ of the capability of the toolkit. | @@ -64,7 +64,7 @@ of the capability of the toolkit. | ||
| 64 | %build | 64 | %build |
| 65 | PREFIX="/usr" | 65 | PREFIX="/usr" |
| 66 | CXXFLAGS+=" -Wall -g -O2" | 66 | CXXFLAGS+=" -Wall -g -O2" |
| 67 | -LDFLAGS+=" -Wl,--rpath=$PREFIX/lib -Wl,--as-needed -fPIC" | 67 | +LDFLAGS+=" -Wl,--rpath=$PREFIX/lib -Wl,--as-needed" |
| 68 | 68 | ||
| 69 | %ifarch %{arm} | 69 | %ifarch %{arm} |
| 70 | CXXFLAGS+=" -D_ARCH_ARM_" | 70 | CXXFLAGS+=" -D_ARCH_ARM_" |