fix(GUI): Notifications freezing menu

This commit is contained in:
LiamD-Flop 2022-03-02 01:40:04 +01:00
parent eb71752b5b
commit f18dde584f
3 changed files with 9 additions and 15 deletions

View File

@ -80,20 +80,12 @@ namespace big
void gui::dx_on_tick()
{
TRY_CLAUSE
{
view::root();
}
EXCEPT_CLAUSE
view::root();
}
void gui::always_draw()
{
TRY_CLAUSE
{
view::always();
}
EXCEPT_CLAUSE
view::always();
}
void gui::script_init()

View File

@ -79,11 +79,13 @@ namespace big
ImGui_ImplWin32_NewFrame();
ImGui::NewFrame();
g_gui.always_draw();
if (g_gui.m_opened)
{
g_gui.dx_on_tick();
}
g_gui.always_draw();
ImGui::Render();
ImGui_ImplDX11_RenderDrawData(ImGui::GetDrawData());

View File

@ -7,7 +7,7 @@ namespace big
{
ImGui::SetNextWindowSize({ (float)g->window.x * 0.2f, (float)g->window.y });
ImGui::SetNextWindowPos({ (float)g->window.x - (float)g->window.x * 0.2f, 0 });
if (ImGui::Begin("notifications", nullptr, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoNav | ImGuiWindowFlags_NoBackground))
if (ImGui::Begin("notifications", nullptr, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoNav | ImGuiWindowFlags_NoBackground | ImGuiWindowFlags_NoMouseInputs | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoBringToFrontOnFocus))
{
std::vector<notification> notifications = g_notification_service->get();
@ -18,14 +18,14 @@ namespace big
ImGui::PushStyleColor(ImGuiCol_ChildBg, ImVec4(0.10f, 0.09f, 0.12f, 1.00f));
ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0.10f, 0.09f, 0.12f, 1.00f));
ImGui::SetNextWindowBgAlpha(n.alpha);
ImGui::BeginChild(i, ImVec2(0, 75.f + (float)(20 * (int)(n.message.size() / 28) + 20 * (float)std::count(n.message.begin(), n.message.end(), '\n'))), true, ImGuiWindowFlags_NoScrollbar);
ImGui::BeginChildFrame(i, ImVec2(0, 75.f + (float)(20 * (int)(n.message.size() / 28) + 20 * (float)std::count(n.message.begin(), n.message.end(), '\n'))), ImGuiWindowFlags_NoMouseInputs | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoBringToFrontOnFocus | ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoInputs);
ImGui::Text(n.title.c_str());
ImGui::PushStyleColor(ImGuiCol_Text, g_notification_service->notification_colors.at(n.type));
ImGui::TextWrapped(n.message.c_str());
ImGui::PopStyleColor();
ImGui::EndChild();
ImGui::PopStyleVar();
ImGui::EndChildFrame();
ImGui::PopStyleColor(2);
ImGui::PopStyleVar();
}
}
}