Class DefaultSystemCalls
- java.lang.Object
-
- net.eternalclient.api.internal.mouse.naturalmouse.support.DefaultSystemCalls
-
- All Implemented Interfaces:
SystemCalls
public class DefaultSystemCalls extends java.lang.Object implements SystemCalls
-
-
Constructor Summary
Constructors Constructor Description DefaultSystemCalls(java.awt.Robot robot)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longcurrentTimeMillis()java.awt.DimensiongetScreenSize()voidsetMousePosition(int x, int y)Moves the mouse to specified pixel using the provided Robot.booleanshouldStop()voidsleep(long time)
-
-
-
Method Detail
-
currentTimeMillis
public long currentTimeMillis()
- Specified by:
currentTimeMillisin interfaceSystemCalls
-
sleep
public void sleep(long time) throws java.lang.InterruptedException- Specified by:
sleepin interfaceSystemCalls- Throws:
java.lang.InterruptedException
-
getScreenSize
public java.awt.Dimension getScreenSize()
- Specified by:
getScreenSizein interfaceSystemCalls
-
setMousePosition
public void setMousePosition(int x, int y)Moves the mouse to specified pixel using the provided Robot.
It seems there is a certain delay, measurable in less than milliseconds, before the mouse actually ends up on the requested pixel when using a Robot class. this usually isn't a problem, but when we ask the mouse position right after this call, there's extremely low but real chance we get wrong information back. I didn't add sleep here as it would cause overhead to sleep always, even when we don't instantly use the mouse position, but just acknowledged the issue with this warning. (Use fast unrestricted loop of Robot movement and checking the position after every move to invoke the issue.)
- Specified by:
setMousePositionin interfaceSystemCalls- Parameters:
x- the x-coordinatey- the y-coordinate
-
shouldStop
public boolean shouldStop()
- Specified by:
shouldStopin interfaceSystemCalls
-
-