Will this help?
// Project: WindowZoom
// Created: 22-09-12
// show all errors
SetErrorMode(2)
// set window properties
SetWindowTitle( "WindowZoom" )
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 )
global renderImage as integer
global renderSprite as integer
global zoomValue as float
renderImage = CreateRenderImage(GetVirtualWidth(), GetVirtualHeight(), 0, 0)
renderSprite = CreateSprite(renderImage)
topLeft = 0.0
topRight = 0.0
zoomValue = 10.0
SetSpriteSize(renderSprite, 10, 10)
SetSpritePosition(renderSprite, (GetVirtualWidth() / 2) - (GetSpriteWidth(renderSprite) / 2), (GetVirtualHeight() / 2) - (GetSpriteHeight(renderSprite) / 2))
DrawToRenderImage()
do
if GetRawKeyReleased(27) then exit
Zoom(zoomValue)
Sync()
loop
end
function DrawToRenderImage()
local x1, y1
local x2, y2
local color as integer
SetRenderToImage(renderImage, 0)
color = MakeColor(255, 0, 0)
x1 = 0
y1 = 0
x2 = x1 + (GetWindowWidth() / 2)
y2 = y1 + (GetVirtualHeight() / 2)
DrawBox(x1, y1, x2, y2, color, color, color, color, 1)
color = MakeColor(0, 255, 0)
x1 = (GetVirtualWidth() / 2)
y1 = 0
x2 = x1 + (GetWindowWidth() / 2)
y2 = y1 + (GetVirtualHeight() / 2)
DrawBox(x1, y1, x2, y2, color, color, color, color, 1)
color = MakeColor(0, 0, 255)
x1 = 0
y1 = (GetVirtualHeight() / 2)
x2 = x1 + (GetWindowWidth() / 2)
y2 = y1 + (GetVirtualHeight() / 2)
DrawBox(x1, y1, x2, y2, color, color, color, color, 1)
color = MakeColor(255, 255, 255)
x1 = (GetVirtualWidth() / 2)
y1 = (GetVirtualHeight() / 2)
x2 = x1 + (GetWindowWidth() / 2)
y2 = y1 + (GetVirtualHeight() / 2)
DrawBox(x1, y1, x2, y2, color, color, color, color, 1)
color = MakeColor(255, 0, 255)
x1 = (GetVirtualWidth() / 2) - (GetVirtualWidth() / 4)
y1 = (GetVirtualHeight() / 2) - (GetVirtualHeight() / 4)
x2 = x1 + (GetWindowWidth() / 2)
y2 = y1 + (GetVirtualHeight() / 2)
DrawBox(x1, y1, x2, y2, color, color, color, color, 1)
SetRenderToScreen()
endfunction
function Zoom(value as float)
local width as float
local height as float
local posX as float
local posY as float
width = GetSpriteWidth(renderSprite)
height = GetSpriteHeight(renderSprite)
inc width, value
inc height, value
SetSpriteSize(renderSprite, width, height)
posX = (GetWindowWidth() / 2 - (GetSpriteWidth(renderSprite) / 2))
posY = (GetWindowHeight() / 2 - (GetSpriteHeight(renderSprite) / 2))
SetSpritePosition(renderSprite, posX, posY)
endfunction