User:Hh: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(DxDrawCheckBox)
 
(Replaced content with "'''hello!'''")
Tag: Replaced
 
Line 1: Line 1:
function DxDrawCheckBox(x, y, w, h, text, chek )
'''hello!'''
local mx, my = getMousePos()
local color1 = tocolor(255, 255, 255, 255)
local color2 = tocolor(82, 82, 82, 255)
local color3 = tocolor(255, 255, 255, 255)
if isPointInRect(mx, my, x, y, w, h) then
color3 = tocolor(200, 200, 200, 200)
end
local pos = x
dxDrawRectangle(x, y, w, h, color1, false)
dxDrawRectangle(x + 2, y + 2, w - 4, h - 4, color2, false)
if chek then
dxDrawRectangle(pos + 4, y + 4, w - 8, h - 8, color3, false)
end
dxDrawText(text, pos + 30, y + 6, 30 + pos + 25, h - 12 + y + 6, tcolor, 1, "default-bold", "left", "center", true, false, false, true)
end
 
function getMousePos()
local xsc, ysc = guiGetScreenSize()
local mx, my = getCursorPosition()
if not mx or not my then
mx, my = 0, 0
end
return mx * xsc, my * ysc
end
 
function isPointInRect(x, y, rx, ry, rw, rh)
if x >= rx and y >= ry and x <= rx + rw and y <= ry + rh then
return true
else
return false
end
end

Latest revision as of 17:34, 28 March 2021

hello!