| 107 | } |
| 108 | |
| 109 | bool level_newLevelUi() |
| 110 | { |
| 111 | pushFont(TFE_Editor::FONT_SMALL); |
| 112 | |
| 113 | DisplayInfo info; |
| 114 | TFE_RenderBackend::getDisplayInfo(&info); |
| 115 | f32 width = std::min((f32)info.width - 64.0f, UI_SCALE(512)); |
| 116 | f32 height = std::min((f32)info.height - 64.0f, 32.0f + UI_SCALE(96)); |
| 117 | |
| 118 | bool finished = false; |
| 119 | ImGui::SetWindowSize("New Level", { width, height }); |
| 120 | ImGuiWindowFlags window_flags = ImGuiWindowFlags_NoResize; |
| 121 | |
| 122 | if (ImGui::BeginPopupModal("New Level", nullptr, window_flags)) |
| 123 | { |
| 124 | ImGui::Text("Name"); ImGui::SameLine(); |
| 125 | ImGui::InputText("##NameLevel", s_newLevel.name, TFE_ARRAYSIZE(s_newLevel.name)); |
| 126 | |
| 127 | ImGui::Text("Slot"); ImGui::SameLine(); |
| 128 | ImGui::Combo("##SlotLevel", &s_newLevel.slotId, c_darkForcesSlots, TFE_ARRAYSIZE(c_darkForcesSlots)); |
| 129 | |
| 130 | ImGui::Separator(); |
| 131 | |
| 132 | if (ImGui::Button("Create Level##Level")) |
| 133 | { |
| 134 | level_createEmpty(s_newLevel); |
| 135 | AssetBrowser::rebuildAssets(); |
| 136 | finished = true; |
| 137 | } |
| 138 | ImGui::SameLine(); |
| 139 | if (ImGui::Button("Cancel##Level")) |
| 140 | { |
| 141 | finished = true; |
| 142 | } |
| 143 | ImGui::EndPopup(); |
| 144 | } |
| 145 | popFont(); |
| 146 | |
| 147 | return finished; |
| 148 | } |
| 149 | } |
no test coverage detected