I'm sorry, i thought it was just position and there's no way to scale the text. Bugga!
// Project: test60
// Created: 2019-07-10
// show all errors
SetErrorMode(2)
// set window properties
SetWindowTitle( "test60" )
SetWindowSize( 1024, 768, 0 )
SetWindowAllowResize( 1 ) // allow the user to resize the window
// set display properties
SetVirtualResolution( 1024, 768 ) // doesn't have to match the window
SetOrientationAllowed( 1, 1, 1, 1 ) // allow both portrait and landscape on mobile devices
SetSyncRate( 30, 0 ) // 30fps instead of 60 to save battery
SetScissor( 0,0,0,0 ) // use the maximum available screen space, no black borders
UseNewDefaultFonts( 1 ) // since version 2.0.22 we can use nicer default fonts
button = CreateSprite(LoadImage("button.png"))
SetSpritePositionByOffset(button, GetWindowWidth() * 0.5, GetWindowHeight() * 0.5)
chain = CreateTweenChain()
up = CreateTweenSprite(1)
SetTweenSpriteYByOffset(up, GetWindowHeight() * 0.5, GetWindowHeight() * 0.4, TweenEaseOut1())
AddTweenChainSprite(chain, up, button, 0)
down = CreateTweenSprite(1)
SetTweenSpriteYByOffset(down, GetWindowHeight() * 0.4, GetWindowHeight() * 0.5, TweenEaseIn1())
AddTweenChainSprite(chain, down, button, 0)
PlayTweenChain(chain)
text = CreateText("TEXT")
SetTextSize(text, 28)
SetTextAlignment(text, 1)
SetTextColor(text, 0xff, 0xff, 0xff, 0xff)
SetTextBold(text, 1)
do
UpdateAllTweens(GetFrameTime())
PinTextToSprite(button, text)
Print( ScreenFPS() )
Sync()
loop
function PinTextToSprite(sprite as integer, text as integer)
x as float
y as float
x = GetWorldXFromSprite(sprite, 0, 0)
y = GetWorldYFromSprite(sprite, 0, -(GetSpriteHeight(sprite) - GetTextTotalHeight(text)) )
SetTextPosition(text, x, y)
endfunction