camera - camera handle zoom# - zoom factor of camera |
Sets zoom factor for a camera. Defaults to 1. |
; CreateZoom Example ; ------------------ dxGraphics3D 640,480 dxSetBuffer dxBackBuffer() camera=dxCreateCamera() dxPositionEntity camera,0,1,0 light=dxCreateLight() dxRotateEntity light,90,0,0 ground=dxCreatePlane() sand_tex=dxLoadTexture("media/sand.bmp") dxScaleTexture sand_tex,10,10 dxEntityTexture ground,sand_tex dxEntityColor ground,168,133,55 cactus1=dxLoadMesh("media/CACTUS2.x") cactus2=dxLoadMesh("media/CACTUS2.x") camel=dxLoadMesh("media/camel.x") dxPositionEntity cactus1,-1,2,10 dxPositionEntity cactus2,1,2,10 dxPositionEntity camel,0,1,1000 ; Set initial zoom value zoom#=1 While Not dxKeyDown( 1 ) If dxKeyDown( 205 )=True Then dxTurnEntity camera,0,-1,0 If dxKeyDown( 203 )=True Then dxTurnEntity camera,0,1,0 ; Change zoom value depending on key pressed If dxKeyDown( 208 )=True Then zoom#=zoom#-0.1 If dxKeyDown( 200 )=True Then zoom#=zoom#+0.1 ; Put a minimum and maximum cap on zoom value If zoom#<1 Then zoom#=1 If zoom#>100 Then zoom#=100 ; Set camera zoom dxCameraZoom camera,zoom# dxRenderWorld dxText 0,0,"Use left and right cursor keys to turn around" dxText 0,20,"Use up and down cursor keys to change camera zoom" dxText 0,40,"There is a camel on the horizon, inbetween the cacti. Zoom in to see it." dxText 0,60,"dxCameraZoom camera,"+zoom# dxFlip Wend End |