I'm trying to make a tiled game. When the window resolution matches the virtual resolution, everything looks great. When I try to resize the window, adjacent tiles bleed together at the edges. When I try placing a 1 pixel border around the tiles, I get a gap when resizing the window.
In the example below, everything looks fine at first. try resizing the window and lines appear. Replace test.png with testpadded.png and change the SetSpriteAnimation parameters to 129,129 to compensate for the padding. Then you will see a gap when the window is resized.
// Project: test
// Created: 2018-02-07
// show all errors
SetErrorMode(2)
// set window properties
SetWindowTitle( "test" )
SetWindowSize( 800, 600, 0 )
SetWindowAllowResize( 1 ) // allow the user to resize the window
// set display properties
SetVirtualResolution( 800, 600 ) // 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
image = LoadImage("test.png")
sprite = CreateSprite(image)
setspriteanimation(sprite,128,128,4)
do
for x = 0 to 4
for y = 0 to 4
setspriteposition(sprite,x*128,y*128)
SetSpriteFrame(sprite,(x && 1) + 1)
DrawSprite(sprite)
next
next
Sync()
loop
First screenshot shows what the screen should look like, second is when the window is resized, third is when tiles are padded with 1 pixel