view_current


Description

This read only variable is only valid in the Draw Event and returns the current view port being rendered. The return value will change during the draw event when you have various views as the draw event is called once for each view port in succession. So when (for example) you are using view port[0] and view port[1] in your game room, the draw event for ALL instances will be run twice, once for each port, and with this variable you can check to see what view is currently being drawn. In general, this is used to only render specific details to a single port when multiple view ports are visible in the room at the same time. See the example code below.


Syntax:

view_current;


Returns:

Real (view port index from 0 to 7)


Example:

if view_current == 0
   {
   var xx = camera_get_view_x(view_camera[0]);
   var yy = camera_get_view_y(view_camera[0]);
   draw_text(xx + 32, yy + 32, "Player 1");
   }
else
   {
   var xx = camera_get_view_x(view_camera[1]);
   var yy = camera_get_view_y(view_camera[1]);
   draw_text(xx + 32, yy + 32, "Player 2");
   }

The above code checks to see which view is currently being drawn and then draws a different text to each view based on the return value.


Back: Cameras
Next: view_enabled
© Copyright YoYo Games Ltd. 2018 All Rights Reserved