此函数检索分配给表面可用的 4 个渲染目标之一的表面。
您提供要检查的渲染目标的索引,如果未分配表面,则该函数将返回 -1,或者整数值 >= 0,表示分配的表面 (由函数 surface_create/surface_create_ext 返回)。
surface_get_target_ext(index);
参数 | 类型 | 描述 |
---|---|---|
index | Real | 要检查的渲染目标索引(从0到3)。 |
Surface or -1 (if no target surface is set)
if surface_get_target_ext(0) == -1
{
surface_set_target_ext(0, global.Surf);
}
上面的代码首先检查着色器渲染目标 0 是否已设置为表面。如果没有,则分配一个。