Skip to content

Commit

Permalink
Added mouseMoveSmooth.
Browse files Browse the repository at this point in the history
  • Loading branch information
octalmage committed Feb 4, 2015
1 parent 39ef2f7 commit ecdd16a
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/robotjs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,22 @@ NAN_METHOD(moveMouse)
NanReturnValue(NanNew("1"));
}

NAN_METHOD(moveMouseSmooth)
{
NanScope();
if (args.Length() < 2)
{
return NanThrowError("Invalid number of arguments");
}
size_t x = args[0]->Int32Value();
size_t y = args[1]->Int32Value();

MMPoint point;
point = MMPointMake(x, y);
smoothlyMoveMouse(point);
NanReturnValue(NanNew("1"));
}

NAN_METHOD(getMousePos)
{
NanScope();
Expand Down Expand Up @@ -99,6 +115,9 @@ void init(Handle<Object> target)
target->Set(NanNew<String>("moveMouse"),
NanNew<FunctionTemplate>(moveMouse)->GetFunction());

target->Set(NanNew<String>("moveMouseSmooth"),
NanNew<FunctionTemplate>(moveMouseSmooth)->GetFunction());

target->Set(NanNew<String>("getMousePos"),
NanNew<FunctionTemplate>(getMousePos)->GetFunction());

Expand Down

0 comments on commit ecdd16a

Please sign in to comment.