Skip to content

Commit

Permalink
add screenToClient and clientToScreen
Browse files Browse the repository at this point in the history
  • Loading branch information
cheat-engine committed Dec 15, 2016
1 parent 0d25b9f commit 09a99a6
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 5 deletions.
40 changes: 40 additions & 0 deletions Cheat Engine/LuaControl.pas
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,44 @@ function control_sendToBack(L: PLua_State): integer; cdecl;
result:=0
end;

function control_screenToClient(L: PLua_State): integer; cdecl;
var
control: TControl;
p: tpoint;
begin
result:=0;
control:=luaclass_getClassObject(L);
if lua_gettop(L)>=2 then
begin
p.x:=lua_tointeger(L,1);
p.y:=lua_tointeger(L,2);

p:=control.ScreenToClient(p);
lua_pushinteger(L,p.x);
lua_pushinteger(L,p.y);
result:=2;
end;
end;

function control_clientToScreen(L: PLua_State): integer; cdecl;
var
control: TControl;
p: tpoint;
begin
result:=0;
control:=luaclass_getClassObject(L);
if lua_gettop(L)>=2 then
begin
p.x:=lua_tointeger(L,1);
p.y:=lua_tointeger(L,2);

p:=control.ClientToScreen(p);
lua_pushinteger(L,p.x);
lua_pushinteger(L,p.y);
result:=2;
end;
end;

procedure control_addMetaData(L: PLua_state; metatable: integer; userdata: integer);
begin
component_addMetaData(L, metatable, userdata);
Expand Down Expand Up @@ -482,6 +520,8 @@ procedure control_addMetaData(L: PLua_state; metatable: integer; userdata: integ

luaclass_addClassFunctionToTable(L, metatable, userdata, 'bringToFront', control_bringToFront);
luaclass_addClassFunctionToTable(L, metatable, userdata, 'sendToBack', control_sendToBack);
luaclass_addClassFunctionToTable(L, metatable, userdata, 'screenToClient', control_screenToClient);
luaclass_addClassFunctionToTable(L, metatable, userdata, 'clientToScreen', control_clientToScreen);

//luaclass_addPropertyToTable(L, metatable, userdata, 'Caption', control_getCaption, control_setCaption);
//luaclass_addPropertyToTable(L, metatable, userdata, 'Top', control_getTop, control_setTop);
Expand Down
2 changes: 2 additions & 0 deletions Cheat Engine/bin/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -666,6 +666,8 @@ methods:
doClick(): Executes the current function under onClick
bringToFront(): Changes the z-order of the control so it'd at the top
sendToBack(): Changes the z-order of the control so it'd at the back
screenToClient(): Converts screen x,y coordinates to x,y coordinates on the control
clientToScreen(): Converts control x,y coordinates to screen coordinates
GraphicsObject : (GraphicsObject->Object)
Expand Down
10 changes: 5 additions & 5 deletions Cheat Engine/docs/todo.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
auto assembler with a saved script should have the name in the title

symhandler: add symbol+[symbol]*4 support

lua: mousepos to clientpos
break and trace: doubleclick register truncates

Expand All @@ -20,4 +16,8 @@ memscan: Don't combine the scanresults into a single file. Leave them split up

hexview: editing by typing chars seems broken (ascii)

memscan: Add a wincp scan option to text scans
memscan: Add a wincp scan option to text scans

symbol condig window: tab 0 isn't on the symbolname

lua:autoassembler: Make autoAssembler return the alloclist which can then be passed to disable scripts

0 comments on commit 09a99a6

Please sign in to comment.