Fingervar
Fingervar
Fingervar
false )
local PANEL = {}
function PANEL:Init()
self.Value = { 0, 0 }
self.UpdateTimer = 0
self.LastShiftState = false
self:SetSize( 48, 48 )
end
self.VarName = _name_
end
self.RestrictX = bRestrict
end
function PANEL:IsRestricted()
end
function PANEL:GetValue()
end
function PANEL:UpdateConVar()
end
function PANEL:SetValue( x, y )
self.Value = { x, y }
end
return
end
self:SetMouseInputEnabled( true )
self:MouseCapture( true )
self.Dragging = true
self:GetParent().Dragging = true
self:OnCursorMoved( self:LocalCursorPos() )
end
self:MouseCapture( false )
self.Dragging = nil
self:SetMouseInputEnabled( false )
self:GetParent().Dragging = false
end
function PANEL:OnCursorMoved( x, y )
local w = self:GetWide()
local h = self:GetTall()
end
function PANEL:Think()
self.LastShiftState = input.IsShiftDown()
self:OnCursorMoved( self:LocalCursorPos() )
end
end
function PANEL:Paint( w, h )
-- This part is dirty, the whole fingerposer needs redoing, it's messy
local wep = LocalPlayer():GetWeapon( "gmod_tool" )
if ( !IsValid( wep ) ) then return end
local v = self:GetValue()
local x = ( v[1] * w ) + w / 2
local y = ( v[2] * h ) + h / 2
x = math.Clamp( x, 3, w - 3 )
y = math.Clamp( y, 3, h - 3 )
surface.SetDrawColor( 0, 0, 0, 250 )
if ( self.HoveredFingerVar ) then surface.SetDrawColor( 255, 255, 255, 255 )
end
surface.DrawLine( x, y, w / 2, h / 2 )
surface.DrawRect( w / 2 - 1, h / 2 - 1, 2, 2 )
surface.DrawRect( x - 3, y - 3, 6, 6 )
end