Skip to content

Commit 570f9b2

Browse files
committed
Fix wrapped mod lines printing in white. NEEDS SG TO BE PULLED TOO
1 parent 16f84a1 commit 570f9b2

4 files changed

Lines changed: 8 additions & 3 deletions

File tree

runtime/SimpleGraphic.dll

546 KB
Binary file not shown.

src/Classes/GemSelectControl.lua

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,6 @@ function GemSelectClass:Draw(viewPort, noTooltip)
493493
local cursorX, cursorY = GetCursorPos()
494494
self.tooltip:Clear()
495495
if gemInstance and gemInstance.gemData then
496-
self.tooltip.titleYOffset = 5 --The image for Gems has an aspect ratio that makes the title not centered.
497496
self:AddGemTooltip(gemInstance)
498497
else
499498
self.tooltip:AddLine(16, toolTipText)

src/Classes/Tooltip.lua

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,9 @@ function TooltipClass:Draw(x, y, w, h, viewPort)
450450
-- Draw background if specified, used for gem mod lines and desecrated mods on items.
451451
local bg = line.background
452452
if bg then
453+
-- Save current draw color BEFORE drawing background image, otherwise wrapped strings print white text for later lines.
454+
local prevR, prevG, prevB, prevA = GetDrawColor()
455+
453456
if type(bg) == "string" then
454457
if not self._bgHandles then
455458
self._bgHandles = {}
@@ -466,9 +469,11 @@ function TooltipClass:Draw(x, y, w, h, viewPort)
466469
local y = line[2] - 1
467470
local width = ttW - 8
468471
local height = line[4] + 3
469-
470-
SetDrawColor(1,1,1,1) -- this makes second line with background print white. Need to save current print color
472+
SetDrawColor(1,1,1,1)
471473
DrawImage(bg, x + 4, y, width, height)
474+
475+
-- Restore color BEFORE DrawString
476+
SetDrawColor(prevR, prevG, prevB, prevA)
472477
end
473478

474479
-- Draw text line

src/HeadlessWrapper.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ function SetClearColor(r, g, b, a) end
5555
function SetDrawLayer(layer, subLayer) end
5656
function SetViewport(x, y, width, height) end
5757
function SetDrawColor(r, g, b, a) end
58+
function GetDrawColor(r, g, b, a) end
5859
function DrawImage(imgHandle, left, top, width, height, tcLeft, tcTop, tcRight, tcBottom) end
5960
function DrawImageQuad(imageHandle, x1, y1, x2, y2, x3, y3, x4, y4, s1, t1, s2, t2, s3, t3, s4, t4) end
6061
function DrawString(left, top, align, height, font, text) end

0 commit comments

Comments
 (0)