January 27, 2021, 06:07:45 AM

Author Topic: AGK - allow users to set a custom resolution?  (Read 825 times)

Offline hosch

  • Jr. Member
  • **
  • Posts: 86
Re: AGK - allow users to set a custom resolution?
« Reply #15 on: June 14, 2020, 03:21:04 PM »
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:

Code: [Select]
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

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal