1. fix ccui.Widget:hitTest() lua不需要第3个参数。 2. NodeEx.lua的触摸事件点击只调用Node的hitTest,避免使用ccui.Widget的。3. lua搜索路径去掉系统路径。

This commit is contained in:
u0u0
2020-03-16 20:44:14 +08:00
parent 32295b723f
commit fd0db28d66
4 changed files with 8 additions and 14 deletions

View File

@@ -3127,27 +3127,21 @@ int lua_cocos2dx_ui_Widget_hitTest(lua_State* tolua_S)
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 3)
if (argc == 2)
{
cocos2d::Vec2 arg0;
const cocos2d::Camera* arg1;
cocos2d::Vec3* arg2;
ok &= luaval_to_vec2(tolua_S, 2, &arg0, "ccui.Widget:hitTest");
ok &= luaval_to_object<const cocos2d::Camera>(tolua_S, 3, "cc.Camera",&arg1, "ccui.Widget:hitTest");
ok &= luaval_to_object<cocos2d::Vec3>(tolua_S, 4, "cc.Vec3",&arg2, "ccui.Widget:hitTest");
if(!ok)
{
if (!ok) {
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Widget_hitTest'", nullptr);
return 0;
}
bool ret = cobj->hitTest(arg0, arg1, arg2);
bool ret = cobj->hitTest(arg0, arg1, nullptr);
tolua_pushboolean(tolua_S,(bool)ret);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Widget:hitTest",argc, 3);
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Widget:hitTest",argc, 2);
return 0;
#if COCOS2D_DEBUG >= 1

View File

@@ -293,11 +293,11 @@ function Node:setTouchEnabled(enable)
local pp = touch:getPreviousLocation()
if name == "began" then
if not self:isVisible(true) or not self:hitTest(tp) then
if not self:isVisible(true) or not Node.hitTest(self, tp) then
return false
end
elseif name == "ended" then
if not self:hitTest(tp) then -- out of touch area
if not Node.hitTest(self, tp) then -- out of touch area
name = "cancelled"
end
end

View File

@@ -6,5 +6,5 @@ function __G__TRACKBACK__(errorMessage)
print("----------------------------------------")
end
package.path = package.path .. ";src/?.lua;src/framework/protobuf/?.lua"
package.path = ";src/?.lua;src/framework/protobuf/?.lua"
require("app.MyApp").new():run()

View File

@@ -6,5 +6,5 @@ function __G__TRACKBACK__(errorMessage)
print("----------------------------------------")
end
package.path = package.path .. ";src/?.lua;src/framework/protobuf/?.lua"
package.path = ";src/?.lua;src/framework/protobuf/?.lua"
require("app.MyApp").new():run()