Skip to content

Commit 5689608

Browse files
authored
Fix Toolscreen Background (#1979)
* Fix toolscreen background and improve colors and trail duration * Tweak trail some more * Remove MATERIAL_VAR_VERTEXALPHA flag * Fix comment
1 parent 839d6f5 commit 5689608

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

lua/starfall/toolscreen.lua

+5-12
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ cvars.AddChangeCallback("starfall_toolscreen_fps", function(_, _, value)
1414
end)
1515

1616
-- Tuning vars
17-
local color_background = Color(33, 33, 40, 30) -- Background color, alpha controls how fast the stars fade out
18-
local color_background_solid = ColorAlpha(color_background, 255) -- Solid version of the background color for the Linux fix
17+
local color_background = Color(41, 38, 52) -- Background color
1918
local color_text = Color(240, 240, 253, 255) -- Text color for subtitle and scrolling text
2019
local color_text_outline = ColorAlpha(color_background, 80) -- Outline text color for subtitle and scrolling text
2120
local star_count = 8 -- Amount of stars to render
@@ -117,7 +116,8 @@ local star_canvas, star_canvas_material
117116
hook.Add("PreRender", "StarfallToolscreenPrepare", function()
118117
star_canvas = GetRenderTarget("starfall_tool_canvas", 256, 256)
119118
star_canvas_material = CreateMaterial("starfall_tool_material", "UnlitGeneric", { ["$basetexture"] = star_canvas:GetName() })
120-
star_canvas_material:SetInt("$flags", 0x8000 + 0x0020 + 0x0010)
119+
star_canvas_material:SetInt("$flags", 0x8000 + 0x0010)
120+
render.ClearRenderTarget(star_canvas, color_background)
121121
hook.Remove("PreRender", "StarfallToolscreenPrepare")
122122
end)
123123

@@ -130,7 +130,6 @@ end)
130130

131131
-------------------------------------------
132132

133-
local is_linux = system.IsLinux()
134133
local ply_eye_ang_prev = Angle()
135134
function SF.DrawToolgunScreen(w, h, title, scroll_text)
136135
curtime = RealTime()
@@ -153,9 +152,8 @@ function SF.DrawToolgunScreen(w, h, title, scroll_text)
153152
local blur = math_clamp(8 + 600 * dt, 12, 30)
154153
render.BlurRenderTarget(star_canvas, blur, blur, 1)
155154

156-
surface.SetMaterial(star_canvas_material)
157-
surface.SetDrawColor(color_background.r, color_background.g, color_background.b, math_clamp(3000 * dt + 20, 40, 120))
158-
surface.DrawTexturedRect(0, 0, w, h)
155+
surface.SetDrawColor(color_background.r, color_background.g, color_background.b, math_clamp(2500 * dt + 20, 30, 100))
156+
surface.DrawRect(0, 0, w, h)
159157

160158
surface.SetMaterial(star_material)
161159
for _, star in ipairs(stars) do
@@ -164,11 +162,6 @@ function SF.DrawToolgunScreen(w, h, title, scroll_text)
164162
render.PopRenderTarget()
165163
end
166164

167-
if is_linux then -- On Linux the original tool background is still visible
168-
surface.SetDrawColor(color_background_solid)
169-
surface.DrawRect(0, 0, w, h)
170-
end
171-
172165
surface.SetDrawColor(255, 255, 255, 255)
173166
surface.SetMaterial(star_canvas_material)
174167
surface.DrawTexturedRect(0, 0, w, h)

0 commit comments

Comments
 (0)