View Single Post
04-19-23, 10:41 PM   #1
lla
A Murloc Raider
Join Date: Sep 2021
Posts: 4
2D Portrait problem

Hey,

I have a problem with creating 2D portrait. Everything is ok with 3D but when I try with 2D it doesnt show anything.
Can you please help what am I doing wrong?

Code:
oUF:RegisterStyle("Raid", function(self, unit, id)
    self:RegisterForClicks("LeftButtonUp", "RightButtonUp")
	self:SetSize(63,74)

	-- Health
	--------------------------------------------
	local health = self:CreateBar(self:GetName().."HealthBar")
	health:SetHeight(9)
	health:SetPoint("TOP", 0, -3)
	health:SetPoint("LEFT", 1.3, 0)
	health:SetPoint("RIGHT", -1.3, 0)
	health:SetStatusBarTexture("Interface\\Buttons\\WHITE8X8")
	health:SetAlpha(.95)

	health.colorHealth = true
	health.colorClass = false
	health.colorReaction = true

	self.Health = health

	local healthBg = health:CreateTexture(health:GetName().."Backdrop", "BACKGROUND", nil, -7)
	healthBg:SetPoint("TOPLEFT", 0, 0)
	healthBg:SetPoint("BOTTOMRIGHT", 0, 0)
	healthBg:SetColorTexture(.05, .05, .05, .95)

	self.Health.bg = healthBg

	local name = self:CreateFontString(nil, "OVERLAY", nil, 6)

	name:SetJustifyH("CENTER")
	name:SetTextColor(199/255, 179/255, 119/255)
	name:SetPoint("TOP", self, "BOTTOM", 0, -2)
	name:SetPoint("LEFT", self, -20, 0)
	name:SetPoint("RIGHT", self, 20, 0)

	self.Name = name

	-- Portrait
	--------------------------------------------
	local portrait = CreateFrame("PlayerModel", self:GetName().."Portrait", self)
	portrait:SetPoint("TOP", 0, -18)
        portrait:SetPoint("BOTTOM", 0, 6)
	portrait:SetPoint("LEFT", 6, 0)
	portrait:SetPoint("RIGHT", -6, 0)
	portrait:SetAlpha(.65)

    self.Portrait = portrait
end)
Here is how I tried 2D:
Code:
    local Portrait = self:CreateTexture(nil, 'OVERLAY')
    Portrait:SetSize(32, 32)
    Portrait:SetPoint('RIGHT', self, 'LEFT')

    self.Portrait = Portrait
Many thanks in advance.
  Reply With Quote