Can someone help me rewrite these .lua snippets in C++? I tried it on my own but it didn't work
Lua:
Код:
if
move
==
true
then
cursor
(
)
repeat
wait
(
0
)
cursorx
,
cursory
=
getCursorPos
(
)
sampToggleCursor
(
1
)
Ini
.
cfg
.
x
=
cursorx
Ini
.
cfg
.
y
=
cursory
if
isKeyDown
(
27
)
then
move
=
0
end
until
isKeyDown
(
32
)
sampToggleCursor
(
0
)
sampSetCursorMode
(
0
)
move
=
false
Ini
.
cfg
.
x
=
cursorx
Ini
.
cfg
.
y
=
cursory
inicfg
.
save
(
Ini
,
MyIni
)
end
Lua:
Код:
function
cursor
(
)
local
x
,
y
=
getScreenResolution
(
)
local
x
=
x
/
2
local
y
=
x
/
2
-- local x = x - 100
local
y
=
y
-
-
70
local
result
,
lib
=
loadDynamicLibrary
(
"user32.dll"
)
if
result
then
local
result
,
proc
=
getDynamicLibraryProcedure
(
"SetCursorPos"
,
lib
)
local
a
=
callFunction
(
proc
,
2
,
0
,
x
,
y
)
freeDynamicLibrary
(
lib
)
end
end