Update the lua test cases about the GUI

This commit is contained in:
samuele3hu 2014-01-03 10:39:19 +08:00
parent c29e328490
commit 07a3efb585
15 changed files with 928 additions and 812 deletions

View File

@ -1 +1 @@
4b92c964454c54c1b5df9576f11365c53e253724
f0d0e2815c4a581e7a1d8895efca2c2e8bc71679

View File

@ -1 +1 @@
7cc2be4e284d9095dd8fa56a092a98562f132776
3e5ec4c41f43234cf4365c10bef1a57a5373aed1

View File

@ -32,6 +32,7 @@
#include "lua_cocos2dx_manual.hpp"
#include "lua_cocos2dx_extension_manual.h"
#include "lua_cocos2dx_coco_studio_manual.hpp"
#include "lua_cocos2dx_gui_manual.hpp"
NS_CC_BEGIN

View File

@ -58,6 +58,8 @@ extern "C" {
#include "lua_cocos2dx_coco_studio_manual.hpp"
#include "lua_cocos2dx_spine_auto.hpp"
#include "lua_cocos2dx_spine_manual.hpp"
#include "lua_cocos2dx_gui_auto.hpp"
#include "lua_cocos2dx_gui_manual.hpp"
namespace {
int lua_print(lua_State * luastate)
@ -148,11 +150,13 @@ bool LuaStack::init(void)
register_cocos2dx_extension_CCBProxy(_state);
register_cocos2dx_event_releated(_state);
tolua_opengl_open(_state);
register_all_cocos2dx_gui(_state);
register_all_cocos2dx_studio(_state);
register_all_cocos2dx_manual(_state);
register_all_cocos2dx_extension_manual(_state);
register_all_cocos2dx_manual_deprecated(_state);
register_all_cocos2dx_coco_studio_manual(_state);
register_all_cocos2dx_gui_manual(_state);
register_all_cocos2dx_spine(_state);
register_all_cocos2dx_spine_manual(_state);
register_glnode_manual(_state);

View File

@ -12,611 +12,11 @@ extern "C" {
#include "LuaBasicConversions.h"
#include "LuaScriptHandlerMgr.h"
#include "CCLuaValue.h"
#include "CocosGUI.h"
#include "CocoStudio.h"
#include "CCLuaEngine.h"
using namespace gui;
using namespace cocostudio;
class LuaCocoStudioEventListener:public Object
{
public:
LuaCocoStudioEventListener();
virtual ~LuaCocoStudioEventListener();
static LuaCocoStudioEventListener* create();
virtual void eventCallbackFunc(Object* sender,int eventType);
};
LuaCocoStudioEventListener::LuaCocoStudioEventListener()
{
}
LuaCocoStudioEventListener::~LuaCocoStudioEventListener()
{
}
LuaCocoStudioEventListener* LuaCocoStudioEventListener::create()
{
LuaCocoStudioEventListener* listener = new LuaCocoStudioEventListener();
if (nullptr == listener)
return nullptr;
listener->autorelease();
return listener;
}
void LuaCocoStudioEventListener::eventCallbackFunc(Object* sender,int eventType)
{
int handler = ScriptHandlerMgr::getInstance()->getObjectHandler((void*)this, ScriptHandlerMgr::HandlerType::STUDIO_EVENT_LISTENER);
if (0 != handler)
{
LuaStudioEventListenerData eventData(sender,eventType);
BasicScriptData data(this,(void*)&eventData);
LuaEngine::getInstance()->handleEvent(ScriptHandlerMgr::HandlerType::STUDIO_EVENT_LISTENER, (void*)&data);
}
}
static int lua_cocos2dx_Widget_addTouchEventListener(lua_State* L)
{
if (nullptr == L)
return 0;
int argc = 0;
Widget* self = nullptr;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
if (!tolua_isusertype(L,1,"Widget",0,&tolua_err)) goto tolua_lerror;
#endif
self = static_cast<Widget*>(tolua_tousertype(L,1,0));
#if COCOS2D_DEBUG >= 1
if (nullptr == self) {
tolua_error(L,"invalid 'self' in function 'lua_cocos2dx_Widget_addTouchEventListener'\n", NULL);
return 0;
}
#endif
argc = lua_gettop(L) - 1;
if (1 == argc)
{
#if COCOS2D_DEBUG >= 1
if (!toluafix_isfunction(L,2,"LUA_FUNCTION",0,&tolua_err))
{
goto tolua_lerror;
}
#endif
LuaCocoStudioEventListener* listener = LuaCocoStudioEventListener::create();
if (nullptr == listener)
{
tolua_error(L,"LuaCocoStudioEventListener create fail\n", NULL);
return 0;
}
LUA_FUNCTION handler = ( toluafix_ref_function(L,2,0));
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)listener, handler, ScriptHandlerMgr::HandlerType::STUDIO_EVENT_LISTENER);
self->setUserObject(listener);
self->addTouchEventListener(listener, toucheventselector(LuaCocoStudioEventListener::eventCallbackFunc));
return 0;
}
CCLOG("'addTouchEventListener' function of Widget has wrong number of arguments: %d, was expecting %d\n", argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(L,"#ferror in function 'addTouchEventListener'.",&tolua_err);
return 0;
#endif
}
static void extendWidget(lua_State* L)
{
lua_pushstring(L, "Widget");
lua_rawget(L, LUA_REGISTRYINDEX);
if (lua_istable(L,-1))
{
tolua_function(L, "addTouchEventListener", lua_cocos2dx_Widget_addTouchEventListener);
}
lua_pop(L, 1);
}
static int lua_cocos2dx_CheckBox_addEventListenerCheckBox(lua_State* L)
{
if (nullptr == L)
return 0;
int argc = 0;
CheckBox* self = nullptr;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
if (!tolua_isusertype(L,1,"CheckBox",0,&tolua_err)) goto tolua_lerror;
#endif
self = static_cast<CheckBox*>(tolua_tousertype(L,1,0));
#if COCOS2D_DEBUG >= 1
if (nullptr == self) {
tolua_error(L,"invalid 'self' in function 'lua_cocos2dx_CheckBox_addEventListenerCheckBox'\n", NULL);
return 0;
}
#endif
argc = lua_gettop(L) - 1;
if (1 == argc)
{
#if COCOS2D_DEBUG >= 1
if (!toluafix_isfunction(L,2,"LUA_FUNCTION",0,&tolua_err))
{
goto tolua_lerror;
}
#endif
LuaCocoStudioEventListener* listener = LuaCocoStudioEventListener::create();
if (nullptr == listener)
{
tolua_error(L,"LuaCocoStudioEventListener create fail\n", NULL);
return 0;
}
LUA_FUNCTION handler = ( toluafix_ref_function(L,2,0));
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)listener, handler, ScriptHandlerMgr::HandlerType::STUDIO_EVENT_LISTENER);
self->setUserObject(listener);
self->addEventListenerCheckBox(listener, checkboxselectedeventselector(LuaCocoStudioEventListener::eventCallbackFunc));
return 0;
}
CCLOG("'addEventListenerCheckBox' function of CheckBox has wrong number of arguments: %d, was expecting %d\n", argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(L,"#ferror in function 'addEventListenerCheckBox'.",&tolua_err);
return 0;
#endif
}
static void extendCheckBox(lua_State* L)
{
lua_pushstring(L, "CheckBox");
lua_rawget(L, LUA_REGISTRYINDEX);
if (lua_istable(L,-1))
{
tolua_function(L, "addEventListenerCheckBox", lua_cocos2dx_CheckBox_addEventListenerCheckBox);
}
lua_pop(L, 1);
}
static int lua_cocos2dx_Slider_addEventListenerSlider(lua_State* L)
{
if (nullptr == L)
return 0;
int argc = 0;
Slider* self = nullptr;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
if (!tolua_isusertype(L,1,"Slider",0,&tolua_err)) goto tolua_lerror;
#endif
self = static_cast<Slider*>(tolua_tousertype(L,1,0));
#if COCOS2D_DEBUG >= 1
if (nullptr == self) {
tolua_error(L,"invalid 'self' in function 'lua_cocos2dx_Slider_addEventListenerSlider'\n", NULL);
return 0;
}
#endif
argc = lua_gettop(L) - 1;
if (1 == argc)
{
#if COCOS2D_DEBUG >= 1
if (!toluafix_isfunction(L,2,"LUA_FUNCTION",0,&tolua_err) )
{
goto tolua_lerror;
}
#endif
LuaCocoStudioEventListener* listener = LuaCocoStudioEventListener::create();
if (nullptr == listener)
{
tolua_error(L,"LuaCocoStudioEventListener create fail\n", NULL);
return 0;
}
LUA_FUNCTION handler = ( toluafix_ref_function(L,2,0));
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)listener, handler, ScriptHandlerMgr::HandlerType::STUDIO_EVENT_LISTENER);
self->setUserObject(listener);
self->addEventListenerSlider(listener, sliderpercentchangedselector(LuaCocoStudioEventListener::eventCallbackFunc));
return 0;
}
CCLOG("'addEventListenerSlider' function of Slider has wrong number of arguments: %d, was expecting %d\n", argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(L,"#ferror in function 'addEventListenerSlider'.",&tolua_err);
return 0;
#endif
}
static void extendSlider(lua_State* L)
{
lua_pushstring(L, "Slider");
lua_rawget(L, LUA_REGISTRYINDEX);
if (lua_istable(L,-1))
{
tolua_function(L, "addEventListenerSlider", lua_cocos2dx_Slider_addEventListenerSlider);
}
lua_pop(L, 1);
}
static int lua_cocos2dx_TextField_addEventListenerTextField(lua_State* L)
{
if (nullptr == L)
return 0;
int argc = 0;
TextField* self = nullptr;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
if (!tolua_isusertype(L,1,"TextField",0,&tolua_err)) goto tolua_lerror;
#endif
self = static_cast<TextField*>(tolua_tousertype(L,1,0));
#if COCOS2D_DEBUG >= 1
if (nullptr == self) {
tolua_error(L,"invalid 'self' in function 'lua_cocos2dx_TextField_addEventListenerTextField'\n", NULL);
return 0;
}
#endif
argc = lua_gettop(L) - 1;
if (1 == argc)
{
#if COCOS2D_DEBUG >= 1
if (!toluafix_isfunction(L,2,"LUA_FUNCTION",0,&tolua_err))
{
goto tolua_lerror;
}
#endif
LuaCocoStudioEventListener* listener = LuaCocoStudioEventListener::create();
if (nullptr == listener)
{
tolua_error(L,"LuaCocoStudioEventListener create fail\n", NULL);
return 0;
}
LUA_FUNCTION handler = ( toluafix_ref_function(L,2,0));
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)listener, handler, ScriptHandlerMgr::HandlerType::STUDIO_EVENT_LISTENER);
self->setUserObject(listener);
self->addEventListenerTextField(listener, textfieldeventselector(LuaCocoStudioEventListener::eventCallbackFunc));
return 0;
}
CCLOG("'addEventListenerTextField' function of TextField has wrong number of arguments: %d, was expecting %d\n", argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(L,"#ferror in function 'addEventListenerTextField'.",&tolua_err);
return 0;
#endif
}
static void extendTextField(lua_State* L)
{
lua_pushstring(L, "TextField");
lua_rawget(L, LUA_REGISTRYINDEX);
if (lua_istable(L,-1))
{
tolua_function(L, "addEventListenerTextField", lua_cocos2dx_TextField_addEventListenerTextField);
}
lua_pop(L, 1);
}
static int lua_cocos2dx_PageView_addEventListenerPageView(lua_State* L)
{
if (nullptr == L)
return 0;
int argc = 0;
PageView* self = nullptr;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
if (!tolua_isusertype(L,1,"PageView",0,&tolua_err)) goto tolua_lerror;
#endif
self = static_cast<PageView*>(tolua_tousertype(L,1,0));
#if COCOS2D_DEBUG >= 1
if (nullptr == self) {
tolua_error(L,"invalid 'self' in function 'lua_cocos2dx_PageView_addEventListenerPageView'\n", NULL);
return 0;
}
#endif
argc = lua_gettop(L) - 1;
if (1 == argc)
{
#if COCOS2D_DEBUG >= 1
if (!toluafix_isfunction(L,2,"LUA_FUNCTION",0,&tolua_err) )
{
goto tolua_lerror;
}
#endif
LuaCocoStudioEventListener* listener = LuaCocoStudioEventListener::create();
if (nullptr == listener)
{
tolua_error(L,"LuaCocoStudioEventListener create fail\n", NULL);
return 0;
}
LUA_FUNCTION handler = ( toluafix_ref_function(L,2,0));
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)listener, handler, ScriptHandlerMgr::HandlerType::STUDIO_EVENT_LISTENER);
self->setUserObject(listener);
self->addEventListenerPageView(listener, pagevieweventselector(LuaCocoStudioEventListener::eventCallbackFunc));
return 0;
}
CCLOG("'addEventListenerPageView' function of PageView has wrong number of arguments: %d, was expecting %d\n", argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(L,"#ferror in function 'addEventListenerPageView'.",&tolua_err);
return 0;
#endif
}
static void extendPageView(lua_State* L)
{
lua_pushstring(L, "PageView");
lua_rawget(L, LUA_REGISTRYINDEX);
if (lua_istable(L,-1))
{
tolua_function(L, "addEventListenerPageView", lua_cocos2dx_PageView_addEventListenerPageView);
}
lua_pop(L, 1);
}
static int lua_cocos2dx_ListView_addEventListenerListView(lua_State* L)
{
if (nullptr == L)
return 0;
int argc = 0;
ListView* self = nullptr;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
if (!tolua_isusertype(L,1,"ListView",0,&tolua_err)) goto tolua_lerror;
#endif
self = static_cast<ListView*>(tolua_tousertype(L,1,0));
#if COCOS2D_DEBUG >= 1
if (nullptr == self) {
tolua_error(L,"invalid 'self' in function 'lua_cocos2dx_ListView_addEventListenerListView'\n", NULL);
return 0;
}
#endif
argc = lua_gettop(L) - 1;
if (1 == argc)
{
#if COCOS2D_DEBUG >= 1
if (!toluafix_isfunction(L,2,"LUA_FUNCTION",0,&tolua_err))
{
goto tolua_lerror;
}
#endif
LuaCocoStudioEventListener* listern = LuaCocoStudioEventListener::create();
if (nullptr == listern)
{
tolua_error(L,"LuaCocoStudioEventListener create fail\n", NULL);
return 0;
}
LUA_FUNCTION handler = ( toluafix_ref_function(L,2,0));
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)listern, handler, ScriptHandlerMgr::HandlerType::STUDIO_EVENT_LISTENER);
self->setUserObject(listern);
self->addEventListenerListView(listern, listvieweventselector(LuaCocoStudioEventListener::eventCallbackFunc));
return 0;
}
CCLOG("'addEventListenerListView' function of ListView has wrong number of arguments: %d, was expecting %d\n", argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(L,"#ferror in function 'addEventListenerListView'.",&tolua_err);
return 0;
#endif
}
static void extendListView(lua_State* L)
{
lua_pushstring(L, "ListView");
lua_rawget(L, LUA_REGISTRYINDEX);
if (lua_istable(L,-1))
{
tolua_function(L, "addEventListenerListView", lua_cocos2dx_ListView_addEventListenerListView);
}
lua_pop(L, 1);
}
static int lua_cocos2dx_LayoutParameter_setMargin(lua_State* L)
{
if (nullptr == L)
return 0;
int argc = 0;
LayoutParameter* self = nullptr;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
if (!tolua_isusertype(L,1,"LayoutParameter",0,&tolua_err)) goto tolua_lerror;
#endif
self = static_cast<LayoutParameter*>(tolua_tousertype(L,1,0));
#if COCOS2D_DEBUG >= 1
if (nullptr == self) {
tolua_error(L,"invalid 'self' in function 'lua_cocos2dx_LayoutParameter_setMargin'\n", NULL);
return 0;
}
#endif
argc = lua_gettop(L) - 1;
if (1 == argc)
{
#if COCOS2D_DEBUG >= 1
if (!tolua_istable(L, 2, 0, &tolua_err))
{
goto tolua_lerror;
}
#endif
Margin margin;
lua_pushstring(L, "left");
lua_gettable(L,2);
margin.left = lua_isnil(L,-1) ? 0 : lua_tonumber(L,-1);
lua_pop(L,1);
lua_pushstring(L, "top");
lua_gettable(L,2);
margin.top = lua_isnil(L,-1) ? 0 : lua_tonumber(L,-1);
lua_pop(L,1);
lua_pushstring(L, "right");
lua_gettable(L,2);
margin.right = lua_isnil(L,-1) ? 0 : lua_tonumber(L,-1);
lua_pop(L,1);
lua_pushstring(L, "bottom");
lua_gettable(L,2);
margin.bottom = lua_isnil(L,-1) ? 0 : lua_tonumber(L,-1);
lua_pop(L,1);
self->setMargin(margin);
return 0;
}
CCLOG("'setMargin' function of LayoutParameter has wrong number of arguments: %d, was expecting %d\n", argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(L,"#ferror in function 'setMargin'.",&tolua_err);
return 0;
#endif
}
static int lua_cocos2dx_LayoutParameter_getMargin(lua_State* L)
{
if (nullptr == L)
return 0;
int argc = 0;
LayoutParameter* self = nullptr;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
if (!tolua_isusertype(L,1,"LayoutParameter",0,&tolua_err)) goto tolua_lerror;
#endif
self = static_cast<LayoutParameter*>(tolua_tousertype(L,1,0));
#if COCOS2D_DEBUG >= 1
if (nullptr == self) {
tolua_error(L,"invalid 'self' in function 'lua_cocos2dx_LayoutParameter_getMargin'\n", NULL);
return 0;
}
#endif
argc = lua_gettop(L) - 1;
if (0 == argc)
{
Margin margin = self->getMargin();
lua_newtable(L);
lua_pushstring(L, "left");
lua_pushnumber(L, (lua_Number) margin.left);
lua_rawset(L, -3);
lua_pushstring(L, "top");
lua_pushnumber(L, (lua_Number) margin.top);
lua_rawset(L, -3);
lua_pushstring(L, "right");
lua_pushnumber(L, (lua_Number) margin.right);
lua_rawset(L, -3);
lua_pushstring(L, "bottom");
lua_pushnumber(L, (lua_Number) margin.bottom);
lua_rawset(L, -3);
return 1;
}
CCLOG("'getMargin' function of LayoutParameter has wrong number of arguments: %d, was expecting %d\n", argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(L,"#ferror in function 'getMargin'.",&tolua_err);
return 0;
#endif
}
static void extendLayoutParameter(lua_State* L)
{
lua_pushstring(L, "LayoutParameter");
lua_rawget(L, LUA_REGISTRYINDEX);
if (lua_istable(L,-1))
{
tolua_function(L, "setMargin", lua_cocos2dx_LayoutParameter_setMargin);
tolua_function(L, "getMargin", lua_cocos2dx_LayoutParameter_getMargin);
}
lua_pop(L, 1);
}
class LuaArmatureWrapper:public Object
{
public:
@ -905,13 +305,6 @@ int register_all_cocos2dx_coco_studio_manual(lua_State* L)
{
if (nullptr == L)
return 0;
extendWidget(L);
extendCheckBox(L);
extendSlider(L);
extendTextField(L);
extendPageView(L);
extendListView(L);
extendLayoutParameter(L);
extendArmatureAnimation(L);
extendArmatureDataManager(L);

View File

@ -13,16 +13,6 @@ extern "C" {
TOLUA_API int register_all_cocos2dx_coco_studio_manual(lua_State* L);
struct LuaStudioEventListenerData
{
cocos2d::Object* objTarget;
int eventType;
LuaStudioEventListenerData(cocos2d::Object* _objTarget, int _eventType):objTarget(_objTarget),eventType(_eventType)
{
}
};
struct LuaArmatureWrapperEventData
{
enum class LuaArmatureWrapperEventType

View File

@ -0,0 +1,631 @@
#include "lua_cocos2dx_gui_manual.hpp"
#ifdef __cplusplus
extern "C" {
#endif
#include "tolua_fix.h"
#ifdef __cplusplus
}
#endif
#include "cocos2d.h"
#include "LuaBasicConversions.h"
#include "LuaScriptHandlerMgr.h"
#include "CCLuaValue.h"
#include "CocosGUI.h"
#include "CCLuaEngine.h"
using namespace gui;
class LuaCocoStudioEventListener:public Object
{
public:
LuaCocoStudioEventListener();
virtual ~LuaCocoStudioEventListener();
static LuaCocoStudioEventListener* create();
virtual void eventCallbackFunc(Object* sender,int eventType);
};
LuaCocoStudioEventListener::LuaCocoStudioEventListener()
{
}
LuaCocoStudioEventListener::~LuaCocoStudioEventListener()
{
}
LuaCocoStudioEventListener* LuaCocoStudioEventListener::create()
{
LuaCocoStudioEventListener* listener = new LuaCocoStudioEventListener();
if (nullptr == listener)
return nullptr;
listener->autorelease();
return listener;
}
void LuaCocoStudioEventListener::eventCallbackFunc(Object* sender,int eventType)
{
int handler = ScriptHandlerMgr::getInstance()->getObjectHandler((void*)this, ScriptHandlerMgr::HandlerType::STUDIO_EVENT_LISTENER);
if (0 != handler)
{
LuaStudioEventListenerData eventData(sender,eventType);
BasicScriptData data(this,(void*)&eventData);
LuaEngine::getInstance()->handleEvent(ScriptHandlerMgr::HandlerType::STUDIO_EVENT_LISTENER, (void*)&data);
}
}
static int lua_cocos2dx_Widget_addTouchEventListener(lua_State* L)
{
if (nullptr == L)
return 0;
int argc = 0;
Widget* self = nullptr;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
if (!tolua_isusertype(L,1,"Widget",0,&tolua_err)) goto tolua_lerror;
#endif
self = static_cast<Widget*>(tolua_tousertype(L,1,0));
#if COCOS2D_DEBUG >= 1
if (nullptr == self) {
tolua_error(L,"invalid 'self' in function 'lua_cocos2dx_Widget_addTouchEventListener'\n", NULL);
return 0;
}
#endif
argc = lua_gettop(L) - 1;
if (1 == argc)
{
#if COCOS2D_DEBUG >= 1
if (!toluafix_isfunction(L,2,"LUA_FUNCTION",0,&tolua_err))
{
goto tolua_lerror;
}
#endif
LuaCocoStudioEventListener* listener = LuaCocoStudioEventListener::create();
if (nullptr == listener)
{
tolua_error(L,"LuaCocoStudioEventListener create fail\n", NULL);
return 0;
}
LUA_FUNCTION handler = ( toluafix_ref_function(L,2,0));
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)listener, handler, ScriptHandlerMgr::HandlerType::STUDIO_EVENT_LISTENER);
self->setUserObject(listener);
self->addTouchEventListener(listener, toucheventselector(LuaCocoStudioEventListener::eventCallbackFunc));
return 0;
}
CCLOG("'addTouchEventListener' function of Widget has wrong number of arguments: %d, was expecting %d\n", argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(L,"#ferror in function 'addTouchEventListener'.",&tolua_err);
return 0;
#endif
}
static void extendWidget(lua_State* L)
{
lua_pushstring(L, "Widget");
lua_rawget(L, LUA_REGISTRYINDEX);
if (lua_istable(L,-1))
{
tolua_function(L, "addTouchEventListener", lua_cocos2dx_Widget_addTouchEventListener);
}
lua_pop(L, 1);
}
static int lua_cocos2dx_CheckBox_addEventListenerCheckBox(lua_State* L)
{
if (nullptr == L)
return 0;
int argc = 0;
CheckBox* self = nullptr;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
if (!tolua_isusertype(L,1,"CheckBox",0,&tolua_err)) goto tolua_lerror;
#endif
self = static_cast<CheckBox*>(tolua_tousertype(L,1,0));
#if COCOS2D_DEBUG >= 1
if (nullptr == self) {
tolua_error(L,"invalid 'self' in function 'lua_cocos2dx_CheckBox_addEventListenerCheckBox'\n", NULL);
return 0;
}
#endif
argc = lua_gettop(L) - 1;
if (1 == argc)
{
#if COCOS2D_DEBUG >= 1
if (!toluafix_isfunction(L,2,"LUA_FUNCTION",0,&tolua_err))
{
goto tolua_lerror;
}
#endif
LuaCocoStudioEventListener* listener = LuaCocoStudioEventListener::create();
if (nullptr == listener)
{
tolua_error(L,"LuaCocoStudioEventListener create fail\n", NULL);
return 0;
}
LUA_FUNCTION handler = ( toluafix_ref_function(L,2,0));
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)listener, handler, ScriptHandlerMgr::HandlerType::STUDIO_EVENT_LISTENER);
self->setUserObject(listener);
self->addEventListenerCheckBox(listener, checkboxselectedeventselector(LuaCocoStudioEventListener::eventCallbackFunc));
return 0;
}
CCLOG("'addEventListenerCheckBox' function of CheckBox has wrong number of arguments: %d, was expecting %d\n", argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(L,"#ferror in function 'addEventListenerCheckBox'.",&tolua_err);
return 0;
#endif
}
static void extendCheckBox(lua_State* L)
{
lua_pushstring(L, "CheckBox");
lua_rawget(L, LUA_REGISTRYINDEX);
if (lua_istable(L,-1))
{
tolua_function(L, "addEventListenerCheckBox", lua_cocos2dx_CheckBox_addEventListenerCheckBox);
}
lua_pop(L, 1);
}
static int lua_cocos2dx_Slider_addEventListenerSlider(lua_State* L)
{
if (nullptr == L)
return 0;
int argc = 0;
Slider* self = nullptr;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
if (!tolua_isusertype(L,1,"Slider",0,&tolua_err)) goto tolua_lerror;
#endif
self = static_cast<Slider*>(tolua_tousertype(L,1,0));
#if COCOS2D_DEBUG >= 1
if (nullptr == self) {
tolua_error(L,"invalid 'self' in function 'lua_cocos2dx_Slider_addEventListenerSlider'\n", NULL);
return 0;
}
#endif
argc = lua_gettop(L) - 1;
if (1 == argc)
{
#if COCOS2D_DEBUG >= 1
if (!toluafix_isfunction(L,2,"LUA_FUNCTION",0,&tolua_err) )
{
goto tolua_lerror;
}
#endif
LuaCocoStudioEventListener* listener = LuaCocoStudioEventListener::create();
if (nullptr == listener)
{
tolua_error(L,"LuaCocoStudioEventListener create fail\n", NULL);
return 0;
}
LUA_FUNCTION handler = ( toluafix_ref_function(L,2,0));
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)listener, handler, ScriptHandlerMgr::HandlerType::STUDIO_EVENT_LISTENER);
self->setUserObject(listener);
self->addEventListenerSlider(listener, sliderpercentchangedselector(LuaCocoStudioEventListener::eventCallbackFunc));
return 0;
}
CCLOG("'addEventListenerSlider' function of Slider has wrong number of arguments: %d, was expecting %d\n", argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(L,"#ferror in function 'addEventListenerSlider'.",&tolua_err);
return 0;
#endif
}
static void extendSlider(lua_State* L)
{
lua_pushstring(L, "Slider");
lua_rawget(L, LUA_REGISTRYINDEX);
if (lua_istable(L,-1))
{
tolua_function(L, "addEventListenerSlider", lua_cocos2dx_Slider_addEventListenerSlider);
}
lua_pop(L, 1);
}
static int lua_cocos2dx_TextField_addEventListenerTextField(lua_State* L)
{
if (nullptr == L)
return 0;
int argc = 0;
TextField* self = nullptr;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
if (!tolua_isusertype(L,1,"TextField",0,&tolua_err)) goto tolua_lerror;
#endif
self = static_cast<TextField*>(tolua_tousertype(L,1,0));
#if COCOS2D_DEBUG >= 1
if (nullptr == self) {
tolua_error(L,"invalid 'self' in function 'lua_cocos2dx_TextField_addEventListenerTextField'\n", NULL);
return 0;
}
#endif
argc = lua_gettop(L) - 1;
if (1 == argc)
{
#if COCOS2D_DEBUG >= 1
if (!toluafix_isfunction(L,2,"LUA_FUNCTION",0,&tolua_err))
{
goto tolua_lerror;
}
#endif
LuaCocoStudioEventListener* listener = LuaCocoStudioEventListener::create();
if (nullptr == listener)
{
tolua_error(L,"LuaCocoStudioEventListener create fail\n", NULL);
return 0;
}
LUA_FUNCTION handler = ( toluafix_ref_function(L,2,0));
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)listener, handler, ScriptHandlerMgr::HandlerType::STUDIO_EVENT_LISTENER);
self->setUserObject(listener);
self->addEventListenerTextField(listener, textfieldeventselector(LuaCocoStudioEventListener::eventCallbackFunc));
return 0;
}
CCLOG("'addEventListenerTextField' function of TextField has wrong number of arguments: %d, was expecting %d\n", argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(L,"#ferror in function 'addEventListenerTextField'.",&tolua_err);
return 0;
#endif
}
static void extendTextField(lua_State* L)
{
lua_pushstring(L, "TextField");
lua_rawget(L, LUA_REGISTRYINDEX);
if (lua_istable(L,-1))
{
tolua_function(L, "addEventListenerTextField", lua_cocos2dx_TextField_addEventListenerTextField);
}
lua_pop(L, 1);
}
static int lua_cocos2dx_PageView_addEventListenerPageView(lua_State* L)
{
if (nullptr == L)
return 0;
int argc = 0;
PageView* self = nullptr;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
if (!tolua_isusertype(L,1,"PageView",0,&tolua_err)) goto tolua_lerror;
#endif
self = static_cast<PageView*>(tolua_tousertype(L,1,0));
#if COCOS2D_DEBUG >= 1
if (nullptr == self) {
tolua_error(L,"invalid 'self' in function 'lua_cocos2dx_PageView_addEventListenerPageView'\n", NULL);
return 0;
}
#endif
argc = lua_gettop(L) - 1;
if (1 == argc)
{
#if COCOS2D_DEBUG >= 1
if (!toluafix_isfunction(L,2,"LUA_FUNCTION",0,&tolua_err) )
{
goto tolua_lerror;
}
#endif
LuaCocoStudioEventListener* listener = LuaCocoStudioEventListener::create();
if (nullptr == listener)
{
tolua_error(L,"LuaCocoStudioEventListener create fail\n", NULL);
return 0;
}
LUA_FUNCTION handler = ( toluafix_ref_function(L,2,0));
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)listener, handler, ScriptHandlerMgr::HandlerType::STUDIO_EVENT_LISTENER);
self->setUserObject(listener);
self->addEventListenerPageView(listener, pagevieweventselector(LuaCocoStudioEventListener::eventCallbackFunc));
return 0;
}
CCLOG("'addEventListenerPageView' function of PageView has wrong number of arguments: %d, was expecting %d\n", argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(L,"#ferror in function 'addEventListenerPageView'.",&tolua_err);
return 0;
#endif
}
static void extendPageView(lua_State* L)
{
lua_pushstring(L, "PageView");
lua_rawget(L, LUA_REGISTRYINDEX);
if (lua_istable(L,-1))
{
tolua_function(L, "addEventListenerPageView", lua_cocos2dx_PageView_addEventListenerPageView);
}
lua_pop(L, 1);
}
static int lua_cocos2dx_ListView_addEventListenerListView(lua_State* L)
{
if (nullptr == L)
return 0;
int argc = 0;
ListView* self = nullptr;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
if (!tolua_isusertype(L,1,"ListView",0,&tolua_err)) goto tolua_lerror;
#endif
self = static_cast<ListView*>(tolua_tousertype(L,1,0));
#if COCOS2D_DEBUG >= 1
if (nullptr == self) {
tolua_error(L,"invalid 'self' in function 'lua_cocos2dx_ListView_addEventListenerListView'\n", NULL);
return 0;
}
#endif
argc = lua_gettop(L) - 1;
if (1 == argc)
{
#if COCOS2D_DEBUG >= 1
if (!toluafix_isfunction(L,2,"LUA_FUNCTION",0,&tolua_err))
{
goto tolua_lerror;
}
#endif
LuaCocoStudioEventListener* listern = LuaCocoStudioEventListener::create();
if (nullptr == listern)
{
tolua_error(L,"LuaCocoStudioEventListener create fail\n", NULL);
return 0;
}
LUA_FUNCTION handler = ( toluafix_ref_function(L,2,0));
ScriptHandlerMgr::getInstance()->addObjectHandler((void*)listern, handler, ScriptHandlerMgr::HandlerType::STUDIO_EVENT_LISTENER);
self->setUserObject(listern);
self->addEventListenerListView(listern, listvieweventselector(LuaCocoStudioEventListener::eventCallbackFunc));
return 0;
}
CCLOG("'addEventListenerListView' function of ListView has wrong number of arguments: %d, was expecting %d\n", argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(L,"#ferror in function 'addEventListenerListView'.",&tolua_err);
return 0;
#endif
}
static void extendListView(lua_State* L)
{
lua_pushstring(L, "ListView");
lua_rawget(L, LUA_REGISTRYINDEX);
if (lua_istable(L,-1))
{
tolua_function(L, "addEventListenerListView", lua_cocos2dx_ListView_addEventListenerListView);
}
lua_pop(L, 1);
}
static int lua_cocos2dx_LayoutParameter_setMargin(lua_State* L)
{
if (nullptr == L)
return 0;
int argc = 0;
LayoutParameter* self = nullptr;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
if (!tolua_isusertype(L,1,"LayoutParameter",0,&tolua_err)) goto tolua_lerror;
#endif
self = static_cast<LayoutParameter*>(tolua_tousertype(L,1,0));
#if COCOS2D_DEBUG >= 1
if (nullptr == self) {
tolua_error(L,"invalid 'self' in function 'lua_cocos2dx_LayoutParameter_setMargin'\n", NULL);
return 0;
}
#endif
argc = lua_gettop(L) - 1;
if (1 == argc)
{
#if COCOS2D_DEBUG >= 1
if (!tolua_istable(L, 2, 0, &tolua_err))
{
goto tolua_lerror;
}
#endif
Margin margin;
lua_pushstring(L, "left");
lua_gettable(L,2);
margin.left = lua_isnil(L,-1) ? 0 : lua_tonumber(L,-1);
lua_pop(L,1);
lua_pushstring(L, "top");
lua_gettable(L,2);
margin.top = lua_isnil(L,-1) ? 0 : lua_tonumber(L,-1);
lua_pop(L,1);
lua_pushstring(L, "right");
lua_gettable(L,2);
margin.right = lua_isnil(L,-1) ? 0 : lua_tonumber(L,-1);
lua_pop(L,1);
lua_pushstring(L, "bottom");
lua_gettable(L,2);
margin.bottom = lua_isnil(L,-1) ? 0 : lua_tonumber(L,-1);
lua_pop(L,1);
self->setMargin(margin);
return 0;
}
CCLOG("'setMargin' function of LayoutParameter has wrong number of arguments: %d, was expecting %d\n", argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(L,"#ferror in function 'setMargin'.",&tolua_err);
return 0;
#endif
}
static int lua_cocos2dx_LayoutParameter_getMargin(lua_State* L)
{
if (nullptr == L)
return 0;
int argc = 0;
LayoutParameter* self = nullptr;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
if (!tolua_isusertype(L,1,"LayoutParameter",0,&tolua_err)) goto tolua_lerror;
#endif
self = static_cast<LayoutParameter*>(tolua_tousertype(L,1,0));
#if COCOS2D_DEBUG >= 1
if (nullptr == self) {
tolua_error(L,"invalid 'self' in function 'lua_cocos2dx_LayoutParameter_getMargin'\n", NULL);
return 0;
}
#endif
argc = lua_gettop(L) - 1;
if (0 == argc)
{
Margin margin = self->getMargin();
lua_newtable(L);
lua_pushstring(L, "left");
lua_pushnumber(L, (lua_Number) margin.left);
lua_rawset(L, -3);
lua_pushstring(L, "top");
lua_pushnumber(L, (lua_Number) margin.top);
lua_rawset(L, -3);
lua_pushstring(L, "right");
lua_pushnumber(L, (lua_Number) margin.right);
lua_rawset(L, -3);
lua_pushstring(L, "bottom");
lua_pushnumber(L, (lua_Number) margin.bottom);
lua_rawset(L, -3);
return 1;
}
CCLOG("'getMargin' function of LayoutParameter has wrong number of arguments: %d, was expecting %d\n", argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(L,"#ferror in function 'getMargin'.",&tolua_err);
return 0;
#endif
}
static void extendLayoutParameter(lua_State* L)
{
lua_pushstring(L, "LayoutParameter");
lua_rawget(L, LUA_REGISTRYINDEX);
if (lua_istable(L,-1))
{
tolua_function(L, "setMargin", lua_cocos2dx_LayoutParameter_setMargin);
tolua_function(L, "getMargin", lua_cocos2dx_LayoutParameter_getMargin);
}
lua_pop(L, 1);
}
int register_all_cocos2dx_gui_manual(lua_State* L)
{
if (nullptr == L)
return 0;
extendWidget(L);
extendCheckBox(L);
extendSlider(L);
extendTextField(L);
extendPageView(L);
extendListView(L);
extendLayoutParameter(L);
return 0;
}

View File

@ -0,0 +1,25 @@
#ifndef COCOS_SCRIPTING_LUA_BINDINGS_LUA_COCOS2DX_GUI_MANUAL_H
#define COCOS_SCRIPTING_LUA_BINDINGS_LUA_COCOS2DX_GUI_MANUAL_H
#ifdef __cplusplus
extern "C" {
#endif
#include "tolua++.h"
#ifdef __cplusplus
}
#endif
#include "CCObject.h"
TOLUA_API int register_all_cocos2dx_gui_manual(lua_State* L);
struct LuaStudioEventListenerData
{
cocos2d::Object* objTarget;
int eventType;
LuaStudioEventListenerData(cocos2d::Object* _objTarget, int _eventType):objTarget(_objTarget),eventType(_eventType)
{
}
};
#endif // #ifndef COCOS_SCRIPTING_LUA_BINDINGS_LUA_COCOS2DX_GUI_MANUAL_H

View File

@ -0,0 +1,179 @@
ccui = ccui or {}
ccui.BrightStyle =
{
none = -1,
normal = 0,
highlight = 1,
}
ccui.WidgetType =
{
widget = 0, --control
container = 1, --container
}
ccui.TextureResType =
{
localType = 0,
plistType = 1,
}
ccui.TouchEventType =
{
began = 0,
moved = 1,
ended = 2,
canceled = 3,
}
ccui.SizeType =
{
absolute = 0,
percent = 1,
}
ccui.PositionType = {
absolute = 0,
percent = 1,
}
ccui.CheckBoxEventType =
{
selected = 0,
unselected = 1,
}
ccui.TextFiledEventType =
{
attach_with_ime = 0,
detach_with_ime = 1,
insert_text = 2,
delete_backward = 3,
}
ccui.LayoutBackGroundColorType =
{
none = 0,
solid = 1,
gradient = 2,
}
ccui.LayoutType =
{
absolute = 0,
linearVertical = 1,
linearHorizontal = 2,
relative = 3,
}
ccui.LayoutParameterType =
{
none = 0,
linear = 1,
relative = 2,
}
ccui.LinearGravity =
{
none = 0,
left = 1,
top = 2,
right = 3,
bottom = 4,
centerVertical = 5,
centerHorizontal = 6,
}
ccui.RelativeAlign =
{
alignNone = 0,
alignParentTopLeft = 1,
alignParentTopCenterHorizontal = 2,
alignParentTopRight = 3,
alignParentLeftCenterVertical = 4,
centerInParent = 5,
alignParentRightCenterVertical = 6,
alignParentLeftBottom = 7,
alignParentBottomCenterHorizontal = 8,
alignParentRightBottom = 9,
locationAboveLeftAlign = 10,
locationAboveCenter = 11,
locationAboveRightAlign = 12,
locationLeftOfTopAlign = 13,
locationLeftOfCenter = 14,
locationLeftOfBottomAlign = 15,
locationRightOfTopAlign = 16,
locationRightOfCenter = 17,
locationRightOfBottomAlign = 18,
locationBelowLeftAlign = 19,
locationBelowCenter = 20,
locationBelowRightAlign = 21,
}
ccui.SliderEventType = {percentChanged = 0}
ccui.LoadingBarType = { left = 0, right = 1}
ccui.ScrollViewDir = {
none = 0,
vertical = 1,
horizontal = 2,
both = 3,
}
ccui.ScrollViewMoveDir = {
none = 0,
up = 1,
down = 2,
left = 3,
right = 4,
}
ccui.ScrollviewEventType = {
scrollToTop = 0,
scrollToBottom = 1,
scrollToLeft = 2,
scrollToRight = 3,
scrolling = 4,
bounceTop = 5,
bounceBottom = 6,
bounceLeft = 7,
bounceRight = 8,
}
ccui.ListViewDirection = {
none = 0,
vertical = 1,
horizontal = 2,
}
ccui.ListViewMoveDirection = {
none = 0,
up = 1,
down = 2,
left = 3,
right = 4,
}
ccui.ListViewEventType = {
onsSelectedItem = 0,
}
ccui.PageViewEventType = {
turning = 0,
}
ccui.PVTouchDir = {
touchLeft = 0,
touchRight = 1,
}
ccui.ListViewGravity = {
left = 0,
right = 1,
centerHorizontal = 2,
top = 3,
bottom = 4 ,
centerVertical = 5,
}

View File

@ -2,186 +2,7 @@ ccs = ccs or {}
ccs.MovementEventType = {
START = 0,
COMPLETE = 1,
LOOP_COMPLETE = 2,
}
ccs.BrightStyle =
{
none = -1,
normal = 0,
highlight = 1,
}
ccs.WidgetType =
{
widget = 0, --control
container = 1, --container
}
ccs.TextureResType =
{
UI_TEX_TYPE_LOCAL = 0,
UI_TEX_TYPE_PLIST = 1,
}
ccs.TouchEventType =
{
began = 0,
moved = 1,
ended = 2,
canceled = 3,
}
ccs.SizeType =
{
absolute = 0,
percent = 1,
}
ccs.PositionType = {
absolute = 0,
percent = 1,
}
ccs.CheckBoxEventType =
{
selected = 0,
unselected = 1,
}
ccs.TextFiledEventType =
{
attach_with_ime = 0,
detach_with_ime = 1,
insert_text = 2,
delete_backward = 3,
}
ccs.LayoutBackGroundColorType =
{
none = 0,
solid = 1,
gradient = 2,
}
ccs.LayoutType =
{
absolute = 0,
linearVertical = 1,
linearHorizontal = 2,
relative = 3,
}
ccs.UILayoutParameterType =
{
none = 0,
linear = 1,
relative = 2,
}
ccs.UILinearGravity =
{
none = 0,
left = 1,
top = 2,
right = 3,
bottom = 4,
centerVertical = 5,
centerHorizontal = 6,
}
ccs.UIRelativeAlign =
{
alignNone = 0,
alignParentTopLeft = 1,
alignParentTopCenterHorizontal = 2,
alignParentTopRight = 3,
alignParentLeftCenterVertical = 4,
centerInParent = 5,
alignParentRightCenterVertical = 6,
alignParentLeftBottom = 7,
alignParentBottomCenterHorizontal = 8,
alignParentRightBottom = 9,
locationAboveLeftAlign = 10,
locationAboveCenter = 11,
locationAboveRightAlign = 12,
locationLeftOfTopAlign = 13,
locationLeftOfCenter = 14,
locationLeftOfBottomAlign = 15,
locationRightOfTopAlign = 16,
locationRightOfCenter = 17,
locationRightOfBottomAlign = 18,
locationBelowLeftAlign = 19,
locationBelowCenter = 20,
locationBelowRightAlign = 21,
}
ccs.SliderEventType = {percent_changed = 0}
ccs.LoadingBarType = { left = 0, right = 1}
ccs.SCROLLVIEW_DIR = {
none = 0,
vertical = 1,
horizontal = 2,
both = 3,
}
ccs.SCROLLVIEW_MOVE_DIR = {
none = 0,
up = 1,
down = 2,
left = 3,
right = 4,
}
ccs.ScrollviewEventType = {
SCROLL_TO_TOP = 0,
SCROLL_TO_BOTTOM = 1,
SCROLL_TO_LEFT = 2,
SCROLL_TO_RIGHT = 3,
SCROLLING = 4,
BOUNCE_TOP = 5,
BOUNCE_BOTTOM = 6,
BOUNCE_LEFT = 7,
BOUNCE_RIGHT = 8,
}
ccs.ListViewDirection = {
none = 0,
vertical = 1,
horizontal = 2,
}
ccs.ListViewMoveDirection = {
none = 0,
up = 1,
down = 2,
left = 3,
right = 4,
}
ccs.ListViewEventType = {
init_child = 0,
update_child = 1,
}
ccs.PageViewEventType = {
turning = 0,
}
ccs.PVTouchDir = {
touch_left = 0,
touch_right = 1,
}
ccs.ListViewGravity = {
left = 0,
right = 1,
center_horizontal = 2,
top = 3,
bottom = 4 ,
center_vertical = 5,
start = 0,
complete = 1,
loopComplete = 2,
}

View File

@ -1 +1 @@
63707dd119d9dad00da66996544c1892162dab08
1cb290e913d84d8cd141945c8b4a78ea45481cd5

View File

@ -3,6 +3,7 @@ require "Cocos2dConstants"
require "Opengl"
require "OpenglConstants"
require "StudioConstants"
require "GuiConstants"
require "luaScript/helper"
require "luaScript/testResource"
require "luaScript/VisibleRect"

View File

@ -0,0 +1,68 @@
[cocos2dx_gui]
# the prefix to be added to the generated functions. You might or might not use this in your own
# templates
prefix = cocos2dx_gui
# create a target namespace (in javascript, this would create some code like the equiv. to `ns = ns || {}`)
# all classes will be embedded in that namespace
target_namespace = ccui
# the native namespace in which this module locates, this parameter is used for avoid conflict of the same class name in different modules, as "cocos2d::Label" <-> "cocos2d::gui::Label".
cpp_namespace = cocos2d::gui
android_headers = -I%(androidndkdir)s/platforms/android-14/arch-arm/usr/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.7/libs/armeabi-v7a/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.7/include
android_flags = -D_SIZE_T_DEFINED_
clang_headers = -I%(clangllvmdir)s/lib/clang/3.3/include
clang_flags = -nostdinc -x c++ -std=c++11
cocos_headers = -I%(cocosdir)s/cocos -I%(cocosdir)s/cocos/2d -I%(cocosdir)s/cocos/base -I%(cocosdir)s/cocos/gui -I%(cocosdir)s/cocos/physics -I%(cocosdir)s/cocos/2d/platform -I%(cocosdir)s/cocos/2d/platform/android -I%(cocosdir)s/cocos/math/kazmath/include -I%(cocosdir)s/extensions -I%(cocosdir)s/external -I%(cocosdir)s
cocos_flags = -DANDROID -DCOCOS2D_JAVASCRIPT
cxxgenerator_headers =
# extra arguments for clang
extra_arguments = %(android_headers)s %(clang_headers)s %(cxxgenerator_headers)s %(cocos_headers)s %(android_flags)s %(clang_flags)s %(cocos_flags)s %(extra_flags)s
# what headers to parse
headers = %(cocosdir)s/cocos/gui/CocosGUI.h
# 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*$".
classes = Helper Widget Layer Layout RootWidget Button CheckBox ImageView Text TextAtlas TextBMFont LoadingBar Slider Switch TextField ScrollView ListView PageView LayoutParameter LinearLayoutParameter RelativeLayoutParameter
# 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
# regular expressions, they will not be surrounded by "^$". If you want to skip a whole class, just
# add a single "*" as functions. See bellow for several examples. A special class name is "*", which
# will apply to all class names. This is a convenience wildcard to be able to skip similar named
# functions from all classes.
skip = *::[^visit$ copyWith.* onEnter.* onExit.* ^description$ getObjectType .*HSV onTouch.* onAcc.* onKey.* onRegisterTouchListener (s|g)etBlendFunc ccTouch.*],
Widget::[(s|g)etUserObject],
Layer::[getInputManager],
LayoutParameter::[(s|g)etMargin],
Helper::[init],
ImageView::[doubleClickEvent checkDoubleClick]
rename_functions =
rename_classes =
# for all class names, should we remove something when registering in the target VM?
remove_prefix =
# classes for which there will be no "parent" lookup
classes_have_no_parents = Helper
# base classes which will be skipped when their sub-classes found them.
base_classes_to_skip = Object
# classes that create no constructor
# Set is special and we will use a hand-written constructor
abstract_classes = Helper
# 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

View File

@ -8,7 +8,7 @@ prefix = cocos2dx_studio
target_namespace = ccs
# the native namespace in which this module locates, this parameter is used for avoid conflict of the same class name in different modules, as "cocos2d::Label" <-> "cocos2d::gui::Label".
cpp_namespace = cocos2d::gui cocostudio
cpp_namespace = cocostudio
android_headers = -I%(androidndkdir)s/platforms/android-14/arch-arm/usr/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.7/libs/armeabi-v7a/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.7/include
android_flags = -D_SIZE_T_DEFINED_
@ -26,11 +26,11 @@ cxxgenerator_headers =
extra_arguments = %(android_headers)s %(clang_headers)s %(cxxgenerator_headers)s %(cocos_headers)s %(android_flags)s %(clang_flags)s %(cocos_flags)s %(extra_flags)s
# what headers to parse
headers = %(cocosdir)s/cocos/gui/CocosGUI.h %(cocosdir)s/cocos/editor-support/cocostudio/CocoStudio.h
headers = %(cocosdir)s/cocos/editor-support/cocostudio/CocoStudio.h
# 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*$".
classes = Armature ArmatureAnimation Skin Bone ArmatureDataManager \w+Data$ Widget Layout RootWidget Button CheckBox ImageView Text TextAtlas LoadingBar ScrollView Slider TextField ListView TextBMFont PageView Helper Layer LayoutParameter GReader LinearLayoutParameter RelativeLayoutParameter SceneReader ActionManagerEx ComAudio ComController ComAttribute ComRender BatchNode
classes = Armature ArmatureAnimation Skin Bone ArmatureDataManager \w+Data$ ActionManagerEx ComAudio ComController ComAttribute ComRender BatchNode SceneReader GUIReader ActionObject Tween DisplayManager
# 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
@ -45,14 +45,14 @@ skip = *::[^visit$ copyWith.* onEnter.* onExit.* ^description$ getObjectType .*
Skin::[(s|g)etSkinData],
ArmatureAnimation::[updateHandler updateFrameData frameEvent setMovementEventCallFunc setFrameEventCallFunc],
Bone::[(s|g)etIgnoreMovementBoneData],
Layer::[getInputManager],
LayoutParameter::[(s|g)etMargin],
Helper::[init],
GReader::[setPropsForImageButtonFromJsonDictionary],
ImageView::[doubleClickEvent],
ActionManagerEx::[initWithDictionary],
ActionObject::[initWithDictionary],
DisplayManager::[initDisplayList (s|g)etCurrentDecorativeDisplay getDecorativeDisplayByIndex],
Tween::[(s|g)etMovementBoneData],
GUIReader::[storeFileDesignSize getFileDesignSize],
ActionNode::[initWithDictionary],
ActionObject::[initWithDictionary]
ActionObject::[initWithDictionary],
BaseData::[copy subtract]
rename_functions = GUIReader::[shareReader=getInstance purgeGUIReader=destroyInstance],
ActionManagerEx::[shareManager=getInstance purgeActionManager=destroyInstance],
@ -72,7 +72,7 @@ base_classes_to_skip = Object ProcessBase
# classes that create no constructor
# Set is special and we will use a hand-written constructor
abstract_classes = ArmatureDataManager
abstract_classes = ArmatureDataManager ComAttribute ComRender ComAudio ActionManagerEx SceneReader GUIReader BatchNode
# 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

View File

@ -85,6 +85,9 @@ LD_LIBRARY_PATH=${CLANG_ROOT}/lib $PYTHON_BIN ${CXX_GENERATOR_ROOT}/generator.py
echo "Generating bindings for cocos2dx_extension..."
LD_LIBRARY_PATH=${CLANG_ROOT}/lib $PYTHON_BIN ${CXX_GENERATOR_ROOT}/generator.py ${TO_JS_ROOT}/cocos2dx_extension.ini -s cocos2dx_extension -t lua -o ${COCOS2DX_ROOT}/cocos/scripting/auto-generated/lua-bindings -n lua_cocos2dx_extension_auto
echo "Generating bindings for cocos2dx_gui..."
LD_LIBRARY_PATH=${CLANG_ROOT}/lib $PYTHON_BIN ${CXX_GENERATOR_ROOT}/generator.py ${TO_JS_ROOT}/cocos2dx_gui.ini -s cocos2dx_gui -t lua -o ${COCOS2DX_ROOT}/cocos/scripting/auto-generated/lua-bindings -n lua_cocos2dx_gui_auto
echo "Generating bindings for cocos2dx_studio..."
LD_LIBRARY_PATH=${CLANG_ROOT}/lib $PYTHON_BIN ${CXX_GENERATOR_ROOT}/generator.py ${TO_JS_ROOT}/cocos2dx_studio.ini -s cocos2dx_studio -t lua -o ${COCOS2DX_ROOT}/cocos/scripting/auto-generated/lua-bindings -n lua_cocos2dx_studio_auto