TGC Codebase Backup



Widescreen Function by Code Dragon

9th Aug 2007 7:39
Summary

Set DBPro to render in widescreen



Description

Call widescreen() with the desired aspect ratio and the function will stretch the camera viewport appropriately. The default ratio is usually 1.333. Higher ratios are more widescreen and smaller ones are more fullscreen. If you're not using a monitor with the aspect you've called the function with, you'll see those black bands at the top and bottom of the screen like in the movies.



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    function widescreen(aspect as float)

  local extra as dword
  
  if aspect <= 0 then exitfunction

  set camera aspect aspect

  if aspect > (screen width() / screen height() * 1.0)
    extra = (screen height() - (screen width() * (1/aspect))) / 2
    set camera view 0, extra, screen width(), screen height()-extra
  else
    extra = (screen width() - (screen height() * aspect)) / 2
    set camera view extra, 0, screen width()-extra, screen height()
  endif

endfunction