hallo liebe community ich habe letztens in meine info box dxDrawingColorTexr eingebaut der code dazu sieht so aus
Lua
function dxDrawColorText(str, ax, ay, bx, by, color, scale, font)
local pat = "(.-)#(%x%x%x%x%x%x)"
local s, e, cap, col = str:find(pat, 1)
local last = 1
while s do
if cap == "" and col then color = tocolor(tonumber("0x"..col:sub(1, 2)), tonumber("0x"..col:sub(3, 4)), tonumber("0x"..col:sub(5, 6)), 255) end
if s ~= 1 or cap ~= "" then
local w = dxGetTextWidth(cap, scale, font)
dxDrawText(cap, ax, ay, ax + w, by, color, scale, font)
ax = ax + w
color = tocolor(tonumber("0x"..col:sub(1, 2)), tonumber("0x"..col:sub(3, 4)), tonumber("0x"..col:sub(5, 6)), 255)
end
last = e + 1
s, e, cap, col = str:find(pat, last)
end
if last <= #str then
cap = str:sub(last)
local w = dxGetTextWidth(cap, scale, font)
dxDrawText(cap, ax, ay, ax + w, by, color, scale, font)
end
end
Alles anzeigen
so hier ist jetzt die definition wie der text geschrieben werden soll
Lua
dxDrawColorText(g_tooltipText, sx/2-200, sy+35-g_tooltipPosY, sx/2+200, sy, tocolor(0, 0, 0,255), 1.2, "default", "center", "top", true, true)
aber wen ich das mache ist es nicht mehr im "center" sondern es verschiebt sich wie es will also der text weiß wer wieso?