Gamestudio Links
Zorro Links
Newest Posts
Stooq now requires an API key
by k_ivan. 06/10/26 14:39
Z9 getting Error 058
by k_ivan. 06/10/26 14:38
ZorroGPT
by TipmyPip. 06/10/26 13:07
Z12 live performance
by alx. 06/09/26 20:42
Lapsa's very own thread
by Lapsa. 06/08/26 22:41
Zorro 3.01 recoded MMI function issue
by TipmyPip. 06/04/26 05:44
SGT_FW
by Aku_Aku. 05/31/26 11:05
Issues resuming trades on Demo account
by Martin_HH. 05/22/26 13:31
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
2 registered members (Quad, Student_64151), 5,249 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Student_64151, Koti, curry, DeepxKalsi, Samed
19219 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Center string of text on screen? #449294
03/12/15 16:08
03/12/15 16:08
Joined: Nov 2006
Posts: 497
Ohio
xbox Offline OP
Senior Member
xbox  Offline OP
Senior Member

Joined: Nov 2006
Posts: 497
Ohio
I can't for the life of me figure out how to center a string of text on a panel to the center of the screen.

I can easily "hard code" the position, but with people having different resolutions, that's clearly not the proper method.

I know how to properly center a bmap panel on screen using the screen_size.x but I can't seem to figure out how to center a string of text.

The best I can get is the left side of the text starting at the center of the screen.

I would think it would be a matter of getting the size in pixels of the string but I don't know how to do that. I'm using true type system fonts so unfortunately it's not like the characters are equally spaced.

I feel like I'm missing something so obvious and I don't know what it is. Any help?? Thanks in advance

EDIT: I've looked through the manual and couldn't find anything, and now, no sooner did I post this, I found what I needed, so dumb...

Last edited by xbox; 03/12/15 16:11.
Re: Center string of text on screen? [Re: xbox] #449295
03/12/15 16:19
03/12/15 16:19
Joined: Dec 2009
Posts: 82
D
Denn15 Offline
Junior Member
Denn15  Offline
Junior Member
D

Joined: Dec 2009
Posts: 82
you can use the CENTER_X and CENTER_Y flags to make the text position be centered on the pos_x and pos_y position. then just set the pos_x and y to half the screen_size.
you can also find the width of the text using str_width and use that


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1