Garry's Mod Wiki


DColorCube:OnUserChanged( table color )


Function which is called when the color cube slider is moved (through user input). Meant to be overridden.


1 table color
The new color, uses Color.


Creates a color cube which controls the blue saturation and value of a ball image.

-- Frame MainFrame = vgui.Create("DFrame") MainFrame:SetSize(320, 200) MainFrame:Center() MainFrame:SetTitle("Choose the saturation and value") -- Image of a ball local ball_img = vgui.Create("DImage", MainFrame) ball_img:SetPos(20, 45) ball_img:SetSize(128, 128) ball_img:SetImage("sprites/sent_ball") -- Color cube local color_cube = vgui.Create("DColorCube", MainFrame) color_cube:SetPos(160, 40) color_cube:SetSize(150, 150) -- Set color to blue color_cube:SetColor(Color(0, 0, 255)) -- Called when slider is moved by user function color_cube:OnUserChanged(col) -- Update ball color ball_img:SetImageColor(col) end

Page Links

Special Pages



Render Time: 265ms

DB GetPage 44
Generate Html 7
SaveChanges (1) 198
Render Body 0
Render Sidebar 14