MY GOAL: I'm trying to draw a transparent black rectangle over the current view.
THE PROBLEM: No matter what alpha I set, the rectangle is drawn with full opacity.
THINGS THAT I'VE TRIED:
- I tried changing the color of the rectangle to make sure that I'm looking in the correct part of the code. (The opaque rectangle's color changed, leading me to believe that this is the correct spot in the code.)
- I tried removing this call to draw_rectangle_color() to make sure that I'm looking in the correct part of the code. (The rectangle stopped being drawn, leading me to believe that this is the correct spot in the code.)
- I tried doing draw_set_alpha(0) immediately before drawing the rectangle, but it was still drawn with full opacity.
- I tried also doing image_alpha = 0 immediately before drawing the rectangle, but it was still drawn with full opacity. (didn't expect this to work, but it was worth a shot)
var rectColor = c_black;
var rectAlpha = 0.2;
draw_set_alpha(rectAlpha);
draw_rectangle_color(viewX, viewY, viewX+viewW, viewY+viewH,
rectColor,rectColor,rectColor,rectColor,
false);
draw_set_alpha(1);
FIXED I was using a shader that was overwriting the alpha to be 1.
draw_set_alpha() works properly with draw_rectangle_color()
:)