I’m trying to use the draw text node and I was wondering how I can get text to always appear in the center of the screen no matter what size the screen is. Here’s my attempt at doing it which doesn’t really work.
I’m also trying to figure out how to make it so the text automatically scales depending on how large the screen is because right now the text gets cut off if the screen is too small.
Hi man !
Here i draw 2 Text in my hud , both almost same size.
But the second dont change with the size of Xhud.
Try to use as scale , your X size of the screen divided by some literal.
Once you checked that it will fit your screen , it should fit any screen.
Lets say we have 3 screen.
1200 get a scale factor of 1
Another one with half of the screen like 600x , will get a scale of 0.5
And another one of 300x, will get a scale of 0.25
What i didnt do in this example is fix the position , because the scale move away the text from the origin.
So you have to put back on the Screen X, Y some adjustment made with a fraction of sizeX of the same type we did here…
That seems to work however if I wanted to change the size (and make it bigger) then it’s no longer in the center. So how does the position in the screen relate to the size?
Thank you so much from 6 years into the future. I was really struggling with this as a decent Photoshop user and your information helped me to finally make sense of this.
I came here looking for the same thing. I’ll share what I figured out in case it helps sb. There’s a GetTextSize() that returns the size of the text in pixels. Divide that by two to center.
I would rather do this in a WBP instead of HUD. Does anyone know if that’s doable? I also have a Selection Marquee that’s drawn in HUD that I would like to have in a WBP if sb can point me in the right direction.