'merge' frame padding fix
This commit is contained in:
@@ -769,12 +769,27 @@ public:
|
|||||||
class FramePaddingConfig : public tsl::Gui {
|
class FramePaddingConfig : public tsl::Gui {
|
||||||
private:
|
private:
|
||||||
std::string modeName;
|
std::string modeName;
|
||||||
|
bool isMiniMode;
|
||||||
|
bool isGameResolutionsMode;
|
||||||
|
bool isFPSCounterMode;
|
||||||
|
bool isFPSGraphMode;
|
||||||
int currentPadding;
|
int currentPadding;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FramePaddingConfig(const std::string& mode) : modeName(mode) {
|
FramePaddingConfig(const std::string& mode) : modeName(mode) {
|
||||||
const std::string value = ult::parseValueFromIniSection(configIniPath, "mini", "frame_padding");
|
isMiniMode = (mode == "Mini");
|
||||||
currentPadding = value.empty() ? 10 : std::clamp(atoi(value.c_str()), 0, 14); // max value 14
|
isGameResolutionsMode = (mode == "Game Resolutions");
|
||||||
|
isFPSCounterMode = (mode == "FPS Counter");
|
||||||
|
isFPSGraphMode = (mode == "FPS Graph");
|
||||||
|
|
||||||
|
std::string section;
|
||||||
|
if (isMiniMode) section = "mini";
|
||||||
|
else if (isGameResolutionsMode) section = "game_resolutions";
|
||||||
|
else if (isFPSCounterMode) section = "fps-counter";
|
||||||
|
else if (isFPSGraphMode) section = "fps-graph";
|
||||||
|
|
||||||
|
const std::string value = ult::parseValueFromIniSection(configIniPath, section, "frame_padding");
|
||||||
|
currentPadding = value.empty() ? 10 : std::clamp(atoi(value.c_str()), 0, 14);
|
||||||
}
|
}
|
||||||
|
|
||||||
~FramePaddingConfig() {
|
~FramePaddingConfig() {
|
||||||
@@ -785,6 +800,12 @@ public:
|
|||||||
auto* list = new tsl::elm::List();
|
auto* list = new tsl::elm::List();
|
||||||
list->addItem(new tsl::elm::CategoryHeader("Frame Padding"));
|
list->addItem(new tsl::elm::CategoryHeader("Frame Padding"));
|
||||||
|
|
||||||
|
std::string section;
|
||||||
|
if (isMiniMode) section = "mini";
|
||||||
|
else if (isGameResolutionsMode) section = "game_resolutions";
|
||||||
|
else if (isFPSCounterMode) section = "fps-counter";
|
||||||
|
else if (isFPSGraphMode) section = "fps-graph";
|
||||||
|
|
||||||
static const std::vector<int> paddingValues = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14};
|
static const std::vector<int> paddingValues = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14};
|
||||||
for (int padding : paddingValues) {
|
for (int padding : paddingValues) {
|
||||||
auto* paddingItem = new tsl::elm::ListItem(std::to_string(padding) + " px");
|
auto* paddingItem = new tsl::elm::ListItem(std::to_string(padding) + " px");
|
||||||
@@ -792,9 +813,9 @@ public:
|
|||||||
paddingItem->setValue(ult::CHECKMARK_SYMBOL);
|
paddingItem->setValue(ult::CHECKMARK_SYMBOL);
|
||||||
lastSelectedListItem = paddingItem;
|
lastSelectedListItem = paddingItem;
|
||||||
}
|
}
|
||||||
paddingItem->setClickListener([this, paddingItem, padding](uint64_t keys) {
|
paddingItem->setClickListener([this, paddingItem, padding, section](uint64_t keys) {
|
||||||
if (keys & KEY_A) {
|
if (keys & KEY_A) {
|
||||||
ult::setIniFileValue(configIniPath, "mini", "frame_padding", std::to_string(padding));
|
ult::setIniFileValue(configIniPath, section, "frame_padding", std::to_string(padding));
|
||||||
paddingItem->setValue(ult::CHECKMARK_SYMBOL);
|
paddingItem->setValue(ult::CHECKMARK_SYMBOL);
|
||||||
if (lastSelectedListItem && paddingItem != lastSelectedListItem)
|
if (lastSelectedListItem && paddingItem != lastSelectedListItem)
|
||||||
lastSelectedListItem->setValue("");
|
lastSelectedListItem->setValue("");
|
||||||
@@ -2084,11 +2105,15 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
int getCurrentFramePadding() {
|
int getCurrentFramePadding() {
|
||||||
if (isMiniMode) {
|
std::string section;
|
||||||
std::string value = ult::parseValueFromIniSection(configIniPath, "mini", "frame_padding");
|
if (isMiniMode) section = "mini";
|
||||||
return value.empty() ? 10 : atoi(value.c_str());
|
else if (isGameResolutionsMode) section = "game_resolutions";
|
||||||
}
|
else if (isFPSCounterMode) section = "fps-counter";
|
||||||
return 10;
|
else if (isFPSGraphMode) section = "fps-graph";
|
||||||
|
else return 10;
|
||||||
|
|
||||||
|
std::string value = ult::parseValueFromIniSection(configIniPath, section, "frame_padding");
|
||||||
|
return value.empty() ? 10 : atoi(value.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string getCurrentTextAlign() {
|
std::string getCurrentTextAlign() {
|
||||||
|
|||||||
Reference in New Issue
Block a user