-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWinFormLib.lua
More file actions
52 lines (46 loc) · 953 Bytes
/
WinFormLib.lua
File metadata and controls
52 lines (46 loc) · 953 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
function size(w, h)
return {
Width = w,
Height = h,
}
end
function point(x, y)
return {
X = x,
Y = y,
}
end
function color(r, g, b, a)
return {r, g, b, a}
end
function dump(o)
if type(o) == 'table' then
local s = '{ '
for k,v in pairs(o) do
if type(k) ~= 'number' then k = '"'..k..'"' end
s = s .. '['..k..'] = ' .. dump(v) .. '\n'
end
return s .. '} '
else
return tostring(o)
end
end
--ffi.cdef([[
-- int ShowCursor(bool bShow);
--]])
--
--function ShowCursor(bool)
-- ffi.C.ShowCursor(bool)
-- print(bool)
--end
function MouseInLocation(X, Y, W, H)
local mouseX, mouseY = input.GetMousePos()
if mouseX >= X and mouseX <= X + W and mouseY >= Y and mouseY <= Y + H then
return true
else
return false
end
end
function center(itemW, itemH, W, H)
return (W/2)-(itemW/2), (H/2)-(itemH/2)
end