Thread Tools Display Modes
02-08-18, 02:38 PM   #1
doofus
A Chromatic Dragonspawn
Join Date: Feb 2018
Posts: 158
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
  Reply With Quote
02-08-18, 02:55 PM   #2
Ammako
A Frostmaul Preserver
AddOn Author - Click to view addons
Join Date: Jun 2016
Posts: 256
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)

Last edited by Ammako : 02-08-18 at 02:57 PM.
  Reply With Quote
02-08-18, 09:10 PM   #3
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
GameFontHighlightLarge is a template, yes, and you can use it with :SetFont.
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
02-09-18, 01:02 AM   #4
lightspark
A Rage Talon Dragon Guard
 
lightspark's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2012
Posts: 341
Originally Posted by Seerah View Post
GameFontHighlightLarge is a template, yes, and you can use it with :SetFont.
Eh? You have to use SetFontObject method
__________________
  Reply With Quote
02-09-18, 01:14 AM   #5
Rainrider
A Firelord
AddOn Author - Click to view addons
Join Date: Nov 2008
Posts: 454
No need for SetFontObject.
lua Code:
  1. f.text = f:CreateFontString(nil, "OVERLAY", "GameFontHighlightLarge")

Last edited by Rainrider : 02-09-18 at 01:20 AM.
  Reply With Quote
02-09-18, 05:12 AM   #6
doofus
A Chromatic Dragonspawn
Join Date: Feb 2018
Posts: 158
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.
  Reply With Quote
02-09-18, 07:38 AM   #7
lightspark
A Rage Talon Dragon Guard
 
lightspark's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2012
Posts: 341
Originally Posted by Rainrider View Post
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

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.
__________________

Last edited by lightspark : 02-09-18 at 07:40 AM.
  Reply With Quote
02-09-18, 09:11 AM   #8
Ammako
A Frostmaul Preserver
AddOn Author - Click to view addons
Join Date: Jun 2016
Posts: 256
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.

Last edited by Ammako : 02-09-18 at 09:13 AM.
  Reply With Quote
02-10-18, 10:38 AM   #9
doofus
A Chromatic Dragonspawn
Join Date: Feb 2018
Posts: 158
It is currently like this

fNoticeBoard = CreateFrame("Frame", "BA_NoticeBoard", UIParent);
fNoticeBoard:SetPoint("CENTER",0,0);
fNoticeBoard:SetWidth(1);
fNoticeBoard:SetHeight(1);
fNoticeBoard:Show();
fNoticeBoard.text = fNoticeBoard:CreateFontString(nil, "OVERLAY");
fNoticeBoard.text:SetFont("Fonts\\FRIZQT__.TTF", 72, "OUTLINE, MONOCHROME");
fNoticeBoard.text:SetPoint("CENTER", fNoticeBoard);
.
.
.
fNoticeBoard.text:SetText(str);
  Reply With Quote
02-10-18, 12:44 PM   #10
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
IIRC, the largest font size in WoW is hardcoded at 32. Anything more and you'll have to use scaling.
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
02-10-18, 12:54 PM   #11
Ammako
A Frostmaul Preserver
AddOn Author - Click to view addons
Join Date: Jun 2016
Posts: 256
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.)

Last edited by Ammako : 02-18-18 at 07:15 PM.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » A simple display

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off