Skip to content

Merge UIText into UILabel / add scale to UILayout#36

Merged
mcmonkey4eva merged 45 commits intomasterfrom
ui-scaling
Mar 31, 2026
Merged

Merge UIText into UILabel / add scale to UILayout#36
mcmonkey4eva merged 45 commits intomasterfrom
ui-scaling

Conversation

@acikek
Copy link
Copy Markdown
Contributor

@acikek acikek commented Jan 13, 2026

  • Slightly refactored RenderableText* classes to be easier to work with
  • Completed the separation between a UILayout's definition and the computed coordinates stored on an individual UIElement
  • Removed UIText and integrated the required functionality into UILabel directly
  • Added scale to UILayout
    • Scale is a float value that expands or contracts the size of a particular element
    • Child elements inherit the scale of their parent when computing their own values
    • UILabels try to find the closest font size to the desired scale
    • UIElement.ScaleSize controls whether to scale an element (default: true) -- the scale value is propagated to children regardless

@mcmonkey4eva mcmonkey4eva marked this pull request as draft January 15, 2026 08:35
@mcmonkey4eva mcmonkey4eva changed the title (DRAFT) Merge UIText into UILabel / add scale to UILayout Merge UIText into UILabel / add scale to UILayout Jan 15, 2026
@acikek acikek marked this pull request as ready for review March 17, 2026 19:31
/// <summary>The debug name of this element.</summary>
public virtual string Name { get; set; } = null;

/// <summary>Whether this element displays additional information in debug mode.</summary>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either flip the bool (AllowDebug = true) or rewrite the doc here to make sense for the negative state

// hold any right or permission to use this software until such time as the official license is identified.
//

using BepuUtilities.Collections;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think the imports here are wonked


public UIStyling HighlightStyling;

public new string Content
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is dirty. Why does this elem extend UIParagraph and then replace or ignore most of the things that make UIParagraph what it is?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

discussed on discord -- noted and I will probably change it to encapsulate a UIParagraph in the future

Comment thread FGEGraphics/ClientSystem/ViewUI2D.cs Outdated
IEnumerable<(int, IEnumerable<string>)> topDebugStack = debugInfoStack.Take(Math.Min(5, debugInfoStack.Count));
int minimumTreeLevel = topDebugStack.Min(entry => entry.Item1);
string debugInfo = topDebugStack
.Select(entry =>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wacky formatting

public string Name = _name.ToLowerFast();

/// <summary>Size of the font set.</summary>
public int Size;// = fontsize;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stray comment?

this(lines,
lines.Length > 0 ? lines.Max(line => line?.Width ?? 0) : 0,
lines.Sum(line => line?.Height ?? 0))
{ }
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wacky formatting


/// <summary>Implements <see cref="Object.ToString"/> to make a "\n" separated string of the contents.</summary>
public override string ToString() => string.Join<RenderableTextLine>('\n', Lines);
} No newline at end of file
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nl@eof

: this(parts,
(int)parts.Sum(part => part?.Width),
parts.Length > 0 ? parts.Max(part => part?.Font.Height ?? 0) : height)
{ }
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wacky format

Comment thread FGEGraphics/UISystem/UILabel.cs Outdated
return (label, image, list);
}
}
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nl@eof

using OpenTK;
using OpenTK.Mathematics;
using FreneticUtilities.FreneticExtensions;
using System;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

imports got wonked

@mcmonkey4eva mcmonkey4eva merged commit f6f4d49 into master Mar 31, 2026
@mcmonkey4eva mcmonkey4eva deleted the ui-scaling branch March 31, 2026 01:33
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.

2 participants