extensions/urho3d/safe_classes.lua: Wrap more methods for Scene and Node

This commit is contained in:
Břetislav Štec 2014-09-29 19:01:21 +02:00
parent 3947187ef5
commit 86b35173e3

View File

@ -178,7 +178,15 @@ function M.define(dst, util)
}) })
util.wc("Node", { util.wc("Node", {
class = {
new = function()
return util.wrap_instance("Node", Node:new())
end,
},
instance = { instance = {
CreateChild = util.wrap_function({"Node", "string"}, function(self, name)
return util.wrap_instance("Node", self:CreateChild(name))
end),
CreateComponent = util.wrap_function({"Node", "string"}, function(self, name) CreateComponent = util.wrap_function({"Node", "string"}, function(self, name)
local component = self:CreateComponent(name) local component = self:CreateComponent(name)
assert(component) assert(component)
@ -195,6 +203,9 @@ function M.define(dst, util)
Translate = util.wrap_function({"Node", "Vector3"}, function(self, v) Translate = util.wrap_function({"Node", "Vector3"}, function(self, v)
self:Translate(v) self:Translate(v)
end), end),
RemoveChild = util.wrap_function({"Node", "Node"}, function(self, v)
self:RemoveChild(v)
end),
}, },
properties = { properties = {
scale = util.simple_property(dst.Vector3), scale = util.simple_property(dst.Vector3),
@ -207,15 +218,15 @@ function M.define(dst, util)
}) })
util.wc("Scene", { util.wc("Scene", {
class = {
new = function()
return util.wrap_instance("Scene", Scene:new())
end,
},
inherited_from_by_wrapper = dst.Node, inherited_from_by_wrapper = dst.Node,
unsafe_constructor = util.wrap_function({}, function() unsafe_constructor = util.wrap_function({}, function()
return util.wrap_instance("Scene", Scene()) return util.wrap_instance("Scene", Scene())
end), end),
instance = {
CreateChild = util.wrap_function({"Scene", "string"}, function(self, name)
return util.wrap_instance("Node", self:CreateChild(name))
end)
},
}) })
util.wc("ResourceCache", { util.wc("ResourceCache", {