I'm a little confused as to what exactly you want to achieve, or rather the issue.
GoSub AppGameKit_Default
Type Resolution
X As Float
Y As Float
Z As Float
W As Float
EndType
Global Virtual As Resolution
Global ViewArea As Resolution
Global HelloText As Integer = 0
HelloText = CreateText( "Hello" )
SetTextPosition( HelloText, 0.0, 0.0 )
SetTextSize( HelloText, 64.0 )
SetTextColor( HelloText, 255, 255, 255, 255 )
Global RedSprite As Integer = 0
RedSprite = CreateSprite( CreateImageColor( 255, 0, 0, 255 ) )
SetSpriteSize( RedSprite, 1280, 720 )
SetSpritePosition( RedSprite, 0.0, 0.0 )
Repeat
If Virtual.x <> GetVirtualWidth() Or Virtual.y <> GetVirtualHeight()
Virtual.x = GetVirtualWidth()
Virtual.y = GetVirtualHeight()
SetScissor( (Virtual.x / 16.0 * 4.0), 0.0, Virtual.x - (Virtual.x / 16.0 * 4.0), Virtual.y )
ViewArea.x = (Virtual.x / 16.0) * 4.0 //GetScreenBoundsLeft()
ViewArea.y = 0.0 //GetScreenBoundsTop()
ViewArea.z = GetVirtualWidth() + ( GetVirtualWidth() - GetScreenBoundsRight() )
ViewArea.w = GetVirtualHeight() + ( GetVirtualHeight() - GetScreenBoundsBottom() )
EndIf
SetTextPosition( HelloText, ViewArea.x, ViewArea.y )
SetTextString( HelloText, Str(ViewArea.x) + " x " + Str(ViewArea.y) )
Update(0)
Render2DFront()
Swap()
Until GetRawKeyPressed( 27 )
End
AppGameKit_Default:
// show all errors
SetErrorMode(2)
// set window properties
SetWindowTitle( "TextBox" )
SetWindowSize( 1280, 720, 0 )
SetWindowAllowResize( 1 ) // allow the user to resize the window
// set display properties
SetVirtualResolution( 1280, 720 ) // doesn't have to match the window
SetOrientationAllowed( 1, 1, 1, 1 ) // allow both portrait and landscape on mobile devices
SetSyncRate( 60, 1 )
SetScissor( 0, 0, 0, 0 )
UseNewDefaultFonts( 1 )
Return
That for example maintains the 4:3 Aspect ratio on a 16:9 Resolution.
But for some reason GetScreenBorders doesn't seems to actually do anything.
(keep in mind it's supposed to be Negative the Offset at Top & Left., while it'll be Resolution + Offset at Bottom & Right)
But they always return 0 for me, not sure if it's an AGK-S bug or such... but to be honest I'd not actually use this approach, because you'd have to change the Scissor Back Post Rendering the Viewport to have the Borders Usable.
It's just easier instead to use Black Borders and simply calculate Offset Ranges for the Desired Viewport.
Sure, you get some overdraw... but that's not too performance intensive, at least not compared to some other more notable limitations of AGK.