AGK - allow users to set a custom resolution?

Started by hosch, June 12, 2020, 07:50:50

Previous topic - Next topic

hosch

#15
Quote from: Steve Elliott on June 14, 2020, 13:43:49
Yes if you want to cap the FPS (as was requested) do as I suggested, but also think about adding delta time.

One thing I forgot to mention was if you're scaling up your pixel art everything will be blurred - so I suggest you turn off filtering.  Replace the SetUpGraphics() function:


function SetUpGraphics()
//calculate correct aspect ratio
SetDisplayAspect(resX / resY)
//set the optimized resolution
SetVirtualResolution(resX,resY)
//this can be set however you/the user likes it
SetWindowSize(gameResX,gameResY,fullscreen)
// background colour
SetClearColor( 147, 168, 172 )
// turn off smoothing filter
SetDefaultMinFilter( 0 )
SetDefaultMagFilter( 0 )
//60 fps
SetSyncRate(60,1)
// turn on vsync
SetVSync(1)
endfunction


I've already included SetMagFilter(0) in my project, after I've seen the horrendous outcome of the scaling. However, I forgot about SetDefaultMinFilter, so thanks a lot!

Concerning delta time, I've found this example, but didn't go through it yet