/*
- * Copyright (c) 2018 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.
/**
* Touch handler, start the grow animation and creates additional metaballs
*/
- bool OnTouch( Actor actor, const TouchData& touch );
+ bool OnTouch( Actor actor, const TouchEvent& touch );
/**
* Key event callback to quit the application on escape or back key
void MetaballRefracController::Create( Application& app )
{
- Stage stage = Stage::GetCurrent();
+ Window window = app.GetWindow();
- stage.KeyEventSignal().Connect( this, &MetaballRefracController::OnKeyEvent );
+ window.KeyEventSignal().Connect( this, &MetaballRefracController::OnKeyEvent );
- mScreenSize = stage.GetSize();
+ mScreenSize = window.GetSize();
- stage.SetBackgroundColor(Color::BLACK);
+ window.SetBackgroundColor(Color::BLACK);
// Load background texture
mBackgroundTexture = DemoHelper::LoadTexture( BACKGROUND_IMAGE );
CreateAnimations();
// Connect the callback to the touch signal on the mesh actor
- stage.GetRootLayer().TouchSignal().Connect( this, &MetaballRefracController::OnTouch );
+ window.GetRootLayer().TouchedSignal().Connect( this, &MetaballRefracController::OnTouch );
}
Geometry MetaballRefracController::CreateGeometry( bool aspectMappedTexture )
// Vertices
Property::Map positionVertexFormat;
positionVertexFormat["aPosition"] = Property::VECTOR2;
- PropertyBuffer positionVertices = PropertyBuffer::New( positionVertexFormat );
+ VertexBuffer positionVertices = VertexBuffer::New( positionVertexFormat );
positionVertices.SetData( vertices, numberOfVertices );
// Textures
Property::Map textureVertexFormat;
textureVertexFormat["aTexture"] = Property::VECTOR2;
- PropertyBuffer textureVertices = PropertyBuffer::New( textureVertexFormat );
+ VertexBuffer textureVertices = VertexBuffer::New( textureVertexFormat );
textureVertices.SetData( textures, numberOfVertices );
// Indices
void MetaballRefracController::CreateMetaballImage()
{
// Create an FBO and a render task to create to render the metaballs with a fragment shader
- Stage stage = Stage::GetCurrent();
+ Window window = mApplication.GetWindow();
mMetaballFBO = FrameBuffer::New( mScreenSize.x, mScreenSize.y );
- stage.Add(mMetaballRoot);
+ window.Add(mMetaballRoot);
//Creation of the render task used to render the metaballs
- RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList();
+ RenderTaskList taskList = window.GetRenderTaskList();
RenderTask task = taskList.CreateTask();
task.SetRefreshRate( RenderTask::REFRESH_ALWAYS );
task.SetSourceActor( mMetaballRoot );
mRendererRefraction.SetTextures( mTextureSetNormal );
mCompositionActor.AddRenderer( mRendererRefraction );
- Stage stage = Stage::GetCurrent();
- stage.Add( mCompositionActor );
+ Window window = mApplication.GetWindow();
+ window.Add( mCompositionActor );
}
void MetaballRefracController::CreateAnimations()
}
}
-bool MetaballRefracController::OnTouch( Actor actor, const TouchData& touch )
+bool MetaballRefracController::OnTouch( Actor actor, const TouchEvent& touch )
{
const float aspect = mScreenSize.y / mScreenSize.x;
switch( touch.GetState( 0 ) )
void MetaballRefracController::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) )
{