add 'camera' library

This commit is contained in:
MihailRis
2024-07-12 06:14:13 +03:00
parent 24ecb94942
commit ffb7aa1189
6 changed files with 56 additions and 26 deletions
+8 -8
View File
@@ -8,11 +8,11 @@
using namespace scripting;
static int l_entity_exists(lua::State* L) {
static int l_exists(lua::State* L) {
return lua::pushboolean(L, get_entity(L, 1).has_value());
}
static int l_entity_spawn(lua::State* L) {
static int l_spawn(lua::State* L) {
auto level = controller->getLevel();
auto defname = lua::tostring(L, 1);
auto& def = content->entities.require(defname);
@@ -25,14 +25,14 @@ static int l_entity_spawn(lua::State* L) {
return 1;
}
static int l_entity_despawn(lua::State* L) {
static int l_despawn(lua::State* L) {
if (auto entity = get_entity(L, 1)) {
entity->destroy();
}
return 0;
}
static int l_entity_set_rig(lua::State* L) {
static int l_set_rig(lua::State* L) {
if (auto entity = get_entity(L, 1)) {
std::string skeletonName = lua::require_string(L, 2);
auto rigConfig = content->getRig(skeletonName);
@@ -45,9 +45,9 @@ static int l_entity_set_rig(lua::State* L) {
}
const luaL_Reg entitylib [] = {
{"exists", lua::wrap<l_entity_exists>},
{"spawn", lua::wrap<l_entity_spawn>},
{"despawn", lua::wrap<l_entity_despawn>},
{"set_rig", lua::wrap<l_entity_set_rig>},
{"exists", lua::wrap<l_exists>},
{"spawn", lua::wrap<l_spawn>},
{"despawn", lua::wrap<l_despawn>},
{"set_rig", lua::wrap<l_set_rig>},
{NULL, NULL}
};