X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=examples%2Fray-marching%2Fray-marching-example.cpp;h=39caa42b116a69bb485b766a274396cedb31d502;hb=1a473d5189ca7e7d55aca3a64a8a4ff2dc3b6c67;hp=d63821732125934a36ea139001e4f79dc578dfdd;hpb=8e7b79aa32faa45e8a231c7b3e413d7ad1783acf;p=platform%2Fcore%2Fuifw%2Fdali-demo.git diff --git a/examples/ray-marching/ray-marching-example.cpp b/examples/ray-marching/ray-marching-example.cpp index d638217..39caa42 100644 --- a/examples/ray-marching/ray-marching-example.cpp +++ b/examples/ray-marching/ray-marching-example.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 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. @@ -20,6 +20,8 @@ #include "shared/view.h" #include "shared/utility.h" #include +#include +#include using namespace Dali; using Dali::Toolkit::TextLabel; @@ -41,14 +43,16 @@ bool LoadShaderCode( const char* path, const char* filename, std::vector& { std::string fullpath( path ); fullpath += filename; - FILE* file = fopen( fullpath.c_str(), "rb" ); - if( ! file ) + + Dali::FileStream fileStream( fullpath, Dali::FileStream::READ | Dali::FileStream::BINARY ); + FILE* file = fileStream.GetFile(); + if( !file ) { return false; } bool retValue = false; - if( ! fseek( file, 0, SEEK_END ) ) + if( !fseek( file, 0, SEEK_END ) ) { long int size = ftell( file ); @@ -63,7 +67,6 @@ bool LoadShaderCode( const char* path, const char* filename, std::vector& } } - fclose( file ); return retValue; } @@ -110,20 +113,17 @@ public: // The Init signal is received once (only) during the Application lifetime void Create( Application& application ) { - // Get a handle to the stage - Stage stage = Stage::GetCurrent(); - - stage.GetRootLayer().TouchSignal().Connect( this, &RayMarchingExample::OnTouch ); + // Get a handle to the window + Window window = application.GetWindow(); - stage.KeyEventSignal().Connect(this, &RayMarchingExample::OnKeyEvent); + window.GetRootLayer().TouchedSignal().Connect( this, &RayMarchingExample::OnTouch ); - stage.SetBackgroundColor( Color::YELLOW ); + window.KeyEventSignal().Connect(this, &RayMarchingExample::OnKeyEvent); - // Hide the indicator bar - application.GetWindow().ShowIndicator( Dali::Window::INVISIBLE ); + window.SetBackgroundColor( Color::YELLOW ); // Creates a default view with a default tool bar. - // The view is added to the stage. + // The view is added to the window. mContentLayer = DemoHelper::CreateView( application, mView, mToolBar, @@ -132,12 +132,12 @@ public: APPLICATION_TITLE ); // Add an extra space on the right to center the title text. - mToolBar.AddControl( Actor::New(), DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight ); + mToolBar.AddControl( Actor::New(), DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HORIZONTAL_RIGHT ); AddContentLayer(); } - bool OnTouch( Actor actor, const TouchData& touch ) + bool OnTouch( Actor actor, const TouchEvent& touch ) { // quit the application mApplication.Quit(); @@ -149,7 +149,7 @@ public: */ void OnKeyEvent(const KeyEvent& event) { - if(event.state == KeyEvent::Down) + if(event.GetState() == KeyEvent::DOWN) { if( IsKey( event, Dali::DALI_KEY_ESCAPE) || IsKey( event, Dali::DALI_KEY_BACK) ) { @@ -168,7 +168,7 @@ public: Property::Map vertexFormat; vertexFormat["aPosition"] = Property::VECTOR2; - PropertyBuffer vertexBuffer = PropertyBuffer::New( vertexFormat ); + VertexBuffer vertexBuffer = VertexBuffer::New( vertexFormat ); const float P( 0.5f ); const Vector2 vertices[] = { @@ -203,7 +203,7 @@ public: void AddContentLayer() { - Stage stage = Stage::GetCurrent(); + Window window = mApplication.GetWindow(); //Create all the renderers Renderer renderer = CreateQuadRenderer(); @@ -211,8 +211,8 @@ public: Actor actor = Actor::New(); actor.AddRenderer( renderer ); - actor.SetAnchorPoint( Dali::AnchorPoint::CENTER ); - actor.SetParentOrigin( Dali::ParentOrigin::CENTER ); + actor.SetProperty( Actor::Property::ANCHOR_POINT, Dali::AnchorPoint::CENTER ); + actor.SetProperty( Actor::Property::PARENT_ORIGIN, Dali::ParentOrigin::CENTER ); actor.SetResizePolicy( Dali::ResizePolicy::FILL_TO_PARENT, Dali::Dimension::ALL_DIMENSIONS ); mContentLayer.Add( actor );