ImGui::PlotLines lua API
This commit is contained in:
parent
c1213a26a4
commit
7d44effd32
|
@ -42,6 +42,7 @@ declare ImGui: {
|
||||||
NewLine : () -> (),
|
NewLine : () -> (),
|
||||||
NextColumn : () -> (),
|
NextColumn : () -> (),
|
||||||
OpenPopup : (string) -> (),
|
OpenPopup : (string) -> (),
|
||||||
|
PlotLines : (string, {number}, Vec2) -> (),
|
||||||
PopItemWidth : () -> (),
|
PopItemWidth : () -> (),
|
||||||
PopID : () -> (),
|
PopID : () -> (),
|
||||||
PopStyleColor : (number) -> (),
|
PopStyleColor : (number) -> (),
|
||||||
|
|
|
@ -41,7 +41,8 @@ declare ImGui: {
|
||||||
NewLine : () -> (),
|
NewLine : () -> (),
|
||||||
NextColumn : () -> (),
|
NextColumn : () -> (),
|
||||||
OpenPopup : (string) -> (),
|
OpenPopup : (string) -> (),
|
||||||
PopItemWidth : () -> (),
|
PlotLines : (string, {number}, Vec2) -> (),
|
||||||
|
PopItemWidth : () -> (),
|
||||||
PopID : () -> (),
|
PopID : () -> (),
|
||||||
PopStyleColor : (number) -> (),
|
PopStyleColor : (number) -> (),
|
||||||
PopStyleVar : (number) -> (),
|
PopStyleVar : (number) -> (),
|
||||||
|
|
|
@ -265,6 +265,22 @@ int SetNextWindowSize(float w, float h)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PlotLines(lua_State* L, const char* str_id) {
|
||||||
|
LuaWrapper::checkTableArg(L, 2);
|
||||||
|
Vec2 size = LuaWrapper::checkArg<Vec2>(L, 3);
|
||||||
|
const i32 num_values = lua_objlen(L, 2);
|
||||||
|
auto getter = [](void* data, i32 idx) -> float {
|
||||||
|
lua_State* L = (lua_State*)data;
|
||||||
|
int t = lua_rawgeti(L, 2, idx + 1);
|
||||||
|
float res = FLT_MAX;
|
||||||
|
if (t == LUA_TNUMBER) {
|
||||||
|
res = (float)lua_tonumber(L, -1);
|
||||||
|
}
|
||||||
|
lua_pop(L, 1);
|
||||||
|
return res;
|
||||||
|
};
|
||||||
|
ImGui::PlotLines(str_id, getter, L, num_values, 0, nullptr, FLT_MAX, FLT_MAX, size);
|
||||||
|
}
|
||||||
|
|
||||||
void OpenPopup(const char* str_id) { ImGui::OpenPopup(str_id); }
|
void OpenPopup(const char* str_id) { ImGui::OpenPopup(str_id); }
|
||||||
|
|
||||||
|
@ -1064,6 +1080,7 @@ void registerEngineAPI(lua_State* L, Engine* engine)
|
||||||
LuaImGui::registerCFunction(L, "NewLine", &LuaWrapper::wrap<&ImGui::NewLine>);
|
LuaImGui::registerCFunction(L, "NewLine", &LuaWrapper::wrap<&ImGui::NewLine>);
|
||||||
LuaImGui::registerCFunction(L, "NextColumn", &LuaWrapper::wrap<&ImGui::NextColumn>);
|
LuaImGui::registerCFunction(L, "NextColumn", &LuaWrapper::wrap<&ImGui::NextColumn>);
|
||||||
LuaImGui::registerCFunction(L, "OpenPopup", &LuaWrapper::wrap<LuaImGui::OpenPopup>);
|
LuaImGui::registerCFunction(L, "OpenPopup", &LuaWrapper::wrap<LuaImGui::OpenPopup>);
|
||||||
|
LuaImGui::registerCFunction(L, "PlotLines", &LuaWrapper::wrap<&LuaImGui::PlotLines>);
|
||||||
LuaImGui::registerCFunction(L, "PopItemWidth", &LuaWrapper::wrap<&ImGui::PopItemWidth>);
|
LuaImGui::registerCFunction(L, "PopItemWidth", &LuaWrapper::wrap<&ImGui::PopItemWidth>);
|
||||||
LuaImGui::registerCFunction(L, "PopID", &LuaWrapper::wrap<&ImGui::PopID>);
|
LuaImGui::registerCFunction(L, "PopID", &LuaWrapper::wrap<&ImGui::PopID>);
|
||||||
LuaImGui::registerCFunction(L, "PopStyleColor", &LuaWrapper::wrap<&ImGui::PopStyleColor>);
|
LuaImGui::registerCFunction(L, "PopStyleColor", &LuaWrapper::wrap<&ImGui::PopStyleColor>);
|
||||||
|
|
|
@ -392,9 +392,7 @@ struct RendererImpl final : Renderer
|
||||||
m_shader_defines.reserve(32);
|
m_shader_defines.reserve(32);
|
||||||
|
|
||||||
gpu::preinit(m_allocator, shouldLoadRenderdoc());
|
gpu::preinit(m_allocator, shouldLoadRenderdoc());
|
||||||
m_frames[0].create(*this, m_allocator, m_engine.getPageAllocator());
|
for (Local<FrameData>& f : m_frames) f.create(*this, m_allocator, m_engine.getPageAllocator());
|
||||||
m_frames[1].create(*this, m_allocator, m_engine.getPageAllocator());
|
|
||||||
m_frames[2].create(*this, m_allocator, m_engine.getPageAllocator());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
float getLODMultiplier() const override { return m_lod_multiplier; }
|
float getLODMultiplier() const override { return m_lod_multiplier; }
|
||||||
|
|
Loading…
Reference in a new issue