Skip to content

Commit

Permalink
Merge branch 'prerelease' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
ZachHembree committed Sep 15, 2021
2 parents 3d207d4 + 08370fa commit 6ee8012
Show file tree
Hide file tree
Showing 68 changed files with 1,696 additions and 1,410 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ protected override void Layout()

protected override void HandleInput(Vector2 cursorPos)
{
/* TextBoard Offsets 101:
/* TextBoard Offsets:
The TextBoard allows you to set an offset for the text being rendered starting from the
center of the element. Text outside the bounds of the element will not be drawn.
Expand All @@ -85,10 +85,6 @@ the opposite direction.
By default, the visible range of text will start at the first line on the first character.
It starts in the upper left hand corner.
If you wanted to move to the last line to the top of the element, you'd need to set a Y-offset
of TextSize.Y - lineSize.Y. If you wanted to move the last character in a line to the right side
of the element, you'd set an X-offset of -charOffset.X + charSize.X / 2f.
*/

ITextBoard textBoard = text.TextBoard;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ public event EventHandler BuildModeChanged
/// </summary>
public GlyphFormat Format
{
get { return _format; }
set
get { return _format; }
set
{
FontStyles style = value.FontStyle;
boldToggle.Selected = style.HasFlag(FontStyles.Bold);
Expand Down Expand Up @@ -128,6 +128,13 @@ public EditorToolBar(HudParentBase parent = null) : base(parent)
Text = "I",
};

/* HudChain is useful for organizing collections of elements into straight lines with regular spacing,
* either vertically horizontally. In this case, I'm organizing elements horizontally from left to right
* in the same order indicated by the collection initializer below.
*
* HudChain and its related types, like ScrollBox and the SelectionBox types, are powerful tools for
* organizing UI elements, especially when used in conjunction with oneanother.
*/
layout = new HudChain(false, this) // Set to alignVertical false to align the elements horizontally
{
// Automatically resize the height of the elements to match that of the chain and allow the chain to be
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,10 @@ private void ChangeBuilderMode(object sender, EventArgs args)
textBox.text.BuilderMode = toolBar.BulderMode;
}

protected override void Draw()
protected override void Layout()
{
base.Layout();

// Set window minimum width to prevent it from becoming narrower than the toolbar's minimum width
MinimumSize = new Vector2(Math.Max(toolBar.MinimumWidth, MinimumSize.X), MinimumSize.Y);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[subrepo]
remote = [email protected]:ZachHembree/RichHudFramework.Client.git
branch = master
commit = 1677b2dddf275fd2e5b2ab647bc3cc05cd7c7e75
parent = dfddf712bcdb7c7a01e4f0d83445f00f8afe0311
commit = ab19e8a09796e3369eb3e8c017a737c0bd87f9ec
parent = a7f048cd796ec1fac1384442966f5dad314a81b0
method = merge
cmdver = 0.4.3
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ namespace RichHudFramework.Client
/// </summary>
public sealed class RichHudClient : RichHudComponentBase
{
public static readonly Vector4I versionID = new Vector4I(1, 1, 1, 0); // Major, Minor, Rev, Hotfix
public static readonly Vector4I versionID = new Vector4I(1, 2, 0, 0); // Major, Minor, Rev, Hotfix
public const ClientSubtypes subtype = ClientSubtypes.Full;

private const long modID = 1965654081, queueID = 1314086443;
private const int vID = 8;
private const int vID = 9;

public static bool Registered => Instance != null ? Instance.registered : false;
private static RichHudClient Instance { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,25 @@ public sealed partial class BindManager : RichHudClient.ApiModule<BindClientMemb
/// </summary
public static IReadOnlyList<IControl> Controls => Instance.controls;

/// <summary>
/// Specifies blacklist mode for SE controls
/// </summary>
public static SeBlacklistModes BlacklistMode
{
get
{
if (_instance == null) Init();
return (SeBlacklistModes)_instance.GetOrSetMemberFunc(null, (int)BindClientAccessors.RequestBlacklistMode);
}
set
{
if (_instance == null)
Init();

_instance.GetOrSetMemberFunc(value, (int)BindClientAccessors.RequestBlacklistMode);
}
}

private static BindManager Instance
{
get { Init(); return _instance; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ private class HudCursor : ICursor
/// </summary>
public bool IsCaptured => (bool)GetOrSetMemberFunc(null, (int)HudCursorAccessors.IsCaptured);

/// <summary>
/// Returns true if a tooltip has been registered
/// </summary>
public bool IsToolTipRegistered { get; private set; }

/// <summary>
/// The position of the cursor in pixels in screen space
/// </summary>
Expand All @@ -44,6 +49,10 @@ private class HudCursor : ICursor
/// </summary>
public Vector3D WorldPos { get; private set; }

/// <summary>
/// Line projected from the cursor into world space on the -Z axis
/// correcting for apparent warping due to perspective projection.
/// </summary>
public LineD WorldLine { get; private set; }

private readonly Func<HudSpaceDelegate, bool> IsCapturingSpaceFunc;
Expand All @@ -69,6 +78,7 @@ public void Update()
ScreenPos = (Vector2)GetOrSetMemberFunc(null, (int)HudCursorAccessors.ScreenPos);
WorldPos = (Vector3D)GetOrSetMemberFunc(null, (int)HudCursorAccessors.WorldPos);
WorldLine = (LineD)GetOrSetMemberFunc(null, (int)HudCursorAccessors.WorldLine);
IsToolTipRegistered = (bool)GetOrSetMemberFunc(null, (int)HudCursorAccessors.IsToolTipRegistered);
}

/// <summary>
Expand Down Expand Up @@ -115,6 +125,14 @@ public bool TryCapture(ApiMemberAccessor capturedElement) =>
/// </summary>
public bool TryRelease(ApiMemberAccessor capturedElement) =>
TryReleaseFunc(capturedElement);

/// <summary>
/// Registers a callback delegate to set the tooltip for the next frame. Tooltips are reset
/// every tick and must be reregistered in HandleInput() every tick. The first tooltip registered
/// takes precedence.
/// </summary>
public void RegisterToolTip(ToolTip toolTip) =>
GetOrSetMemberFunc(toolTip.GetToolTipFunc, (int)HudCursorAccessors.RegisterToolTip);
}
}
}
Expand Down
Loading

0 comments on commit 6ee8012

Please sign in to comment.