It's strange, but you can force it to behave...
SetDisplayAspect( 768.0/1024.0 )
SetClearColor( 151,170,204 ); // light blue
virtualHeight=1024
virtualWidth=768
SetVirtualResolution (virtualWidth,virtualHeight)
// Draw button image
imageBouton = LoadImage("button.png")
spriteBouton= CreateSprite (imageBouton)
SetSpritePosition(spriteBouton,0,0)
buttonHeight = (GetSpriteHeight(spriteBouton))
// create text
answer = CreateText("Button test")
SetTextMaxWidth( answer, virtualWidth)
SetTextSize ( answer, 64)
// vertical alignment
SetTextPosition (answer, virtualWidth/2 , (buttonHeight/2) - GetTextTotalHeight(answer)/2)
SetTextAlignment(answer, 1 )
Render()
// get full button image
img = GetImage(0,0,768,152)
// create sprite from button image
imgSprite = CreateSprite(img)
SetSpritePosition(imgSprite,0,200)
SetSpriteSize(imgSprite,768,152)
//SetSpriteSize (imgSprite,768,152)
do
Sync()
loop
I changed the setup so it uses the same native resolution of 768x1024, and doing that made the sprite just a little smaller than the original. I also set the display aspect to exactly 768/1024 - or 0.75 instead of 0.66. So if you use the exact resolutions, it's still not the same size...
So the last thing I did, was set the sprite size which seems to get around the problem, and that might be the only thing you need to do, set the sprite size as the image might be fine, it might be the exact perfect resolution, but the sprite may just be scaled for some reason.
I'd actually suggest just having separate texts and buttons, rather than merging the 2 - AppGameKit is not too shabby at rendering text, I'd just make some nice button sprite animations, overlay the text, and you have a bit more freedom as you wouldn't need lots of unique grabbed button images. Plus - GETing an image is not ideal, you'll probably notice little artifacts on alpha transparent parts - best to avoid this I say, have dynamic buttons and separate text
.
I am the one who knocks...