Here's a function that will make DBPro programs render in widescreen. If you're not using a widescreen monitor, you'll see those black bands at the top and bottom like in the movies. All you have to do is call
widescreen() with the aspect ratio you want. 1.777 (aka 16:9) is standard. You can even make the screen taller than it is wide by using a ratio less than 1.
An example to show how easy it is to use,
sync on
sync rate 60
make object cube 1, 1
do
text 0, 0, "Press spacekey to enable 16:9 widescreen"
text 0, 10, "Press controlkey to enable 4:3 fullscreen"
if spacekey() then cls : widescreen(16.0/9.0)
if controlkey() then cls : widescreen(4.0/3.0)
yrotate object 1, object angle y(1) + 1
sync
loop
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
And the stand alone function,
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
This sig has been viewed
times.