4#define WIN32_LEAN_AND_MEAN
14void set_mouse_cursor(
int x,
int y)
18bool get_mouse_cursor(
int& x,
int& y)
21 if (GetCursorPos(&p) == TRUE) {
29void send_mouse_button_event(
int button,
bool press_not_release)
31 static const DWORD mouse_button_flag[6] = {
32 MOUSEEVENTF_LEFTUP, MOUSEEVENTF_MIDDLEUP, MOUSEEVENTF_RIGHTUP,
33 MOUSEEVENTF_LEFTDOWN, MOUSEEVENTF_MIDDLEDOWN, MOUSEEVENTF_RIGHTDOWN
35 INPUT inputs[1] = { 0 };
36 inputs[0].type = INPUT_MOUSE;
37 inputs[0].mi.dwFlags = mouse_button_flag[button + press_not_release?3:0];
38 SendInput(1, inputs,
sizeof(INPUT));
40void send_mouse_wheel_event(
float dy)
42 INPUT inputs[1] = { 0 };
43 inputs[0].type = INPUT_MOUSE;
44 inputs[0].mi.dwFlags = MOUSEEVENTF_WHEEL;
45 inputs[0].mi.mouseData = DWORD(120 * dy);
46 SendInput(1, inputs,
sizeof(INPUT));
50void set_mouse_cursor(
int x,
int y)
52 std::cerr <<
"cgv::os::set_mouse_cursor(x,y) not implemented on this platform" << std::endl;
54bool get_mouse_cursor(
int& x,
int& y)
56 std::cerr <<
"cgv::os::get_mouse_cursor(x, y) not implemented on this platform" << std::endl;
59void send_mouse_button_event(
int button,
bool press_not_release)
61 std::cerr <<
"cgv::os::send_mouse_button_event(button,press_not_release) not implemented on this platform" << std::endl;
63void send_mouse_wheel_event(
float dy)
65 std::cerr <<
"cgv::os::send_mouse_wheel_event(dy) not implemented on this platform" << std::endl;