File tree Expand file tree Collapse file tree 3 files changed +34
-9
lines changed Expand file tree Collapse file tree 3 files changed +34
-9
lines changed Original file line number Diff line number Diff line change 16
16
# *.pro
17
17
* .user
18
18
* .directory
19
- build- *
20
- * build- *
19
+ build *
20
+ * build *
Original file line number Diff line number Diff line change 1
1
cmake_minimum_required (VERSION 2.8.4 )
2
2
project (XInputSimulator )
3
3
4
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11" )
5
-
6
4
set (SOURCE_FILES
7
5
main.cpp
8
6
notimplementedexception.cpp
@@ -23,15 +21,23 @@ set(SOURCE_FILES
23
21
find_library (X_11 X11 )
24
22
find_library (X_TST Xtst )
25
23
set (EXTRA_LIBS ${X_11} ${X_TST} )
24
+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11" )
26
25
endif (UNIX AND NOT APPLE )
27
26
28
27
# Apple
29
28
if (APPLE )
30
29
find_library (APP_SERVICES ApplicationServices )
31
30
find_library (CARBON Carbon )
32
- find_library (CORE_FOUNDATION CoreFoundation )
31
+ find_library (CORE_FOUNDATION CoreFoundation )
33
32
set (EXTRA_LIBS ${APP_SERVICES_LIBRARY} ${CARBON} ${CORE_FOUNDATION} )
33
+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11" )
34
34
endif (APPLE )
35
+
36
+ # Windows
37
+ if (WIN32 )
38
+ #find_library(USER_32 User32.Lib)
39
+ #set(EXTRA_LIBS ${USER_32})
40
+ endif (WIN32 )
35
41
36
42
add_executable (XInputSimulator ${SOURCE_FILES} )
37
43
target_link_libraries (XInputSimulator ${EXTRA_LIBS} )
Original file line number Diff line number Diff line change 18
18
#include < iostream>
19
19
#include " xinputsimulator.h"
20
20
21
+ #ifdef __linux__
22
+ // sleep
21
23
#include < unistd.h>
24
+ #elif __APPLE__
25
+ // sleep
26
+ #include < unistd.h>
27
+ #elif _WIN32
28
+ // sleep
29
+ #include < windows.h>
30
+ #endif
22
31
23
32
using namespace std ;
24
33
@@ -51,23 +60,33 @@ int main()
51
60
waitABit ();
52
61
sim.mouseScrollX (-10 );
53
62
54
- char anA = ' a' ;
63
+ #ifdef __linux__ || __APPLE__
64
+ char anA = ' a' ;
55
65
cout << " a: " << (int )anA << " " << sim.charToKeyCode (anA) << endl;
56
66
std::cout << std::endl;
57
67
waitABit ();
58
68
sim.keyClick (sim.charToKeyCode (anA));
59
69
std::cout << std::endl;
60
70
waitABit ();
61
71
sim.keySequence (" Simple sentence Here 123 " );
72
+ #elif _WIN32
73
+ // not implemented
74
+ #endif
62
75
63
76
64
-
65
- // waitABit();
77
+ waitABit ();
66
78
return 0 ;
67
79
}
68
80
69
81
void waitABit ()
70
82
{
71
83
// std::this_thread::sleep_for(std::chrono::milliseconds(1000));
72
- sleep (1 );
84
+ #ifdef __linux__
85
+ sleep (1 );
86
+ #elif __APPLE__
87
+ sleep (1 );
88
+ #elif _WIN32
89
+ Sleep (1000 );
90
+ #endif
91
+
73
92
}
You can’t perform that action at this time.
0 commit comments