2 // Open Service Platform
3 // Copyright (c) 2012-2013 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://floralicense.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.
18 * @file FUiEffects_RuntimeLuaProcessing.h
19 * @brief This is the header file for the LuaProcessing class.
22 #ifndef _FUI_EFFECTS_INTERNAL_RUNTIME_LUA_PROCESSING_H_
23 #define _FUI_EFFECTS_INTERNAL_RUNTIME_LUA_PROCESSING_H_
25 #include <unique_ptr.h>
29 #include <FUiEffectsTypes.h>
31 #include "FUiEffects_RuntimeIScriptProcessing.h"
32 #include "FUiEffects_RuntimeModel.h"
33 #include "FUiEffects_RuntimeEffectModelScript.h"
34 #include "FUiEffects_RuntimeIEffectModelScript.h"
36 namespace Tizen { namespace Ui { namespace Effects { namespace _Runtime
41 void operator()(lua_State* pLua) const
48 class EffectModelScript;
51 * @class LuaProcessing
52 * @brief This class executes relevant lua script functions
58 : public IScriptProcessing
63 * LuaProcessing default class constructor
71 * LuaProcessing class constructor
76 LuaProcessing(const char* pPathToScript, IEffectModelScript* pEModel);
79 * LuaProcessing class destructor
84 virtual ~LuaProcessing(void);
87 * Calls OnEffectStart function from script
91 * @remarks Function is inherited from IScriptProcessing interface;
92 * if script function performs successfully (with no errors),
93 * the function returns true, otherwise returns false
95 virtual bool OnEffectStart(const EffectsVector<float>& effectStartInfo);
98 * Calls OnEffectCalculate function from script
102 * @remarks Function is inherited from IScriptProcessing interface;
103 * if script function performs successfully (with no errors),
104 * the function returns true, otherwise returns false
106 virtual bool OnEffectCalculate(float dt);
109 * Calls OnTouchPressed function from script for handling touch pressed event
113 * @remarks Function is inherited from IScriptProcessing interface;
114 * if script function performs successfully (with no errors),
115 * the function returns true, otherwise returns false
117 virtual bool OnTouchPressed(const TouchEventScript& position);
120 * Calls OnTouchDoublePressed function from script for handling touch double pressed event
124 * @remarks Function is inherited from IScriptProcessing interface;
125 * if script function performs successfully (with no errors),
126 * the function returns true, otherwise returns false
128 virtual bool OnTouchDoublePressed(const TouchEventScript& position);
131 * Calls OnTouchMoved function from script for handling touch moved event
135 * @remarks Function is inherited from IScriptProcessing interface;
136 * if script function performs successfully (with no errors),
137 * the function returns true, otherwise returns false
139 virtual bool OnTouchMoved(const TouchEventScript& position);
142 * Calls OnTouchReleased function from script for handling touch released event
146 * @remarks Function is inherited from IScriptProcessing interface;
147 * if script function performs successfully (with no errors),
148 * the function returns true, otherwise returns false
150 virtual bool OnTouchReleased(const TouchEventScript& position);
153 * Calls IsEffectFinished function from script
158 virtual ::Tizen::Ui::Effects::_Runtime::EffectResultS IsEffectFinished(void);
161 * Calls Initialize function from script
165 * @remarks Function is inherited from IScriptProcessing interface;
166 * if script function performs successfully (with no errors),
167 * the function returns true, otherwise returns false
169 virtual bool Initialize(void);
173 * Hidden copy constructor
178 LuaProcessing(const LuaProcessing& rhs);
181 * Hidden assignment operator
186 LuaProcessing &operator=(const LuaProcessing& rhs);
189 * Auxiliary function for calling touch events handling script functions
194 bool OnTouchEvent(const char* pFunName, const TouchEventScript& position);
197 * Function for calling lua script function
202 static int CallFunction(const char* pFunctionName, int argsCount, int resultsCount, lua_State* pLua);
206 std::unique_ptr<lua_State, LuaClose> __pLua; /**< pointer to structure that keeps the whole state of a Lua interpreter*/
207 std::unique_ptr<EffectModelScript> __pEMScript; /**< pointer to instance of class EffectModelScript (for calling C++ functions from scripts)*/
209 static const char* __pStringLua; /**< contains a simple lua code for transmitting to lua-global variable the pointer to EffectModelScript (performs once in constructor)*/
213 } } } } // Tizen::Ui::Effects::_Runtime
215 #endif //_FUI_EFFECTS_INTERNAL_RUNTIME_LUA_PROCESSING_H_