diff --git a/lua/entities/base_wire_entity.lua b/lua/entities/base_wire_entity.lua index 94a92eb005..97c027e485 100644 --- a/lua/entities/base_wire_entity.lua +++ b/lua/entities/base_wire_entity.lua @@ -105,7 +105,7 @@ if CLIENT then -- This is overridable by other wire entities which want to customize the overlay, but generally you shouldn't override it function ENT:DrawWorldTipOutline( pos ) draw.NoTexture() - surface.SetDrawColor(Color(25,25,25,200)) + surface.SetDrawColor(25, 25, 25, 200) local poly = { {x = pos.min.x + edgesize, y = pos.min.y, u = 0, v = 0 }, @@ -119,7 +119,7 @@ if CLIENT then render.CullMode(MATERIAL_CULLMODE_CCW) surface.DrawPoly( poly ) - surface.SetDrawColor(Color(0,0,0,255)) + surface.SetDrawColor(0, 0, 0, 255) for i=1,#poly-1 do surface.DrawLine( poly[i].x, poly[i].y, poly[i+1].x, poly[i+1].y ) @@ -201,7 +201,7 @@ if CLIENT then self:DrawWorldTipBody( pos ) offset = offset + h_body + edgesize - surface.SetDrawColor( Color(0,0,0,255) ) + surface.SetDrawColor(0, 0, 0, 255) surface.DrawLine( pos.min.x, offset, pos.max.x, offset ) end diff --git a/lua/entities/gmod_wire_colorer.lua b/lua/entities/gmod_wire_colorer.lua index c5e2b3d388..1065a3265b 100644 --- a/lua/entities/gmod_wire_colorer.lua +++ b/lua/entities/gmod_wire_colorer.lua @@ -33,12 +33,12 @@ if CLIENT then local black = Color(0,0,0,255) local function drawColorBox( color, x, y ) - surface.SetDrawColor( color ) + surface.SetDrawColor(color.r, color.g, color.b, color.a) surface.DrawRect( x, y, color_box_size, color_box_size ) local size = color_box_size - surface.SetDrawColor( black ) + surface.SetDrawColor(0, 0, 0) surface.DrawLine( x, y, x + size, y ) surface.DrawLine( x + size, y, x + size, y + size ) surface.DrawLine( x + size, y + size, x, y + size ) diff --git a/lua/entities/gmod_wire_expression2/cl_init.lua b/lua/entities/gmod_wire_expression2/cl_init.lua index 6fef0a49d0..8749edc0cb 100644 --- a/lua/entities/gmod_wire_expression2/cl_init.lua +++ b/lua/entities/gmod_wire_expression2/cl_init.lua @@ -157,10 +157,6 @@ function ENT:DrawWorldTipBody( pos ) local txt = data.txt .. "\nauthor: " .. self:GetPlayerName() local err = data.error -- this isn't used (yet), might do something with it later - - local white = Color(255,255,255,255) - local black = Color(0,0,0,255) - local w_total, yoffset = 0, pos.min.y ------------------- @@ -171,13 +167,13 @@ function ENT:DrawWorldTipBody( pos ) h = math.min(h,pos.size.h - (h_of_lower+pos.footersize.h)) render.SetScissorRect( pos.min.x + 16, pos.min.y, pos.max.x - 16, pos.min.y + h, true ) - draw.DrawText( txt, "GModWorldtip", pos.min.x + pos.size.w/2, yoffset + 9, white, TEXT_ALIGN_CENTER ) + draw.DrawText( txt, "GModWorldtip", pos.min.x + pos.size.w/2, yoffset + 9, color_white, TEXT_ALIGN_CENTER ) render.SetScissorRect( 0, 0, ScrW(), ScrH(), false ) w_total = math.max( w_total, w ) yoffset = yoffset + h - surface.SetDrawColor( black ) + surface.SetDrawColor(0, 0, 0) surface.DrawLine( pos.min.x, yoffset, pos.max.x, yoffset ) ------------------- @@ -196,7 +192,7 @@ function ENT:DrawWorldTipBody( pos ) -- ops text local hardtext = (prfcount / e2_hardquota > 0.33) and "(+" .. tostring(math.Round(prfcount / e2_hardquota * 100)) .. "%)" or "" local str = string.format("%i ops, %i%% %s", prfbench, prfbench / e2_softquota * 100, hardtext) - draw.DrawText( str, "GModWorldtip", pos.min.x + pos.size.w/2, yoffset + 9, white, TEXT_ALIGN_CENTER ) + draw.DrawText( str, "GModWorldtip", pos.min.x + pos.size.w/2, yoffset + 9, color_white, TEXT_ALIGN_CENTER ) local _,h = surface.GetTextSize( str ) yoffset = yoffset + h + pos.edgesize @@ -207,16 +203,16 @@ function ENT:DrawWorldTipBody( pos ) local quota_width = softquota_width * math.min(prfbench/e2_softquota,1) + (w - softquota_width + 1) * (prfcount/e2_hardquota) local y = yoffset - surface.SetDrawColor( Color(0,170,0,255) ) + surface.SetDrawColor(0, 170, 0, 255) surface.DrawRect( pos.min.x + pos.edgesize, y, softquota_width, 20 ) - surface.SetDrawColor( Color(170,0,0,255) ) + surface.SetDrawColor(170, 0, 0, 255) surface.DrawRect( pos.min.x + pos.edgesize + softquota_width - 1, y, w - softquota_width + 2, 20 ) - surface.SetDrawColor( Color(0,0,0,200) ) + surface.SetDrawColor(0, 0, 0, 200) surface.DrawRect( pos.min.x + pos.edgesize, y, quota_width, 20 ) - surface.SetDrawColor( black ) + surface.SetDrawColor(0, 0, 0) surface.DrawLine( pos.min.x + pos.edgesize, y, pos.min.x + pos.edgesize + w, y ) surface.DrawLine( pos.min.x + pos.edgesize + w, y, pos.min.x + pos.edgesize + w, y + 20 ) surface.DrawLine( pos.min.x + pos.edgesize + w, y + 20, pos.min.x + pos.edgesize, y + 20 ) @@ -226,5 +222,5 @@ function ENT:DrawWorldTipBody( pos ) -- cpu time text local str = string.format("cpu time: %ius", timebench*1000000) - draw.DrawText( str, "GModWorldtip", pos.min.x + pos.size.w/2, yoffset + 9, white, TEXT_ALIGN_CENTER ) + draw.DrawText( str, "GModWorldtip", pos.min.x + pos.size.w/2, yoffset + 9, color_white, TEXT_ALIGN_CENTER ) end diff --git a/lua/entities/gmod_wire_indicator.lua b/lua/entities/gmod_wire_indicator.lua index c698df58d3..ae78b53f36 100644 --- a/lua/entities/gmod_wire_indicator.lua +++ b/lua/entities/gmod_wire_indicator.lua @@ -24,11 +24,8 @@ if CLIENT then return 400,80 end - local white = Color(255,255,255,255) - local black = Color(0,0,0,255) - local function drawSquare( x,y,w,h ) - surface.SetDrawColor( black ) + surface.SetDrawColor(0, 0, 0) surface.DrawLine( x, y, x + w, y ) surface.DrawLine( x + w, y, x + w, y + h ) surface.DrawLine( x + w, y + h, x, y + h ) @@ -38,7 +35,7 @@ if CLIENT then local function drawColorSlider( x, y, w, h, self ) if self.a == self.b then -- no infinite loops! draw.DrawText( "Can't draw color bar because A == B", - "GModWorldtip", x + w / 2, y + h / 2, white, TEXT_ALIGN_CENTER ) + "GModWorldtip", x + w / 2, y + h / 2, color_white, TEXT_ALIGN_CENTER ) return end @@ -63,7 +60,7 @@ if CLIENT then end end - surface.SetDrawColor( color ) + surface.SetDrawColor(color.r, color.g, color.b, color.a) surface.DrawRect( pos_x, y, math.ceil(w/50), h ) end @@ -93,17 +90,17 @@ if CLIENT then -- A local color_text = string.format("A color: %d,%d,%d,%d\nA value: %d",self.ar,self.ag,self.ab,self.aa,self.a) - draw.DrawText( color_text, "GModWorldtip", pos.min.x + pos.edgesize, pos.min.y + pos.edgesize, white, TEXT_ALIGN_LEFT ) + draw.DrawText( color_text, "GModWorldtip", pos.min.x + pos.edgesize, pos.min.y + pos.edgesize, color_white, TEXT_ALIGN_LEFT ) -- B local color_text = string.format("B color: %d,%d,%d,%d\nB value: %d",self.br,self.bg,self.bb,self.ba,self.b) - draw.DrawText( color_text, "GModWorldtip", pos.max.x - pos.edgesize, pos.min.y + pos.edgesize, white, TEXT_ALIGN_RIGHT ) + draw.DrawText( color_text, "GModWorldtip", pos.max.x - pos.edgesize, pos.min.y + pos.edgesize, color_white, TEXT_ALIGN_RIGHT ) -- Percent local factor = math.Clamp((self.value-self.a)/(self.b-self.a), 0, 1) local color_text = string.format("%s (%d%%)",math.Round(self.value,2),factor*100) local w,h = surface.GetTextSize(color_text) - draw.DrawText( color_text, "GModWorldtip", pos.center.x + 40, pos.min.y + pos.edgesize + h, white, TEXT_ALIGN_RIGHT ) + draw.DrawText( color_text, "GModWorldtip", pos.center.x + 40, pos.min.y + pos.edgesize + h, color_white, TEXT_ALIGN_RIGHT ) -- Slider drawColorSlider( pos.min.x + pos.edgesize, pos.min.y + pos.edgesize + 46, 401, 16, self ) diff --git a/lua/entities/gmod_wire_light.lua b/lua/entities/gmod_wire_light.lua index 45087a796b..37c30f9cbf 100644 --- a/lua/entities/gmod_wire_light.lua +++ b/lua/entities/gmod_wire_light.lua @@ -94,17 +94,14 @@ if CLIENT then return w_total, h_total end - - local white = Color(255,255,255,255) - local black = Color(0,0,0,255) - + local function drawColorBox( color, x, y ) surface.SetDrawColor( color ) surface.DrawRect( x, y, color_box_size, color_box_size ) local size = color_box_size - surface.SetDrawColor( black ) + surface.SetDrawColor(0, 0, 0) surface.DrawLine( x, y, x + size, y ) surface.DrawLine( x + size, y, x + size, y + size ) surface.DrawLine( x + size, y + size, x, y + size ) @@ -119,7 +116,7 @@ if CLIENT then local color_text = string.format("Color:\n%d,%d,%d",color.r,color.g,color.b) local w,h = surface.GetTextSize( color_text ) - draw.DrawText( color_text, "GModWorldtip", pos.center.x, pos.min.y + pos.edgesize, white, TEXT_ALIGN_CENTER ) + draw.DrawText( color_text, "GModWorldtip", pos.center.x, pos.min.y + pos.edgesize, color_white, TEXT_ALIGN_CENTER ) -- color box drawColorBox( color, pos.center.x - color_box_size / 2, pos.min.y + pos.edgesize * 1.5 + h ) diff --git a/lua/entities/gmod_wire_screen.lua b/lua/entities/gmod_wire_screen.lua index 0a0c0a00c4..1b42b07d89 100644 --- a/lua/entities/gmod_wire_screen.lua +++ b/lua/entities/gmod_wire_screen.lua @@ -41,10 +41,6 @@ if CLIENT then self.GPU:Finalize() end - local header_color = Color(100,100,150,255) - local text_color = Color(255,255,255,255) - local background_color = Color(0,0,0,255) - local large_font = "Trebuchet36" local small_font = "Trebuchet18" local value_large_font = "screen_font_single" @@ -64,11 +60,11 @@ if CLIENT then value_font = value_large_font end - surface.SetDrawColor( header_color ) + surface.SetDrawColor(100, 100, 150, 255) surface.DrawRect( x, y, w, header_height ) surface.SetFont( header_font ) - surface.SetTextColor( text_color ) + surface.SetTextColor( 255, 255, 255 ) local _w,_h = surface.GetTextSize( header ) surface.SetTextPos( x + w / 2 - _w / 2, y + 2 ) surface.DrawText( header, header_font ) @@ -96,7 +92,7 @@ if CLIENT then self:DrawModel() self.GPU:RenderToWorld(nil, 188, function(x, y, w, h) - surface.SetDrawColor(background_color) + surface.SetDrawColor(0, 0, 0, 255) surface.DrawRect(x, y, w, h) if self:GetSingleValue() then diff --git a/lua/weapons/gmod_tool/stools/wire_adv.lua b/lua/weapons/gmod_tool/stools/wire_adv.lua index 4bd9042d5c..57a398de59 100644 --- a/lua/weapons/gmod_tool/stools/wire_adv.lua +++ b/lua/weapons/gmod_tool/stools/wire_adv.lua @@ -1054,10 +1054,10 @@ elseif CLIENT then y = y + 2 local temp,_ = surface.GetTextSize( name .. ":" ) - surface.SetTextColor( Color(255,255,255,255) ) + surface.SetTextColor( 255, 255, 255 ) surface.SetTextPos( x-temp/2+w/2, y ) surface.DrawText( name .. ":" ) - surface.SetDrawColor( Color(255,255,255,255) ) + surface.SetDrawColor( 255, 255, 255 ) surface.DrawLine( x, y + fonth+2, x+w, y + fonth+2 ) y = y + 6 @@ -1075,11 +1075,11 @@ elseif CLIENT then end if tbl[i][4] == true then - surface.SetTextColor( Color(255,0,0,255) ) + surface.SetTextColor(255, 0, 0, 255) elseif self:IsBlocked( name, tbl, ent, i ) then - surface.SetTextColor( Color(255,255,255,32) ) + surface.SetTextColor(255, 255, 255, 32) else - surface.SetTextColor( Color(255,255,255,255) ) + surface.SetTextColor(255, 255, 255) end if tbl[i][9] and tbl[i][9] > 1 then diff --git a/lua/weapons/gmod_tool/stools/wire_debugger.lua b/lua/weapons/gmod_tool/stools/wire_debugger.lua index c2e699af4c..7cf2f3536e 100644 --- a/lua/weapons/gmod_tool/stools/wire_debugger.lua +++ b/lua/weapons/gmod_tool/stools/wire_debugger.lua @@ -184,9 +184,9 @@ if CLIENT then for _, port in ipairs(inputs) do surface.SetTextPos(boxx,boxy+port.y) if port[4] then - surface.SetTextColor(Color(255,0,0,255)) + surface.SetTextColor(255, 0, 0) else - surface.SetTextColor(Color(255,255,255,255)) + surface.SetTextColor(255, 255, 255) end surface.DrawText(port.text) port.text = nil @@ -216,7 +216,7 @@ if CLIENT then for _, port in ipairs(outputs) do surface.SetTextPos(boxx,boxy+port.y) - surface.SetTextColor(Color(255,255,255,255)) + surface.SetTextColor(255, 255, 255) surface.DrawText(port.text) port.text = nil port.y = nil diff --git a/lua/wire/client/e2helper.lua b/lua/wire/client/e2helper.lua index 9e7ea16615..e69da00dc0 100644 --- a/lua/wire/client/e2helper.lua +++ b/lua/wire/client/e2helper.lua @@ -203,7 +203,7 @@ function E2Helper.Create(reset) if const.description then E2Helper.DescriptionEntry:SetText(const.description) - E2Helper.DescriptionEntry:SetTextColor(Color(0, 0, 0)) + E2Helper.DescriptionEntry:SetTextColor(color_black) else E2Helper.DescriptionEntry:SetText("No description found :(") E2Helper.DescriptionEntry:SetTextColor(Color(128, 128, 128)) diff --git a/lua/wire/client/text_editor/issue_viewer.lua b/lua/wire/client/text_editor/issue_viewer.lua index b806c9652c..28768475d5 100644 --- a/lua/wire/client/text_editor/issue_viewer.lua +++ b/lua/wire/client/text_editor/issue_viewer.lua @@ -33,7 +33,8 @@ function PANEL:Init() function self.Dragger:Paint(w, h) if self.Hovered or self.Held then - surface_SetDrawColor(base.ValidationColorDragger) + local color = base.ValidationColorDragger + surface_SetDrawColor(color.r, color.g, color.b, color.a) else surface_SetDrawColor(48, 48, 48, 255) end @@ -111,10 +112,9 @@ function PANEL:Init() n.Label.Paint = function(_, _, _) end return n end - - local IssuesView_BackgroundColor = Color(32, 32, 32) + function self.IssuesView:Paint(w, h) - surface_SetDrawColor(IssuesView_BackgroundColor) + surface_SetDrawColor(32, 32, 32) surface_DrawRect(0, 0, w, h) end @@ -133,11 +133,12 @@ function PANEL:Init() else validation_color = base.ValidationColorBackground end - - surface_SetDrawColor(validation_color) + + surface_SetDrawColor(validation_color.r, validation_color.g, validation_color.b, validation_color.a) surface_DrawRect(0, 0, w, h) - - surface_SetDrawColor(base.ValidationColorOutline) + + local color = base.ValidationColorOutline + surface_SetDrawColor(color.r, color.g, _color.b, color.a) surface_DrawOutlinedRect(0, 0, w, h, 2) draw_SimpleText(base.ValidationText, "DermaDefault", w / 2, h / 2, color_white, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER ) @@ -188,7 +189,7 @@ function PANEL:Init() function self.TogglePopupButton:Paint(w, h) - surface_SetDrawColor(color_white) + surface_SetDrawColor(255, 255, 255) local centerX, centerY = w / 2, h / 2 local arrowWidth, arrowHeight = 6, 3 * (base.IsCollapsed and -1 or 1) diff --git a/lua/wire/client/text_editor/texteditor.lua b/lua/wire/client/text_editor/texteditor.lua index 837c51e8a1..6363e17acf 100644 --- a/lua/wire/client/text_editor/texteditor.lua +++ b/lua/wire/client/text_editor/texteditor.lua @@ -2941,8 +2941,7 @@ function EDITOR:AC_FillList() end surface_DrawRect(0, 0, w, h) - - surface_SetDrawColor(backgroundColor) + surface_SetDrawColor(backgroundColor.r, backgroundColor.g, backgroundColor.b, backgroundColor.a) surface_DrawRect(0, 0, 4, h) surface.SetFont(self.CurrentFont)