| 1730 | } |
| 1731 | |
| 1732 | void MainLoop() { |
| 1733 | const auto cur_width = GetCanvasWidth(); |
| 1734 | const auto cur_height = GetCanvasHeight(); |
| 1735 | if((cur_width != g_Width) || (cur_height != g_Height)) { |
| 1736 | g_Width = cur_width; |
| 1737 | g_Height = cur_height; |
| 1738 | OnCanvasDimensionsChanged(); |
| 1739 | } |
| 1740 | |
| 1741 | glfwPollEvents(); |
| 1742 | ImGui_ImplOpenGL3_NewFrame(); |
| 1743 | ImGui_ImplGlfw_NewFrame(); |
| 1744 | ImGui::NewFrame(); |
| 1745 | |
| 1746 | const auto width = (u32)(g_Width * WindowWidthFactor); |
| 1747 | const auto height = (u32)(g_Height * WindowHeightFactor); |
| 1748 | |
| 1749 | #define _DRAW_FOR_MENU(name, type, ...) { \ |
| 1750 | ImGui::SetNextWindowSize(ImVec2(ul::design::ScreenWidth * g_Scale, ul::design::ScreenHeight * g_Scale + WindowTitleBarExtraHeight), ImGuiCond_Always); \ |
| 1751 | ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0); \ |
| 1752 | ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0, 0)); \ |
| 1753 | if(ImGui::Begin(name)) { \ |
| 1754 | if(IsLoadedTheme()) { \ |
| 1755 | elem_background.DrawOnWindow(); \ |
| 1756 | __VA_ARGS__ \ |
| 1757 | } \ |
| 1758 | } \ |
| 1759 | ImGui::End(); \ |
| 1760 | ImGui::PopStyleVar(2); \ |
| 1761 | } |
| 1762 | |
| 1763 | _DRAW_FOR_MENU("Main menu", ul::design::MenuType::Main, { |
| 1764 | elem_main_entry_menu_bg.DrawOnWindow(); |
| 1765 | elem_main_entry_menu_left_icon.DrawOnWindow(); |
| 1766 | elem_main_entry_menu_right_icon.DrawOnWindow(); |
| 1767 | |
| 1768 | switch(g_VisibleTopMenuBackground) { |
| 1769 | case 0: { |
| 1770 | elem_main_top_menu_default_bg.DrawOnWindow(); |
| 1771 | break; |
| 1772 | } |
| 1773 | case 1: { |
| 1774 | elem_main_top_menu_app_bg.DrawOnWindow(); |
| 1775 | break; |
| 1776 | } |
| 1777 | case 2: { |
| 1778 | elem_main_top_menu_hb_bg.DrawOnWindow(); |
| 1779 | break; |
| 1780 | } |
| 1781 | case 3: { |
| 1782 | elem_main_top_menu_folder_bg.DrawOnWindow(); |
| 1783 | break; |
| 1784 | } |
| 1785 | } |
| 1786 | |
| 1787 | DrawInputBar(elem_main_input_bar_bg); |
| 1788 | |
| 1789 | ////// Entry menu |
nothing calls this directly
no test coverage detected