| 738 | } |
| 739 | |
| 740 | void menu() |
| 741 | { |
| 742 | pushFont(FONT_SMALL); |
| 743 | |
| 744 | s_menuActive = false; |
| 745 | beginMenuBar(); |
| 746 | { |
| 747 | // General menu items. |
| 748 | if (ImGui::BeginMenu("Editor")) |
| 749 | { |
| 750 | s_menuActive = true; |
| 751 | if (ImGui::MenuItem("Editor Config", NULL, (bool*)NULL)) |
| 752 | { |
| 753 | s_editorPopup = POPUP_CONFIG; |
| 754 | } |
| 755 | if (ImGui::MenuItem("Resources", NULL, (bool*)NULL)) |
| 756 | { |
| 757 | s_editorPopup = POPUP_RESOURCES; |
| 758 | } |
| 759 | ImGui::Separator(); |
| 760 | if (ImGui::MenuItem("Asset Browser", NULL, s_editorMode == EDIT_ASSET_BROWSER)) |
| 761 | { |
| 762 | bool exitSavePopup = false; |
| 763 | if (s_editorMode == EDIT_ASSET && s_editorAssetType == TYPE_LEVEL) |
| 764 | { |
| 765 | exitSavePopup = LevelEditor::edit_closeLevelCheckSave(); |
| 766 | } |
| 767 | if (exitSavePopup) |
| 768 | { |
| 769 | setPopupEndCallback(popupCallback_openAssetBrowser); |
| 770 | } |
| 771 | else |
| 772 | { |
| 773 | s_editorMode = EDIT_ASSET_BROWSER; |
| 774 | } |
| 775 | } |
| 776 | |
| 777 | // Disable the Asset Editor menu item, unless actually in an Asset Editor. |
| 778 | // This allows the item to be highlighted, and to be able to switch back to |
| 779 | // the Asset Browser using the menu. |
| 780 | const bool disable = s_editorMode != EDIT_ASSET; |
| 781 | if (disable) { disableNextItem(); } |
| 782 | if (ImGui::MenuItem("Asset Editor", NULL, s_editorMode == EDIT_ASSET)) |
| 783 | { |
| 784 | s_editorMode = EDIT_ASSET; |
| 785 | } |
| 786 | if (disable) { enableNextItem(); } |
| 787 | |
| 788 | ImGui::Separator(); |
| 789 | if (ImGui::MenuItem("Return to Game", NULL, (bool*)NULL)) |
| 790 | { |
| 791 | bool exitSavePopup = false; |
| 792 | if (s_editorMode == EDIT_ASSET && s_editorAssetType == TYPE_LEVEL) |
| 793 | { |
| 794 | exitSavePopup = LevelEditor::edit_closeLevelCheckSave(); |
| 795 | } |
| 796 | if (exitSavePopup) |
| 797 | { |
no test coverage detected