layer_get_shader


Description

This function can be used to check if the given layer has a shader assigned to it. You supply the layer ID (which you get when you create the layer using layer_create()) or the layer name (as a string - this will have a performance impact), and the function will return either the shader index of the shader assigned, or -1 if no shader is assigned.


Syntax:

layer_get_shader(layer_id)


Arguments:

Argument Description
layer_id The unique ID value of the layer to target (or the layer name as a string)


Returns:

Shader Index or -1if no shader is assigned


Example:

if layer_get_shader(layer) == -1
   {
   layer_shader(layer, shd_Sepia);
   }

The above code will check to see if the layer that the instance running the code has a shader assigned to it and if it doesn't one is assigned.


Back: General Layer Functions
next: layer_set_target_room
© Copyright YoYo Games Ltd. 2018 All Rights Reserved