|
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
omoe Grandmaster Cheater Reputation: 8
Joined: 11 Jun 2013 Posts: 547
|
Posted: Sat Feb 21, 2015 7:43 am Post subject: Making borderless form movable |
|
|
I don't know if anyone else made a tutorial on this or if there is a better way to do it but i was working on a new GUI and thought it may help some people ,
Most of my trainer form is made of one control CHEATPANEL.
First you need the following variables and it should be global variables
// Is the user dragging the trainer or not? Default No .
Code: | CurrentmouseX=0;
CurrentmouseY=0;
MovingmouseX=0;
MovingmouseY=0;
CurrentX=0;
CurrentY=0; |
// Mouse position is made of 2 veriables X,Y
The following require you to use object or control events
Select the main object which you want the user to be able to drag trainer with and go to event,
We want the following events , OnMouseDown, OnMouseMove , OnMouseUp
Code: | function CHEATPANELMouseDown(sender, button, x, y)
CurrentmouseX,CurrentmouseY =getMousePos()
dragging=true;
end |
//On mouse down we want to get the current cursor position and turn the dragging on so if the user
//drag the trainer it will move
Code: | function CHEATPANELMouseMove(sender, x, y)
if dragging then
CurrentX,CurrentY =control_getPosition(CETrainer)
MovingmouseX,MovingmouseY =getMousePos()
control_setPosition(CETrainer, CurrentX-(CurrentmouseX-MovingmouseX),CurrentY-(CurrentmouseY-MovingmouseY))
CurrentmouseX,CurrentmouseY =getMousePos()
end
end |
//On mouse move we want to get the position of the form then the new position of the mouse
//To see where it is going , then make the trainer move with the cursor by doing some math
//CurrentX-(CurrentmouseX-MovingmouseX),CurrentY-(CurrentmouseY-MovingmouseY)
//Then we want to update the current cursor position
If you have a trainer form with multiple large controls you simply have to make this into a function and put events on each control then call the function from the event .
_________________
Hey! , Rep++ . |
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25287 Location: The netherlands
|
|
Back to top |
|
|
omoe Grandmaster Cheater Reputation: 8
Joined: 11 Jun 2013 Posts: 547
|
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|