I ported it, but you will need the newest ENIGMA (which can only be got trough Git). Things that needed to be changed or fixed:
1) We don't have argument_count variable in scripts, and there is no easy way to support it.
2) We don't support argument array (argument[0] instead of normally used argument0) or at least I don't think we do. It didn't trow an error, but it seemed to return wrong values.
3) I added sprite_get_uvs() which we didn't have. (
https://github.com/enigma-dev/enigma-dev/commit/1924f0f1a1fb119837cb6bc5dc3d416a3d5d13ed)
4) I fixed texture_get_texel_width and texture_get_texel_height which didn't return texel size but instead texture size in pixels. (
https://github.com/enigma-dev/enigma-dev/commit/81980dcf3782bb3e0ee66514ef000ee6f1a52d35)
5) I replaced window_set_title with room_current because of a conflict right now. We try to fix it here:
https://github.com/enigma-dev/enigma-dev/issues/1636) When drawing points and lines in surfaces we have 1 pixel offset compared to GM, so I had to change a few lines in the example.
7) We do texture binding in shaders differently than GM. GM gets "stage" id trough shader_get_sampler_index, but in our case it gets the uniform variable index (it's the same as using shader_get_uniform). Instead we allow any stage to be set to any sampler, so it is possible to have one code work with several shaders. So in GM code is like this:
Pal_Texture = shader_get_sampler_index(shr_shader, "samplerID");
texture_set_stage(Pal_Texture, tex);
But in ENIGMA it must be this:
Pal_Texture = shader_get_sampler_index(shr_shader, "samplerID");
texture_set_stage(1, tex); //Bind to stage 1
shader_set_uniform_i(Pal_Texture, 1); //Use stage 1 in shader
You can download the EGM file here:
https://www.dropbox.com/s/ubsjocf3wzrg33s/Palette%20Swap%20Unlimited.project.egm?dl=0Every example in there works - basic swapping, gradual swapping (linear interpolation), outline, full fade, desaturate and even tiles. Shaders didn't need to be changed in any way (although I slightly did change one of them to be more like GL3).
Of course this example will only work in GL3 graphics system.