zombiesurvival-evolved/gamemodes/zombiesurvival/gamemode/cl_util.lua
2014-10-01 20:49:54 -04:00

64 lines
1.6 KiB
Lua

concommand.Add("printdxinfo", function()
print("DX Level: "..tostring(render.GetDXLevel()))
print("Supports HDR: "..tostring(render.SupportsHDR()))
print("Supports Pixel Shaders 1.4: "..tostring(render.SupportsPixelShaders_1_4()))
print("Supports Pixel Shaders 2.0: "..tostring(render.SupportsPixelShaders_2_0()))
print("Supports Vertex Shaders 2.0: "..tostring(render.SupportsVertexShaders_2_0()))
end)
local function GetViewModelPosition(self, pos, ang)
return pos + ang:Forward() * -256, ang
end
function DontDrawViewModel()
if SWEP then
SWEP.GetViewModelPosition = GetViewModelPosition
end
end
-- Scales the screen based around 1080p but doesn't make things TOO tiny on low resolutions.
function BetterScreenScale()
return math.Clamp(ScrH() / 1080, 0.6, 1)
end
function render.GetLightRGB(pos)
local vec = render.GetLightColor(pos)
return vec.r, vec.g, vec.b
end
function EasyLabel(parent, text, font, textcolor)
local dpanel = vgui.Create("DLabel", parent)
if font then
dpanel:SetFont(font or "DefaultFont")
end
dpanel:SetText(text)
dpanel:SizeToContents()
if textcolor then
dpanel:SetTextColor(textcolor)
end
dpanel:SetKeyboardInputEnabled(false)
dpanel:SetMouseInputEnabled(false)
return dpanel
end
function EasyButton(parent, text, xpadding, ypadding)
local dpanel = vgui.Create("DButton", parent)
if textcolor then
dpanel:SetFGColor(textcolor or color_white)
end
if text then
dpanel:SetText(text)
end
dpanel:SizeToContents()
if xpadding then
dpanel:SetWide(dpanel:GetWide() + xpadding * 2)
end
if ypadding then
dpanel:SetTall(dpanel:GetTall() + ypadding * 2)
end
return dpanel
end