• Make AvatarImage circular
    8 replies, posted
Hey, Someone can give me a quick info how to edit the AvatarImage Element? So i get the Material of the avatar or sth like that? Need it to be circular and have no clue how to get it done. Just a quick thought-provoking impulse would be cool :) Thanks,
Thanks so far, But as a result i got this: [IMG]http://i.imgur.com/yWmPQxX.png[/IMG] Is there a way to make it transparent?
Sorry for asking, but render is normally for 3D right? So i would need to do it in a cam2D?
Since i need the AvatarImage to be painted manually, i need to figure out how to... On the Wiki i found SetPaintedManually, but after setting it to true, no Paint hook gets called: [LUA] frame:SetPaintedManually(true) frame.Paint = function() print("calledPaint") --not called local w = 64 local h = 64 surface.SetMaterial(Material('vgui/white')) surface.SetDrawColor(Color(52, 56, 67)) for a = 1, 13 do -- For extra aa for i = 0, 360, a do local _i = i * math.pi/180; surface.DrawTexturedRectRotated(math.cos(_i)*(40)+w/2, math.sin(_i)*(40)+h/2, 15, a*2, -i ) end end end frame:SetPaintFunction(function() print("calledSetPaint")--not called local w = 64 local h = 64 surface.SetMaterial(Material('vgui/white')) surface.SetDrawColor(Color(52, 56, 67)) for a = 1, 13 do -- For extra aa for i = 0, 360, a do local _i = i * math.pi/180; surface.DrawTexturedRectRotated(math.cos(_i)*(40)+w/2, math.sin(_i)*(40)+h/2, 15, a*2, -i ) end end end) frame.PaintManual = function() print("calledPaintManual")--not called local w = 64 local h = 64 surface.SetMaterial(Material('vgui/white')) surface.SetDrawColor(Color(52, 56, 67)) for a = 1, 13 do -- For extra aa for i = 0, 360, a do local _i = i * math.pi/180; surface.DrawTexturedRectRotated(math.cos(_i)*(40)+w/2, math.sin(_i)*(40)+h/2, 15, a*2, -i ) end end end [/LUA]
Override the "Paint" hook and then do somthing like this to draw it: [code] self:SetPaintedManually( false ) self:PaintManual() self:SetPaintedManually( true ) [/code]
Sorry, you need to Log In to post a reply to this thread.