mirror of https://github.com/axmolengine/axmol.git
Merge pull request #4593 from samuele3hu/NewEventDispatcher
issue #3403:Add the EventDispatcher lua binding and the releated test cases
This commit is contained in:
commit
71966d8ca9
|
@ -29,6 +29,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include "CCObject.h"
|
||||||
#include "CCPlatformMacros.h"
|
#include "CCPlatformMacros.h"
|
||||||
|
|
||||||
NS_CC_BEGIN
|
NS_CC_BEGIN
|
||||||
|
@ -38,7 +39,7 @@ class Node;
|
||||||
/**
|
/**
|
||||||
* Base class of all kinds of events.
|
* Base class of all kinds of events.
|
||||||
*/
|
*/
|
||||||
class Event
|
class Event : public Object
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum class Type
|
enum class Type
|
||||||
|
|
|
@ -46,6 +46,8 @@ private:
|
||||||
|
|
||||||
bool init(std::function<void(Acceleration*, Event* event)> callback);
|
bool init(std::function<void(Acceleration*, Event* event)> callback);
|
||||||
std::function<void(Acceleration*, Event*)> onAccelerationEvent;
|
std::function<void(Acceleration*, Event*)> onAccelerationEvent;
|
||||||
|
|
||||||
|
friend class LuaEventListenerAcceleration;
|
||||||
};
|
};
|
||||||
|
|
||||||
NS_CC_END
|
NS_CC_END
|
||||||
|
|
|
@ -70,6 +70,8 @@ protected:
|
||||||
bool init(ListenerID listenerId, std::function<void(EventCustom*)> callback);
|
bool init(ListenerID listenerId, std::function<void(EventCustom*)> callback);
|
||||||
|
|
||||||
std::function<void(EventCustom*)> _onCustomEvent;
|
std::function<void(EventCustom*)> _onCustomEvent;
|
||||||
|
|
||||||
|
friend class LuaEventListenerCustom;
|
||||||
};
|
};
|
||||||
|
|
||||||
NS_CC_END
|
NS_CC_END
|
||||||
|
|
|
@ -214,6 +214,12 @@ enum ScriptEventType
|
||||||
kAssetsManagerEvent,//Now it's only used in Lua Binding
|
kAssetsManagerEvent,//Now it's only used in Lua Binding
|
||||||
kCocoStudioEventListener,//Now it's only used in Lua Binding
|
kCocoStudioEventListener,//Now it's only used in Lua Binding
|
||||||
kArmatureWrapper,//Now it's only used in Lua Binding
|
kArmatureWrapper,//Now it's only used in Lua Binding
|
||||||
|
kEventListenerAcc,//Now it's only used in Lua Binding
|
||||||
|
kEventListenerKeyboard,//Now it's only used in Lua Binding
|
||||||
|
kEventListenerTouch,//Now it's only used in Lua Binding
|
||||||
|
kEventListenerTouches,//Now it's only used in Lua Binding
|
||||||
|
kEventListenerMouse,//Now it's only used in Lua Binding
|
||||||
|
kEventListenerCustom,////Now it's only used in Lua Binding
|
||||||
};
|
};
|
||||||
|
|
||||||
struct BasicScriptData
|
struct BasicScriptData
|
||||||
|
|
|
@ -23,12 +23,14 @@
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "CCLuaEngine.h"
|
#include "CCLuaEngine.h"
|
||||||
|
#include "tolua_fix.h"
|
||||||
#include "cocos2d.h"
|
#include "cocos2d.h"
|
||||||
#include "CCArray.h"
|
#include "CCArray.h"
|
||||||
#include "CCScheduler.h"
|
#include "CCScheduler.h"
|
||||||
#include "LuaScriptHandlerMgr.h"
|
#include "LuaScriptHandlerMgr.h"
|
||||||
#include "extensions/GUI/CCControlExtension/CCControl.h"
|
#include "extensions/GUI/CCControlExtension/CCControl.h"
|
||||||
#include "LuaOpengl.h"
|
#include "LuaOpengl.h"
|
||||||
|
#include "lua_cocos2dx_manual.hpp"
|
||||||
#include "lua_cocos2dx_extension_manual.h"
|
#include "lua_cocos2dx_extension_manual.h"
|
||||||
#include "lua_cocos2dx_coco_studio_manual.hpp"
|
#include "lua_cocos2dx_coco_studio_manual.hpp"
|
||||||
|
|
||||||
|
@ -267,6 +269,36 @@ int LuaEngine::sendEvent(ScriptEvent* evt)
|
||||||
return handleArmatureWrapper(evt->data);
|
return handleArmatureWrapper(evt->data);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case kEventListenerAcc:
|
||||||
|
{
|
||||||
|
return handleEventListenerAcc(evt->data);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case kEventListenerKeyboard:
|
||||||
|
{
|
||||||
|
return handleEventListenerKeyboard(evt->data);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case kEventListenerTouch:
|
||||||
|
{
|
||||||
|
return handleEventListenerTouch(evt->data);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case kEventListenerTouches:
|
||||||
|
{
|
||||||
|
return handleEventListenerTouches(evt->data);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case kEventListenerMouse:
|
||||||
|
{
|
||||||
|
return handleEventListenerMouse(evt->data);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case kEventListenerCustom:
|
||||||
|
{
|
||||||
|
return handleEventListenerCustom(evt->data);
|
||||||
|
};
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -858,4 +890,160 @@ int LuaEngine::handleArmatureWrapper(void* data)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int LuaEngine::handleEventListenerAcc(void* data)
|
||||||
|
{
|
||||||
|
if (nullptr == data)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
BasicScriptData* basicScriptData = static_cast<BasicScriptData*>(data);
|
||||||
|
if (nullptr == basicScriptData->nativeObject || nullptr == basicScriptData->value)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
int handler = ScriptHandlerMgr::getInstance()->getObjectHandler(basicScriptData->nativeObject, ScriptHandlerMgr::HandlerType::EVENTLISTENER_ACC);
|
||||||
|
if (0 == handler)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
lua_State* L = _stack->getLuaState();
|
||||||
|
|
||||||
|
LuaEventListenerAccelerationData* eventListennerAcc = static_cast<LuaEventListenerAccelerationData*>(basicScriptData->value);
|
||||||
|
toluafix_pushusertype_ccobject(L, eventListennerAcc->event->_ID, &(eventListennerAcc->event->_luaID), (void*)(eventListennerAcc->event),"Event");
|
||||||
|
Acceleration* accleration = static_cast<Acceleration*>(eventListennerAcc->acc);
|
||||||
|
lua_pushnumber(L,accleration->x);
|
||||||
|
lua_pushnumber(L,accleration->y);
|
||||||
|
lua_pushnumber(L,accleration->z);
|
||||||
|
lua_pushnumber(L,accleration->timestamp);
|
||||||
|
int ret = _stack->executeFunctionByHandler(handler, 5);
|
||||||
|
_stack->clean();
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
int LuaEngine::handleEventListenerKeyboard(void* data)
|
||||||
|
{
|
||||||
|
if (nullptr == data)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
BasicScriptData* basicScriptData = static_cast<BasicScriptData*>(data);
|
||||||
|
if (nullptr == basicScriptData->nativeObject || nullptr == basicScriptData->value)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
LuaEventListenerKeyboarData* keyboardData = static_cast<LuaEventListenerKeyboarData*>(basicScriptData->value);
|
||||||
|
|
||||||
|
int handler = ScriptHandlerMgr::getInstance()->getObjectHandler(basicScriptData->nativeObject, keyboardData->type);
|
||||||
|
if (0 == handler)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
lua_State* L = _stack->getLuaState();
|
||||||
|
lua_pushinteger(L, keyboardData->keyCode);
|
||||||
|
toluafix_pushusertype_ccobject(L, keyboardData->event->_ID, &(keyboardData->event->_luaID), (void*)(keyboardData->event),"Event");
|
||||||
|
int ret = _stack->executeFunctionByHandler(handler, 2);
|
||||||
|
_stack->clean();
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
int LuaEngine::handleEventListenerTouch(void* data)
|
||||||
|
{
|
||||||
|
if (nullptr == data)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
LuaEventListenerTouchData* listenerData = static_cast<LuaEventListenerTouchData*>(data);
|
||||||
|
if (nullptr == listenerData->nativeObject || nullptr == listenerData->touch || nullptr == listenerData->event)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
int handler = ScriptHandlerMgr::getInstance()->getObjectHandler(listenerData->nativeObject, listenerData->type);
|
||||||
|
if (0 == handler)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
|
Touch* touch = listenerData->touch;
|
||||||
|
if (NULL != touch) {
|
||||||
|
lua_State* L = _stack->getLuaState();
|
||||||
|
toluafix_pushusertype_ccobject(L, listenerData->touch->_ID, &(listenerData->touch->_luaID), (void*)(listenerData->touch),"Touch");
|
||||||
|
toluafix_pushusertype_ccobject(L, listenerData->event->_ID, &(listenerData->event->_luaID), (void*)(listenerData->event),"Event");
|
||||||
|
ret = _stack->executeFunctionByHandler(handler, 2);
|
||||||
|
}
|
||||||
|
_stack->clean();
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
int LuaEngine::handleEventListenerTouches(void* data)
|
||||||
|
{
|
||||||
|
if (nullptr == data)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
LuaEventListenerTouchesData * listenerData = static_cast<LuaEventListenerTouchesData*>(data);
|
||||||
|
if (NULL == listenerData->nativeObject || nullptr == listenerData->event || listenerData->touches.size() == 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
int handler = ScriptHandlerMgr::getInstance()->getObjectHandler((void*)listenerData->nativeObject, listenerData->type);
|
||||||
|
|
||||||
|
if (0 == handler)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
lua_State *L = _stack->getLuaState();
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
|
lua_newtable(L);
|
||||||
|
int i = 1;
|
||||||
|
for (auto& touch : listenerData->touches)
|
||||||
|
{
|
||||||
|
lua_pushnumber(L, (lua_Number)i);
|
||||||
|
toluafix_pushusertype_ccobject(L, touch->_ID, &(touch->_luaID), (void*)(touch),"Touch");
|
||||||
|
lua_rawset(L, -3);
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
toluafix_pushusertype_ccobject(L, listenerData->event->_ID, &(listenerData->event->_luaID), (void*)(listenerData->event),"Event");
|
||||||
|
|
||||||
|
ret = _stack->executeFunctionByHandler(handler, 2);
|
||||||
|
_stack->clean();
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
int LuaEngine::handleEventListenerMouse(void* data)
|
||||||
|
{
|
||||||
|
if (nullptr == data)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
LuaEventListenerMouseData * listenerData = static_cast<LuaEventListenerMouseData*>(data);
|
||||||
|
if (NULL == listenerData->nativeObject || nullptr == listenerData->event )
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
int handler = ScriptHandlerMgr::getInstance()->getObjectHandler((void*)listenerData->nativeObject, listenerData->type);
|
||||||
|
|
||||||
|
if (0 == handler)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
lua_State* L = _stack->getLuaState();
|
||||||
|
toluafix_pushusertype_ccobject(L, listenerData->event->_ID, &(listenerData->event->_luaID), (void*)(listenerData->event),"Event");
|
||||||
|
|
||||||
|
int ret = _stack->executeFunctionByHandler(handler, 1);
|
||||||
|
_stack->clean();
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
int LuaEngine::handleEventListenerCustom(void* data)
|
||||||
|
{
|
||||||
|
if (nullptr == data)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
BasicScriptData * listenerData = static_cast<BasicScriptData*>(data);
|
||||||
|
if (NULL == listenerData->nativeObject || nullptr == listenerData->value )
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
EventCustom* eventCustom = static_cast<EventCustom*>(listenerData->value);
|
||||||
|
int handler = ScriptHandlerMgr::getInstance()->getObjectHandler((void*)listenerData->nativeObject, ScriptHandlerMgr::HandlerType::EVENTLISTENER_CUSTIOM);
|
||||||
|
|
||||||
|
if (0 == handler)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
lua_State* L = _stack->getLuaState();
|
||||||
|
toluafix_pushusertype_ccobject(L, eventCustom->_ID, &(eventCustom->_luaID), (void*)(eventCustom),"EventCustom");
|
||||||
|
int ret = _stack->executeFunctionByHandler(handler, 1);
|
||||||
|
_stack->clean();
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
NS_CC_END
|
NS_CC_END
|
||||||
|
|
|
@ -139,6 +139,12 @@ private:
|
||||||
int handleAssetsManagerEvent(void* data);
|
int handleAssetsManagerEvent(void* data);
|
||||||
int handleCocoStudioEventListener(void* data);
|
int handleCocoStudioEventListener(void* data);
|
||||||
int handleArmatureWrapper(void* data);
|
int handleArmatureWrapper(void* data);
|
||||||
|
int handleEventListenerAcc(void* data);
|
||||||
|
int handleEventListenerKeyboard(void* data);
|
||||||
|
int handleEventListenerTouch(void* data);
|
||||||
|
int handleEventListenerTouches(void* data);
|
||||||
|
int handleEventListenerMouse(void* data);
|
||||||
|
int handleEventListenerCustom(void* data);
|
||||||
private:
|
private:
|
||||||
static LuaEngine* _defaultEngine;
|
static LuaEngine* _defaultEngine;
|
||||||
LuaStack *_stack;
|
LuaStack *_stack;
|
||||||
|
|
|
@ -144,6 +144,7 @@ bool LuaStack::init(void)
|
||||||
register_all_cocos2dx_extension(_state);
|
register_all_cocos2dx_extension(_state);
|
||||||
register_all_cocos2dx_deprecated(_state);
|
register_all_cocos2dx_deprecated(_state);
|
||||||
register_cocos2dx_extension_CCBProxy(_state);
|
register_cocos2dx_extension_CCBProxy(_state);
|
||||||
|
register_cocos2dx_event_releated(_state);
|
||||||
tolua_opengl_open(_state);
|
tolua_opengl_open(_state);
|
||||||
register_all_cocos2dx_studio(_state);
|
register_all_cocos2dx_studio(_state);
|
||||||
register_all_cocos2dx_manual(_state);
|
register_all_cocos2dx_manual(_state);
|
||||||
|
|
|
@ -110,6 +110,22 @@ public:
|
||||||
|
|
||||||
EVENT_LISTENER,
|
EVENT_LISTENER,
|
||||||
ARMATURE_EVENT,
|
ARMATURE_EVENT,
|
||||||
|
|
||||||
|
EVENTLISTENER_ACC,
|
||||||
|
EVENTLISTENER_CUSTIOM,
|
||||||
|
|
||||||
|
EVENTLISTENER_KEYBOARD_PRESSED,
|
||||||
|
EVENTLISTENER_KEYBOARD_RELEASE,
|
||||||
|
|
||||||
|
EVENTLISTENER_TOUCH_BEGAN,
|
||||||
|
EVENTLISTENER_TOUCH_MOVED,
|
||||||
|
EVENTLISTENER_TOUCH_ENDED,
|
||||||
|
EVENTLISTENER_TOUCH_CANCELLED,
|
||||||
|
|
||||||
|
EVENTLISTENER_MOUSE_DOWN,
|
||||||
|
EVENTLISTENER_MOUSE_UP,
|
||||||
|
EVENTLISTENER_MOUSE_MOVE,
|
||||||
|
EVENTLISTENER_MOUSE_SCROLL,
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef int Handler;
|
typedef int Handler;
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1 @@
|
||||||
|
b633b49d700c36e38f74509d09c52255e2300ecf
|
|
@ -9,6 +9,101 @@ extern "C" {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int register_all_cocos2dx_manual(lua_State* tolua_S);
|
#include "cocos2d.h"
|
||||||
|
#include "LuaScriptHandlerMgr.h"
|
||||||
|
|
||||||
|
NS_CC_BEGIN
|
||||||
|
class LuaEventListenerCustom
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static EventListenerCustom* create(const std::string& eventName);
|
||||||
|
};
|
||||||
|
|
||||||
|
class LuaEventListenerAcceleration
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static EventListenerAcceleration* create();
|
||||||
|
};
|
||||||
|
NS_CC_END
|
||||||
|
|
||||||
|
USING_NS_CC;
|
||||||
|
|
||||||
|
TOLUA_API int register_all_cocos2dx_manual(lua_State* tolua_S);
|
||||||
|
|
||||||
|
TOLUA_API int register_cocos2dx_event_releated(lua_State* tolua_S);
|
||||||
|
|
||||||
|
struct LuaEventListenerAccelerationData
|
||||||
|
{
|
||||||
|
void* acc;
|
||||||
|
Event* event;
|
||||||
|
|
||||||
|
LuaEventListenerAccelerationData(void* inAcc,Event* inEvent)
|
||||||
|
:acc(inAcc),event(inEvent)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct LuaEventListenerKeyboarData
|
||||||
|
{
|
||||||
|
enum class KeyboardStatus :int
|
||||||
|
{
|
||||||
|
PRESSED = 0,
|
||||||
|
RELEASE,
|
||||||
|
};
|
||||||
|
int keyCode;
|
||||||
|
Event* event;
|
||||||
|
ScriptHandlerMgr::HandlerType type;
|
||||||
|
|
||||||
|
LuaEventListenerKeyboarData(int inKeyCode,Event* inEvent,ScriptHandlerMgr::HandlerType inType)
|
||||||
|
:keyCode(inKeyCode),event(inEvent),type(inType)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct LuaEventListenerTouchData
|
||||||
|
{
|
||||||
|
ScriptHandlerMgr::HandlerType type;
|
||||||
|
void* nativeObject;
|
||||||
|
Touch* touch;
|
||||||
|
Event* event;
|
||||||
|
|
||||||
|
LuaEventListenerTouchData(ScriptHandlerMgr::HandlerType inType, void* inNativeObject, Touch* inTouch, Event* inEvent)
|
||||||
|
: type(inType),
|
||||||
|
nativeObject(inNativeObject),
|
||||||
|
touch(inTouch),
|
||||||
|
event(inEvent)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct LuaEventListenerTouchesData
|
||||||
|
{
|
||||||
|
ScriptHandlerMgr::HandlerType type;
|
||||||
|
void* nativeObject;
|
||||||
|
std::vector<Touch*> touches;
|
||||||
|
Event* event;
|
||||||
|
|
||||||
|
LuaEventListenerTouchesData(ScriptHandlerMgr::HandlerType inType, void* inNativeObject, std::vector<Touch*> inTouches, Event* inEvent)
|
||||||
|
: type(inType),
|
||||||
|
nativeObject(inNativeObject),
|
||||||
|
touches(inTouches),
|
||||||
|
event(inEvent)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct LuaEventListenerMouseData
|
||||||
|
{
|
||||||
|
ScriptHandlerMgr::HandlerType type;
|
||||||
|
void* nativeObject;
|
||||||
|
Event* event;
|
||||||
|
|
||||||
|
LuaEventListenerMouseData(ScriptHandlerMgr::HandlerType inType, void* inNativeObject, Event* inEvent)
|
||||||
|
: type(inType),
|
||||||
|
nativeObject(inNativeObject),
|
||||||
|
event(inEvent)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
#endif // #ifndef COCOS2DX_SCRIPT_LUA_COCOS2DX_SUPPORT_GENERATED_LUA_COCOS2DX_MANUAL_H
|
#endif // #ifndef COCOS2DX_SCRIPT_LUA_COCOS2DX_SUPPORT_GENERATED_LUA_COCOS2DX_MANUAL_H
|
||||||
|
|
|
@ -326,9 +326,41 @@ cc.HANDLERTYPE_ASSETSMANAGER_SUCCESS = 33
|
||||||
cc.HANDLERTYPE_ASSETSMANAGER_ERROR = 34
|
cc.HANDLERTYPE_ASSETSMANAGER_ERROR = 34
|
||||||
cc.HANDLERTYPE_EVENT_LISTENER = 35
|
cc.HANDLERTYPE_EVENT_LISTENER = 35
|
||||||
cc.HANDLERTYPE_ARMATURE_EVENT = 36
|
cc.HANDLERTYPE_ARMATURE_EVENT = 36
|
||||||
|
cc.HANDLERTYPE_EVENTLISTENER_ACC = 37
|
||||||
|
cc.HANDLERTYPE_EVENTLISTENER_CUSTIOM = 38
|
||||||
|
|
||||||
|
cc.HANDLERTYPE_EVENTLISTENER_KEYBOARD_PRESSED = 39
|
||||||
|
cc.HANDLERTYPE_EVENTLISTENER_KEYBOARD_RELEASE = 40
|
||||||
|
|
||||||
|
cc.HANDLERTYPE_EVENTLISTENER_TOUCH_BEGAN = 41
|
||||||
|
cc.HANDLERTYPE_EVENTLISTENER_TOUCH_MOVED = 42
|
||||||
|
cc.HANDLERTYPE_EVENTLISTENER_TOUCH_ENDED = 43
|
||||||
|
cc.HANDLERTYPE_EVENTLISTENER_TOUCH_CANCELLED = 44
|
||||||
|
|
||||||
|
cc.HANDLERTYPE_EVENTLISTENER_MOUSE_DOWN = 45
|
||||||
|
cc.HANDLERTYPE_EVENTLISTENER_MOUSE_UP = 46
|
||||||
|
cc.HANDLERTYPE_EVENTLISTENER_MOUSE_MOVE = 47
|
||||||
|
cc.HANDLERTYPE_EVENTLISTENER_MOUSE_SCROLL = 48
|
||||||
|
|
||||||
|
|
||||||
cc.GLYPHCOLLECTION_DYNAMIC = 0
|
cc.GLYPHCOLLECTION_DYNAMIC = 0
|
||||||
cc.GLYPHCOLLECTION_NEHE = 1
|
cc.GLYPHCOLLECTION_NEHE = 1
|
||||||
cc.GLYPHCOLLECTION_ASCII = 2
|
cc.GLYPHCOLLECTION_ASCII = 2
|
||||||
cc.GLYPHCOLLECTION_CUSTOM = 3
|
cc.GLYPHCOLLECTION_CUSTOM = 3
|
||||||
|
|
||||||
|
cc.EVENTLISTENER_UNKNOWN = 0
|
||||||
|
cc.EVENTLISTENER_TOUCH_ONE_BY_ONE = 1
|
||||||
|
cc.EVENTLISTENER_TOUCH_ALL_AT_ONCE = 2
|
||||||
|
cc.EVENTLISTENER_KEYBOARD = 3
|
||||||
|
cc.EVENTLISTENER_MOUSE = 4
|
||||||
|
cc.EVENTLISTENER_ACCELERATION = 5
|
||||||
|
cc.EVENTLISTENER_CUSTOM = 6
|
||||||
|
|
||||||
|
cc.TOUCH_BEGAN = 0
|
||||||
|
cc.TOUCH_MOVED = 1
|
||||||
|
cc.TOUCH_ENDED = 2
|
||||||
|
cc.TOUCH_CANCELLED = 3
|
||||||
|
|
||||||
|
cc.KEYBOARD_PRESSED = 0
|
||||||
|
cc.KEYBOARD_RELEASE = 1
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -32,6 +32,7 @@ require "luaScript/LabelTestNew/LabelTestNew"
|
||||||
require "luaScript/LayerTest/LayerTest"
|
require "luaScript/LayerTest/LayerTest"
|
||||||
require "luaScript/MenuTest/MenuTest"
|
require "luaScript/MenuTest/MenuTest"
|
||||||
require "luaScript/MotionStreakTest/MotionStreakTest"
|
require "luaScript/MotionStreakTest/MotionStreakTest"
|
||||||
|
require "luaScript/NewEventDispatcherTest/NewEventDispatcherTest"
|
||||||
require "luaScript/NodeTest/NodeTest"
|
require "luaScript/NodeTest/NodeTest"
|
||||||
require "luaScript/OpenGLTest/OpenGLTest"
|
require "luaScript/OpenGLTest/OpenGLTest"
|
||||||
require "luaScript/ParallaxTest/ParallaxTest"
|
require "luaScript/ParallaxTest/ParallaxTest"
|
||||||
|
@ -87,6 +88,7 @@ local _allTests = {
|
||||||
{ isSupported = true, name = "MenuTest" , create_func = MenuTestMain },
|
{ isSupported = true, name = "MenuTest" , create_func = MenuTestMain },
|
||||||
{ isSupported = true, name = "MotionStreakTest" , create_func = MotionStreakTest },
|
{ isSupported = true, name = "MotionStreakTest" , create_func = MotionStreakTest },
|
||||||
{ isSupported = false, name = "MutiTouchTest" , create_func= MutiTouchTestMain },
|
{ isSupported = false, name = "MutiTouchTest" , create_func= MutiTouchTestMain },
|
||||||
|
{ isSupported = true, name = "NewEventDispatcherTest" , create_func = NewEventDispatcherTest },
|
||||||
{ isSupported = true, name = "NodeTest" , create_func = CocosNodeTest },
|
{ isSupported = true, name = "NodeTest" , create_func = CocosNodeTest },
|
||||||
{ isSupported = true, name = "OpenGLTest" , create_func= OpenGLTestMain },
|
{ isSupported = true, name = "OpenGLTest" , create_func= OpenGLTestMain },
|
||||||
{ isSupported = true, name = "ParallaxTest" , create_func = ParallaxTestMain },
|
{ isSupported = true, name = "ParallaxTest" , create_func = ParallaxTestMain },
|
||||||
|
|
|
@ -26,7 +26,7 @@ headers = %(cocosdir)s/cocos/2d/cocos2d.h %(cocosdir)s/cocos/audio/include/Simpl
|
||||||
|
|
||||||
# what classes to produce code for. You can use regular expressions here. When testing the regular
|
# what classes to produce code for. You can use regular expressions here. When testing the regular
|
||||||
# expression, it will be enclosed in "^$", like this: "^Menu*$".
|
# expression, it will be enclosed in "^$", like this: "^Menu*$".
|
||||||
classes = New.* Sprite.* Scene Node.* Director Layer.* Menu.* Touch .*Action.* Move.* Rotate.* Blink.* Tint.* Sequence Repeat.* Fade.* Ease.* Scale.* Transition.* Spawn Animat.* Flip.* Delay.* Skew.* Jump.* Place.* Show.* Progress.* PointArray ToggleVisibility.* RemoveSelf Hide Particle.* Label.* Atlas.* TextureCache.* Texture2D Cardinal.* CatmullRom.* ParallaxNode TileMap.* TMX.* CallFunc RenderTexture GridAction Grid3DAction GridBase$ .+Grid Shaky3D Waves3D FlipX3D FlipY3D Speed ActionManager Set Data SimpleAudioEngine Scheduler Timer Orbit.* Follow.* Bezier.* CardinalSpline.* Camera.* DrawNode .*3D$ Liquid$ Waves$ ShuffleTiles$ TurnOffTiles$ Split.* Twirl$ FileUtils$ GLProgram ShaderCache Application ClippingNode MotionStreak ^Object$ UserDefault EGLViewProtocol EGLView Image
|
classes = New.* Sprite.* Scene Node.* Director Layer.* Menu.* Touch .*Action.* Move.* Rotate.* Blink.* Tint.* Sequence Repeat.* Fade.* Ease.* Scale.* Transition.* Spawn Animat.* Flip.* Delay.* Skew.* Jump.* Place.* Show.* Progress.* PointArray ToggleVisibility.* RemoveSelf Hide Particle.* Label.* Atlas.* TextureCache.* Texture2D Cardinal.* CatmullRom.* ParallaxNode TileMap.* TMX.* CallFunc RenderTexture GridAction Grid3DAction GridBase$ .+Grid Shaky3D Waves3D FlipX3D FlipY3D Speed ActionManager Set Data SimpleAudioEngine Scheduler Timer Orbit.* Follow.* Bezier.* CardinalSpline.* Camera.* DrawNode .*3D$ Liquid$ Waves$ ShuffleTiles$ TurnOffTiles$ Split.* Twirl$ FileUtils$ GLProgram ShaderCache Application ClippingNode MotionStreak ^Object$ UserDefault EGLViewProtocol EGLView Image Event.*
|
||||||
|
|
||||||
# what should we skip? in the format ClassName::[function function]
|
# what should we skip? in the format ClassName::[function function]
|
||||||
# ClassName is a regular expression, but will be used like this: "^ClassName$" functions are also
|
# ClassName is a regular expression, but will be used like this: "^ClassName$" functions are also
|
||||||
|
@ -79,6 +79,9 @@ skip = Node::[setGLServerState description getUserObject .*UserData getGLServerS
|
||||||
Dictionary::[*],
|
Dictionary::[*],
|
||||||
Array::[*],
|
Array::[*],
|
||||||
Range::[*],
|
Range::[*],
|
||||||
|
EventListenerVector::[*],
|
||||||
|
EventListener.*::[create],
|
||||||
|
EventTouch::[(s|g)etTouches],
|
||||||
NotificationObserver::[*],
|
NotificationObserver::[*],
|
||||||
Image::[initWithString initWithImageData initWithRawData],
|
Image::[initWithString initWithImageData initWithRawData],
|
||||||
Sequence::[create],
|
Sequence::[create],
|
||||||
|
@ -139,7 +142,7 @@ base_classes_to_skip = Clonable
|
||||||
|
|
||||||
# classes that create no constructor
|
# classes that create no constructor
|
||||||
# Set is special and we will use a hand-written constructor
|
# Set is special and we will use a hand-written constructor
|
||||||
abstract_classes = Action FiniteTimeAction ActionInterval ActionEase EaseRateAction EaseElastic EaseBounce ActionInstant GridAction Grid3DAction TiledGrid3DAction Director SpriteFrameCache TransitionEaseScene Set SimpleAudioEngine FileUtils Application ClippingNode Label EGLViewProtocol EGLView
|
abstract_classes = Action FiniteTimeAction ActionInterval ActionEase EaseRateAction EaseElastic EaseBounce ActionInstant GridAction Grid3DAction TiledGrid3DAction Director SpriteFrameCache TransitionEaseScene Set SimpleAudioEngine FileUtils Application ClippingNode Label EGLViewProtocol EGLView EventAcceleration
|
||||||
|
|
||||||
# Determining whether to use script object(js object) to control the lifecycle of native(cpp) object or the other way around. Supported values are 'yes' or 'no'.
|
# Determining whether to use script object(js object) to control the lifecycle of native(cpp) object or the other way around. Supported values are 'yes' or 'no'.
|
||||||
script_control_cpp = no
|
script_control_cpp = no
|
||||||
|
|
Loading…
Reference in New Issue