Cloaked Games
Member
Hello, I am using buffer_get_surface to read color data for a sprite. However, I do not know how to get the color components from the color itself. I tried using color_get, which worked when I was using draw_getpixel, but seems to be always returning 0 in this situation.
Here is the relevant code:
Everything except getting the color components is working correctly, as far as I can tell. When I ran this code in the script, it returned a valid color value, but 0 for the rgb components. I manually checked the color values to the pixels that it should be returning and they match up.
Please tell me if there's a different way to do this (maybe with bit functions?) and why my current code doesn't work. If my code should work, but doesn't, I'll post more so hopefully I can find the problem.
Thank you!
Here is the relevant code:
Code:
var c = buffer_read(buffer, buffer_u32);
var r = colour_get_red(c);
var g = colour_get_green(c);
var b = colour_get_blue(c);
Code:
show_debug_message("R"+string(r)+" G"+string(g)+" B"+string(b)+" C"+string(c));
Thank you!