changing surface.SetDrawColour with mixer
I'm having trouble changing the colour of a drawn crosshair using a color mixer.
This is the mixer
This is the crosshair
Whenever I choose a color on the mixer, then press a button I've made that does the following when clicked it doesn't change the color of the drawn crosshair
What am I doing wrong?
This is the mixer
Code:
local CMixer = vgui.Create( "DColorMixer", panel3) CMixer:Dock( 50, 20, 0, 0 ) CMixer:SetPalette( true ) CMixer:SetAlphaBar( true ) CMixer:SetColor( color_white ) local cross = CMixer:GetColor()
Code:
function crosshair()
surface.SetDrawColor(cross)
surface.DrawLine(670, 384, 680, 384)
surface.DrawLine(688, 384, 698, 384)
surface.DrawLine(684, 388, 684, 398)
surface.DrawLine(684, 380, 684, 370)
end
hook.Add("HUDPaint", "crosshair", crosshair)
Code:
crosschange.DoClick = function() surface.SetDrawColor(cross) end