diff --git a/src/computervision/ObjectDetection.cpp b/src/computervision/ObjectDetection.cpp index 9009cbc..c9ca81e 100644 --- a/src/computervision/ObjectDetection.cpp +++ b/src/computervision/ObjectDetection.cpp @@ -59,10 +59,10 @@ namespace computervision putText(cameraFrame,hand_text, Point(10, 75), FONT_HERSHEY_PLAIN, 2.0, Scalar(255, 0, 255),3); imshow("camera", cameraFrame); - imshow("output", frameOut); + //imshow("output", frameOut); //imshow("foreground", foreground); //imshow("handMask", handMask); - imshow("handDetection", fingerCountDebug); + //imshow("handDetection", fingerCountDebug); int key = waitKey(1); diff --git a/src/gui/gui_interactable.cpp b/src/gui/gui_interactable.cpp index 6e939eb..1b90251 100644 --- a/src/gui/gui_interactable.cpp +++ b/src/gui/gui_interactable.cpp @@ -76,10 +76,14 @@ namespace gui { double x_pos, y_pos; glfwGetCursorPos(window, &x_pos, &y_pos); + std::cout << "Cursor pos in method: " << x_pos <<"::" << y_pos << std::endl; const float x_rel = (x_pos / SCALED_WIDTH / DEFAULT_WIDTH) * 2.0f - 1.0f; const float y_rel = -((y_pos / SCALED_HEIGHT / DEFAULT_HEIGHT) * 2.0f - 1.0f); + std::cout << "x_rel And y_rel in method: " << x_rel << "::" << y_rel << std::endl; + + if (x_rel >= minXY.x && x_rel <= maxXY.x && y_rel >= minXY.y && y_rel <= maxXY.y) { diff --git a/src/scenes/startup_Scene.cpp b/src/scenes/startup_Scene.cpp index bdec1e2..96e21b0 100644 --- a/src/scenes/startup_Scene.cpp +++ b/src/scenes/startup_Scene.cpp @@ -41,7 +41,6 @@ namespace scene if (texture->GetType() == gui::GuiType::BUTTON) { gui::Button* button = (gui::Button*)texture; - std::cout << button->clicked_texture << std::endl; return button; } else { @@ -110,6 +109,7 @@ namespace scene computervision::ObjectDetection objDetect; cv::Mat cameraFrame; gui::GuiTexture* chosen_item = NULL; + bool hand_closed = false; while (return_value == scene::Scenes::STARTUP) { @@ -130,6 +130,8 @@ namespace scene if (hand_detection) { + hand_closed = false; + std::cout << "hand is opened" << std::endl; //Loop through menu items @@ -182,9 +184,10 @@ namespace scene std::cout << chosen_item->texture << std::endl; gui::Button* new_button = ConvertGuiTextureToButton(chosen_item); - if (new_button != NULL) { + if (new_button != NULL && !hand_closed) { //Run function click new_button->ForceClick(GLFW_MOUSE_BUTTON_LEFT); + hand_closed = true; } }