MCPcopy Create free account
hub / github.com/TheForceEngine/TheForceEngine / level_newLevelUi

Function level_newLevelUi

TheForceEngine/TFE_Editor/editorLevel.cpp:109–148  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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}

Callers 1

handlePopupEndFunction · 0.85

Calls 7

pushFontFunction · 0.85
getDisplayInfoFunction · 0.85
minFunction · 0.85
ButtonEnum · 0.85
level_createEmptyFunction · 0.85
rebuildAssetsFunction · 0.85
popFontFunction · 0.85

Tested by

no test coverage detected