camera flag binds

This commit is contained in:
2020-02-01 06:26:57 +07:00
parent 3edf783950
commit 2c465f4f42
2 changed files with 32 additions and 0 deletions

View File

@@ -6,6 +6,12 @@ local camera = {
---@type boolean ---@type boolean
disabled = false, disabled = false,
---@type boolean
input = false,
---@type boolean
gizmos = false,
---@type integer ---@type integer
depth = 0, depth = 0,

View File

@@ -50,6 +50,32 @@ namespace e2d::bindings::high
} }
), ),
"input", sol::property(
[](const gcomponent<camera>& c) -> bool {
return c.owner().component<camera::input>().exists();
},
[](gcomponent<camera>& c, bool yesno){
if ( yesno ) {
c.owner().component<camera::input>().ensure();
} else {
c.owner().component<camera::input>().remove();
}
}
),
"gizmos", sol::property(
[](const gcomponent<camera>& c) -> bool {
return c.owner().component<camera::gizmos>().exists();
},
[](gcomponent<camera>& c, bool yesno){
if ( yesno ) {
c.owner().component<camera::gizmos>().ensure();
} else {
c.owner().component<camera::gizmos>().remove();
}
}
),
"depth", sol::property( "depth", sol::property(
[](const gcomponent<camera>& c) -> i32 { [](const gcomponent<camera>& c) -> i32 {
return c->depth(); return c->depth();