X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;ds=sidebyside;f=examples%2Frefraction-effect%2Frefraction-effect-example.cpp;h=c9930fe6df4e5755a091c9e41994af215e2303d8;hb=de02cf1d81d8a6fc40b2d7b55174a1651c658759;hp=3203d132828cf42bb6a0872307f0a49035d8d826;hpb=c1ab3b4c9ffa2172d332b85b94546b5d5f730c28;p=platform%2Fcore%2Fuifw%2Fdali-demo.git diff --git a/examples/refraction-effect/refraction-effect-example.cpp b/examples/refraction-effect/refraction-effect-example.cpp index 3203d13..c9930fe 100644 --- a/examples/refraction-effect/refraction-effect-example.cpp +++ b/examples/refraction-effect/refraction-effect-example.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,7 +17,7 @@ // EXTERNAL INCLUDES #include -#include +#include #include #include @@ -26,6 +26,7 @@ // INTERNAL INCLUDES #include "shared/view.h" +#include "shared/utility.h" using namespace Dali; @@ -74,19 +75,6 @@ struct LightOffsetConstraint }; /** - * @brief Load an image, scaled-down to no more than the stage dimensions. - * - * Uses image scaling mode SCALE_TO_FILL to resize the image at - * load time to cover the entire stage with pixels with no borders, - * and filter mode BOX_THEN_LINEAR to sample the image with maximum quality. - */ -ResourceImage LoadStageFillingImage( const char * const imagePath ) -{ - Size stageSize = Stage::GetCurrent().GetSize(); - return ResourceImage::New( imagePath, ImageDimensions( stageSize.x, stageSize.y ), Dali::FittingMode::SCALE_TO_FILL, Dali::SamplingMode::BOX_THEN_LINEAR ); -} - -/** * structure of the vertex in the mesh */ struct Vertex @@ -280,9 +268,9 @@ private: mShaderFlat = Shader::New( VERTEX_SHADER_FLAT, FRAGMENT_SHADER_FLAT ); mGeometry = CreateGeometry( MESH_FILES[mCurrentMeshId] ); - Image texture = LoadStageFillingImage( TEXTURE_IMAGES[mCurrentTextureId] ); + Texture texture = DemoHelper::LoadStageFillingTexture( TEXTURE_IMAGES[mCurrentTextureId] ); mTextureSet = TextureSet::New(); - mTextureSet.SetImage( 0u, texture ); + mTextureSet.SetTexture( 0u, texture ); mRenderer = Renderer::New( mGeometry, mShaderFlat ); mRenderer.SetTextures( mTextureSet ); @@ -294,7 +282,7 @@ private: mContent.Add( mMeshActor ); // Connect the callback to the touch signal on the mesh actor - mContent.TouchedSignal().Connect( this, &RefractionEffectExample::OnTouch ); + mContent.TouchSignal().Connect( this, &RefractionEffectExample::OnTouch ); // shader used when the finger is touching the screen. render refraction effect mShaderRefraction = Shader::New( VERTEX_SHADER_REFRACTION, FRAGMENT_SHADER_REFRACTION ); @@ -343,21 +331,20 @@ private: bool OnChangeTexture( Toolkit::Button button ) { mCurrentTextureId = ( mCurrentTextureId + 1 ) % NUM_TEXTURE_IMAGES; - Image texture = LoadStageFillingImage( TEXTURE_IMAGES[mCurrentTextureId] ); - mTextureSet.SetImage( 0u, texture ); + Texture texture = DemoHelper::LoadStageFillingTexture( TEXTURE_IMAGES[mCurrentTextureId] ); + mTextureSet.SetTexture( 0u, texture ); return true; } - bool OnTouch( Actor actor , const TouchEvent& event ) + bool OnTouch( Actor actor, const TouchData& event ) { - const TouchPoint &point = event.GetPoint(0); - switch(point.state) + switch( event.GetState( 0 ) ) { - case TouchPoint::Down: + case PointState::DOWN: { mRenderer.SetShader( mShaderRefraction ); - SetLightXYOffset( point.screen ); + SetLightXYOffset( event.GetScreenPosition( 0 ) ); mLightAnimation.Play(); @@ -372,15 +359,15 @@ private: break; } - case TouchPoint::Motion: + case PointState::MOTION: { // make the light position following the finger movement - SetLightXYOffset( point.screen ); + SetLightXYOffset( event.GetScreenPosition( 0 ) ); break; } - case TouchPoint::Up: - case TouchPoint::Leave: - case TouchPoint::Interrupted: + case PointState::UP: + case PointState::LEAVE: + case PointState::INTERRUPTED: { mLightAnimation.Pause(); @@ -394,9 +381,7 @@ private: mStrenghAnimation.Play(); break; } - case TouchPoint::Stationary: - case TouchPoint::Last: - default: + case PointState::STATIONARY: { break; } @@ -597,8 +582,7 @@ RunTest(Application& app) /*****************************************************************************/ -int -main(int argc, char **argv) +int DALI_EXPORT_API main(int argc, char **argv) { Application app = Application::New(&argc, &argv, DEMO_THEME_PATH);