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.

Newcomers AppGameKit Corner / Text Position

Author
Message
darzon
13
Years of Service
User Offline
Joined: 23rd Oct 2010
Location: Italy
Posted: 31st Dec 2017 17:51
Hi, first of all HAPPY NEW YEAR to ALL


I need help for Text

I have three letter (in vector vstring$) printed on screen with Arial.ttf font
they are printed one every 100 pixel and are printed with color black,
this is an example code.

vstring$[1]="A"
vstring$[2]="i"
vstring$[3]="C"


font=LoadFont("Arial.ttf")

for u= 1 to 3
tx2[u] = createtext(vstring$[u])
SetTextColor(tx2[u],0,0,0,255)
SetTextFont(tx2[u], font)
SetTextSize(tx2[u], 80)
SetTextPosition(tx2[u],100 * u ,500)
next


now I answer this:
in this example the position X of the letter is Known
but in my real code is not known because it is parametric and non fixed

how I can know the position of 3 letter ? AppGameKit have SetTextPosition but not a command GetTextPosition
I need to know in pixel the initial position of the 3 single letter .
thank you

puzzler2018
User Banned
Posted: 31st Dec 2017 17:55
Isnt it

x=300 and y =500

you did u=1 to 3 and times by 100 so the 3rd one must be 3 x 100

?
Bengismo
6
Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 31st Dec 2017 18:19 Edited at: 31st Dec 2017 18:21
You can use GetTextX() and GetTextY()

Look at:
https://www.appgamekit.com/documentation/Reference/Text/GetTextX.htm

oh...and... Happy New year

Login to post a reply

Server time is: 2024-03-29 06:35:47
Your offset time is: 2024-03-29 06:35:47