Quantcast
WoWInterface - View Single Post - Putting font over a status bar.
View Single Post
07-01-19, 03:55 AM   #1
Hartwell
A Defias Bandit
Join Date: Jun 2019
Posts: 2
Question Putting font over a status bar.

Hello! I'm not very familiar with LUA or WoW's syntax myself, as I'm quite new to working with it. Right now I'm working with a status bar template and fonts that should go in front of those status bars, as well as messing around with textures. I've bumped into a layering problem, where the textures from the status bar are taking priority over the font.

Code:
	-- Create the display frame.
	local UI_DisplayFrame = CreateFrame("Frame", AddonName .. "_PlayerButton_DisplayFrame", UI_Frame);

	-- Set display frame.
	UI_DisplayFrame:SetSize(tableOfPlayerFrame.buttonSize.x, tableOfPlayerFrame.buttonSize.y);
	UI_DisplayFrame:SetPoint(tableOfPlayerFrame.buttonRelativeAlignment, UI_Frame, tableOfPlayerFrame.buttonRelativeAlignment, 0, 0);
	UI_DisplayFrame:Show();
	UI_DisplayFrame:EnableMouse(false);

	-- Set the health status bar.
	UI_DisplayFrame.statusBar_Health = CreateFrame("StatusBar", AddonName .. "_PlayerButton_DisplayFrame_HealthBar", UI_DisplayFrame, "UIWidgetTemplateStatusBar");
	UI_DisplayFrame.statusBar_Health:SetSize(tableOfPlayerFrame.buttonSize.x, tableOfPlayerFrame.buttonSize.y);
	UI_DisplayFrame.statusBar_Health:SetPoint(tableOfPlayerFrame.buttonRelativeAlignment, UI_DisplayFrame, tableOfPlayerFrame.buttonRelativeAlignment, 0, 0);
	UI_DisplayFrame.statusBar_Health:SetStatusBarTexture("interface/targetingframe/ui-statusbar.blp", "BACKGROUND");
	UI_DisplayFrame.statusBar_Health:SetStatusBarColor(0.2, 1, 0.2);
	UI_DisplayFrame.statusBar_Health:SetMinMaxValues(0, 1);
	UI_DisplayFrame.statusBar_Health:SetValue(1);
	UI_DisplayFrame.statusBar_Health:SetReverseFill(false);
	UI_DisplayFrame.statusBar_Health:Show();

	-- Make the border to the health status bar.
	UI_DisplayFrame.statusBar_Health.border = UI_DisplayFrame.statusBar_Health:CreateTexture("healthBarBorder", "BORDER");
	UI_DisplayFrame.statusBar_Health.border:SetAllPoints(UI_DisplayFrame.statusBar_Health);
	UI_DisplayFrame.statusBar_Health.border:SetTexture("interface/tooltips/ui-statusbar-border.blp");
	UI_DisplayFrame.statusBar_Health.border:Show();

	-- Make a frame for the text.
	UI_DisplayFrame.textFrame = CreateFrame("Frame", "TextFrame", UI_DisplayFrame.statusBar_Health);
	UI_DisplayFrame.textFrame:SetAllPoints(UI_DisplayFrame);

	-- Set the title font.
	UI_DisplayFrame.textFrame.title = UI_DisplayFrame:CreateFontString("buttonTitle", "OVERLAY");
	UI_DisplayFrame.textFrame.title:SetFontObject("TextStatusBarText");
	UI_DisplayFrame.textFrame.title:SetTextColor(0.95, 0.95, 0.95, 0.95);
	UI_DisplayFrame.textFrame.title:SetPoint(tableOfPlayerFrame.buttonRelativeAlignment, UI_DisplayFrame.textFrame, tableOfPlayerFrame.buttonRelativeAlignment, 0, 0);

	-- Set the subtitle font.
	UI_DisplayFrame.textFrame.subtitle = UI_DisplayFrame:CreateFontString("buttonSubtitle", "OVERLAY");
	UI_DisplayFrame.textFrame.subtitle:SetFontObject("TextStatusBarText");
	UI_DisplayFrame.textFrame.subtitle:SetTextColor(0.75, 0.75, 0.75, 0.9);
	UI_DisplayFrame.textFrame.subtitle:SetPoint(tableOfPlayerFrame.buttonRelativeAlignment, UI_DisplayFrame.textFrame.title, tableOfPlayerFrame.buttonRelativeAlignment, 0, -10);
I tried to parent the frames to make the text frame a child of the healthbar. Another thing I've tried to change was the layer of the font as well as changing the category of the layer, but read somewhere that the font should always have the highest layer of a category. I'm not sure if that information is accurate, although I would imagine it to be true. Does the status bar widget template I'm using have something like that going on as well?

Sorry if I don't respond quickly or at all. I'm working a lot of overtime at a job right now. Any advice would be much appreciated for when I have the time.
  Reply With Quote