add text3d.get_axis_x, .set_axis_x, .get_axis_y, .set_axis_y

This commit is contained in:
MihailRis
2024-11-15 03:09:05 +03:00
parent 525cf1ed4b
commit a8388a6243
5 changed files with 61 additions and 7 deletions
+31 -1
View File
@@ -48,7 +48,6 @@ static int l_get_pos(lua::State* L) {
}
return 0;
}
static int l_set_pos(lua::State* L) {
if (auto note = renderer->texts->get(lua::tointeger(L, 1))) {
note->setPosition(lua::tovec3(L, 2));
@@ -56,6 +55,33 @@ static int l_set_pos(lua::State* L) {
return 0;
}
static int l_get_axis_x(lua::State* L) {
if (auto note = renderer->texts->get(lua::tointeger(L, 1))) {
return lua::pushvec(L, note->getAxisX());
}
return 0;
}
static int l_set_axis_x(lua::State* L) {
if (auto note = renderer->texts->get(lua::tointeger(L, 1))) {
note->setAxisX(lua::tovec3(L, 2));
}
return 0;
}
static int l_get_axis_y(lua::State* L) {
if (auto note = renderer->texts->get(lua::tointeger(L, 1))) {
return lua::pushvec(L, note->getAxisY());
}
return 0;
}
static int l_set_axis_y(lua::State* L) {
if (auto note = renderer->texts->get(lua::tointeger(L, 1))) {
note->setAxisY(lua::tovec3(L, 2));
}
return 0;
}
static int l_update_settings(lua::State* L) {
if (auto note = renderer->texts->get(lua::tointeger(L, 1))) {
note->updatePreset(lua::tovalue(L, 2));
@@ -70,6 +96,10 @@ const luaL_Reg text3dlib[] = {
{"set_text", lua::wrap<l_set_text>},
{"get_pos", lua::wrap<l_get_pos>},
{"set_pos", lua::wrap<l_set_pos>},
{"get_axis_x", lua::wrap<l_get_axis_x>},
{"set_axis_x", lua::wrap<l_set_axis_x>},
{"get_axis_y", lua::wrap<l_get_axis_y>},
{"set_axis_y", lua::wrap<l_set_axis_y>},
{"update_settings", lua::wrap<l_update_settings>},
{NULL, NULL}
};