mirror of
https://github.com/Mr-X-GTA/YimMenu.git
synced 2025-07-01 12:02:55 +08:00
Lua: can make new tabs from lua scripts, doc generation for available tabs to use (#1593)
* lua api: add globals.get_uint and globals.set_uint * lua doc: remove duplicate function check as we can overload so it doesn't make sense * lua doc gen: add support for parsing the tabs enum * gui: custom lua tabs don't have a `func` rendering function but can still have elements to draw * lua doc: update generated doc * chore: code style * chore: minor spelling mistake * chore: code style * gui_service: add runtime removal of tabs * refactor: make it so that it's less likely defining tabs and their translation key in a wrong way. * lua api: ability to add custom tabs to the gui from lua
This commit is contained in:
@ -9,12 +9,15 @@ namespace big
|
||||
{
|
||||
void view::active_view()
|
||||
{
|
||||
auto selected = g_gui_service->get_selected();
|
||||
const auto selected = g_gui_service->get_selected();
|
||||
|
||||
if (selected->func == nullptr)
|
||||
if (selected->func == nullptr &&
|
||||
(g_lua_manager && !g_lua_manager->has_gui_to_draw(selected->hash)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
static float alpha = 1.f;
|
||||
constexpr float alpha = 1.f;
|
||||
|
||||
ImGui::SetNextWindowPos({(300.f + 20.f) * g.window.gui_scale, 100.f * g.window.gui_scale}, ImGuiCond_Always);
|
||||
ImGui::SetNextWindowSize({0.f, 0.f});
|
||||
@ -31,7 +34,9 @@ namespace big
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, alpha);
|
||||
components::title(key);
|
||||
ImGui::Separator();
|
||||
selected->func();
|
||||
|
||||
if (selected->func)
|
||||
selected->func();
|
||||
|
||||
if (g_lua_manager)
|
||||
g_lua_manager->draw_gui(selected->hash);
|
||||
|
@ -11,13 +11,13 @@ namespace big
|
||||
if (ImGui::Begin("navigation", 0, window_flags))
|
||||
{
|
||||
g_gui_service->reset_nav_size();
|
||||
for (std::pair<tabs, navigation_struct> navItem : g_gui_service->get_navigation())
|
||||
for (std::pair<tabs, navigation_struct> nav_item : g_gui_service->get_navigation())
|
||||
{
|
||||
switch (navItem.first)
|
||||
switch (nav_item.first)
|
||||
{
|
||||
case tabs::PLAYER:
|
||||
case tabs::DEBUG: continue;
|
||||
default: components::nav_item(navItem, 0);
|
||||
default: components::nav_item(nav_item, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user