Skip to content

Commit e4ba3c0

Browse files
committed
Added mouseClick function.
1 parent 7f2090d commit e4ba3c0

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/autonode.cc

+15
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,33 @@ Handle<Value> getMousePos(const Arguments& args)
2828
HandleScope scope;
2929

3030
MMPoint pos = getMousePos();
31+
32+
//Return object with .x and .y.
3133
Local<Object> obj = Object::New();
3234
obj->Set(String::NewSymbol("x"), Number::New(pos.x));
3335
obj->Set(String::NewSymbol("y"), Number::New(pos.y));
3436
return scope.Close(obj);
3537
}
3638

39+
Handle<Value> mouseClick(const Arguments& args)
40+
{
41+
HandleScope scope;
42+
43+
MMMouseButton button = LEFT_BUTTON;
44+
45+
clickMouse(button);
46+
return scope.Close(String::New("1"));
47+
}
48+
3749
void init(Handle<Object> target)
3850
{
3951
target->Set(String::NewSymbol("moveMouse"),
4052
FunctionTemplate::New(moveMouse)->GetFunction());
4153

4254
target->Set(String::NewSymbol("getMousePos"),
4355
FunctionTemplate::New(getMousePos)->GetFunction());
56+
57+
target->Set(String::NewSymbol("mouseClick"),
58+
FunctionTemplate::New(mouseClick)->GetFunction());
4459
}
4560
NODE_MODULE(autonode, init)

0 commit comments

Comments
 (0)