With this variable you can set the contents of a view port to draw to a surface. When working with surfaces, it is often required that capture the whole visible region of the screen to the surface, and so you would assign it to a view port using this function. This means that everything that is shown in the chosen port view will now be drawn to the assigned surface and the contents of that view port will no longer be displayed, meaning that you will need to either:
- 启用一个新的视野,在新视野中绘制表面(使用 view_current 检测正在绘制哪个视野)。
- 既然GUI层是独立出视野的,那么可以在一个实例的GUI事件中绘制表面。
When using this function you give the view port index (from 0 to 7) and a surface index (either the application_surface or the unique index value returned by the function surface_create) or, if a surface has previously been assigned and you want to remove it, a value of -1. For further information on setting the view port to a surface see also the variable view_surface_id.
view_set_surface_id(view_port, surf)
参数 描述 view_port The view port to target (0 - 7)
Real(实数)
if view_get_surface_id(0) == -1
{
view_set_surface_id(0, global.vSurf);
}
上述代码将会检查是否有表面被分配给view port[0],如果没有就分配一个。