22 posts / 1 project
[tip] (GLSL) how to refresh CToy when saving an external shader file
1 year, 7 months ago Edited by anaël seghezzi on Aug. 11, 2017, 10:30 a.m.
sometimes you may want to refresh CToy when saving an external file, like a GLSL shader.
Here is a simple trick to do just that thanks to the C (and GLSL) preprocessor.
To force CToy to refresh when an external file is saved, it must be included like a regular C file:
The __TINYC__ macro will make sure this trick is disabled when compiling with another compiler like GCC or VS.
And to make sure the shader will not be compiled by TCC, use the negative of the same macro in the shader:
Now you can edit the shader files and CToy will refresh on file save.