Ich möchte mir in der linux Konsole bash auf Slackware mit Hilfe eines in C/C++ geschriebenen Programm die Mauskoordinaten ausgeben lassen.
Das Ganze soll dann Servos ansteuern, die an den RP6 Roboter angeschlossen sind.
Dieser code wurde mir von robocat gegeben, jedoch ist er für windows
gruss
carlitoco
Code:// einfaches konsolenprogramm um mauskoordinaten anzuzeigen #include <windows.h> // for API functions #include <stdio.h> // for printf int main() { CURSORINFO cursorinfo; POINT p; for(;;) { // structure wants to know its size cursorinfo.cbSize=sizeof(CURSORINFO); // fill the cursorinfo structure GetCursorInfo(&cursorinfo); // copy mouse coordinates to p // not necessary; cursorinfo.ptScreenPos.x could be used directly p=cursorinfo.ptScreenPos; // output coordinates printf("x:%d,y:%d\n",p.x,p.y); // sleep for 100ms to keep cpu load low Sleep(100); } return 0; }







Zitieren

Lesezeichen