2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 // Licensed under the Flora License, Version 1.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.tizenopensource.org/license
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an AS IS BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
17 #include "TimeBasedSingleEffectForm.h"
22 using namespace Osp::Ui::Controls;
23 using namespace Osp::Ui::Effects;
25 TimeBasedSingleEffectForm::TimeBasedSingleEffectForm() : EffectsBaseForm()
29 TimeBasedSingleEffectForm::~TimeBasedSingleEffectForm()
34 TimeBasedSingleEffectForm::InitializeEffect()
36 _pPanel->AddTouchEventListener(*this);
38 // Register effect file
39 _pEffect = _pEffectManager->CreateEffect(Osp::App::App::GetInstance()->GetAppResourcePath() + L"paper_timebased.eff");
41 // Set the frame as a render target of effects
42 _pEffect->SetRenderTarget(*Osp::App::UiApp::GetInstance()->GetFrameAt(0));
43 _pEffect->SetEffectEventListener(this);
44 _pEffect->SetResourceProvider(this);
48 TimeBasedSingleEffectForm::OnTouchPressed(const Osp::Ui::Control& source, const Osp::Graphics::Point& currentPosition, const Osp::Ui::TouchEventInfo& touchInfo)
53 TimeBasedSingleEffectForm::OnTouchLongPressed(const Osp::Ui::Control& source, const Osp::Graphics::Point& currentPosition, const Osp::Ui::TouchEventInfo& touchInfo)
55 //Switching to main form:
57 OnFormBackRequested(*this);
61 TimeBasedSingleEffectForm::OnTouchMoved(const Osp::Ui::Control& source, const Osp::Graphics::Point& currentPosition, const Osp::Ui::TouchEventInfo& touchInfo)
64 Osp::Base::Collection::ArrayList effectStartInfo;
65 effectStartInfo.Construct();
68 Osp::Base::Float randomInfo(rand() * 1.f / RAND_MAX);
69 effectStartInfo.Add(randomInfo);
70 _pEffect->Start(effectStartInfo);