Develop into master #9

Merged
SemvdH merged 126 commits from develop into main 2021-06-18 15:56:41 +00:00
3 changed files with 39 additions and 4 deletions
Showing only changes of commit 0b1e37119c - Show all commits

View File

@@ -18,7 +18,6 @@ namespace computervision
{ {
cv::rectangle(output_frame, cv::Rect(0, 0, output_frame.cols, 40), cv::Scalar(0, 0, 0), -1); cv::rectangle(output_frame, cv::Rect(0, 0, output_frame.cols, 40), cv::Scalar(0, 0, 0), -1);
cv::putText(output_frame, "Hand calibration", cv::Point(output_frame.cols / 2 - 100, 25), cv::FONT_HERSHEY_PLAIN, 2.0, cv::Scalar(18, 219, 65), 2); cv::putText(output_frame, "Hand calibration", cv::Point(output_frame.cols / 2 - 100, 25), cv::FONT_HERSHEY_PLAIN, 2.0, cv::Scalar(18, 219, 65), 2);
cv::putText(output_frame, "press 'b' to calibrate background,then press 's' to calibrate skin tone", cv::Point(5, 35), cv::FONT_HERSHEY_PLAIN, 1.0, cv::Scalar(18, 219, 65), 1);
cv::rectangle(output_frame, cv::Rect(0, output_frame.rows - 80, 450, output_frame.cols), cv::Scalar(0, 0, 0), -1); cv::rectangle(output_frame, cv::Rect(0, output_frame.rows - 80, 450, output_frame.cols), cv::Scalar(0, 0, 0), -1);

View File

@@ -174,9 +174,9 @@ namespace scene
gui::GuiTexture background(render_engine::loader::LoadTexture("res/background_grey.png"), glm::vec2(0, 0), glm::vec2(1, 1)); gui::GuiTexture background(render_engine::loader::LoadTexture("res/background_grey.png"), glm::vec2(0, 0), glm::vec2(1, 1));
pause_guis.push_back(&background); pause_guis.push_back(&background);
gui::Button pause_button_resume(render_engine::loader::LoadTexture("res/menu_item_start1.png"), glm::vec2(0.0f, 0.3f), glm::vec2(0.25f, 0.25f)); gui::Button pause_button_resume(render_engine::loader::LoadTexture("res/menu_item_resume1.png"), glm::vec2(0.0f, 0.3f), glm::vec2(0.25f, 0.25f));
pause_button_resume.SetHoverTexture(render_engine::loader::LoadTexture("res/menu_item_start1_hover.png")); pause_button_resume.SetHoverTexture(render_engine::loader::LoadTexture("res/menu_item_resume1_hover.png"));
pause_button_resume.SetClickedTexture(render_engine::loader::LoadTexture("res/menu_item_start1_click.png")); pause_button_resume.SetClickedTexture(render_engine::loader::LoadTexture("res/menu_item_resume1_click.png"));
std::function<void()> resume_fun = [this]() std::function<void()> resume_fun = [this]()
{ {
std::cout << "I got clicked on the resume button!" << std::endl; std::cout << "I got clicked on the resume button!" << std::endl;
@@ -211,7 +211,9 @@ namespace scene
case scene::Game_State::PAUSED: case scene::Game_State::PAUSED:
render(); render();
update_buttons(window);
render_pause_menu(); render_pause_menu();
break; break;
case scene::Game_State::RUNNING: case scene::Game_State::RUNNING:
@@ -235,6 +237,27 @@ namespace scene
return return_value; return return_value;
} }
gui::Button* In_Game_Scene::ConvertGuiTextureToButton(gui::GuiTexture* texture) {
gui::Button* button;
if (texture != NULL)
{
if (texture->GetType() == gui::GuiType::BUTTON) {
button = (gui::Button*)texture;
return button;
}
else {
button = nullptr;
return button;
}
}
else {
button = nullptr;
return button;
}
}
/** /**
* renders the game models * renders the game models
*/ */
@@ -264,6 +287,15 @@ namespace scene
DrawScore(score); DrawScore(score);
} }
void scene::In_Game_Scene::update_buttons(GLFWwindow* window)
{
for (gui::GuiTexture* button : pause_guis) {
gui::Button* new_button = ConvertGuiTextureToButton(button);
if (new_button != NULL)
new_button->Update(window);
}
}
//updates certain variables //updates certain variables
void scene::In_Game_Scene::update(GLFWwindow* window) void scene::In_Game_Scene::update(GLFWwindow* window)
{ {

View File

@@ -114,6 +114,10 @@ namespace scene
* *
*/ */
void LoadChunk(int model_pos); void LoadChunk(int model_pos);
void update_buttons(GLFWwindow* window);
gui::Button* ConvertGuiTextureToButton(gui::GuiTexture* texture);
public: public:
In_Game_Scene(int *score_ptr); In_Game_Scene(int *score_ptr);