rename spawn to show & add gfx.text3d.hide(...)
This commit is contained in:
parent
eb5715eba9
commit
d74b530a83
@ -25,9 +25,9 @@ function on_hud_open()
|
||||
drop.rigidbody:set_vel(velocity)
|
||||
end)
|
||||
|
||||
gfx.text3d.spawn({0.5, 99.5, 0.0015}, "Segmentation fault", {
|
||||
scale = 0.005,
|
||||
color = {0, 0, 0, 1},
|
||||
displayMode = "static_billboard"
|
||||
gfx.text3d.show({0.5, 99.5, 0.0015}, "Segmentation fault", {
|
||||
scale=0.005,
|
||||
color={0, 0, 0, 1},
|
||||
displayMode="static_billboard"
|
||||
})
|
||||
end
|
||||
|
||||
@ -95,3 +95,7 @@ u64id_t TextsRenderer::add(std::unique_ptr<TextNote> note) {
|
||||
notes[uid] = std::move(note);
|
||||
return uid;
|
||||
}
|
||||
|
||||
void TextsRenderer::remove(u64id_t id) {
|
||||
notes.erase(id);
|
||||
}
|
||||
|
||||
@ -40,4 +40,6 @@ public:
|
||||
);
|
||||
|
||||
u64id_t add(std::unique_ptr<TextNote> note);
|
||||
|
||||
void remove(u64id_t id);
|
||||
};
|
||||
|
||||
@ -53,7 +53,7 @@ static int l_get_def(lua::State* L) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int l_spawn(lua::State* L) {
|
||||
static int l_show(lua::State* L) {
|
||||
auto level = controller->getLevel();
|
||||
auto defname = lua::tostring(L, 1);
|
||||
auto& def = content->entities.require(defname);
|
||||
@ -213,7 +213,7 @@ const luaL_Reg entitylib[] = {
|
||||
{"def_hitbox", lua::wrap<l_def_hitbox>},
|
||||
{"get_def", lua::wrap<l_get_def>},
|
||||
{"defs_count", lua::wrap<l_defs_count>},
|
||||
{"spawn", lua::wrap<l_spawn>},
|
||||
{"spawn", lua::wrap<l_show>},
|
||||
{"despawn", lua::wrap<l_despawn>},
|
||||
{"get_skeleton", lua::wrap<l_get_skeleton>},
|
||||
{"set_skeleton", lua::wrap<l_set_skeleton>},
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
|
||||
using namespace scripting;
|
||||
|
||||
static int l_spawn(lua::State* L) {
|
||||
static int l_show(lua::State* L) {
|
||||
auto position = lua::tovec3(L, 1);
|
||||
auto text = lua::require_wstring(L, 2);
|
||||
auto preset = lua::tovalue(L, 3);
|
||||
@ -23,7 +23,13 @@ static int l_spawn(lua::State* L) {
|
||||
return lua::pushinteger(L, renderer->texts->add(std::move(note)));
|
||||
}
|
||||
|
||||
static int l_hide(lua::State* L) {
|
||||
renderer->texts->remove(lua::touinteger(L, 1));
|
||||
return 0;
|
||||
}
|
||||
|
||||
const luaL_Reg text3dlib[] = {
|
||||
{"spawn", lua::wrap<l_spawn>},
|
||||
{"show", lua::wrap<l_show>},
|
||||
{"hide", lua::wrap<l_hide>},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user