Initial Commit
This commit is contained in:
86
gamemode/vgui/button.lua
Normal file
86
gamemode/vgui/button.lua
Normal file
@@ -0,0 +1,86 @@
|
||||
-- ####################################################################################
|
||||
-- ## ##
|
||||
-- ## ##
|
||||
-- ## CASUAL BANANAS CONFIDENTIAL ##
|
||||
-- ## ##
|
||||
-- ## __________________________ ##
|
||||
-- ## ##
|
||||
-- ## ##
|
||||
-- ## Copyright 2014 (c) Casual Bananas ##
|
||||
-- ## All Rights Reserved. ##
|
||||
-- ## ##
|
||||
-- ## NOTICE: All information contained herein is, and remains ##
|
||||
-- ## the property of Casual Bananas. The intellectual and technical ##
|
||||
-- ## concepts contained herein are proprietary to Casual Bananas and may be ##
|
||||
-- ## covered by U.S. and Foreign Patents, patents in process, and are ##
|
||||
-- ## protected by trade secret or copyright law. ##
|
||||
-- ## Dissemination of this information or reproduction of this material ##
|
||||
-- ## is strictly forbidden unless prior written permission is obtained ##
|
||||
-- ## from Casual Bananas ##
|
||||
-- ## ##
|
||||
-- ## _________________________ ##
|
||||
-- ## ##
|
||||
-- ## ##
|
||||
-- ## Casual Bananas is registered with the "Kamer van Koophandel" (Dutch ##
|
||||
-- ## chamber of commerce) in The Netherlands. ##
|
||||
-- ## ##
|
||||
-- ## Company (KVK) number : 59449837 ##
|
||||
-- ## Email : info@casualbananas.com ##
|
||||
-- ## ##
|
||||
-- ## ##
|
||||
-- ####################################################################################
|
||||
|
||||
|
||||
local matEdge = Material("materials/jailbreak_excl/button_edge.png");
|
||||
local matMid = Material("materials/jailbreak_excl/button_middle.png")
|
||||
|
||||
surface.CreateFont("JBButton",{
|
||||
font=JB.Config.font,
|
||||
size=14,
|
||||
weight = 700,
|
||||
});
|
||||
surface.CreateFont("JBButtonShadow",{
|
||||
font=JB.Config.font,
|
||||
size=14,
|
||||
weight = 700,
|
||||
blursize=2,
|
||||
});
|
||||
|
||||
local PNL = {};
|
||||
AccessorFunc(PNL,"text","Text",FORCE_STRING);
|
||||
function PNL:Init()
|
||||
self:SetText("Example text");
|
||||
self.color = Color(200,200,200);
|
||||
end
|
||||
function PNL:OnCursorEntered()
|
||||
self.Hover = true;
|
||||
end
|
||||
function PNL:OnCursorExited()
|
||||
self.Hover=false;
|
||||
end
|
||||
function PNL:Paint(w,h)
|
||||
if self.Hover then
|
||||
self.color.r = math.Approach( self.color.r, 255, FrameTime() * 600 )
|
||||
self.color.g = math.Approach( self.color.g, 255, FrameTime() * 600 )
|
||||
self.color.b = math.Approach( self.color.b, 255, FrameTime() * 600 )
|
||||
else
|
||||
self.color.r = math.Approach( self.color.r, 180, FrameTime() * 400 )
|
||||
self.color.g = math.Approach( self.color.g, 180, FrameTime() * 400 )
|
||||
self.color.b = math.Approach( self.color.b, 180, FrameTime() * 400 )
|
||||
end
|
||||
|
||||
surface.SetDrawColor(Color(self.color.r * .8,self.color.g * .8, self.color.b * .8))
|
||||
surface.SetMaterial(matEdge);
|
||||
|
||||
surface.DrawTexturedRectRotated(32/2,h/2,32,32,0);
|
||||
surface.DrawTexturedRectRotated(w-32/2,h/2,32,32,180);
|
||||
|
||||
surface.SetMaterial(matMid);
|
||||
|
||||
surface.DrawTexturedRectRotated(w/2,h/2,w-64,32,0);
|
||||
|
||||
draw.SimpleText(self:GetText(),"JBButtonShadow",w/2,h/2,JB.Color.black,1,1);
|
||||
draw.SimpleText(self:GetText(),"JBButtonShadow",w/2,h/2,JB.Color.black,1,1);
|
||||
draw.SimpleText(self:GetText(),"JBButton",w/2,h/2,self.color,1,1);
|
||||
end
|
||||
vgui.Register("JB.Button",PNL,"Panel");
|
||||
182
gamemode/vgui/frame.lua
Normal file
182
gamemode/vgui/frame.lua
Normal file
@@ -0,0 +1,182 @@
|
||||
-- ####################################################################################
|
||||
-- ## ##
|
||||
-- ## ##
|
||||
-- ## CASUAL BANANAS CONFIDENTIAL ##
|
||||
-- ## ##
|
||||
-- ## __________________________ ##
|
||||
-- ## ##
|
||||
-- ## ##
|
||||
-- ## Copyright 2014 (c) Casual Bananas ##
|
||||
-- ## All Rights Reserved. ##
|
||||
-- ## ##
|
||||
-- ## NOTICE: All information contained herein is, and remains ##
|
||||
-- ## the property of Casual Bananas. The intellectual and technical ##
|
||||
-- ## concepts contained herein are proprietary to Casual Bananas and may be ##
|
||||
-- ## covered by U.S. and Foreign Patents, patents in process, and are ##
|
||||
-- ## protected by trade secret or copyright law. ##
|
||||
-- ## Dissemination of this information or reproduction of this material ##
|
||||
-- ## is strictly forbidden unless prior written permission is obtained ##
|
||||
-- ## from Casual Bananas ##
|
||||
-- ## ##
|
||||
-- ## _________________________ ##
|
||||
-- ## ##
|
||||
-- ## ##
|
||||
-- ## Casual Bananas is registered with the "Kamer van Koophandel" (Dutch ##
|
||||
-- ## chamber of commerce) in The Netherlands. ##
|
||||
-- ## ##
|
||||
-- ## Company (KVK) number : 59449837 ##
|
||||
-- ## Email : info@casualbananas.com ##
|
||||
-- ## ##
|
||||
-- ## ##
|
||||
-- ####################################################################################
|
||||
|
||||
|
||||
/* backup of old vgui
|
||||
local matGradient = Material("materials/jailbreak_excl/gradient.png");
|
||||
local matClose = Material("materials/jailbreak_excl/vgui_close.png");
|
||||
local matCloseHover = Material("materials/jailbreak_excl/vgui_close_hover.png");
|
||||
|
||||
local color_white_shadow = Color(255,255,255,60);
|
||||
|
||||
vgui.Register("JB.Frame.CloseButton",{
|
||||
OnCursorEntered = function(self)
|
||||
self.Hover = true;
|
||||
end,
|
||||
OnCursorExited = function(self)
|
||||
self.Hover = false;
|
||||
end,
|
||||
Paint = function(self,w,h)
|
||||
surface.SetMaterial(self.Hover and matCloseHover or matClose)
|
||||
surface.SetDrawColor(JB.Color.white);
|
||||
surface.DrawTexturedRectRotated(w/2,h/2,32,32,0);
|
||||
end
|
||||
},"Panel");
|
||||
|
||||
local PNL = {};
|
||||
AccessorFunc(PNL,"title","Title",FORCE_STRING);
|
||||
function PNL:Init()
|
||||
self:SetTitle("Example title");
|
||||
|
||||
self.CloseButton = vgui.Create("JB.Frame.CloseButton",self)
|
||||
self.CloseButton:SetSize(32,32);
|
||||
self.CloseButton.OnMouseReleased = function()
|
||||
self:Remove();
|
||||
end
|
||||
end
|
||||
function PNL:PerformLayout()
|
||||
self.CloseButton:SetPos(self:GetWide()-32,0);
|
||||
end
|
||||
function PNL:Paint(w,h)
|
||||
draw.RoundedBox(8,0,0,w,h,JB.Color.black);
|
||||
|
||||
draw.RoundedBoxEx(6,2,2,w-4,28,JB.Color["#BBB"],true,true);
|
||||
|
||||
draw.SimpleText(string.upper(self:GetTitle()),"JBNormal",13,30/2+1,color_white_shadow,0,1);
|
||||
draw.SimpleText(string.upper(self:GetTitle()),"JBNormal",12,30/2,JB.Color["#222"],0,1);
|
||||
|
||||
surface.SetDrawColor(color_white_shadow);
|
||||
surface.DrawRect(2,29,w-4,1);
|
||||
|
||||
surface.SetDrawColor(Color(0,0,0,120));
|
||||
surface.SetMaterial(matGradient);
|
||||
surface.DrawTexturedRectRotated(w/2,30 - 20/2,w-4,20,180);
|
||||
|
||||
draw.RoundedBoxEx(6,2,32,w-4,h-32-2,JB.Color["#444"],false,false,true,true);
|
||||
|
||||
surface.SetDrawColor(Color(0,0,0,120));
|
||||
surface.SetMaterial(matGradient);
|
||||
local h_grad = math.Clamp(h-30-2-8,0,256);
|
||||
surface.DrawTexturedRectRotated(w/2,30 + 3 + (h_grad)/2,w-6,h_grad,0);
|
||||
end
|
||||
vgui.Register("JB.Frame",PNL,"EditablePanel");
|
||||
*/
|
||||
surface.CreateFont("JBWindowTitle",{
|
||||
font = "Arial",
|
||||
size = 18,
|
||||
weight = 800
|
||||
})
|
||||
surface.CreateFont("JBWindowTitleShadow",{
|
||||
font = "Arial",
|
||||
size = 18,
|
||||
weight = 800,
|
||||
blursize =2
|
||||
})
|
||||
|
||||
local matGradient = Material("materials/jailbreak_excl/gradient.png");
|
||||
local matClose = Material("materials/jailbreak_excl/vgui_close.png");
|
||||
local matCloseHover = Material("materials/jailbreak_excl/vgui_close_hover.png");
|
||||
|
||||
local color_white_shadow = Color(255,255,255,1);
|
||||
local color_gradient_top = Color(0,0,0,20);
|
||||
local color_gradient_bottom = Color(0,0,0,120);
|
||||
|
||||
vgui.Register("JB.Frame.CloseButton",{
|
||||
Init = function(self)
|
||||
self.clr = Color(200,0,0,80);
|
||||
end,
|
||||
OnCursorEntered = function(self)
|
||||
self.Hover = true;
|
||||
end,
|
||||
OnCursorExited = function(self)
|
||||
self.Hover = false;
|
||||
end,
|
||||
Paint = function(self,w,h)
|
||||
//surface.SetMaterial(self.Hover and matCloseHover or matClose)
|
||||
//surface.SetDrawColor(JB.Color.white);
|
||||
//surface.DrawTexturedRectRotated(w/2,h/2,32,32,0);
|
||||
|
||||
if self.Hover then
|
||||
self.clr.a = Lerp(FrameTime()*6,self.clr.a,255);
|
||||
else
|
||||
self.clr.a = Lerp(FrameTime()*6,self.clr.a,60);
|
||||
end
|
||||
|
||||
draw.RoundedBox(6,0,0,w,h,Color(0,0,0,150));
|
||||
draw.RoundedBox(4,1,1,w-2,h-2,JB.Color.black);
|
||||
draw.RoundedBox(4,2,2,w-4,h-4,self.clr)
|
||||
surface.SetDrawColor(color_gradient_bottom);
|
||||
surface.SetMaterial(matGradient);
|
||||
surface.DrawTexturedRect(2,2,w-4,h-4);
|
||||
end
|
||||
},"Panel");
|
||||
|
||||
local PNL = {};
|
||||
AccessorFunc(PNL,"title","Title",FORCE_STRING);
|
||||
function PNL:Init()
|
||||
self:SetTitle("Example title");
|
||||
|
||||
self.CloseButton = vgui.Create("JB.Frame.CloseButton",self)
|
||||
self.CloseButton:SetSize(20,20);
|
||||
self.CloseButton.OnMouseReleased = function()
|
||||
self:Remove();
|
||||
end
|
||||
end
|
||||
function PNL:PerformLayout()
|
||||
self.CloseButton:SetPos(self:GetWide()-(self.CloseButton:GetWide())-(32-self.CloseButton:GetWide())/2,(32-self.CloseButton:GetTall())/2);
|
||||
end
|
||||
|
||||
function PNL:Paint(w,h)
|
||||
draw.RoundedBox(8,0,0,w,h,Color(0,0,0,150));
|
||||
draw.RoundedBox(4,1,1,w-2,h-2,JB.Color.black);
|
||||
draw.RoundedBoxEx(4,2,2,w-4,28,JB.Color["#111"],true,true);
|
||||
draw.RoundedBox(6,2,2,w-4,h-4,JB.Color["#4a4a4a"],false,false,true,true);
|
||||
|
||||
|
||||
|
||||
surface.SetDrawColor(color_gradient_top);
|
||||
surface.SetMaterial(matGradient);
|
||||
surface.DrawTexturedRectRotated(w/2,30 - 20/2,w-4,20,180);
|
||||
|
||||
|
||||
|
||||
surface.SetDrawColor(color_white_shadow);
|
||||
surface.DrawRect(2,29,w-4,1);
|
||||
|
||||
surface.SetDrawColor(color_gradient_bottom);
|
||||
surface.SetMaterial(matGradient);
|
||||
local h_grad = math.Clamp(h-30-8,0,256);
|
||||
surface.DrawTexturedRectRotated(w/2,31 + (h_grad)/2,w-6,h_grad,0);
|
||||
|
||||
local wTitle,hTitle = JB.Util.drawSimpleShadowText(string.upper(self:GetTitle()),"JBWindowTitle",12,32/2 + 1,JB.Color["#EEE"],0,1,4);
|
||||
end
|
||||
vgui.Register("JB.Frame",PNL,"EditablePanel");
|
||||
50
gamemode/vgui/panel.lua
Normal file
50
gamemode/vgui/panel.lua
Normal file
@@ -0,0 +1,50 @@
|
||||
-- ####################################################################################
|
||||
-- ## ##
|
||||
-- ## ##
|
||||
-- ## CASUAL BANANAS CONFIDENTIAL ##
|
||||
-- ## ##
|
||||
-- ## __________________________ ##
|
||||
-- ## ##
|
||||
-- ## ##
|
||||
-- ## Copyright 2014 (c) Casual Bananas ##
|
||||
-- ## All Rights Reserved. ##
|
||||
-- ## ##
|
||||
-- ## NOTICE: All information contained herein is, and remains ##
|
||||
-- ## the property of Casual Bananas. The intellectual and technical ##
|
||||
-- ## concepts contained herein are proprietary to Casual Bananas and may be ##
|
||||
-- ## covered by U.S. and Foreign Patents, patents in process, and are ##
|
||||
-- ## protected by trade secret or copyright law. ##
|
||||
-- ## Dissemination of this information or reproduction of this material ##
|
||||
-- ## is strictly forbidden unless prior written permission is obtained ##
|
||||
-- ## from Casual Bananas ##
|
||||
-- ## ##
|
||||
-- ## _________________________ ##
|
||||
-- ## ##
|
||||
-- ## ##
|
||||
-- ## Casual Bananas is registered with the "Kamer van Koophandel" (Dutch ##
|
||||
-- ## chamber of commerce) in The Netherlands. ##
|
||||
-- ## ##
|
||||
-- ## Company (KVK) number : 59449837 ##
|
||||
-- ## Email : info@casualbananas.com ##
|
||||
-- ## ##
|
||||
-- ## ##
|
||||
-- ####################################################################################
|
||||
|
||||
|
||||
|
||||
local PNL = {};
|
||||
local color_shade = Color(255,255,255,5);
|
||||
local color_bg = Color(20,20,20);
|
||||
local color_bg_weak = Color(20,20,20,240);
|
||||
local matGradient = Material("materials/jailbreak_excl/gradient.png");
|
||||
|
||||
function PNL:Paint(w,h)
|
||||
surface.SetMaterial(matGradient);
|
||||
surface.SetDrawColor(color_bg);
|
||||
surface.DrawTexturedRect(0,0,w,h);
|
||||
surface.SetDrawColor(color_bg_weak);
|
||||
surface.DrawRect(0,0,w,h);
|
||||
draw.RoundedBox(0,0,0,w,1,color_shade);
|
||||
end
|
||||
vgui.Register("JB.Panel",PNL,"EditablePanel");
|
||||
|
||||
Reference in New Issue
Block a user