WoWInterface (
-   Lua/XML Help (
-   -   A simple display (

doofus 02-08-18 02:38 PM

A simple display
Hello everyone

I have tried to write a very simple addon that would display a very large number on the screen like "1" or "5" , or maybe some very short text like "MOVE" and as I am so new I did not know what frame object to use. I have tried MessageFrame and have used the largest font "GameFontHighlightLarge" but it is still too small and I do not like the way MessageFrame scrolls messages either.

The way I imagine it would be like so:

1) create the widget
2) position the widget - make sure it is transparent to clicks
3) set the text on the widget like "MOVE" which appears in very, very large letters
4) clear the widget so the screen is clean again
5) set some other text maybe
6) size the widget in code so it does not need to be sizeable
7) move the widget to get it away from important screen areas would be nice but can also be done in code

Any suggestions would be welcome

Ammako 02-08-18 02:55 PM

If you just want to show text on screen, you can really just use a regular frame.

Really just, local f = CreateFrame("frame"), then f.text = f:CreateFontString(nil, "OVERLAY")

And you set the text via f.text:SetText("text")

with f.text:SetPoint("CENTER", f)

Then you've got to write the relevant code to have the frame show on screen where you want it and when you want it to, of course, but I think you've already got that part figured out (otherwise I can go in more detail and write actual code, rather than just giving pointers.)

Just off the top of my head, but that should be right.

GameFontHighlightLarge isn't a font, it's a template. You want to use f.text:SetFont(fontname, fontsize, fontflags)

Seerah 02-08-18 09:10 PM

GameFontHighlightLarge is a template, yes, and you can use it with :SetFont. ;)

lightspark 02-09-18 01:02 AM


Originally Posted by Seerah (Post 326771)
GameFontHighlightLarge is a template, yes, and you can use it with :SetFont. ;)

Eh? You have to use SetFontObject method :p

Rainrider 02-09-18 01:14 AM

No need for SetFontObject.
lua Code:
  1. f.text = f:CreateFontString(nil, "OVERLAY", "GameFontHighlightLarge")

doofus 02-09-18 05:12 AM

Thanks for the suggestions I will try today.

As an idea I like the DBM's "pull" countdown : great large numbers in the middle of the screen and some small animation or effect, OK, I do not care about the effect, just the numbers/letters on the screen, no need for borders either.

lightspark 02-09-18 07:38 AM


Originally Posted by Rainrider (Post 326773)
No need for SetFontObject.
lua Code:
  1. f.text = f:CreateFontString(nil, "OVERLAY", "GameFontHighlightLarge")

Duh, if he decides to re-set it later, he'll have to use SetFontObjcect :rolleyes:

On a side note, there's a bug, and it won't be fixed in the near future, if you use font string's SetFont method, you won't be able to use SetFontObject for that font string anymore.

Ammako 02-09-18 09:11 AM

The point being of course, that OP was trying to use GameFontHighlightLarge because they thought it was "the largest font" and would make their text bigger on screen. Which it isn't, it's just a template; font size needs to be set via SetFont to a size that's big enough for their needs. They might not even really need nor care about that template.

doofus 02-10-18 10:38 AM

It is currently like this

fNoticeBoard = CreateFrame("Frame", "BA_NoticeBoard", UIParent);
fNoticeBoard.text = fNoticeBoard:CreateFontString(nil, "OVERLAY");
fNoticeBoard.text:SetFont("Fonts\\FRIZQT__.TTF", 72, "OUTLINE, MONOCHROME");
fNoticeBoard.text:SetPoint("CENTER", fNoticeBoard);

Seerah 02-10-18 12:44 PM

IIRC, the largest font size in WoW is hardcoded at 32. Anything more and you'll have to use scaling.

Ammako 02-10-18 12:54 PM

I'm not sure how true that is, at least not in the current time. Otherwise I wouldn't be able to do this.
(Font size 3000, set with SetFont)

I remember when I was originally messing with this, I used GetFont to get nameplate name font size and re-used it as-is, but it turned out they used some kind of downscaling and the actual font size returned by GetFont was something in the 5 digits, lol. Got a nice surprise when I hit /reload

lua Code:
  1. local f = CreateFrame("frame", "name")
  2. f:SetFrameStrata("HIGH")
  3. f:SetPoint("CENTER", UIParent)
  4. f:SetSize(500, 500)
  5. f.text = f.text or f:CreateFontString(nil, "OVERLAY")
  6. f.text:SetFont("FONTS\\FRIZQT__.TTF", 72, "OUTLINE, MONOCHROME")
  7. f.text:SetPoint("CENTER", UIParent)
  8. f.text:Show()
  9. f.text:SetText("Ta-daa")
  10. f.text:SetVertexColor(1, 1, 1)

(There definitely is a hardcoded limit, but it's much higher than 32 ;p I don't think the screenshot I linked was actually 3000 but I typed in a random large number just to show. At the very least the difference between 32 and 72 is very apparent, and it can even go higher.)

All times are GMT -6. The time now is 11:44 PM.

vBulletin © 2020, Jelsoft Enterprises Ltd
© 2004 - 2020 MMOUI