2014-07-17 12:54:50 +08:00
|
|
|
#include "lua_cocos2dx_experimental_manual.hpp"
|
|
|
|
#include "UIVideoPlayer.h"
|
|
|
|
#include "tolua_fix.h"
|
|
|
|
#include "LuaBasicConversions.h"
|
|
|
|
#include "CCLuaValue.h"
|
|
|
|
#include "CCLuaEngine.h"
|
|
|
|
|
2014-07-17 14:54:34 +08:00
|
|
|
static int lua_cocos2dx_experimental_TMXLayer_getTileGIDAt(lua_State* tolua_S)
|
2014-07-17 12:54:50 +08:00
|
|
|
{
|
|
|
|
int argc = 0;
|
2014-07-17 14:54:34 +08:00
|
|
|
cocos2d::experimental::TMXLayer* cobj = nullptr;
|
2014-07-17 12:54:50 +08:00
|
|
|
bool ok = true;
|
|
|
|
|
|
|
|
#if COCOS2D_DEBUG >= 1
|
|
|
|
tolua_Error tolua_err;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#if COCOS2D_DEBUG >= 1
|
2014-07-17 16:41:09 +08:00
|
|
|
if (!tolua_isusertype(tolua_S,1,"ccexp.TMXLayer",0,&tolua_err)) goto tolua_lerror;
|
2014-07-17 12:54:50 +08:00
|
|
|
#endif
|
|
|
|
|
2014-07-17 14:54:34 +08:00
|
|
|
cobj = (cocos2d::experimental::TMXLayer*)tolua_tousertype(tolua_S,1,0);
|
2014-07-17 12:54:50 +08:00
|
|
|
|
|
|
|
#if COCOS2D_DEBUG >= 1
|
|
|
|
if (!cobj)
|
|
|
|
{
|
2014-07-17 14:54:34 +08:00
|
|
|
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_experimental_TMXLayer_getTileGIDAt'", nullptr);
|
2014-07-17 12:54:50 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
argc = lua_gettop(tolua_S)-1;
|
|
|
|
if (argc == 1)
|
|
|
|
{
|
|
|
|
cocos2d::Vec2 arg0;
|
|
|
|
|
2014-07-22 11:16:16 +08:00
|
|
|
ok &= luaval_to_vec2(tolua_S, 2, &arg0, "ccexp.TMXLayer:getTileGIDAt");
|
2014-07-17 12:54:50 +08:00
|
|
|
if(!ok)
|
|
|
|
return 0;
|
|
|
|
int ret = cobj->getTileGIDAt(arg0);
|
|
|
|
tolua_pushnumber(tolua_S,(lua_Number)ret);
|
|
|
|
tolua_pushnumber(tolua_S,(lua_Number)0);
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
if (argc == 2)
|
|
|
|
{
|
|
|
|
cocos2d::Vec2 arg0;
|
|
|
|
int arg1 = 0;
|
|
|
|
|
2014-07-22 11:16:16 +08:00
|
|
|
ok &= luaval_to_vec2(tolua_S, 2, &arg0, "ccexp.TMXLayer:getTileGIDAt");
|
|
|
|
ok &= luaval_to_int32(tolua_S, 3, &arg1, "ccexp.TMXLayer:getTileGIDAt");
|
2014-07-17 12:54:50 +08:00
|
|
|
|
|
|
|
if(!ok)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
unsigned int ret = cobj->getTileGIDAt(arg0, (cocos2d::TMXTileFlags*)&arg1);
|
|
|
|
tolua_pushnumber(tolua_S,(lua_Number)ret);
|
|
|
|
tolua_pushnumber(tolua_S,(lua_Number)arg1);
|
|
|
|
return 2;
|
|
|
|
}
|
2014-07-22 11:16:16 +08:00
|
|
|
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "ccexp.TMXLayer:getTileGIDAt",argc, 1);
|
2014-07-17 12:54:50 +08:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
#if COCOS2D_DEBUG >= 1
|
|
|
|
tolua_lerror:
|
2014-07-17 14:54:34 +08:00
|
|
|
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_experimental_TMXLayer_getTileGIDAt'.",&tolua_err);
|
2014-07-17 12:54:50 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-07-17 14:54:34 +08:00
|
|
|
static void extendExperimentalTMXLayer(lua_State* tolua_S)
|
2014-07-17 12:54:50 +08:00
|
|
|
{
|
2014-07-17 14:54:34 +08:00
|
|
|
lua_pushstring(tolua_S, "ccexp.TMXLayer");
|
2014-07-17 12:54:50 +08:00
|
|
|
lua_rawget(tolua_S, LUA_REGISTRYINDEX);
|
|
|
|
if (lua_istable(tolua_S,-1))
|
|
|
|
{
|
2014-07-17 14:54:34 +08:00
|
|
|
tolua_function(tolua_S, "getTileGIDAt", lua_cocos2dx_experimental_TMXLayer_getTileGIDAt);
|
2014-07-17 12:54:50 +08:00
|
|
|
}
|
|
|
|
lua_pop(tolua_S, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
int register_all_cocos2dx_experimental_manual(lua_State* L)
|
|
|
|
{
|
|
|
|
if (nullptr == L)
|
|
|
|
return 0;
|
|
|
|
|
2014-07-17 14:54:34 +08:00
|
|
|
extendExperimentalTMXLayer(L);
|
2014-07-17 12:54:50 +08:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|