Keyboard example.
#include <visp/vpConfig.h>
#include <visp/vpDebug.h>
#if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__)))
#include <stdio.h>
#include <iostream>
#include <signal.h>
#include <visp/vpKeyboard.h>
int
main()
{
int c;
{
std::cout << "Push some characters on the keyboard..." << std::endl;
printf("Hit 'q' or 'Q' to stop the loop ...\n");
vpKeyboard keyboard;
std::cout << "Start the keyboard scrutation..." << std::endl;
for ( ; ; ) {
if (keyboard.kbhit()) {
c = keyboard.getchar () ;
printf("You hit key: %d '%c'\n", c, c);
if (c == 'q' || c == 'Q') {
printf("You hit key: %d %c we stop the loop\n", c, c);
break ;
}
}
}
}
std::cout << "Enter an integer: ";
int myvalue;
std::cin >> myvalue;
return 0;
}
#else
int
main()
{
vpTRACE(
"Sorry, for the moment, vpKeyboard class works only on unix...");
return 0;
}
#endif