draw_set_alpha似乎不使用draw_retectangle
我的目标: 我正在尝试通过当前视图绘制一个透明的黑色矩形。
问题: 无论我设置了什么alpha,矩形都是用完全不透明度绘制的。
我尝试过的东西:
- 我尝试了更改矩形的颜色确保我在代码的正确部分中查找。 (不透明的矩形的颜色发生了变化,使我相信这是代码中的正确位置。)
- 我尝试删除draw_rectangle_color()的呼叫代码。 (矩形不再被绘制,使我相信这是代码中的正确位置。)
- 我尝试在绘制矩形之前立即进行 draw_set_set_alpha(0),但仍以完全不透明度绘制。
- 我也尝试在绘制矩形之前直接执行 image_alpha = 0 ,但仍以完全不透明度绘制。 (没想到这会起作用,但值得一试)
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);
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);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
固定
我正在使用一个覆盖alpha为1的着色器。draw_set_alpha
正常使用。
()与draw_rectangle_color() :)
FIXED
I was using a shader that was overwriting the alpha to be 1.
draw_set_alpha() works properly with draw_rectangle_color()
:)