dobrograd-13-06-2022/garrysmod/addons/gmod-tools/lua/entities/keypad/cl_init.lua
Jonny_Bro (Nikita) e4d5311906 first commit
2023-11-16 15:01:19 +05:00

36 lines
No EOL
872 B
Lua

include "sh_init.lua"
include "cl_maths.lua"
include "cl_panel.lua"
local mat = CreateMaterial("aeypad_baaaaaaaaaaaaaaaaaaase", "VertexLitGeneric", {
["$basetexture"] = "white",
["$color"] = "{ 36 36 36 }",
})
function ENT:Draw()
render.SetMaterial(mat)
render.DrawBox(self:GetPos(), self:GetAngles(), self.Mins, self.Maxs, color_white, true)
local pos, ang = self:CalculateRenderPos(), self:CalculateRenderAng()
local w, h = self.Width2D, self.Height2D
local x, y = self:CalculateCursorPos()
local scale = self.Scale -- A high scale avoids surface call integerising from ruining aesthetics
cam.Start3D2D(pos, ang, self.Scale)
self:Paint(w, h, x, y)
cam.End3D2D()
end
function ENT:SendCommand(command, data)
net.Start("Keypad")
net.WriteEntity(self)
net.WriteUInt(command, 4)
if data then
net.WriteUInt(data, 8)
end
net.SendToServer()
end