Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
fix: check on highlight.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Jul 10, 2024
1 parent d6fb564 commit a46ea6b
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 35 deletions.
32 changes: 0 additions & 32 deletions ActionTimelineEx/Helpers/DrawHelper.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using Dalamud.Interface.Textures;
using Dalamud.Interface.Textures.TextureWraps;
using ECommons.DalamudServices;
using ECommons.ImGuiMethods;
using ImGuiNET;
using Lumina.Data.Files;
using System.Numerics;
Expand All @@ -11,37 +10,6 @@ namespace ActionTimeline.Helpers;

internal static class DrawHelper
{
private static readonly Vector2 _uv1 = new (96 * 5 / 852f, 0),
_uv2 = new ((96 * 5 + 144) / 852f, 0.5f);

private static IDalamudTextureWrap? _roundTex;
public static void Init()
{
var tex = Svc.Data.GetFile<TexFile>("ui/uld/icona_frame_hr1.tex");
if (tex == null) return;
byte[] imageData = tex.ImageData;
byte[] array = new byte[imageData.Length];

for (int i = 0; i < imageData.Length; i += 4)
{
array[i] = array[i + 1] = array[i + 2] = byte.MaxValue;
array[i + 3] = imageData[i + 3];
}

_roundTex = Svc.Texture.CreateFromRaw(RawImageSpecification.Rgba32(tex!.Header.Width, tex!.Header.Height), array);
}

public static void DrawDamage(this ImDrawListPtr drawList, Vector2 position, float size, uint lightCol)
{
if(_roundTex == null) return;

var pixPerUnit = size / 82;

var outPos = position - new Vector2(pixPerUnit * 31, pixPerUnit * 31);
drawList.AddImage(_roundTex.ImGuiHandle, outPos, outPos + new Vector2(pixPerUnit * 144, pixPerUnit * 154),
_uv1, _uv2, lightCol);
}

public static void DrawActionIcon(this ImDrawListPtr drawList, uint iconId, bool isHq, Vector2 position, float size)
{
IDalamudTextureWrap? texture = GetTextureFromIconId(iconId, isHq);
Expand Down
1 change: 0 additions & 1 deletion ActionTimelineEx/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ public Plugin(IDalamudPluginInterface pluginInterface)
Svc.PluginInterface.UiBuilder.OpenMainUi += OpenConfigUi;

TimelineManager.Initialize();
DrawHelper.Init();

try
{
Expand Down
3 changes: 2 additions & 1 deletion ActionTimelineEx/Timeline/TimelineItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using Dalamud.Interface.Textures.TextureWraps;
using ImGuiNET;
using System.Numerics;
using XIVConfigUI;

namespace ActionTimelineEx.Timeline;

Expand Down Expand Up @@ -191,7 +192,7 @@ private void DrawItemWithCenter(ImDrawListPtr drawList, Vector2 centerPos, Vecto
DamageType.CriticalDirect => ImGui.ColorConvertFloat4ToU32(setting.CriticalDirectColor),
_ => 0u,
};
drawList.DrawDamage(centerPos - iconSize / 2 * setting.RealDownDirection, iconSize, lightCol);
drawList.DrawSlotHighlight(centerPos - iconSize / 2 * setting.RealDownDirection, iconSize, lightCol);
}

return;
Expand Down
2 changes: 1 addition & 1 deletion XIVConfigUI

0 comments on commit a46ea6b

Please sign in to comment.