/c local p = game.player
rendering.draw_rectangle{
color = {r=1,g=0,b=0,a=0},
filled=true,
left_top={x=p.position.x-1.5, y=p.position.y-1.5},
right_bottom={x=p.position.x+1.5, y=p.position.y+1.5},
surface=p.surface}
It's not completely ignored. It's just not applied correctly. Looks like (r+a)/2 instead of (r*a) to me.
Re: Respect color.alpha by rendering.draw_something
/c
local p = game.player
for x = 0, 10 do
for y = 0, 10 do
local color = x/10
local alpha = y/10
rendering.draw_rectangle{
color={r=color, g=color, b=color, a=alpha},
filled=true,
left_top = {x=p.position.x + x, y=p.position.y + y},
right_bottom={x=p.position.x+1 + x, y=p.position.y+1 + y},
surface=p.surface}
end
end
day and night results:
2019-06-04T21_20_20-Window.png (238.78 KiB) Viewed 2132 times
2019-06-04T21_21_34-Window.png (131.76 KiB) Viewed 2132 times
/c
local p = game.player
local y = 0
for x = 0, 10 do
local color = x/10 * 0.4
local alpha = x/10
rendering.draw_rectangle{
color={r=color, g=color, b=color, a=alpha},
filled=true,
left_top = {x=p.position.x + x, y=p.position.y + y},
right_bottom={x=p.position.x+1 + x, y=p.position.y+1 + y},
surface=p.surface}
end
day and night results:
2019-06-04T21_31_17-Window.png (72.33 KiB) Viewed 2132 times
2019-06-04T21_31_10-Window.png (85.37 KiB) Viewed 2132 times
upd3: another for simulation, darker for the middle:
/c
local p = game.player
local y = 0
for x = 0, 10 do
local color = (x/10)^2 * 0.4
local alpha = x/10
rendering.draw_rectangle{
color={r=color, g=color, b=color, a=alpha},
filled=true,
left_top = {x=p.position.x + x, y=p.position.y + y},
right_bottom={x=p.position.x+1 + x, y=p.position.y+1 + y},
surface=p.surface}
end
day and night results:
2019-06-04T21_35_02-Window.png (65.37 KiB) Viewed 2129 times
2019-06-04T21_35_14-Window.png (81.4 KiB) Viewed 2129 times
/c local p = game.player
local amount =128
for x = 0, amount do
local color = (x/amount) * 0.3
local alpha = (x/amount) * 0.8
rendering.draw_rectangle{
color={r=color, g=color, b=color, a=alpha},
filled=true,
left_top = {x=p.position.x + x, y=p.position.y},
right_bottom={x=p.position.x+1 + x, y=p.position.y+32},
surface=p.surface}
end
day and night results:
2019-06-04T22_24_52-Window.png (802.46 KiB) Viewed 2128 times
2019-06-04T22_25_40-Window.png (344.38 KiB) Viewed 2128 times