Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / No Vertical Alignment for Text Object?

Author
Message
Tobias_Ripper
11
Years of Service
User Offline
Joined: 24th Mar 2013
Location: REPCONN inc.
Posted: 30th Aug 2018 19:35
I've noticed that there is a SetTextAlignment along the horizontal line of the text, left, right and center justified but there is no such option for Vertical line justification?
No straight forward way to set TextAxys point to center of the Text object box?
Eisenstadt Studio: Eisenstadtstudio.com
Composers Page: Milesthatch.net
puzzler2018
User Banned
Posted: 30th Aug 2018 20:10 Edited at: 30th Aug 2018 20:16
Quote: "Where there is a will, there is always a way, whether of course it been the logical or illogical way then that would be a different story"


There is a way to do this but brain is like mush at moment with programming. if no one can get to you by tomorrow then ill code something up to do it if no one beats me to it.
Bengismo
6
Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 30th Aug 2018 20:48 Edited at: 30th Aug 2018 20:54
This was sort of answered in this thread

https://forum.thegamecreators.com/thread/222424

Basically, you know the height of the text so you simply offset the text by its height if you want it bottom justified
SetTextPosition(id,GetTextPosition(id),GetTextPosition(id)-GetTextTotalheight(id))

If you want it centered - use half the height
SetTextPosition(id,GetTextPosition(id),GetTextPosition(id)-GetTextTotalheight(id)/2)

Its only one line ad these only work if there is no angle to the text.

If there is an angle then use the function provided by the thread above. (The function listed by IronManhood is perfect for centering text but chnage the 0.5 to 1.0 and it bottom justifies it.

A function in AppGameKit to do this would be nice but not absolutely needed.
Tobias_Ripper
11
Years of Service
User Offline
Joined: 24th Mar 2013
Location: REPCONN inc.
Posted: 30th Aug 2018 21:11
I was going to use it with the scaling, wanted to scale the text right along the middle point instead of top middle.
Looks like the total height accounts for scale too so that's good.

Thanks for the answer.
Eisenstadt Studio: Eisenstadtstudio.com
Composers Page: Milesthatch.net

Login to post a reply

Server time is: 2024-04-18 05:04:58
Your offset time is: 2024-04-18 05:04:58