With the following code, I'm supposed to be able to do WC_InterpolateColor(0xFF0000, 0xFFFF00, 0.5) and get the color that is halfway in between the two colors specified (red and yellow in this case). The pos value should be between 1.0 and 0.0. The code is obviously unfinished and I don't know where to go next with it. Has anybody else tried doing something like this? Can somebody show me how to do it correctly? Right now the code always returns the end color (yellow in this case). Thanks ahead of time, and please explain so I can learn from it.
WC_InterpolateColor(start, end, Float:pos) {
new start_bytes[1], end_bytes[1];
start_bytes[0] = start;
end_bytes[0] = end;
for (new i = 0; i < 4; i++) {
start_bytes{i} = floatround(start_bytes{i} * (1.0-pos) + end_bytes{i} * pos);
}
return end_bytes[0];
}
Ps. The language used is Pawn, a language very similar to C++. The keyword new is like doing int or float, in this case int.