So I am working on making a initial UI for a program I am working on. I can get the text and sprites to line up fine on my computer or phone. With the computer I used setspritescale() and on the phone I ended up using setspritesize(). Am I missing something here or do I needed to code 2 completely different UI's and do a check for if the program is running on an phone or a PC? Below is an example of the code (there is a lot of commented out code that I have been using as testing, hope that doesn't confuse anyone):
// set window properties
SetWindowTitle( "DiceRoller" )
SetWindowSize( 1024, 768, 0 )
//SetDisplayAspect( 4.0 / 3.0 )
//SetWindowAllowResize( 1 )
//SetVirtualResolution( 600,800)
SetOrientationAllowed( 1, 1, 1, 1 )
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
//Load Images
btn_press = LoadImage ("GUIFrame_Sci-Fi3_Button1.png")
btn_unpress = LoadImage ("GUIFrame_Sci-Fi3_Button2.png")
//Creating buttons
btn_press_spr = CreateSprite(btn_press)
setspritesize(btn_press_spr, 10, -1)
SetSpritePosition(btn_press_spr,36.0,38.5)
SetSpriteVisible(btn_press_spr, 0)
SetSpriteScale(btn_press_spr,2,2)
btn_unpress_spr = CreateSprite(btn_unpress)
setspritesize(btn_unpress_spr, 10, -1)
SetSpritePosition(btn_unpress_spr,36.0,38.5)
SetSpriteVisible(btn_unpress_spr,1)
//SetSpriteScale(btn_unpress_spr,2,2)
Setspritesize(btn_unpress_spr, 40, 9)
// sets background color to black
SetClearColor(0,0,0)
// Creates text
CreateText(1, "Test Text")
SetTextSize(1,10)
SetTextPosition(1,35.0,20.0)
//// Creates text
CreateText(2, "Option 1")
SetTextSize(2,5)
SetTextPosition(2,40.0,40.0)
do
//Changes the color of the Title text
SetTextColor(1, (random(1,255)),(random(1,255)),(random(1,255)), 255)
changebutten(btn_press_spr,btn_unpress_spr)
//* If sprite hit is hidden circle *
//if GetPointerPressed() = 1 and GetSpriteHit(GetPointerX(),GetPointerY()) = btn_unpress_spr
////** Show appropriate circle **
//SetSpriteVisible(btn_press_spr,1)
//SetSpriteVisible(btn_unpress_spr,0)
//endif
//if getpointerstate() = 1
//print("Press held")
//endif
//if GetPointerReleased() = 1
//SetSpriteVisible(btn_press_spr,0)
//SetSpriteVisible(btn_unpress_spr,1)
//endif
Sync()
loop
function changebutten(on as integer, off as integer)
if GetPointerPressed() = 1 and GetSpriteHit(GetPointerX(),GetPointerY()) = off
//** Show appropriate circle **
SetSpriteVisible(on,1)
SetSpriteVisible(off,0)
endif
if GetPointerReleased() = 1
SetSpriteVisible(on,0)
SetSpriteVisible(off,1)
endif
endfunction