-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #397 from louis-langholtz/updates-20210427
Updates 20210427
- Loading branch information
Showing
25 changed files
with
428 additions
and
27,796 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// | ||
// ExtensionsForImgui.cpp | ||
// Testbed | ||
// | ||
// Created by Louis D. Langholtz on 4/27/21. | ||
// | ||
|
||
#include "ExtensionsForImgui.hpp" | ||
|
||
#include "imgui_internal.h" | ||
|
||
void ImGui::SetColumnWidths(float remainingWidth, std::initializer_list<float> widths) | ||
{ | ||
const auto numColumns = GetColumnsCount(); | ||
auto column = decltype(numColumns){0}; | ||
for (auto width: widths) | ||
{ | ||
SetColumnWidth(column, width); | ||
remainingWidth -= width; | ||
++column; | ||
} | ||
const auto remainingColumns = numColumns - column; | ||
const auto widthPerRemainingColumn = remainingWidth / remainingColumns; | ||
for (auto i = column; i < numColumns; ++i) | ||
{ | ||
SetColumnWidth(i, widthPerRemainingColumn); | ||
} | ||
} | ||
|
||
void ImGui::Value(const char* prefix, unsigned long v) | ||
{ | ||
Text("%s: %lu", prefix, v); | ||
} | ||
|
||
void ImGui::Value(const char* prefix, double v, const char* float_format) | ||
{ | ||
if (float_format) | ||
{ | ||
char fmt[64]; | ||
ImFormatString(fmt, IM_ARRAYSIZE(fmt), "%%s: %s", float_format); | ||
Text(fmt, prefix, v); | ||
} | ||
else | ||
{ | ||
Text("%s: %.3f", prefix, v); | ||
} | ||
} |
Oops, something went wrong.