diff --git a/Umbra.Bejeweled/Umbra.Bejeweled.csproj b/Umbra.Bejeweled/Umbra.Bejeweled.csproj index 60402aa..c2eb82d 100644 --- a/Umbra.Bejeweled/Umbra.Bejeweled.csproj +++ b/Umbra.Bejeweled/Umbra.Bejeweled.csproj @@ -24,7 +24,7 @@ Una Una XIV - 1.0.2 + 1.0.3 A bejeweled game to kill time while waiting for queues. (C)2024 https://github.com/una-xiv/Umbra.BejeweledPlugin diff --git a/Umbra.Bejeweled/src/Game/Board.cs b/Umbra.Bejeweled/src/Game/Board.cs index 3d3db40..e9a6167 100644 --- a/Umbra.Bejeweled/src/Game/Board.cs +++ b/Umbra.Bejeweled/src/Game/Board.cs @@ -3,12 +3,13 @@ using System.Numerics; using FFXIVClientStructs.FFXIV.Client.UI; using Umbra.Common; +using Una.Drawing; namespace Umbra.Bejeweled.Game; internal sealed partial class Board(Viewport viewport, Vec2 size) { - public const int CellSize = 64; + public int CellSize => (int)Math.Ceiling(64 * Node.ScaleFactor); public bool Active { get; set; } public bool EnableSfx { get; set; } = true; diff --git a/Umbra.Bejeweled/src/Game/Entities/Particle.cs b/Umbra.Bejeweled/src/Game/Entities/Particle.cs index e61170f..c0fdde5 100644 --- a/Umbra.Bejeweled/src/Game/Entities/Particle.cs +++ b/Umbra.Bejeweled/src/Game/Entities/Particle.cs @@ -35,7 +35,7 @@ internal sealed class Particle( protected override void OnDraw(float deltaTime) { if (_elapsedTime == 0) { - int h = Board.CellSize / 2; + int h = _board.CellSize / 2; int x = new Random().Next(-h, h); int y = new Random().Next(-h, h); @@ -47,8 +47,8 @@ protected override void OnDraw(float deltaTime) _uv1 = new(uvOffset, uvOffset); _uv2 = new(1 - uvOffset, 1 - uvOffset); - _targetPos = _board.Viewport.TopLeft + new Vector2(Board.CellSize, -Board.CellSize); - _position = _board.Viewport.TopLeft + SpritePosition + new Vector2(x + h, y + h); + _targetPos = _board.Viewport.TopLeft + new Vector2(_board.CellSize, -_board.CellSize); + _position = _board.Viewport.TopLeft + SpritePosition + new Vector2(x + h, y + h); Vector2 accelPos1 = Vector2.Normalize(_targetPos - _position); Vector2 accelPos2 = new( diff --git a/Umbra.Bejeweled/src/Game/Entity.cs b/Umbra.Bejeweled/src/Game/Entity.cs index a2a8d6f..4389f0b 100644 --- a/Umbra.Bejeweled/src/Game/Entity.cs +++ b/Umbra.Bejeweled/src/Game/Entity.cs @@ -20,8 +20,8 @@ internal abstract class Entity(byte entityType, Board board, Vec2 cellPosition) /// Returns the sprite position of the entity. /// public Vector2 SpritePosition { get; private set; } = new( - Board.CellSize * cellPosition.X, - Board.CellSize * cellPosition.Y + board.CellSize * cellPosition.X, + board.CellSize * cellPosition.Y ); /// @@ -128,7 +128,7 @@ public void Render(float deltaTime) protected void DrawIcon(uint iconId, int padding = 4) { Rect r = new Rect(Rect.TopLeft, Rect.BottomRight); - r.Shrink(new(padding)); + r.Shrink(new((int)(padding * Node.ScaleFactor))); ImGui .GetForegroundDrawList() diff --git a/Umbra.Bejeweled/src/Popup/BejeweledPopup.cs b/Umbra.Bejeweled/src/Popup/BejeweledPopup.cs index a96fc87..8b0cc1a 100644 --- a/Umbra.Bejeweled/src/Popup/BejeweledPopup.cs +++ b/Umbra.Bejeweled/src/Popup/BejeweledPopup.cs @@ -69,8 +69,8 @@ protected override unsafe void OnUpdate() } float deltaTime = Framework.Instance()->FrameDeltaTime; - Vector2 topLeft = Node.QuerySelector("#Cell-0-0")!.Bounds.MarginRect.TopLeft; - Vector2 bottomRight = Node.QuerySelector("#Cell-9-7")!.Bounds.MarginRect.BottomRight; + Vector2 topLeft = Node.QuerySelector("#Cell-0-0")!.Bounds.ContentRect.TopLeft; + Vector2 bottomRight = Node.QuerySelector("#Cell-9-7")!.Bounds.ContentRect.BottomRight; for (var y = 0; y < 8; y++) { for (var x = 0; x < 10; x++) {