DarkBASIC Professional Help Wiki
Advertisement


This command will adjust the aspect ratio at which the camera renders to the screen.

Syntax
SET CAMERA ASPECT  Aspect Ratio
SET CAMERA ASPECT Camera Number, Aspect Ratio
Parameters
Camera Number

Integer
The camera number Aspect Ratio Float
By default this aspect ratio is calculated by dividing the screen width by the screen height, normally resulting in an aspect ratio of 0.75

Returns

This command does not return a value.

Description

By default this aspect ratio is calculated by dividing the screen width by the screen height, normally resulting in an aspect ratio of 0.75. You can change this aspect ratio using this command in situations where you would like to render a perfect square to the screen or if you are writing for hardware that spans a single surface over multiple display devices.

Example Code
autocam on:backdrop on

make matrix 1,4000,4000,100,100

set matrix height 1,50,50,500

update matrix 1

position camera 0,0,500,500

point camera 0,2000,0,2000

aspect=screen width()/screen height()

while mouseclick()<>1

set cursor 0,0

print "f-v Aspect Ratio ",aspect

if inkey$()="f" then aspect=aspect-1:if aspect<0 then aspect=0

if inkey$()="v" then aspect=aspect+1

set camera aspect  0,aspect

endwhile

while mouseclick()=1 : endwhile

delete matrix 1:autocam off:backdrop off

end
Advertisement