SaveTool: add a convenience wrapper over ImGui stuff.

This commit is contained in:
Guillaume Jacquemin 2022-02-23 21:59:00 +01:00
parent 883d5d3f41
commit 350ad59f8e
5 changed files with 69 additions and 129 deletions

View file

@ -168,6 +168,12 @@ class SaveTool: public Platform::Sdl2Application, public efsw::FileWatchListener
} }
} }
template<typename... Args>
void drawAlignedText(const char* text, Args... args) {
ImGui::AlignTextToFramePadding();
ImGui::Text(text, std::forward<Args>(args)...);
}
void openUri(const std::string& uri); void openUri(const std::string& uri);
void checkGameState(); void checkGameState();

View file

@ -42,8 +42,7 @@ void SaveTool::drawManager() {
return; return;
} }
ImGui::AlignTextToFramePadding(); drawAlignedText("Current profile: %s (%s)",
ImGui::Text("Current profile: %s (%s)",
_currentProfile->companyName().c_str(), _currentProfile->companyName().c_str(),
_currentProfile->type() == ProfileType::Demo ? "demo" : "full game"); _currentProfile->type() == ProfileType::Demo ? "demo" : "full game");
ImGui::SameLine(); ImGui::SameLine();

View file

@ -218,8 +218,7 @@ void SaveTool::drawJointSliders() {
ImGui::TableNextRow(); ImGui::TableNextRow();
ImGui::TableSetColumnIndex(0); ImGui::TableSetColumnIndex(0);
ImGui::AlignTextToFramePadding(); drawAlignedText("Neck");
ImGui::TextUnformatted("Neck");
ImGui::TableSetColumnIndex(1); ImGui::TableSetColumnIndex(1);
ImGui::SetNextItemWidth(-1.0f); ImGui::SetNextItemWidth(-1.0f);
if(ImGui::SliderFloat("##NeckSlider", &_currentMass->jointSliders().neck, 0.0f, 1.0f)) { if(ImGui::SliderFloat("##NeckSlider", &_currentMass->jointSliders().neck, 0.0f, 1.0f)) {
@ -228,8 +227,7 @@ void SaveTool::drawJointSliders() {
ImGui::TableNextRow(); ImGui::TableNextRow();
ImGui::TableSetColumnIndex(0); ImGui::TableSetColumnIndex(0);
ImGui::AlignTextToFramePadding(); drawAlignedText("Body");
ImGui::TextUnformatted("Body");
ImGui::TableSetColumnIndex(1); ImGui::TableSetColumnIndex(1);
ImGui::SetNextItemWidth(-1.0f); ImGui::SetNextItemWidth(-1.0f);
if(ImGui::SliderFloat("##BodySlider", &_currentMass->jointSliders().body, 0.0f, 1.0f)) { if(ImGui::SliderFloat("##BodySlider", &_currentMass->jointSliders().body, 0.0f, 1.0f)) {
@ -238,8 +236,7 @@ void SaveTool::drawJointSliders() {
ImGui::TableNextRow(); ImGui::TableNextRow();
ImGui::TableSetColumnIndex(0); ImGui::TableSetColumnIndex(0);
ImGui::AlignTextToFramePadding(); drawAlignedText("Shoulders");
ImGui::TextUnformatted("Shoulders");
ImGui::TableSetColumnIndex(1); ImGui::TableSetColumnIndex(1);
ImGui::SetNextItemWidth(-1.0f); ImGui::SetNextItemWidth(-1.0f);
if(ImGui::SliderFloat("##ShouldersSlider", &_currentMass->jointSliders().shoulders, 0.0f, 1.0f)) { if(ImGui::SliderFloat("##ShouldersSlider", &_currentMass->jointSliders().shoulders, 0.0f, 1.0f)) {
@ -248,8 +245,7 @@ void SaveTool::drawJointSliders() {
ImGui::TableNextRow(); ImGui::TableNextRow();
ImGui::TableSetColumnIndex(0); ImGui::TableSetColumnIndex(0);
ImGui::AlignTextToFramePadding(); drawAlignedText("Hips");
ImGui::TextUnformatted("Hips");
ImGui::TableSetColumnIndex(1); ImGui::TableSetColumnIndex(1);
ImGui::SetNextItemWidth(-1.0f); ImGui::SetNextItemWidth(-1.0f);
if(ImGui::SliderFloat("##HipsSlider", &_currentMass->jointSliders().hips, 0.0f, 1.0f)) { if(ImGui::SliderFloat("##HipsSlider", &_currentMass->jointSliders().hips, 0.0f, 1.0f)) {
@ -258,8 +254,7 @@ void SaveTool::drawJointSliders() {
ImGui::TableNextRow(); ImGui::TableNextRow();
ImGui::TableSetColumnIndex(0); ImGui::TableSetColumnIndex(0);
ImGui::AlignTextToFramePadding(); drawAlignedText("Arms");
ImGui::TextUnformatted("Arms");
ImGui::TableSetColumnIndex(1); ImGui::TableSetColumnIndex(1);
ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, ImVec2{2.0f, 1.0f}); ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, ImVec2{2.0f, 1.0f});
if(ImGui::BeginTable("##UpperLowerArmsLayoutTable", 2)) { if(ImGui::BeginTable("##UpperLowerArmsLayoutTable", 2)) {
@ -283,8 +278,7 @@ void SaveTool::drawJointSliders() {
ImGui::TableNextRow(); ImGui::TableNextRow();
ImGui::TableSetColumnIndex(0); ImGui::TableSetColumnIndex(0);
ImGui::AlignTextToFramePadding(); drawAlignedText("Legs");
ImGui::TextUnformatted("Legs");
ImGui::TableSetColumnIndex(1); ImGui::TableSetColumnIndex(1);
ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, ImVec2{2.0f, 1.0f}); ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, ImVec2{2.0f, 1.0f});
if(ImGui::BeginTable("##UpperLowerLegsLayoutTable", 2)) { if(ImGui::BeginTable("##UpperLowerLegsLayoutTable", 2)) {
@ -337,8 +331,7 @@ void SaveTool::drawFrameStyles() {
} }
for(Int i = 0; i < 4; i++) { for(Int i = 0; i < 4; i++) {
ImGui::AlignTextToFramePadding(); drawAlignedText("Slot %d:", i + 1);
ImGui::Text("Slot %d:", i + 1);
ImGui::SameLine(); ImGui::SameLine();
@ -520,8 +513,7 @@ void SaveTool::drawArmour() {
ImGui::TextUnformatted("Styles:"); ImGui::TextUnformatted("Styles:");
for(Int j = 0; j < 4; j++) { for(Int j = 0; j < 4; j++) {
ImGui::AlignTextToFramePadding(); drawAlignedText("Slot %d:", j + 1);
ImGui::Text("Slot %d:", j + 1);
ImGui::SameLine(); ImGui::SameLine();
@ -547,8 +539,7 @@ void SaveTool::drawArmour() {
ImGui::PushID("Decal"); ImGui::PushID("Decal");
ImGui::AlignTextToFramePadding(); drawAlignedText("Showing/editing decal");
ImGui::TextUnformatted("Showing/editing decal");
for(UnsignedLong j = 0; j < part.decals.size(); j++) { for(UnsignedLong j = 0; j < part.decals.size(); j++) {
ImGui::SameLine(); ImGui::SameLine();
ImGui::RadioButton(std::to_string(j + 1).c_str(), &_selectedArmourDecals[i], j); ImGui::RadioButton(std::to_string(j + 1).c_str(), &_selectedArmourDecals[i], j);
@ -563,8 +554,7 @@ void SaveTool::drawArmour() {
ImGui::PushID("Accessory"); ImGui::PushID("Accessory");
ImGui::AlignTextToFramePadding(); drawAlignedText("Showing/editing accessory");
ImGui::TextUnformatted("Showing/editing accessory");
for(UnsignedInt j = 0; j < part.accessories.size(); j++) { for(UnsignedInt j = 0; j < part.accessories.size(); j++) {
ImGui::SameLine(); ImGui::SameLine();
ImGui::RadioButton(std::string{char(65 + j)}.c_str(), &_selectedArmourAccessories[i], j); ImGui::RadioButton(std::string{char(65 + j)}.c_str(), &_selectedArmourAccessories[i], j);
@ -901,13 +891,13 @@ void SaveTool::drawWeaponEditor(Weapon& weapon) {
return; return;
} }
ImGui::AlignTextToFramePadding();
static const char* labels[] { static const char* labels[] {
#define c(enumerator, strenum, name) name, #define c(enumerator, strenum, name) name,
#include "../Maps/WeaponTypes.hpp" #include "../Maps/WeaponTypes.hpp"
#undef c #undef c
}; };
ImGui::Text("%s: %s", labels[UnsignedInt(weapon.type)], weapon.name.c_str());
drawAlignedText("%s: %s", labels[UnsignedInt(weapon.type)], weapon.name.c_str());
ImGui::SameLine(); ImGui::SameLine();
@ -924,23 +914,18 @@ void SaveTool::drawWeaponEditor(Weapon& weapon) {
} }
ImGui::BeginGroup(); ImGui::BeginGroup();
ImGui::AlignTextToFramePadding(); drawAlignedText("Equipped:");
ImGui::TextUnformatted("Equipped:");
if(weapon.type != WeaponType::Shield) { if(weapon.type != WeaponType::Shield) {
ImGui::AlignTextToFramePadding(); drawAlignedText("Damage type:");
ImGui::TextUnformatted("Damage type:");
} }
if(weapon.type == WeaponType::Melee) { if(weapon.type == WeaponType::Melee) {
ImGui::AlignTextToFramePadding(); drawAlignedText("Dual-wield:");
ImGui::TextUnformatted("Dual-wield:");
ImGui::AlignTextToFramePadding(); drawAlignedText("Custom effect mode:");
ImGui::TextUnformatted("Custom effect mode:");
ImGui::AlignTextToFramePadding(); drawAlignedText("Custom effect colour:");
ImGui::TextUnformatted("Custom effect colour:");
} }
ImGui::EndGroup(); ImGui::EndGroup();
@ -1006,8 +991,7 @@ void SaveTool::drawWeaponEditor(Weapon& weapon) {
ImGui::Separator(); ImGui::Separator();
if(ImGui::CollapsingHeader("Weapon parts")) { if(ImGui::CollapsingHeader("Weapon parts")) {
ImGui::AlignTextToFramePadding(); drawAlignedText("Viewing/editing part:");
ImGui::TextUnformatted("Viewing/editing part:");
for(Int i = 0; UnsignedLong(i) < weapon.parts.size(); i++) { for(Int i = 0; UnsignedLong(i) < weapon.parts.size(); i++) {
if(UnsignedLong(_selectedWeaponPart) >= weapon.parts.size()) { if(UnsignedLong(_selectedWeaponPart) >= weapon.parts.size()) {
_selectedWeaponPart = 0; _selectedWeaponPart = 0;
@ -1024,8 +1008,7 @@ void SaveTool::drawWeaponEditor(Weapon& weapon) {
ImGui::TextUnformatted("Styles:"); ImGui::TextUnformatted("Styles:");
for(Int i = 0; i < 4; i++) { for(Int i = 0; i < 4; i++) {
ImGui::AlignTextToFramePadding(); drawAlignedText("Slot %d:", i + 1);
ImGui::Text("Slot %d:", i + 1);
ImGui::SameLine(); ImGui::SameLine();
@ -1049,8 +1032,7 @@ void SaveTool::drawWeaponEditor(Weapon& weapon) {
ImGui::PushID("Decal"); ImGui::PushID("Decal");
ImGui::AlignTextToFramePadding(); drawAlignedText("Showing/editing decal");
ImGui::TextUnformatted("Showing/editing decal");
for(UnsignedLong i = 0; i < part.decals.size(); i++) { for(UnsignedLong i = 0; i < part.decals.size(); i++) {
ImGui::SameLine(); ImGui::SameLine();
ImGui::RadioButton(std::to_string(i + 1).c_str(), &_selectedWeaponDecal, i); ImGui::RadioButton(std::to_string(i + 1).c_str(), &_selectedWeaponDecal, i);
@ -1065,8 +1047,7 @@ void SaveTool::drawWeaponEditor(Weapon& weapon) {
ImGui::PushID("Accessory"); ImGui::PushID("Accessory");
ImGui::AlignTextToFramePadding(); drawAlignedText("Showing/editing accessory");
ImGui::TextUnformatted("Showing/editing accessory");
for(UnsignedLong i = 0; i < part.accessories.size(); i++) { for(UnsignedLong i = 0; i < part.accessories.size(); i++) {
ImGui::SameLine(); ImGui::SameLine();
ImGui::RadioButton(std::string{char(65 + i)}.c_str(), &_selectedWeaponAccessory, i); ImGui::RadioButton(std::string{char(65 + i)}.c_str(), &_selectedWeaponAccessory, i);
@ -1255,14 +1236,10 @@ auto SaveTool::drawCustomStyle(CustomStyle& style) -> DCSResult {
ImGui::TableNextColumn(); ImGui::TableNextColumn();
ImGui::BeginGroup(); ImGui::BeginGroup();
ImGui::AlignTextToFramePadding(); drawAlignedText("Colour:");
ImGui::TextUnformatted("Colour:"); drawAlignedText("Metallic:");
ImGui::AlignTextToFramePadding(); drawAlignedText("Gloss:");
ImGui::TextUnformatted("Metallic:"); drawAlignedText("Glow:");
ImGui::AlignTextToFramePadding();
ImGui::TextUnformatted("Gloss:");
ImGui::AlignTextToFramePadding();
ImGui::TextUnformatted("Glow:");
ImGui::EndGroup(); ImGui::EndGroup();
ImGui::SameLine(); ImGui::SameLine();
@ -1284,25 +1261,18 @@ auto SaveTool::drawCustomStyle(CustomStyle& style) -> DCSResult {
ImGui::TableNextColumn(); ImGui::TableNextColumn();
ImGui::BeginGroup(); ImGui::BeginGroup();
ImGui::AlignTextToFramePadding(); drawAlignedText("Pattern:");
ImGui::TextUnformatted("Pattern:"); drawAlignedText("Opacity:");
ImGui::AlignTextToFramePadding(); drawAlignedText("X offset:");
ImGui::TextUnformatted("Opacity:"); drawAlignedText("Y offset:");
ImGui::AlignTextToFramePadding(); drawAlignedText("Rotation:");
ImGui::TextUnformatted("X offset:"); drawAlignedText("Scale:");
ImGui::AlignTextToFramePadding();
ImGui::TextUnformatted("Y offset:");
ImGui::AlignTextToFramePadding();
ImGui::TextUnformatted("Rotation:");
ImGui::AlignTextToFramePadding();
ImGui::TextUnformatted("Scale:");
ImGui::EndGroup(); ImGui::EndGroup();
ImGui::SameLine(); ImGui::SameLine();
ImGui::BeginGroup(); ImGui::BeginGroup();
ImGui::AlignTextToFramePadding(); drawAlignedText("%i", style.patternId);
ImGui::Text("%i", style.patternId);
ImGui::PushItemWidth(-FLT_MIN); ImGui::PushItemWidth(-FLT_MIN);
ImGui::SliderFloat("##SliderOpacity", &style.opacity, 0.0f, 1.0f); ImGui::SliderFloat("##SliderOpacity", &style.opacity, 0.0f, 1.0f);
ImGui::SliderFloat("##SliderOffsetX", &style.offset.x(), 0.0f, 1.0f); ImGui::SliderFloat("##SliderOffsetX", &style.offset.x(), 0.0f, 1.0f);
@ -1340,23 +1310,12 @@ void SaveTool::drawDecalEditor(Decal& decal) {
ImGui::TableNextColumn(); ImGui::TableNextColumn();
ImGui::BeginGroup(); ImGui::BeginGroup();
ImGui::AlignTextToFramePadding(); drawAlignedText("Colour:");
ImGui::TextUnformatted("Colour:"); drawAlignedText("Offset:");
drawAlignedText("Rotation:");
ImGui::AlignTextToFramePadding(); drawAlignedText("Scale:");
ImGui::TextUnformatted("Offset:"); drawAlignedText("Flip X:");
drawAlignedText("Surface wrap:");
ImGui::AlignTextToFramePadding();
ImGui::TextUnformatted("Rotation:");
ImGui::AlignTextToFramePadding();
ImGui::TextUnformatted("Scale:");
ImGui::AlignTextToFramePadding();
ImGui::TextUnformatted("Flip X:");
ImGui::AlignTextToFramePadding();
ImGui::TextUnformatted("Surface wrap:");
ImGui::EndGroup(); ImGui::EndGroup();
ImGui::SameLine(); ImGui::SameLine();
@ -1396,14 +1355,9 @@ void SaveTool::drawDecalEditor(Decal& decal) {
ImGui::TextUnformatted("Advanced settings. Touch these at your own risk."); ImGui::TextUnformatted("Advanced settings. Touch these at your own risk.");
ImGui::BeginGroup(); ImGui::BeginGroup();
ImGui::AlignTextToFramePadding(); drawAlignedText("Position:");
ImGui::TextUnformatted("Position:"); drawAlignedText("U axis:");
drawAlignedText("V axis:");
ImGui::AlignTextToFramePadding();
ImGui::TextUnformatted("U axis:");
ImGui::AlignTextToFramePadding();
ImGui::TextUnformatted("V axis:");
ImGui::EndGroup(); ImGui::EndGroup();
ImGui::SameLine(); ImGui::SameLine();
@ -1462,18 +1416,12 @@ void SaveTool::drawAccessoryEditor(Accessory& accessory, Containers::ArrayView<C
#endif #endif
ImGui::BeginGroup(); ImGui::BeginGroup();
ImGui::AlignTextToFramePadding(); drawAlignedText("Styles:");
ImGui::TextUnformatted("Styles:"); drawAlignedText("Base position:");
ImGui::AlignTextToFramePadding(); drawAlignedText("Position offset:");
ImGui::TextUnformatted("Base position:"); drawAlignedText("Base rotation:");
ImGui::AlignTextToFramePadding(); drawAlignedText("Rotation offset:");
ImGui::TextUnformatted("Position offset:"); drawAlignedText("Scale:");
ImGui::AlignTextToFramePadding();
ImGui::TextUnformatted("Base rotation:");
ImGui::AlignTextToFramePadding();
ImGui::TextUnformatted("Rotation offset:");
ImGui::AlignTextToFramePadding();
ImGui::TextUnformatted("Scale:");
ImGui::EndGroup(); ImGui::EndGroup();
ImGui::SameLine(); ImGui::SameLine();

View file

@ -57,9 +57,8 @@ void SaveTool::drawAbout() {
ImGui::TextWrapped("This application, made for the M.A.S.S. Builder community by Guillaume Jacquemin (aka William JCM), " ImGui::TextWrapped("This application, made for the M.A.S.S. Builder community by Guillaume Jacquemin (aka William JCM), "
"is a rewrite of the wxWidgets-powered M.A.S.S. Builder Save Tool (formerly known as wxMASSManager)."); "is a rewrite of the wxWidgets-powered M.A.S.S. Builder Save Tool (formerly known as wxMASSManager).");
ImGui::AlignTextToFramePadding();
const char* repo = "https://williamjcm.ovh/git/williamjcm/MassBuilderSaveTool"; const char* repo = "https://williamjcm.ovh/git/williamjcm/MassBuilderSaveTool";
ImGui::Text(ICON_FA_GIT_ALT " %s", repo); drawAlignedText(ICON_FA_GIT_ALT " %s", repo);
ImGui::SameLine(); ImGui::SameLine();
if(ImGui::Button("Copy to clipboard")) { if(ImGui::Button("Copy to clipboard")) {
ImGui::SetClipboardText(repo); ImGui::SetClipboardText(repo);
@ -90,9 +89,8 @@ void SaveTool::drawAbout() {
if(ImGui::TreeNodeEx("Corrade", ImGuiTreeNodeFlags_SpanAvailWidth)) { if(ImGui::TreeNodeEx("Corrade", ImGuiTreeNodeFlags_SpanAvailWidth)) {
ImGui::Text("Version used: %s", CORRADE_VERSION_STRING); ImGui::Text("Version used: %s", CORRADE_VERSION_STRING);
ImGui::AlignTextToFramePadding();
const char* corrade_website = "https://magnum.graphics/corrade"; const char* corrade_website = "https://magnum.graphics/corrade";
ImGui::Text(ICON_FA_GLOBE " %s", corrade_website); drawAlignedText(ICON_FA_GLOBE " %s", corrade_website);
ImGui::SameLine(); ImGui::SameLine();
if(ImGui::Button("Copy to clipboard")) { if(ImGui::Button("Copy to clipboard")) {
ImGui::SetClipboardText(corrade_website); ImGui::SetClipboardText(corrade_website);
@ -119,9 +117,8 @@ void SaveTool::drawAbout() {
ImGui::TextUnformatted("Versions used:"); ImGui::TextUnformatted("Versions used:");
ImGui::BulletText("Magnum: %s", MAGNUM_VERSION_STRING); ImGui::BulletText("Magnum: %s", MAGNUM_VERSION_STRING);
ImGui::BulletText("Integration: %s", MAGNUMINTEGRATION_VERSION_STRING); ImGui::BulletText("Integration: %s", MAGNUMINTEGRATION_VERSION_STRING);
ImGui::AlignTextToFramePadding();
const char* magnum_website = "https://magnum.graphics"; const char* magnum_website = "https://magnum.graphics";
ImGui::Text(ICON_FA_GLOBE " %s", magnum_website); drawAlignedText(ICON_FA_GLOBE " %s", magnum_website);
ImGui::SameLine(); ImGui::SameLine();
if(ImGui::Button("Copy to clipboard")) { if(ImGui::Button("Copy to clipboard")) {
ImGui::SetClipboardText(magnum_website); ImGui::SetClipboardText(magnum_website);
@ -146,9 +143,8 @@ void SaveTool::drawAbout() {
if(ImGui::TreeNodeEx("Dear ImGui", ImGuiTreeNodeFlags_SpanAvailWidth)) { if(ImGui::TreeNodeEx("Dear ImGui", ImGuiTreeNodeFlags_SpanAvailWidth)) {
ImGui::Text("Version used: %s", IMGUI_VERSION); ImGui::Text("Version used: %s", IMGUI_VERSION);
ImGui::AlignTextToFramePadding();
const char* imgui_repo = "https://github.com/ocornut/imgui"; const char* imgui_repo = "https://github.com/ocornut/imgui";
ImGui::Text(ICON_FA_GITHUB " %s", imgui_repo); drawAlignedText(ICON_FA_GITHUB " %s", imgui_repo);
ImGui::SameLine(); ImGui::SameLine();
if(ImGui::Button("Copy to clipboard")) { if(ImGui::Button("Copy to clipboard")) {
ImGui::SetClipboardText(imgui_repo); ImGui::SetClipboardText(imgui_repo);
@ -173,9 +169,8 @@ void SaveTool::drawAbout() {
if(ImGui::TreeNodeEx("Simple DirectMedia Layer (SDL) 2", ImGuiTreeNodeFlags_SpanAvailWidth)) { if(ImGui::TreeNodeEx("Simple DirectMedia Layer (SDL) 2", ImGuiTreeNodeFlags_SpanAvailWidth)) {
ImGui::Text("Version used: %i.%i.%i", SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL); ImGui::Text("Version used: %i.%i.%i", SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL);
ImGui::AlignTextToFramePadding();
const char* sdl_website = "https://www.libsdl.org/"; const char* sdl_website = "https://www.libsdl.org/";
ImGui::Text(ICON_FA_GLOBE " %s", sdl_website); drawAlignedText(ICON_FA_GLOBE " %s", sdl_website);
ImGui::SameLine(); ImGui::SameLine();
if(ImGui::Button("Copy to clipboard")) { if(ImGui::Button("Copy to clipboard")) {
ImGui::SetClipboardText(sdl_website); ImGui::SetClipboardText(sdl_website);
@ -200,9 +195,8 @@ void SaveTool::drawAbout() {
if(ImGui::TreeNodeEx("libzip", ImGuiTreeNodeFlags_SpanAvailWidth)) { if(ImGui::TreeNodeEx("libzip", ImGuiTreeNodeFlags_SpanAvailWidth)) {
ImGui::Text("Version used: %s", LIBZIP_VERSION); ImGui::Text("Version used: %s", LIBZIP_VERSION);
ImGui::AlignTextToFramePadding();
const char* libzip_website = "https://libzip.org/"; const char* libzip_website = "https://libzip.org/";
ImGui::Text(ICON_FA_GLOBE " %s", libzip_website); drawAlignedText(ICON_FA_GLOBE " %s", libzip_website);
ImGui::SameLine(); ImGui::SameLine();
if(ImGui::Button("Copy to clipboard")) { if(ImGui::Button("Copy to clipboard")) {
ImGui::SetClipboardText(libzip_website); ImGui::SetClipboardText(libzip_website);
@ -226,9 +220,8 @@ void SaveTool::drawAbout() {
} }
if(ImGui::TreeNodeEx("Entropia File System Watcher (efsw)", ImGuiTreeNodeFlags_SpanAvailWidth)) { if(ImGui::TreeNodeEx("Entropia File System Watcher (efsw)", ImGuiTreeNodeFlags_SpanAvailWidth)) {
ImGui::AlignTextToFramePadding();
const char* efsw_repo = "https://github.com/SpartanJ/efsw"; const char* efsw_repo = "https://github.com/SpartanJ/efsw";
ImGui::Text(ICON_FA_GITHUB " %s", efsw_repo); drawAlignedText(ICON_FA_GITHUB " %s", efsw_repo);
ImGui::SameLine(); ImGui::SameLine();
if(ImGui::Button("Copy to clipboard")) { if(ImGui::Button("Copy to clipboard")) {
ImGui::SetClipboardText(efsw_repo); ImGui::SetClipboardText(efsw_repo);
@ -252,9 +245,8 @@ void SaveTool::drawAbout() {
} }
if(ImGui::TreeNodeEx("C++ Requests (cpr)", ImGuiTreeNodeFlags_SpanAvailWidth)) { if(ImGui::TreeNodeEx("C++ Requests (cpr)", ImGuiTreeNodeFlags_SpanAvailWidth)) {
ImGui::AlignTextToFramePadding();
const char* cpr_website = "https://whoshuu.github.io/cpr/"; const char* cpr_website = "https://whoshuu.github.io/cpr/";
ImGui::Text(ICON_FA_GLOBE " %s", cpr_website); drawAlignedText(ICON_FA_GLOBE " %s", cpr_website);
ImGui::SameLine(); ImGui::SameLine();
if(ImGui::Button("Copy to clipboard")) { if(ImGui::Button("Copy to clipboard")) {
ImGui::SetClipboardText(cpr_website); ImGui::SetClipboardText(cpr_website);
@ -278,9 +270,8 @@ void SaveTool::drawAbout() {
} }
if(ImGui::TreeNodeEx("JSON for Modern C++ (aka json.hpp)", ImGuiTreeNodeFlags_SpanAvailWidth)) { if(ImGui::TreeNodeEx("JSON for Modern C++ (aka json.hpp)", ImGuiTreeNodeFlags_SpanAvailWidth)) {
ImGui::AlignTextToFramePadding();
const char* json_website = "https://json.nlohmann.me/"; const char* json_website = "https://json.nlohmann.me/";
ImGui::Text(ICON_FA_GLOBE " %s", json_website); drawAlignedText(ICON_FA_GLOBE " %s", json_website);
ImGui::SameLine(); ImGui::SameLine();
if(ImGui::Button("Copy to clipboard")) { if(ImGui::Button("Copy to clipboard")) {
ImGui::SetClipboardText(json_website); ImGui::SetClipboardText(json_website);
@ -305,9 +296,8 @@ void SaveTool::drawAbout() {
if(ImGui::TreeNodeEx("Font Awesome", ImGuiTreeNodeFlags_SpanAvailWidth)) { if(ImGui::TreeNodeEx("Font Awesome", ImGuiTreeNodeFlags_SpanAvailWidth)) {
ImGui::TextUnformatted("Version used: 5.15.3"); ImGui::TextUnformatted("Version used: 5.15.3");
ImGui::AlignTextToFramePadding();
const char* fa_website = "https://fontawesome.com/"; const char* fa_website = "https://fontawesome.com/";
ImGui::Text(ICON_FA_GLOBE " %s", fa_website); drawAlignedText(ICON_FA_GLOBE " %s", fa_website);
ImGui::SameLine(); ImGui::SameLine();
if(ImGui::Button("Copy to clipboard")) { if(ImGui::Button("Copy to clipboard")) {
ImGui::SetClipboardText(fa_website); ImGui::SetClipboardText(fa_website);
@ -323,9 +313,8 @@ void SaveTool::drawAbout() {
} }
if(ImGui::TreeNodeEx("IconFontCppHeaders", ImGuiTreeNodeFlags_SpanAvailWidth)) { if(ImGui::TreeNodeEx("IconFontCppHeaders", ImGuiTreeNodeFlags_SpanAvailWidth)) {
ImGui::AlignTextToFramePadding();
const char* icon_repo = "https://github.com/juliettef/IconFontCppHeaders"; const char* icon_repo = "https://github.com/juliettef/IconFontCppHeaders";
ImGui::Text(ICON_FA_GITHUB " %s", icon_repo); drawAlignedText(ICON_FA_GITHUB " %s", icon_repo);
ImGui::SameLine(); ImGui::SameLine();
if(ImGui::Button("Copy to clipboard")) { if(ImGui::Button("Copy to clipboard")) {
ImGui::SetClipboardText(icon_repo); ImGui::SetClipboardText(icon_repo);

View file

@ -55,8 +55,7 @@ void SaveTool::drawMainMenu() {
ImGui::Separator(); ImGui::Separator();
if(ImGui::BeginMenu(ICON_FA_COG " Settings")) { if(ImGui::BeginMenu(ICON_FA_COG " Settings")) {
ImGui::AlignTextToFramePadding(); drawAlignedText("Frame limiter:");
ImGui::TextUnformatted("Frame limiter:");
ImGui::SameLine(); ImGui::SameLine();
static UnsignedByte selection = static_cast<UnsignedByte>(_framelimit); static UnsignedByte selection = static_cast<UnsignedByte>(_framelimit);
@ -118,8 +117,7 @@ void SaveTool::drawMainMenu() {
} }
if(_updateAvailable) { if(_updateAvailable) {
ImGui::AlignTextToFramePadding(); drawAlignedText("Version %s is available.", _latestVersion.c_str());
ImGui::Text("Version %s is available.", _latestVersion.c_str());
if(ImGui::Button(ICON_FA_FILE_SIGNATURE " Release notes")) { if(ImGui::Button(ICON_FA_FILE_SIGNATURE " Release notes")) {
openUri(_releaseLink); openUri(_releaseLink);
} }