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 long
currentTimeMillis()
java.awt.Dimension
getScreenSize()
void
setMousePosition(int x, int y)
Moves the mouse to specified pixel using the provided Robot.boolean
shouldStop()
void
sleep(long time)
-
-
-
Method Detail
-
currentTimeMillis
public long currentTimeMillis()
- Specified by:
currentTimeMillis
in interfaceSystemCalls
-
sleep
public void sleep(long time) throws java.lang.InterruptedException
- Specified by:
sleep
in interfaceSystemCalls
- Throws:
java.lang.InterruptedException
-
getScreenSize
public java.awt.Dimension getScreenSize()
- Specified by:
getScreenSize
in 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:
setMousePosition
in interfaceSystemCalls
- Parameters:
x
- the x-coordinatey
- the y-coordinate
-
shouldStop
public boolean shouldStop()
- Specified by:
shouldStop
in interfaceSystemCalls
-
-