Skip to content

Refactor GuiProgressbar for improved accuracy#2573

Open
oznogon wants to merge 6 commits into
daid:masterfrom
oznogon:refactor-guiprogressbar
Open

Refactor GuiProgressbar for improved accuracy#2573
oznogon wants to merge 6 commits into
daid:masterfrom
oznogon:refactor-guiprogressbar

Conversation

@oznogon
Copy link
Copy Markdown
Contributor

@oznogon oznogon commented Oct 30, 2025

GuiProgressbar can fail to show pixels near the min and max values, such as for 98-100% power or coolant on the Power Management screen or the final jump drive charge points in the jump drive controls.

This appears to be caused by the GuiProgressbar being filled by a PNG with a transparent border of pixels, which become the only pixels rendered at these extremes, particularly on high-resolution displays.

  • Remove transparent pixels from edges of the default progress bar fill PNG that caused inaccuracies for values near min and max. Screens that implement GuiProgressbar should manage its width or height using size or margin attributes if necessary.
  • Conditionally reduce the default width of the fill rect when using a background. This is set to an arbitrary value that approximates the proportions used in existing behavior, but results in a tighter and more accurate fit on high-resolution displays.
  • Simplify min/max logic using clamps.

This change retains the fill PNG rather than replacing it with a fill rect so that the bar fill image can still be replaced by mods or themes.

Before

Screenshot_20251029_180016 Screenshot_20251029_175931 Screenshot_20251029_175909 Screenshot_20251029_175857 Screenshot_20251029_175836 Screenshot_20251029_175821

Note how the jump, load, and unload bars appear to be full or empty but aren't.

After

Screenshot_20251029_175658 Screenshot_20251029_175541 Screenshot_20251029_175522 Screenshot_20251029_175510 Screenshot_20251029_175455 Screenshot_20251029_175449

Bars now reach their full extents, and values within 2-3% of empty or full are still visible.

Power Management screen sliders now overflow; the screen has numerous other layout issues (text overlapping controls, bar values not matching slider values) that can also be addressed separately.

GuiProgressbar can fail to show pixels near the min and max values,
such as for 98-100% power or coolant on the Power Management screen
or the final jump drive charge points in the jump drive controls.

This appears to be caused by the GuiProgressbar being filled by a
PNG with a transparent border of pixels, which become the only
pixels rendered at these extremes, particularly on high-resolution
displays.

- Remove transparent pixels from edges of the default progress bar
  fill PNG that caused inaccuracies for values near min and max.
  Screens that implement GuiProgressbar should manage its width or
  height using size or margin attributes if necessary.
- Conditionally reduce the default width of the fill rect when
  using a background. This is set to an arbitrary value that
  approximates the proportions used in existing behavior, but
  results in a tighter and more accurate fit on high-resolution
  displays.
- Simplify min/max logic using clamps.
oznogon added 4 commits April 12, 2026 09:29
A trailing this->value = value immediately overwrites the clamped
result, so sliders never enforce their bounds when set programmatically.
Remove the extraneous value assignment.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant