mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
add update_settings
This commit is contained in:
parent
501f1b568d
commit
4a74e56eda
4 changed files with 17 additions and 2 deletions
|
|
@ -35,6 +35,7 @@ function on_hud_open()
|
|||
end
|
||||
|
||||
function on_hud_render()
|
||||
local pos = gfx.text3d.get_pos(textid)
|
||||
gfx.text3d.set_pos(textid, {pos[1], pos[2]+time.delta(), pos[3]})
|
||||
gfx.text3d.update_settings(textid, {
|
||||
color={math.sin(time.uptime() * 12) * 0.5 + 0.5, 0, 0, 1}
|
||||
})
|
||||
end
|
||||
|
|
|
|||
|
|
@ -18,6 +18,10 @@ const NotePreset& TextNote::getPreset() const {
|
|||
return preset;
|
||||
}
|
||||
|
||||
void TextNote::updatePreset(const dv::value& data) {
|
||||
preset.deserialize(data);
|
||||
}
|
||||
|
||||
void TextNote::setPosition(const glm::vec3& position) {
|
||||
this->position = position;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@ public:
|
|||
|
||||
const NotePreset& getPreset() const;
|
||||
|
||||
void updatePreset(const dv::value& data);
|
||||
|
||||
void setPosition(const glm::vec3& position);
|
||||
|
||||
const glm::vec3& getPosition() const;
|
||||
|
|
|
|||
|
|
@ -56,6 +56,13 @@ static int l_set_pos(lua::State* L) {
|
|||
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));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
const luaL_Reg text3dlib[] = {
|
||||
{"show", lua::wrap<l_show>},
|
||||
{"hide", lua::wrap<l_hide>},
|
||||
|
|
@ -63,5 +70,6 @@ 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>},
|
||||
{"update_settings", lua::wrap<l_update_settings>},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue