CreateCamera()
Syntax
Result = CreateCamera(#Camera, x, y, Width, Height)Description
Creates a new #Camera in the current world, at the position x,y with the specified dimensions. Note that these positions and sizes are the position and sizes of the display on your screen, not the position and size of the camera in the world.
Unlike other graphics related commands, these co-ordinates and dimensions are in percentages, from 0 to 100 (float numbers can be used for more precise placement). This could seems odd, but 3D applications should be resolution independant and this is a good way of achieving that. If a camera is created with a height of 50% then it will always fill 50% of the height of the screen, irrespective of whether you use a screen which is 640*480 or 1600*1200. If a camera has already been created with the same number, the previous camera is automatically freed and replaced by the new one.
Cameras can be overlapped. This means that it is possible to display a camera which fills the whole screen and put a little camera inside which shows another place in the world. To achieve this, the order of creation is very important: the camera which will be on top should be created last.
Parameters
#Camera - The numeric value you want to use to identify the new camera when you use the other commands from this library.
x - The percentage position across the screen of the left edge of the start of the display for this camera. 0% means at the left of the screen, 100% means at the right of the screen.
y - The percentage position down the screen of the top edge of the start of the display for this camera. 0% means at the top of the screen, 100% means at the bottom of the screen.
Width - The percentage of the width of the screen that the display for this camera should take up.
Height - The percentage of the height of the screen that the display for this camera should take up.
Return value
Returns '0' if the #Camera can't be created. If #PB_Any is used as '#Camera' parameter, the new camera number will be returned as 'Result'.
Example:
CreateCamera(0, 0, 0, 100, 100) ; Creates a camera which fill the whole screen CreateCamera(0, 0, 0, 100, 50) ; Creates an horizontal split screen effect, for 2 players CreateCamera(1, 0, 50, 100, 50) ; mode on the same screen CreateCamera(0, 0, 0, 100, 100) ; Create a full screen camera CreateCamera(1, 25, 0, 50, 10) ; And a rear-view mirror effect. ; Note the rear-view is last so that it is displayed on top of the full screen camera
Supported OS
Windows, Linux