How to return the size of a TEXT?

Posted By: Mahdi

How to return the size of a TEXT? - 04/11/11 20:23

hi there,

I have 2 texts:

Code:
FONT text_font = "Arial", 1, 40;
TEXT menu_1
{
	font=inventory_menu_font;
	layer = 15;
	flags = NARROW,;
}
TEXT menu_2
{
	font=inventory_menu_font;
	layer = 15;
	flags = NARROW ;
}



I want the second text (menu_2) to be at the end of first text (menu_1).

But I don't know how to return the width of a text? Is there anyway to find the width of first text so I can use something like this:

menu_2.pos_x=menu_1 + menu_1.width; // or something like that?

is there anyway?
Posted By: Uhrwerk

Re: How to return the size of a TEXT? - 04/11/11 22:03

That should be what you're looking for: http://www.conitec.net/beta/atext-size_y.htm
Posted By: Mahdi

Re: How to return the size of a TEXT? - 04/12/11 12:37

I cann't use Size_x. Engine says parameter unknown. Only size_y works but i don't need that.

Why it says parameter unknown? Is there any other way?
Posted By: 3dgs_snake

Re: How to return the size of a TEXT? - 04/12/11 12:59

Hi,
If you want the size of a text for a known font, you can use str_width.

Posted By: Uhrwerk

Re: How to return the size of a TEXT? - 04/12/11 14:05

Now that is a strange thing. I just had a look into the header file with the types and size_x and size_y are members of the TEXT struct. How did you try to access them?
Posted By: Mahdi

Re: How to return the size of a TEXT? - 04/12/11 14:41

Thanks, these functions are not within gs v7.05, so I updated to 7.86.

But now, engine says: Compiled without meshes!

I rebuilt the map via WED but the error is still there.
© 2024 lite-C Forums