diff --git a/lua/pixelui/drawing/cl_overheads.lua b/lua/pixelui/drawing/cl_overheads.lua index a0c83f8..f02670e 100644 --- a/lua/pixelui/drawing/cl_overheads.lua +++ b/lua/pixelui/drawing/cl_overheads.lua @@ -53,7 +53,7 @@ local function drawOverhead(ent, pos, text, ang, scale) PIXEL.DrawRoundedBox(12, x, y, h, h, PIXEL.Colors.Primary) PIXEL.DrawRoundedBoxEx(12, x + (h - 12), y + h - 20, w + 15, 20, PIXEL.Colors.Primary, false, false, false, true) PIXEL.DrawText(text, "UI.Overhead", x + h + 15, y + 8, PIXEL.Colors.PrimaryText) - PIXEL.DrawImgur(x + 10, y + 10, h - 20, h - 20, Icon, color_white) + PIXEL.DrawImage(x + 10, y + 10, h - 20, h - 20, Icon, color_white) end end3d2d() @@ -95,6 +95,10 @@ end function PIXEL.EnableIconOverheads(new) local oldIcon = Icon + local imgurMatch = new:match("^%w+$") + if imgurMatch then + new = "https://i.imgur.com/" .. new .. ".png" + end Icon = new return oldIcon end \ No newline at end of file diff --git a/lua/pixelui/elements/cl_check_box.lua b/lua/pixelui/elements/cl_check_box.lua index 64e1dac..87cdcc2 100644 --- a/lua/pixelui/elements/cl_check_box.lua +++ b/lua/pixelui/elements/cl_check_box.lua @@ -23,7 +23,7 @@ function PANEL:Init() local boxSize = PIXEL.Scale(20) self:SetSize(boxSize, boxSize) - self:SetImgurURL("https://pixel-cdn.lythium.dev/i/7u6uph3x6g") + self:SetImageURL("https://pixel-cdn.lythium.dev/i/7u6uph3x6g") self:SetNormalColor(PIXEL.Colors.Transparent) self:SetHoverColor(PIXEL.Colors.PrimaryText) diff --git a/lua/pixelui/elements/cl_frame.lua b/lua/pixelui/elements/cl_frame.lua index b3f5ee8..c7c76c9 100644 --- a/lua/pixelui/elements/cl_frame.lua +++ b/lua/pixelui/elements/cl_frame.lua @@ -25,9 +25,21 @@ AccessorFunc(PANEL, "ScreenLock", "ScreenLock", FORCE_BOOL) AccessorFunc(PANEL, "RemoveOnClose", "RemoveOnClose", FORCE_BOOL) AccessorFunc(PANEL, "Title", "Title", FORCE_STRING) -AccessorFunc(PANEL, "ImgurID", "ImgurID", FORCE_STRING) +AccessorFunc(PANEL, "ImgurID", "ImgurID", FORCE_STRING) -- Deprecated AccessorFunc(PANEL, "ImageURL", "ImageURL", FORCE_STRING) +function PANEL:SetImgurID(id) + assert(type(id) == "string", "bad argument #1 to SetImgurID, string expected, got " .. type(id)) + print("[PIXEL UI] PIXEL.Frame:SetImgurID is deprecated, use PIXEL.Frame:SetImageURL instead") + self:SetImageURL("https://i.imgur.com/" .. id .. ".png") + self.ImgurID = id +end + +function PANEL:GetImgurID() + print("[PIXEL UI] PIXEL.Frame:GetImgurID is deprecated, use PIXEL.Frame:GetImageURL instead") + return self:GetImageURL():match("https://i.imgur.com/(.-).png") +end + PIXEL.RegisterFont("UI.FrameTitle", "Open Sans Bold", 22) function PANEL:Init() @@ -143,7 +155,7 @@ function PANEL:OnMouseReleased() self:MouseCapture(false) end -function PANEL:CreateSidebar(defaultItem, imgurID, imgurScale, imgurYOffset, buttonYOffset) +function PANEL:CreateSidebar(defaultItem, imageURL, imageScale, imageYOffset, buttonYOffset) if IsValid(self.SideBar) then return end self.SideBar = vgui.Create("PIXEL.Sidebar", self) @@ -154,9 +166,17 @@ function PANEL:CreateSidebar(defaultItem, imgurID, imgurScale, imgurYOffset, but end) end - if imgurID then self.SideBar:SetImgurID(imgurID) end - if imgurScale then self.SideBar:SetImgurScale(imgurScale) end - if imgurYOffset then self.SideBar:SetImgurOffset(imgurYOffset) end + if imageURL then + local imgurMatch = imageURL:match("^%w+$") + if imgurMatch then + imageURL = "https://i.imgur.com/" .. imageURL .. ".png" + end + + self.SideBar:SetImageURL(imageURL) + end + + if imageScale then self.SideBar:SetImageScale(imageScale) end + if imageYOffset then self.SideBar:SetImageOffset(imageYOffset) end if buttonYOffset then self.SideBar:SetButtonOffset(buttonYOffset) end return self.SideBar @@ -220,14 +240,6 @@ function PANEL:OnClose() end function PANEL:PaintHeader(x, y, w, h) PIXEL.DrawRoundedBoxEx(PIXEL.Scale(6), x, y, w, h, PIXEL.Colors.Header, true, true) - local imgurID = self:GetImgurID() - if imgurID then - local iconSize = h * .6 - PIXEL.DrawImgur(PIXEL.Scale(6), x + (h - iconSize) / 2, y + iconSize, iconSize, imgurID, color_white) - PIXEL.DrawSimpleText(self:GetTitle(), "UI.FrameTitle", x + PIXEL.Scale(12) + iconSize, y + h / 2, PIXEL.Colors.PrimaryText, nil, TEXT_ALIGN_CENTER) - return - end - local imageURL = self:GetImageURL() if imageURL then local iconSize = h * .6 diff --git a/lua/pixelui/elements/cl_image_button.lua b/lua/pixelui/elements/cl_image_button.lua index 7ca9e28..c52bb39 100644 --- a/lua/pixelui/elements/cl_image_button.lua +++ b/lua/pixelui/elements/cl_image_button.lua @@ -18,11 +18,26 @@ local PANEL = {} AccessorFunc(PANEL, "ImageURL", "ImageURL", FORCE_STRING) +AccessorFunc(PANEL, "ImageSize", "ImageSize", FORCE_NUMBER) +AccessorFunc(PANEL, "NormalColor", "NormalColor") +AccessorFunc(PANEL, "HoverColor", "HoverColor") +AccessorFunc(PANEL, "ClickColor", "ClickColor") +AccessorFunc(PANEL, "DisabledColor", "DisabledColor") function PANEL:Init() - self:SetImageURL(PIXEL.ProgressImageURL) + self.ImageCol = PIXEL.CopyColor(color_white) + self:SetImageURL("https://pixel-cdn.lythium.dev/i/loading") + + self:SetNormalColor(color_white) + self:SetHoverColor(color_white) + self:SetClickColor(color_white) + self:SetDisabledColor(color_white) + + self:SetImageSize(1) end +function PANEL:PaintBackground(w, h) end + function PANEL:Paint(w, h) self:PaintBackground(w, h) @@ -49,4 +64,4 @@ function PANEL:Paint(w, h) PIXEL.DrawImage(imageOffset, imageOffset, imageSize, imageSize, self:GetImageURL(), self.ImageCol) end -vgui.Register("PIXEL.ImageButton", PANEL, "PIXEL.ImgurButton") \ No newline at end of file +vgui.Register("PIXEL.Imagebutton", PANEL, "PIXEL.Button") \ No newline at end of file diff --git a/lua/pixelui/elements/cl_imgur_button.lua b/lua/pixelui/elements/cl_imgur_button.lua index a193d56..f7ec2ac 100644 --- a/lua/pixelui/elements/cl_imgur_button.lua +++ b/lua/pixelui/elements/cl_imgur_button.lua @@ -18,50 +18,34 @@ local PANEL = {} AccessorFunc(PANEL, "ImgurID", "ImgurID", FORCE_STRING) -AccessorFunc(PANEL, "ImageSize", "ImageSize", FORCE_NUMBER) -AccessorFunc(PANEL, "NormalColor", "NormalColor") -AccessorFunc(PANEL, "HoverColor", "HoverColor") -AccessorFunc(PANEL, "ClickColor", "ClickColor") -AccessorFunc(PANEL, "DisabledColor", "DisabledColor") +AccessorFunc(PANEL, "ImgurSize", "ImgurSize", FORCE_NUMBER) -function PANEL:Init() - self.ImageCol = PIXEL.CopyColor(color_white) - self:SetImgurID("635PPvg") - - self:SetNormalColor(color_white) - self:SetHoverColor(color_white) - self:SetClickColor(color_white) - self:SetDisabledColor(color_white) - - self:SetImageSize(1) +function PANEL:SetImgurID(id) + assert(type(id) == "string", "bad argument #1 to 'SetImgurID' (string expected, got " .. type(id)) + print("[PIXEL UI] PIXEL.ImgurButton:SetImgurID is deprecated, use PIXEL.ImageButton:SetImageURL instead.") + self.ImgurID = id + self:SetImageURL("https://i.imgur.com/" .. id .. ".png") end -function PANEL:PaintBackground(w, h) end - -function PANEL:Paint(w, h) - self:PaintBackground(w, h) - - local imageSize = h * self:GetImageSize() - local imageOffset = (h - imageSize) / 2 - - if not self:IsEnabled() then - PIXEL.DrawImgur(imageOffset, imageOffset, imageSize, imageSize, self:GetImgurID(), self:GetDisabledColor()) - return - end - - local col = self:GetNormalColor() - - if self:IsHovered() then - col = self:GetHoverColor() - end +function PANEL:GetImgurID() + print("[PIXEL UI] PIXEL.ImgurButton:GetImgurID is deprecated, use PIXEL.ImageButton:GetImgurID instead.") + return self:GetImageURL():match("https://i.imgur.com/(.*).png") +end - if self:IsDown() or self:GetToggle() then - col = self:GetClickColor() - end +function PANEL:SetImgurSize(size) + assert(type(size) == "number", "bad argument #1 to 'SetImgurSize' (number expected, got " .. type(size)) + print("[PIXEL UI] PIXEL.ImgurButton:SetImgurSize is deprecated, use PIXEL.ImageButton:SetImageSize instead.") + self.ImgurSize = size + self:SetImageSize(size, size) +end - self.ImageCol = PIXEL.LerpColor(FrameTime() * 12, self.ImageCol, col) +function PANEL:GetImgurSize() + print("[PIXEL UI] PIXEL.ImgurButton:GetImgurSize is deprecated, use PIXEL.ImageButton:GetImageSize instead.") + return self:GetImageSize() +end - PIXEL.DrawImgur(imageOffset, imageOffset, imageSize, imageSize, self:GetImgurID(), self.ImageCol) +function PANEL:Init() + print("[PIXEL UI] PIXEL.ImgurButton is deprecated, use PIXEL.ImageButton instead.") end -vgui.Register("PIXEL.ImgurButton", PANEL, "PIXEL.Button") \ No newline at end of file +vgui.Register("PIXEL.ImgurButton", PANEL, "PIXEL.Imagebutton") \ No newline at end of file diff --git a/lua/pixelui/elements/cl_sidebar.lua b/lua/pixelui/elements/cl_sidebar.lua index f90a48b..cefa88c 100644 --- a/lua/pixelui/elements/cl_sidebar.lua +++ b/lua/pixelui/elements/cl_sidebar.lua @@ -18,158 +18,202 @@ local PANEL = {} AccessorFunc(PANEL, "Name", "Name", FORCE_STRING) -AccessorFunc(PANEL, "ImgurID", "ImgurID", FORCE_STRING) AccessorFunc(PANEL, "ImageURL", "ImageURL", FORCE_STRING) AccessorFunc(PANEL, "DrawOutline", "DrawOutline", FORCE_BOOL) +AccessorFunc(PANEL, "ImgurID", "ImgurID", FORCE_STRING) -- Deprecated + +function PANEL:SetImgurID(id) + assert(type(id) == "string", "bad argument #1 to 'SetImgurID' (string expected, got " .. type(id) .. ")") + print("[PIXEL UI] PIXEL.SidebarItem:SetImgurID is deprecated, use PIXEL.SidebarItem:SetImageURL instead") + self:SetImageURL("https://i.imgur.com/" .. id .. ".png") + self.ImgurID = id +end + +function PANEL:GetImgurID() + print("[PIXEL UI] PIXEL.SidebarItem:GetImgurID is deprecated, use PIXEL.SidebarItem:GetImageURL instead") + return self:GetImageURL():match("https://i.imgur.com/(.-).png") +end PIXEL.RegisterFont("SidebarItem", "Open Sans Bold", 19) function PANEL:Init() - self:SetName("N/A") - self:SetDrawOutline(true) + self:SetName("N/A") + self:SetDrawOutline(true) - self.TextCol = PIXEL.CopyColor(PIXEL.Colors.SecondaryText) - self.BackgroundCol = PIXEL.CopyColor(PIXEL.Colors.Transparent) - self.BackgroundHoverCol = ColorAlpha(PIXEL.Colors.Scroller, 80) + self.TextCol = PIXEL.CopyColor(PIXEL.Colors.SecondaryText) + self.BackgroundCol = PIXEL.CopyColor(PIXEL.Colors.Transparent) + self.BackgroundHoverCol = ColorAlpha(PIXEL.Colors.Scroller, 80) end function PANEL:Paint(w, h) - local textCol = PIXEL.Colors.SecondaryText - local backgroundCol = PIXEL.Colors.Transparent + local textCol = PIXEL.Colors.SecondaryText + local backgroundCol = PIXEL.Colors.Transparent + + if self:IsHovered() then + textCol = PIXEL.Colors.PrimaryText + backgroundCol = self.BackgroundHoverCol + end + + if self:IsDown() or self:GetToggle() then + textCol = PIXEL.Colors.PrimaryText + backgroundCol = self.BackgroundHoverCol + end + + local animTime = FrameTime() * 12 + self.TextCol = PIXEL.LerpColor(animTime, self.TextCol, textCol) + self.BackgroundCol = PIXEL.LerpColor(animTime, self.BackgroundCol, backgroundCol) + + if self:GetDrawOutline() then PIXEL.DrawRoundedBox(PIXEL.Scale(4), 0, 0, w, h, self.BackgroundCol, PIXEL.Scale(1)) end + + local imageURL = self:GetImageURL() + if imageURL then + local iconSize = h * .65 + PIXEL.DrawImage(PIXEL.Scale(10), (h - iconSize) / 2, iconSize, iconSize, imageURL, self.TextCol) + PIXEL.DrawSimpleText(self:GetName(), "SidebarItem", PIXEL.Scale(20) + iconSize, h / 2, self.TextCol, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER) + return + end + + PIXEL.DrawSimpleText(self:GetName(), "SidebarItem", PIXEL.Scale(10), h / 2, self.TextCol, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER) +end - if self:IsHovered() then - textCol = PIXEL.Colors.PrimaryText - backgroundCol = self.BackgroundHoverCol - end +vgui.Register("PIXEL.SidebarItem", PANEL, "PIXEL.Button") - if self:IsDown() or self:GetToggle() then - textCol = PIXEL.Colors.PrimaryText - backgroundCol = self.BackgroundHoverCol - end +PANEL = {} - local animTime = FrameTime() * 12 - self.TextCol = PIXEL.LerpColor(animTime, self.TextCol, textCol) - self.BackgroundCol = PIXEL.LerpColor(animTime, self.BackgroundCol, backgroundCol) +AccessorFunc(PANEL, "ImageURL", "ImageURL", FORCE_STRING) +AccessorFunc(PANEL, "ImageScale", "ImageScale", FORCE_NUMBER) +AccessorFunc(PANEL, "ImageOffset", "ImageOffset", FORCE_NUMBER) +AccessorFunc(PANEL, "ButtonOffset", "ButtonOffset", FORCE_NUMBER) - if self:GetDrawOutline() then PIXEL.DrawRoundedBox(PIXEL.Scale(4), 0, 0, w, h, self.BackgroundCol, PIXEL.Scale(1)) end +AccessorFunc(PANEL, "ImgurID", "ImgurID", FORCE_STRING) -- Deprecated +AccessorFunc(PANEL, "ImgurScale", "ImgurScale", FORCE_NUMBER) -- Deprecated +AccessorFunc(PANEL, "ImgurOffset", "ImgurOffset", FORCE_NUMBER) -- Deprecated - local imgurID = self:GetImgurID() - if imgurID then - local iconSize = h * .65 - PIXEL.DrawImgur(PIXEL.Scale(10), (h - iconSize) / 2, iconSize, iconSize, imgurID, self.TextCol) - PIXEL.DrawSimpleText(self:GetName(), "SidebarItem", PIXEL.Scale(20) + iconSize, h / 2, self.TextCol, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER) - return - end +function PANEL:SetImgurID(id) + assert(type(id) == "string", "bad argument #1 to 'SetImgurID' (string expected, got " .. type(id) .. ")") + print("[PIXEL UI] PIXEL.Sidebar:SetImgurID is deprecated, use PIXEL.Sidebar:SetImageURL instead") + self:SetImageURL("https://i.imgur.com/" .. id .. ".png") + self.ImgurID = id +end - local imageURL = self:GetImageURL() - if imageURL then - local iconSize = h * .65 - PIXEL.DrawImage(PIXEL.Scale(10), (h - iconSize) / 2, iconSize, iconSize, imageURL, self.TextCol) - PIXEL.DrawSimpleText(self:GetName(), "SidebarItem", PIXEL.Scale(20) + iconSize, h / 2, self.TextCol, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER) - return - end +function PANEL:GetImgurID() + print("[PIXEL UI] PIXEL.Sidebar:GetImgurID is deprecated, use PIXEL.Sidebar:GetImageURL instead") + return self:GetImageURL():match("https://i.imgur.com/(.-).png") +end - PIXEL.DrawSimpleText(self:GetName(), "SidebarItem", PIXEL.Scale(10), h / 2, self.TextCol, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER) +function PANEL:SetImgurScale(scale) + assert(type(scale) == "number", "bad argument #1 to 'SetImgurScale' (number expected, got " .. type(scale) .. ")") + print("[PIXEL UI] PIXEL.Sidebar:SetImgurScale is deprecated, use PIXEL.Sidebar:SetImageScale instead") + self:SetImageScale(scale) + self.ImgurScale = scale end -vgui.Register("PIXEL.SidebarItem", PANEL, "PIXEL.Button") +function PANEL:GetImgurScale() + print("[PIXEL UI] PIXEL.Sidebar:GetImgurScale is deprecated, use PIXEL.Sidebar:GetImageScale instead") + return self:GetImageScale() +end -PANEL = {} +function PANEL:SetImgurOffset(offset) + assert(type(offset) == "number", "bad argument #1 to 'SetImgurOffset' (number expected, got " .. type(offset) .. ")") + print("[PIXEL UI] PIXEL.Sidebar:SetImgurOffset is deprecated, use PIXEL.Sidebar:SetImageOffset instead") + self:SetImageOffset(offset) + self.ImgurOffset = offset +end -AccessorFunc(PANEL, "ImgurID", "ImgurID", FORCE_STRING) -AccessorFunc(PANEL, "ImageURL", "ImageURL", FORCE_STRING) -AccessorFunc(PANEL, "ImgurScale", "ImgurScale", FORCE_NUMBER) -AccessorFunc(PANEL, "ImgurOffset", "ImgurOffset", FORCE_NUMBER) -AccessorFunc(PANEL, "ButtonOffset", "ButtonOffset", FORCE_NUMBER) +function PANEL:GetImgurOffset() + print("[PIXEL UI] PIXEL.Sidebar:GetImgurOffset is deprecated, use PIXEL.Sidebar:GetImageOffset instead") + return self:GetImageOffset() +end function PANEL:Init() - self.Items = {} - - self.Scroller = vgui.Create("PIXEL.ScrollPanel", self) - self.Scroller:SetBarDockShouldOffset(true) - self.Scroller.LayoutContent = function(s, w, h) - local spacing = PIXEL.Scale(8) - local height = PIXEL.Scale(35) - for k,v in pairs(self.Items) do - v:SetTall(height) - v:Dock(TOP) - v:DockMargin(0, 0, 0, spacing) - end - end - - self:SetImgurScale(.6) - self:SetImgurOffset(0) - self:SetButtonOffset(0) - - self.BackgroundCol = PIXEL.CopyColor(PIXEL.Colors.Header) + self.Items = {} + + self.Scroller = vgui.Create("PIXEL.ScrollPanel", self) + self.Scroller:SetBarDockShouldOffset(true) + self.Scroller.LayoutContent = function(s, w, h) + local spacing = PIXEL.Scale(8) + local height = PIXEL.Scale(35) + for k,v in pairs(self.Items) do + v:SetTall(height) + v:Dock(TOP) + v:DockMargin(0, 0, 0, spacing) + end + end + + self:SetImageScale(.6) + self:SetImageOffset(0) + self:SetButtonOffset(0) + + self.BackgroundCol = PIXEL.CopyColor(PIXEL.Colors.Header) end -function PANEL:AddItem(id, name, imgurID, doClick, order) - local btn = vgui.Create("PIXEL.SidebarItem", self.Scroller) +function PANEL:AddItem(id, name, imageURL, doClick, order) + local btn = vgui.Create("PIXEL.SidebarItem", self.Scroller) - btn:SetZPos(order or table.Count(self.Items) + 1) - btn:SetName(name) - if imgurID then btn:SetImgurID(imgurID) end - btn.Function = doClick + btn:SetZPos(order or table.Count(self.Items) + 1) + btn:SetName(name) + if imageURL then + local imgurMatch = imageURL:match("^%w+$") + if imgurMatch then + imageURL = "https://i.imgur.com/" .. imageURL .. ".png" + end - btn.DoClick = function(s) - self:SelectItem(id) - end + btn:SetImageURL(imageURL) + end + btn.Function = doClick - self.Items[id] = btn + btn.DoClick = function(s) + self:SelectItem(id) + end - return btn + self.Items[id] = btn + + return btn end function PANEL:RemoveItem(id) - local item = self.Items[id] - if not item then return end + local item = self.Items[id] + if not item then return end - item:Remove() - self.Items[id] = nil + item:Remove() + self.Items[id] = nil - if self.SelectedItem != id then return end - self:SelectItem(next(self.Items)) + if self.SelectedItem != id then return end + self:SelectItem(next(self.Items)) end function PANEL:SelectItem(id) - local item = self.Items[id] - if not item then return end + local item = self.Items[id] + if not item then return end - if self.SelectedItem and self.SelectedItem == id then return end - self.SelectedItem = id + if self.SelectedItem and self.SelectedItem == id then return end + self.SelectedItem = id - for k,v in pairs(self.Items) do - v:SetToggle(false) - end + for k,v in pairs(self.Items) do + v:SetToggle(false) + end - item:SetToggle(true) - item.Function(item) + item:SetToggle(true) + item.Function(item) end function PANEL:PerformLayout(w, h) - local sideSpacing = PIXEL.Scale(7) - local topSpacing = PIXEL.Scale(7) - self:DockPadding(sideSpacing, self:GetImgurID() and w * self:GetImgurScale() + self:GetImgurOffset() + self:GetButtonOffset() + topSpacing * 2 or topSpacing, sideSpacing, topSpacing) + local sideSpacing = PIXEL.Scale(7) + local topSpacing = PIXEL.Scale(7) + self:DockPadding(sideSpacing, self:GetImageURL() and w * self:GetImageScale() + self:GetImageOffset() + self:GetButtonOffset() + topSpacing * 2 or topSpacing, sideSpacing, topSpacing) - self.Scroller:Dock(FILL) - self.Scroller:GetCanvas():DockPadding(0, 0, self.Scroller.VBar.Enabled and sideSpacing or 0, 0) + self.Scroller:Dock(FILL) + self.Scroller:GetCanvas():DockPadding(0, 0, self.Scroller.VBar.Enabled and sideSpacing or 0, 0) end function PANEL:Paint(w, h) - PIXEL.DrawRoundedBoxEx(PIXEL.Scale(6), 0, 0, w, h, self.BackgroundCol, false, false, true) - - local imgurID = self:GetImgurID() - if imgurID then - local imageSize = w * self:GetImgurScale() - PIXEL.DrawImgur((w - imageSize) / 2, self:GetImgurOffset() + PIXEL.Scale(15), imageSize, imageSize, imgurID, color_white) - end - - local imageURL = self:GetImageURL() - if imageURL then - local imageSize = w * self:GetImgurScale() - PIXEL.DrawImage((w - imageSize) / 2, self:GetImgurOffset() + PIXEL.Scale(15), imageSize, imageSize, imageURL, color_white) - end + PIXEL.DrawRoundedBoxEx(PIXEL.Scale(6), 0, 0, w, h, self.BackgroundCol, false, false, true) + + local imageURL = self:GetImageURL() + if imageURL then + local imageSize = w * self:GetImageScale() + PIXEL.DrawImage((w - imageSize) / 2, self:GetImageOffset() + PIXEL.Scale(15), imageSize, imageSize, imageURL, color_white) + end end vgui.Register("PIXEL.Sidebar", PANEL, "Panel") \ No newline at end of file