A small example at adding a native func
in Redscript to calculate RGBA from a hex string.
Both Rust toolchain and Justfile command runner must be pre-installed.
Build binary:
just build
Binary will be built into red4ext\plugins\colorconverter\colorconverter.dll
.
Don't forget to also place r6\scripts\ColorConverter\Native.reds
in your game folder :)
let color: Color = ColorHexToRgba("FF0000");
let color: Color = ColorHexToRgba("#ff00007f");
let color: Color = ColorHexToRgba("aliceblue");
It supports any input accepted by csscolorparser.