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

Function project_editUi

TheForceEngine/TFE_Editor/editorProject.cpp:310–424  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

308 }
309
310 bool project_editUi(bool newProject)
311 {
312 // Make sure we are *either* creating a new project or editing an active project.
313 if (!newProject && !s_curProject.active) { return true; }
314
315 pushFont(TFE_Editor::FONT_SMALL);
316
317 DisplayInfo info;
318 TFE_RenderBackend::getDisplayInfo(&info);
319 f32 width = std::min((f32)info.width - 64.0f, UI_SCALE(900));
320 f32 height = std::min((f32)info.height - 64.0f, 70.0f + UI_SCALE(600));
321
322 bool finished = false;
323 ImGui::SetWindowSize("Project", { width, height });
324 ImGuiWindowFlags window_flags = ImGuiWindowFlags_NoResize;
325
326 if (ImGui::BeginPopupModal("Project", nullptr, window_flags))
327 {
328 f32 labelWidth = ImGui::CalcTextSize("Description").x + ImGui::GetFontSize();
329
330 ImGui::Text("Name"); ImGui::SameLine(labelWidth);
331 ImGui::InputText("##Name", s_newProject.name, 256);
332
333 ImGui::Text("Path"); ImGui::SameLine(labelWidth);
334 ImGui::InputText("##Path", s_newProject.path, TFE_MAX_PATH);
335 ImGui::SameLine();
336 if (ImGui::Button("Browse"))
337 {
338 FileResult res = TFE_Ui::directorySelectDialog("Project Path", s_newProject.path);
339 if (!res.empty())
340 {
341 strcpy(s_newProject.path, res[0].c_str());
342 }
343 }
344
345 ImGui::Checkbox("Create Directory for Project", &s_createDir);
346 ImGui::Separator();
347
348 // Settings.
349 listSelection("Project Type", c_projTypes, TFE_ARRAYSIZE(c_projTypes), (s32*)&s_newProject.type, 128, 196);
350 listSelection("Game", TFE_Settings::c_gameName, TFE_ARRAYSIZE(TFE_Settings::c_gameName), (s32*)&s_newProject.game, 128, 196);
351 listSelection("Feature Set", c_featureSet, TFE_ARRAYSIZE(c_featureSet), (s32*)&s_newProject.featureSet, 128, 196);
352
353 ImGui::CheckboxFlags("True Color Only", &s_newProject.flags, PFLAG_TRUE_COLOR);
354 ImGui::Separator();
355
356 // TODO: Handle word wrap...
357 strcpy(s_descrBuffer, s_newProject.desc.c_str());
358 ImGui::Text("Description"); ImGui::SameLine(labelWidth);
359 if (ImGui::InputTextMultiline("##Description", s_descrBuffer, MAX_DESCR_LEN))
360 {
361 s_newProject.desc = s_descrBuffer;
362 }
363
364 strcpy(s_descrBuffer, s_newProject.authors.c_str());
365 ImGui::Text("Authors"); ImGui::SameLine(labelWidth);
366 if (ImGui::InputTextMultiline("##Authors", s_descrBuffer, MAX_DESCR_LEN))
367 {

Callers 1

handlePopupEndFunction · 0.85

Calls 15

pushFontFunction · 0.85
getDisplayInfoFunction · 0.85
minFunction · 0.85
ButtonEnum · 0.85
directorySelectDialogFunction · 0.85
listSelectionFunction · 0.85
logWriteFunction · 0.85
resources_clearFunction · 0.85
project_saveFunction · 0.85
popFontFunction · 0.85
c_strMethod · 0.80
fixupPathFunction · 0.50

Tested by

no test coverage detected