void AutomaticCameraCalibrator::listen() { if(insertionValueExistant) insertSample(wantedPoint, insertionOnCamera); if(deletionValueExistant) deleteSample(unwantedPoint, deletionOnCamera); }
void handleKeyboard(int key) { char cKey = (char)key; // ESC if(cKey == 27) { b_running = false; return; } // toggle mode if(cKey == 'm') { mode = (mode + 1) % 2; std::stringstream ss; ss << "mode: " << (mode == MODE_SAMPLES ? "samples" : "glint"); animator.setText(ss.str()); return; } if(cKey == 'd') { // delete sample deleteSample(); bUpdateGraphics = true; } // see which mode if(mode == MODE_SAMPLES) { if(cKey == 'S') { // right arrow nextSample(); bUpdateGraphics = true; } else if(cKey == 'Q') { // left arrow prevSample(); bUpdateGraphics = true; } else if(cKey == 'R') { // up arrow nextContainer(); bUpdateGraphics = true; } else if(cKey == 'T') { // down arrow prevContainer(); bUpdateGraphics = true; } } else if(mode == MODE_GLINT) { calib::LEDCalibSample &sample = LEDContainers[indContainer].getSamples()[indSample]; if(cKey == 'S') { // right arrow int sugg = sample.glint.x + 1; if(sugg < 640) { sample.glint.x = sugg; } bUpdateGraphics = true; } else if(cKey == 'Q') { // left arrow int sugg = sample.glint.x - 1; if(sugg >= 0) { sample.glint.x = sugg; } bUpdateGraphics = true; } else if(cKey == 'R') { // up arrow int sugg = sample.glint.y - 1; if(sugg >= 0) { sample.glint.y = sugg; } bUpdateGraphics = true; } else if(cKey == 'T') { // down arrow int sugg = sample.glint.y + 1; if(sugg < 480) { sample.glint.y = sugg; } bUpdateGraphics = true; } } }