Centered text in "clusterdef text"

Ask about editing graphics, sounds, models, music, etc here!
Shaders (GLSL) and SNDINFO questions also go here!

Moderators: GZDoom Developers, Raze Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.
User avatar
Tormentor667
Posts: 13554
Joined: Wed Jul 16, 2003 3:52 am
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia (Modern GZDoom)
Location: Germany

Centered text in "clusterdef text"

Post by Tormentor667 »

Hello friends,

I have a question regarding the clusterdef texts that can be added through this feature: https://zdoom.org/wiki/MAPINFO/Cluster_definition

Is there a way to make the text aligned centered and not left aligned? I didn't find anything in the wiki so I thought I'd ask.

Best regards,
Torm
User avatar
MFG38
Posts: 414
Joined: Sun Apr 14, 2019 8:26 am
Graphics Processor: nVidia (Modern GZDoom)
Location: Finland

Re: Centered text in "clusterdef text"

Post by MFG38 »

As far as I know, there is no simple way to make the text centered. You could always insert a bunch of spaces at the beginnings of lines, but that's sort of hacky and would inevitably look weird.
User avatar
Kappes Buur
 
 
Posts: 4166
Joined: Thu Jul 17, 2003 12:19 am
Graphics Processor: nVidia (Legacy GZDoom)
Location: British Columbia, Canada

Re: Centered text in "clusterdef text"

Post by Kappes Buur »

Instead of specifying the text in the custerdef section you could make
a script which displays the text at the appropriate time with HudMessage.
See x and y.
User avatar
Tormentor667
Posts: 13554
Joined: Wed Jul 16, 2003 3:52 am
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia (Modern GZDoom)
Location: Germany

Re: Centered text in "clusterdef text"

Post by Tormentor667 »

Kappes Buur wrote:Instead of specifying the text in the custerdef section you could make
a script which displays the text at the appropriate time with HudMessage.
See x and y.
Yeah, I also thought that this might be the only solution. One question though: If I use SetHudeSize, how can I align each line centered then?
User avatar
Mikk-
Posts: 2274
Joined: Tue Jun 30, 2009 1:31 pm

Re: Centered text in "clusterdef text"

Post by Mikk- »

[wiki]SetHudSize[/wiki], see the Coordinate Behaviour section. If you want your text to align center, you need to add a .4 to the Text's xpos argument, like so:

Code: Select all

SetHudSize(640,480,0);
HudMessage(s:"Hello World!"; HUDMSG_PLAIN, 1, CR_RED, 320.4, 240.0, 5.0); 
User avatar
Tormentor667
Posts: 13554
Joined: Wed Jul 16, 2003 3:52 am
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia (Modern GZDoom)
Location: Germany

Re: Centered text in "clusterdef text"

Post by Tormentor667 »

Thanks kindly, that worked

Return to “Assets (and other stuff)”