I'm not sure where to look to find this information, but I'd like to know how to get mouse input (or any hid input) using the fewest non standard libraries in c. Basically, is there an stdio equivalent for mouse (and other input) input in c? Or is there a library that is minimal and cross compatible on multiple platforms. Just being able to print mouse coordinates to a terminal window would be enough.
相关问题
- Multiple sockets for clients to connect to
- What is the best way to do a search in a large fil
- glDrawElements only draws half a quad
- Index of single bit in long integer (in C) [duplic
- Equivalent of std::pair in C
Here is a 0 non-standard library approach. Runs wherever /dev/input/event# exists.
On Windows, you need to do something ghastly with the Win32 API and hook into the message system.
In short, no, there is no standard in C for this.
SDL will do the trick I believe.
Depends on the platform and the operating system. If you want to "track" mouse (or HID) events directly, you may have to write a driver or find one. The driver will monitor the port and listen for mouse data (messages).
On an event driven system, you will have to subscribe to mouse event messages. Some OS's will broadcast the messages to every task (such as Windows), while others will only send the events to subscribers.
This is too general of a question to receive a specific answer.