Compare commits
10 Commits
feature/pa
...
feature/me
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1558ee298b | ||
|
|
e7a9cda9dd | ||
|
|
c94f798a9d | ||
|
|
aa4860eb48 | ||
|
|
b3412e414e | ||
|
|
7cc918fdf8 | ||
|
|
f76c0fcf1b | ||
|
|
7679555059 | ||
|
|
623003a4f7 | ||
|
|
27e99dd2eb |
2
.gitignore
vendored
@@ -428,4 +428,6 @@ FodyWeavers.xsd
|
|||||||
**/docs/*
|
**/docs/*
|
||||||
**/doc/*
|
**/doc/*
|
||||||
|
|
||||||
|
**/pose_iter_160000.caffemodel
|
||||||
|
|
||||||
# End of https://www.toptal.com/developers/gitignore/api/c++,visualstudio,visualstudiocode,opencv
|
# End of https://www.toptal.com/developers/gitignore/api/c++,visualstudio,visualstudiocode,opencv
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 294 KiB |
BIN
res/menu_item_calibrate1.png
Normal file
|
After Width: | Height: | Size: 31 KiB |
BIN
res/menu_item_calibrate1_click.png
Normal file
|
After Width: | Height: | Size: 31 KiB |
BIN
res/menu_item_calibrate1_hover.png
Normal file
|
After Width: | Height: | Size: 29 KiB |
BIN
res/menu_item_quit1.png
Normal file
|
After Width: | Height: | Size: 29 KiB |
BIN
res/menu_item_quit1_click.png
Normal file
|
After Width: | Height: | Size: 29 KiB |
BIN
res/menu_item_quit1_hover.png
Normal file
|
After Width: | Height: | Size: 28 KiB |
BIN
res/menu_item_start.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
res/menu_item_start1.png
Normal file
|
After Width: | Height: | Size: 25 KiB |
BIN
res/menu_item_start1_click.png
Normal file
|
After Width: | Height: | Size: 35 KiB |
BIN
res/menu_item_start1_hover.png
Normal file
|
After Width: | Height: | Size: 33 KiB |
25
src/computervision/MenuTest.cpp
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
#include "MenuTest.h"
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
namespace computervision
|
||||||
|
{
|
||||||
|
int menu_item_array[4] = { 1, 2, 3, 4 };
|
||||||
|
float item_number = 0;
|
||||||
|
|
||||||
|
MenuTest::MenuTest(void) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
int MenuTest::GetMenuItem(bool hand_state) {
|
||||||
|
item_number += 0.20f;
|
||||||
|
|
||||||
|
|
||||||
|
int temp_item_number = item_number;
|
||||||
|
//If temp_item_number is equal to the size of the array, set item_number bac to zero to loop through the array again
|
||||||
|
if (temp_item_number == sizeof(menu_item_array) / sizeof(menu_item_array[0])) {
|
||||||
|
item_number = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return menu_item_array[temp_item_number];
|
||||||
|
}
|
||||||
|
}
|
||||||
18
src/computervision/MenuTest.h
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
|
||||||
|
namespace computervision
|
||||||
|
{
|
||||||
|
class MenuTest {
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* @brief Constructor for the class MenuTest, loads in array with menu items
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
MenuTest(void);
|
||||||
|
/**
|
||||||
|
* @brief Returns the itemnumber in an array
|
||||||
|
*
|
||||||
|
* @param input_bool is either true or false, depending on the recognized hand gesture
|
||||||
|
*/
|
||||||
|
int GetMenuItem(bool input_bool);
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -59,10 +59,10 @@ namespace computervision
|
|||||||
putText(cameraFrame,hand_text, Point(10, 75), FONT_HERSHEY_PLAIN, 2.0, Scalar(255, 0, 255),3);
|
putText(cameraFrame,hand_text, Point(10, 75), FONT_HERSHEY_PLAIN, 2.0, Scalar(255, 0, 255),3);
|
||||||
imshow("camera", cameraFrame);
|
imshow("camera", cameraFrame);
|
||||||
|
|
||||||
/* imshow("output", frameOut);
|
//imshow("output", frameOut);
|
||||||
imshow("foreground", foreground);
|
//imshow("foreground", foreground);
|
||||||
imshow("handMask", handMask);
|
//imshow("handMask", handMask);
|
||||||
imshow("handDetection", fingerCountDebug);*/
|
//imshow("handDetection", fingerCountDebug);
|
||||||
|
|
||||||
int key = waitKey(1);
|
int key = waitKey(1);
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,11 @@
|
|||||||
|
|
||||||
namespace gui
|
namespace gui
|
||||||
{
|
{
|
||||||
|
//Represents the type of the entitie
|
||||||
|
enum class GuiType{
|
||||||
|
LABEL, BUTTON
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Structure for representing a gui item to display on the screen
|
* Structure for representing a gui item to display on the screen
|
||||||
*
|
*
|
||||||
@@ -18,9 +23,12 @@ namespace gui
|
|||||||
glm::vec2 position;
|
glm::vec2 position;
|
||||||
glm::vec2 scale;
|
glm::vec2 scale;
|
||||||
|
|
||||||
|
virtual GuiType GetType() {
|
||||||
|
return GuiType::LABEL;
|
||||||
|
}
|
||||||
GuiTexture(int texture, glm::vec2 position, glm::vec2 scale): texture(texture), position(position), scale(scale)
|
GuiTexture(int texture, glm::vec2 position, glm::vec2 scale): texture(texture), position(position), scale(scale)
|
||||||
{
|
{
|
||||||
scale.x /= (WINDOW_WIDTH / WINDOW_HEIGT);
|
scale.x /= (WINDOW_WIDTH / WINDOW_HEIGHT);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
#include <GLFW/glfw3.h>
|
#include <GLFW/glfw3.h>
|
||||||
#include "gui_interactable.h"
|
#include "gui_interactable.h"
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
namespace gui
|
namespace gui
|
||||||
{
|
{
|
||||||
InteractableGui::InteractableGui(int default_texture, glm::vec2 position, glm::vec2 scale)
|
InteractableGui::InteractableGui(int default_texture, glm::vec2 position, glm::vec2 scale)
|
||||||
@@ -41,14 +43,47 @@ namespace gui
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void InteractableGui::ForceClick( int mouseButton)
|
||||||
|
{
|
||||||
|
if(mouseButton == GLFW_MOUSE_BUTTON_LEFT)
|
||||||
|
{
|
||||||
|
if (clicked_texture != 0)
|
||||||
|
{
|
||||||
|
texture = clicked_texture;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
texture = default_texture;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!is_clicking)
|
||||||
|
{
|
||||||
|
OnClick();
|
||||||
|
is_clicking = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (is_clicking)
|
||||||
|
{
|
||||||
|
is_clicking = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
bool InteractableGui::IsHoveringAbove(GLFWwindow* window)
|
bool InteractableGui::IsHoveringAbove(GLFWwindow* window)
|
||||||
{
|
{
|
||||||
double x_pos, y_pos;
|
double x_pos, y_pos;
|
||||||
glfwGetCursorPos(window, &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 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);
|
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 &&
|
if (x_rel >= minXY.x && x_rel <= maxXY.x &&
|
||||||
y_rel >= minXY.y && y_rel <= maxXY.y)
|
y_rel >= minXY.y && y_rel <= maxXY.y)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
#include <glm/gtc/matrix_transform.hpp>
|
#include <glm/gtc/matrix_transform.hpp>
|
||||||
#include "../toolbox/toolbox.h"
|
#include "../toolbox/toolbox.h"
|
||||||
#include "gui_element.h"
|
#include "gui_element.h"
|
||||||
@@ -32,6 +33,14 @@ namespace gui
|
|||||||
*/
|
*/
|
||||||
void Update(GLFWwindow* window);
|
void Update(GLFWwindow* window);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @brief: Call this function when you want to perform a mouseclick
|
||||||
|
*
|
||||||
|
* @param mousebutton: mouseButton you want to perform the click on
|
||||||
|
*/
|
||||||
|
void ForceClick(int mouseButton);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @brief: This function gets called when the InteractabeGui is clicked
|
* @brief: This function gets called when the InteractabeGui is clicked
|
||||||
*/
|
*/
|
||||||
@@ -50,7 +59,10 @@ namespace gui
|
|||||||
/*
|
/*
|
||||||
* @brief: This function sets the texture of the InteractableGUI for when the InteractableGUI is clicked
|
* @brief: This function sets the texture of the InteractableGUI for when the InteractableGUI is clicked
|
||||||
*/
|
*/
|
||||||
void SetClickedTexture(int texture) { clicked_texture = texture; }
|
void SetClickedTexture(int texture)
|
||||||
|
{
|
||||||
|
clicked_texture = texture;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @brief: This function sets the texture of the InteractableGUI for when the mouse is hovering above the InteractableGUI
|
* @brief: This function sets the texture of the InteractableGUI for when the mouse is hovering above the InteractableGUI
|
||||||
@@ -104,6 +116,10 @@ namespace gui
|
|||||||
*/
|
*/
|
||||||
void SetOnExitAction(void (*fun)()) { on_exit_action = fun; }
|
void SetOnExitAction(void (*fun)()) { on_exit_action = fun; }
|
||||||
|
|
||||||
|
GuiType GetType() override {
|
||||||
|
return GuiType::BUTTON;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void OnClick() override { if (on_click_action != nullptr) on_click_action(); }
|
void OnClick() override { if (on_click_action != nullptr) on_click_action(); }
|
||||||
void OnEnter() override { if (on_enter_action != nullptr) on_enter_action(); }
|
void OnEnter() override { if (on_enter_action != nullptr) on_enter_action(); }
|
||||||
|
|||||||
21
src/main.cpp
@@ -7,6 +7,8 @@
|
|||||||
|
|
||||||
#include "stb_image.h"
|
#include "stb_image.h"
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
#include <opencv2/core.hpp>
|
#include <opencv2/core.hpp>
|
||||||
#include <opencv2/videoio.hpp>
|
#include <opencv2/videoio.hpp>
|
||||||
@@ -23,8 +25,6 @@
|
|||||||
#include "scenes/in_Game_Scene.h"
|
#include "scenes/in_Game_Scene.h"
|
||||||
#include "scenes/startup_Scene.h"
|
#include "scenes/startup_Scene.h"
|
||||||
|
|
||||||
#include "computervision/ObjectDetection.h"
|
|
||||||
|
|
||||||
#pragma comment(lib, "glfw3.lib")
|
#pragma comment(lib, "glfw3.lib")
|
||||||
#pragma comment(lib, "glew32s.lib")
|
#pragma comment(lib, "glew32s.lib")
|
||||||
#pragma comment(lib, "opengl32.lib")
|
#pragma comment(lib, "opengl32.lib")
|
||||||
@@ -32,6 +32,7 @@
|
|||||||
static double UpdateDelta();
|
static double UpdateDelta();
|
||||||
|
|
||||||
static GLFWwindow* window;
|
static GLFWwindow* window;
|
||||||
|
|
||||||
scene::Scene* current_scene;
|
scene::Scene* current_scene;
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
@@ -39,7 +40,7 @@ int main(void)
|
|||||||
#pragma region OPENGL_SETTINGS
|
#pragma region OPENGL_SETTINGS
|
||||||
if (!glfwInit())
|
if (!glfwInit())
|
||||||
throw "Could not inditialize glwf";
|
throw "Could not inditialize glwf";
|
||||||
window = glfwCreateWindow(WINDOW_WIDTH, WINDOW_HEIGT, "SDBA", NULL, NULL);
|
window = glfwCreateWindow(WINDOW_WIDTH, WINDOW_HEIGHT, "SDBA", NULL, NULL);
|
||||||
if (!window)
|
if (!window)
|
||||||
{
|
{
|
||||||
glfwTerminate();
|
glfwTerminate();
|
||||||
@@ -62,8 +63,11 @@ int main(void)
|
|||||||
|
|
||||||
current_scene->onKey(window, key, scancode, action, mods);
|
current_scene->onKey(window, key, scancode, action, mods);
|
||||||
});
|
});
|
||||||
|
|
||||||
bool window_open = true;
|
bool window_open = true;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Main game loop
|
// Main game loop
|
||||||
while (!glfwWindowShouldClose(window) && window_open)
|
while (!glfwWindowShouldClose(window) && window_open)
|
||||||
{
|
{
|
||||||
@@ -82,14 +86,21 @@ int main(void)
|
|||||||
current_scene = new scene::Startup_Scene();
|
current_scene = new scene::Startup_Scene();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case scene::Scenes::INGAME:
|
case scene::Scenes::INGAME:
|
||||||
current_scene = new scene::In_Game_Scene();
|
current_scene = new scene::In_Game_Scene();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
std::cout << "Wrong return value!!! ->" << std::endl;
|
std::cout << "Wrong return value!!! ->" << std::endl;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Finish up
|
||||||
|
//shader.Stop();
|
||||||
|
glfwSwapBuffers(window);
|
||||||
|
glfwPollEvents();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clean up -> preventing memory leaks!!!
|
// Clean up -> preventing memory leaks!!!
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ namespace render_engine
|
|||||||
glCullFace(GL_BACK);
|
glCullFace(GL_BACK);
|
||||||
|
|
||||||
const glm::mat4 projectionMatrix =
|
const glm::mat4 projectionMatrix =
|
||||||
glm::perspective(glm::radians(FOV), (WINDOW_WIDTH / WINDOW_HEIGT), NEAR_PLANE, FAR_PLANE);
|
glm::perspective(glm::radians(FOV), (WINDOW_WIDTH / WINDOW_HEIGHT), NEAR_PLANE, FAR_PLANE);
|
||||||
|
|
||||||
// Load the projectionmatrix into the shader
|
// Load the projectionmatrix into the shader
|
||||||
shader.Start();
|
shader.Start();
|
||||||
|
|||||||
@@ -14,13 +14,18 @@
|
|||||||
|
|
||||||
namespace scene
|
namespace scene
|
||||||
{
|
{
|
||||||
/**
|
std::vector<entities::Entity> entities;
|
||||||
* sets up the first things when the objects has been made
|
std::vector<entities::Light> lights;
|
||||||
*/
|
models::RawModel raw_model;
|
||||||
|
models::ModelTexture texture;
|
||||||
|
shaders::EntityShader *shader;
|
||||||
|
shaders::GuiShader *gui_shader;
|
||||||
|
entities::Camera camera(glm::vec3(0, 0, 0), glm::vec3(0, 0, 0));
|
||||||
|
std::vector<gui::GuiTexture*> guis;
|
||||||
|
|
||||||
|
|
||||||
In_Game_Scene::In_Game_Scene()
|
In_Game_Scene::In_Game_Scene()
|
||||||
{
|
{
|
||||||
camera = new entities::Camera(glm::vec3(0, 0, 0), glm::vec3(0, 0, 0));
|
|
||||||
|
|
||||||
shader = new shaders::EntityShader;
|
shader = new shaders::EntityShader;
|
||||||
shader->Init();
|
shader->Init();
|
||||||
render_engine::renderer::Init(*shader);
|
render_engine::renderer::Init(*shader);
|
||||||
@@ -28,19 +33,7 @@ namespace scene
|
|||||||
gui_shader = new shaders::GuiShader();
|
gui_shader = new shaders::GuiShader();
|
||||||
gui_shader->Init();
|
gui_shader->Init();
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* deletes certain veriables when the object will be deleted, prevents memory leaks
|
|
||||||
*/
|
|
||||||
In_Game_Scene::~In_Game_Scene()
|
|
||||||
{
|
|
||||||
delete camera;
|
|
||||||
delete shader;
|
|
||||||
delete gui_shader;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* starts the game scene, calls the render and update methods in a while loop
|
|
||||||
*/
|
|
||||||
scene::Scenes scene::In_Game_Scene::start(GLFWwindow* window)
|
scene::Scenes scene::In_Game_Scene::start(GLFWwindow* window)
|
||||||
{
|
{
|
||||||
raw_model = render_engine::LoadObjModel("res/House.obj");
|
raw_model = render_engine::LoadObjModel("res/House.obj");
|
||||||
@@ -52,7 +45,7 @@ namespace scene
|
|||||||
int z = 0;
|
int z = 0;
|
||||||
for (int i = 0; i < 5; ++i)
|
for (int i = 0; i < 5; ++i)
|
||||||
{
|
{
|
||||||
entities_to_render.push_back(entities::Entity(model, glm::vec3(0, -50, -50 - z), glm::vec3(0, 90, 0), 20));
|
entities.push_back(entities::Entity(model, glm::vec3(0, -50, -50 - z), glm::vec3(0, 90, 0), 20));
|
||||||
z += (raw_model.model_size.x * 20);
|
z += (raw_model.model_size.x * 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -61,7 +54,7 @@ namespace scene
|
|||||||
lights.push_back(entities::Light(glm::vec3(0, 0, -200), glm::vec3(0, 2, 0), glm::vec3(0.0001f, 0.0001f, 0.0001f)));
|
lights.push_back(entities::Light(glm::vec3(0, 0, -200), glm::vec3(0, 2, 0), glm::vec3(0.0001f, 0.0001f, 0.0001f)));
|
||||||
|
|
||||||
// GUI stuff
|
// GUI stuff
|
||||||
gui::Button button(render_engine::loader::LoadTexture("res/Mayo.png"), glm::vec2(0.5f, 0.0f), glm::vec2(1, 1));
|
gui::Button button(render_engine::loader::LoadTexture("res/Mayo.png"), glm::vec2(0.5f, 0.0f), glm::vec2(0.25f, 0.25f));
|
||||||
button.SetHoverTexture(render_engine::loader::LoadTexture("res/Texture.png"));
|
button.SetHoverTexture(render_engine::loader::LoadTexture("res/Texture.png"));
|
||||||
button.SetClickedTexture(render_engine::loader::LoadTexture("res/Mayo.png"));
|
button.SetClickedTexture(render_engine::loader::LoadTexture("res/Mayo.png"));
|
||||||
button.SetOnClickAction([]()
|
button.SetOnClickAction([]()
|
||||||
@@ -71,54 +64,11 @@ namespace scene
|
|||||||
guis.push_back(&button);
|
guis.push_back(&button);
|
||||||
|
|
||||||
|
|
||||||
//guis for the pause menu
|
|
||||||
gui::GuiTexture background(render_engine::loader::LoadTexture("res/background_grey.png"), glm::vec2(0, 0), glm::vec2(1, 1));
|
|
||||||
pause_guis.push_back(&background);
|
|
||||||
|
|
||||||
gui::Button pause_button_resume(render_engine::loader::LoadTexture("res/Mayo.png"), glm::vec2(0, 0), glm::vec2(0.25f, 0.25f));
|
|
||||||
pause_button_resume.SetHoverTexture(render_engine::loader::LoadTexture("res/Texture.png"));
|
|
||||||
pause_button_resume.SetClickedTexture(render_engine::loader::LoadTexture("res/Mayo.png"));
|
|
||||||
pause_button_resume.SetOnClickAction([]()
|
|
||||||
{
|
|
||||||
std::cout << "I got clicked on the resume button!" << std::endl;
|
|
||||||
});
|
|
||||||
pause_guis.push_back(&pause_button_resume);
|
|
||||||
|
|
||||||
gui::Button pause_button_quit(render_engine::loader::LoadTexture("res/Mayo.png"), glm::vec2(0.3f, 0.0f), glm::vec2(0.25f, 0.25f));
|
|
||||||
pause_button_quit.SetHoverTexture(render_engine::loader::LoadTexture("res/Texture.png"));
|
|
||||||
pause_button_quit.SetClickedTexture(render_engine::loader::LoadTexture("res/Mayo.png"));
|
|
||||||
pause_button_quit.SetOnClickAction([]()
|
|
||||||
{
|
|
||||||
std::cout << "I got clicked on the quit button!" << std::endl;
|
|
||||||
});
|
|
||||||
pause_guis.push_back(&pause_button_quit);
|
|
||||||
|
|
||||||
|
|
||||||
//the scene loop, this while loop represent the scene
|
|
||||||
while (return_value == scene::Scenes::INGAME)
|
while (return_value == scene::Scenes::INGAME)
|
||||||
{
|
{
|
||||||
//checks the current game state, so it can render the correct models for each state
|
update(window);
|
||||||
switch (game_state)
|
button.Update(window);
|
||||||
{
|
render();
|
||||||
/*case scene::Game_State::IDLE:
|
|
||||||
break;*/
|
|
||||||
|
|
||||||
case scene::Game_State::PAUSED:
|
|
||||||
render();
|
|
||||||
render_pause_menu();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case scene::Game_State::RUNNING:
|
|
||||||
update(window);
|
|
||||||
button.Update(window);
|
|
||||||
render();
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
std::cout << "Game state unknown" << std::endl;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
glfwSwapBuffers(window);
|
glfwSwapBuffers(window);
|
||||||
glfwPollEvents();
|
glfwPollEvents();
|
||||||
@@ -129,58 +79,40 @@ namespace scene
|
|||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* renders the game models
|
|
||||||
*/
|
|
||||||
void scene::In_Game_Scene::render()
|
void scene::In_Game_Scene::render()
|
||||||
{
|
{
|
||||||
// Render
|
// Render
|
||||||
render_engine::renderer::Prepare();
|
render_engine::renderer::Prepare();
|
||||||
//starts the shader and begins to render
|
|
||||||
shader->Start();
|
shader->Start();
|
||||||
shader->LoadSkyColor(render_engine::renderer::SKY_COLOR);
|
shader->LoadSkyColor(render_engine::renderer::SKY_COLOR);
|
||||||
shader->LoadLights(lights);
|
shader->LoadLights(lights);
|
||||||
shader->LoadViewMatrix(*camera);
|
shader->LoadViewMatrix(camera);
|
||||||
|
|
||||||
// Renders each entity in the entities list
|
// Renders each entity in the entities list
|
||||||
for (entities::Entity& entity : entities_to_render)
|
for (entities::Entity& entity : entities)
|
||||||
{
|
{
|
||||||
render_engine::renderer::Render(entity, *shader);
|
render_engine::renderer::Render(entity, *shader);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Render GUI items
|
// Render GUI items
|
||||||
//render_engine::renderer::Render(guis, *gui_shader);
|
render_engine::renderer::Render(guis, *gui_shader);
|
||||||
|
|
||||||
// Stop rendering the entities
|
// Stop rendering the entities
|
||||||
shader->Stop();
|
shader->Stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
//updates certain variables
|
|
||||||
void scene::In_Game_Scene::update(GLFWwindow* window)
|
void scene::In_Game_Scene::update(GLFWwindow* window)
|
||||||
{
|
{
|
||||||
camera->Move(window);
|
camera.Move(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
//renders the models for the pause menu
|
|
||||||
void In_Game_Scene::render_pause_menu()
|
|
||||||
{
|
|
||||||
render_engine::renderer::Render(pause_guis, *gui_shader);
|
|
||||||
}
|
|
||||||
|
|
||||||
//manages the key input in the game scene
|
|
||||||
void scene::In_Game_Scene::onKey(GLFWwindow* window, int key, int scancode, int action, int mods)
|
void scene::In_Game_Scene::onKey(GLFWwindow* window, int key, int scancode, int action, int mods)
|
||||||
{
|
{
|
||||||
if (glfwGetKey(window, GLFW_KEY_SPACE) == GLFW_PRESS)
|
if (glfwGetKey(window, GLFW_KEY_SPACE) == GLFW_PRESS)
|
||||||
{
|
{
|
||||||
return_value = scene::Scenes::STOP;
|
return_value = scene::Scenes::STOP;
|
||||||
}
|
}
|
||||||
if (glfwGetKey(window, GLFW_KEY_P) == GLFW_PRESS)
|
|
||||||
{
|
|
||||||
game_state = scene::Game_State::PAUSED;
|
|
||||||
}
|
|
||||||
if (glfwGetKey(window, GLFW_KEY_O) == GLFW_PRESS)
|
|
||||||
{
|
|
||||||
game_state = scene::Game_State::RUNNING;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,100 +1,20 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <iostream>
|
|
||||||
#include <ostream>
|
|
||||||
#include <vector>
|
|
||||||
#include "scene.h"
|
#include "scene.h"
|
||||||
#include "../gui/gui_interactable.h"
|
|
||||||
#include "../models/model.h"
|
|
||||||
#include "../renderEngine/loader.h"
|
|
||||||
#include "../renderEngine/obj_loader.h"
|
|
||||||
#include "../renderEngine/renderer.h"
|
|
||||||
#include "../shaders/entity_shader.h"
|
|
||||||
#include "../toolbox/toolbox.h"
|
|
||||||
|
|
||||||
|
|
||||||
namespace scene
|
namespace scene
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* This enum is for managing the game scene state.
|
|
||||||
* for example: when pressed on a specific button, the game will be in a paused state and nothing about the player or the speed of the game will be updated
|
|
||||||
* and the pause screen will show up.
|
|
||||||
**/
|
|
||||||
enum class Game_State
|
|
||||||
{
|
|
||||||
//IDLE,
|
|
||||||
RUNNING,
|
|
||||||
PAUSED
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class In_Game_Scene : public scene::Scene
|
class In_Game_Scene : public scene::Scene
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
//return_value is an enum that is necessary for the scene switching. Whenever this changes, the scene will change to a different scene.
|
|
||||||
scene::Scenes return_value = scene::Scenes::INGAME;
|
scene::Scenes return_value = scene::Scenes::INGAME;
|
||||||
//game_state is an enum that keeps track of the current game state. For example: is the game running(thus the user is playing the game) of is the game paused.
|
|
||||||
scene::Game_State game_state = scene::Game_State::RUNNING;
|
|
||||||
|
|
||||||
//entities_to_render is a list of entities, those entities will be rendered in the 3D environment.
|
|
||||||
std::vector<entities::Entity> entities_to_render;
|
|
||||||
//lights is a lost of light points in the game, for example the sun or it can be used to attach light effects to lamps.
|
|
||||||
std::vector<entities::Light> lights;
|
|
||||||
|
|
||||||
models::RawModel raw_model;
|
|
||||||
models::ModelTexture texture;
|
|
||||||
//the shader that is used for rendering the models.
|
|
||||||
shaders::EntityShader* shader;
|
|
||||||
//the gui_shader is used of rendering the gui models (for example the pause buttons).
|
|
||||||
shaders::GuiShader* gui_shader;
|
|
||||||
//camera is the camera view of the game scene, this camera will be behind the main character.
|
|
||||||
entities::Camera *camera;
|
|
||||||
//guis is a list of all the gui components that needs to be load in the scene.
|
|
||||||
std::vector<gui::GuiTexture*> guis;
|
|
||||||
//pause_guis is a list of components that will be rendered when the game is paused.
|
|
||||||
std::vector<gui::GuiTexture*> pause_guis;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief renders the objects/gui models
|
|
||||||
* @param
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
void render_pause_menu();
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
In_Game_Scene();
|
In_Game_Scene();
|
||||||
~In_Game_Scene();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief the method start is the start of the scene where a while loop runs, this runs the scene.
|
|
||||||
* @param window the main window of the application
|
|
||||||
* @return Scene value that indicates in which scene the application is
|
|
||||||
*/
|
|
||||||
Scenes start(GLFWwindow* window) override;
|
Scenes start(GLFWwindow* window) override;
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief this method renders the models for the game scene
|
|
||||||
* @param
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
void render() override;
|
void render() override;
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief this method updates the models/variables for the game scene
|
|
||||||
* @param window the main window of the application
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
void update(GLFWwindow* window) override;
|
void update(GLFWwindow* window) override;
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief this method updates the models/variables for the game scene
|
|
||||||
* @param window the main window of the application
|
|
||||||
* @param key this is the keycode on which key has been pressed
|
|
||||||
* @param scancode -
|
|
||||||
* @param action-
|
|
||||||
* @param mods -
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
void onKey(GLFWwindow* window, int key, int scancode, int action, int mods) override;
|
void onKey(GLFWwindow* window, int key, int scancode, int action, int mods) override;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
#include <iostream>
|
|
||||||
#include "scene.h"
|
|
||||||
|
|
||||||
scene::Scene::~Scene()
|
|
||||||
{
|
|
||||||
std::cout << "Main scene class gone!" << std::endl;
|
|
||||||
}
|
|
||||||
@@ -6,9 +6,6 @@
|
|||||||
|
|
||||||
namespace scene {
|
namespace scene {
|
||||||
|
|
||||||
/**
|
|
||||||
* this enum represents the scenes in the game, those wil help to keep track in which scene the game is.
|
|
||||||
*/
|
|
||||||
enum class Scenes
|
enum class Scenes
|
||||||
{
|
{
|
||||||
STARTUP,
|
STARTUP,
|
||||||
@@ -21,40 +18,14 @@ namespace scene {
|
|||||||
class Scene
|
class Scene
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~Scene() = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief the method start is the start of a scene where a while loop runs, this runs the scene.
|
|
||||||
* @param window the main window of the application
|
|
||||||
* @return Scene value that indicates in which scene the application is
|
|
||||||
*/
|
|
||||||
virtual Scenes start(GLFWwindow* window) = 0;
|
virtual Scenes start(GLFWwindow* window) = 0;
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief this method renders the models for a scene
|
|
||||||
* @param
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
virtual void render() = 0;
|
virtual void render() = 0;
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief this method updates the models/variables for a scene
|
|
||||||
* @param window the main window of the application
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
virtual void update(GLFWwindow* window) = 0;
|
virtual void update(GLFWwindow* window) = 0;
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief this method updates the models/variables for a scene
|
|
||||||
* @param window the main window of the application
|
|
||||||
* @param key this is the keycode on which key has been pressed
|
|
||||||
* @param scancode -
|
|
||||||
* @param action-
|
|
||||||
* @param mods -
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
virtual void onKey(GLFWwindow* window, int key, int scancode, int action, int mods) {};
|
virtual void onKey(GLFWwindow* window, int key, int scancode, int action, int mods) {};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,60 +1,194 @@
|
|||||||
#include <iostream>
|
|
||||||
#include <GL/glew.h>
|
#include <GL/glew.h>
|
||||||
#include <GLFW/glfw3.h>
|
#include <GLFW/glfw3.h>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include "startup_Scene.h"
|
#include "startup_Scene.h"
|
||||||
|
#include <iostream>
|
||||||
|
#include <opencv2/core/mat.hpp>
|
||||||
|
|
||||||
|
#include "../models/model.h"
|
||||||
|
#include "../renderEngine/loader.h"
|
||||||
|
#include "../renderEngine/obj_loader.h"
|
||||||
|
#include "../renderEngine/renderer.h"
|
||||||
|
#include "../shaders/entity_shader.h"
|
||||||
|
#include "../gui/gui_interactable.h"
|
||||||
|
#include "../toolbox/toolbox.h"
|
||||||
|
#include "../computervision/MenuTest.h"
|
||||||
|
#include "../computervision/ObjectDetection.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace scene
|
namespace scene
|
||||||
{
|
{
|
||||||
/**
|
shaders::GuiShader* gui_shader1;
|
||||||
* deletes certain variables to prevent memory leaks
|
std::vector<gui::GuiTexture*> guis1;
|
||||||
*/
|
|
||||||
Startup_Scene::~Startup_Scene()
|
float item_number = 0;
|
||||||
{
|
|
||||||
std::cout << "startup scene gone!" << std::endl;
|
bool hand_mode = false;
|
||||||
|
|
||||||
|
Startup_Scene::Startup_Scene() {
|
||||||
|
shaders::EntityShader shader;
|
||||||
|
shader.Init();
|
||||||
|
render_engine::renderer::Init(shader);
|
||||||
|
shader.CleanUp();
|
||||||
|
|
||||||
|
gui_shader1 = new shaders::GuiShader();
|
||||||
|
gui_shader1->Init();
|
||||||
|
}
|
||||||
|
|
||||||
|
gui::Button* ConvertGuiTextureToButton(gui::GuiTexture* texture) {
|
||||||
|
if (texture != NULL)
|
||||||
|
if (texture->GetType() == gui::GuiType::BUTTON) {
|
||||||
|
|
||||||
|
gui::Button* button = (gui::Button*)texture;
|
||||||
|
return button;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*gui::InteractableGui* ConvertGuiTextureToInteractableGui(gui::GuiTexture* texture) {
|
||||||
|
if (texture != NULL)
|
||||||
|
if (texture->GetType() == gui::GuiType::BUTTON) {
|
||||||
|
return (gui::InteractableGui*)texture;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
}*/
|
||||||
|
|
||||||
|
gui::GuiTexture* GetMenuItem(bool hand_state) {
|
||||||
|
if(hand_state)
|
||||||
|
item_number += 0.20f;
|
||||||
|
|
||||||
|
int temp_item_number = item_number;
|
||||||
|
|
||||||
|
//If temp_item_number is equal to the size of the array, set item_number bac to zero to loop through the array again
|
||||||
|
if (temp_item_number == guis1.size()) {
|
||||||
|
item_number = 0;
|
||||||
|
temp_item_number = 0;
|
||||||
|
}
|
||||||
|
std::cout << guis1[temp_item_number]->texture << std::endl;
|
||||||
|
return guis1[temp_item_number];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* starts the start-up scene, calls the render and update methods in a while loop
|
|
||||||
*/
|
|
||||||
scene::Scenes scene::Startup_Scene::start(GLFWwindow *window)
|
scene::Scenes scene::Startup_Scene::start(GLFWwindow *window)
|
||||||
{
|
{
|
||||||
|
// GUI stuff
|
||||||
|
gui::Button button_start(render_engine::loader::LoadTexture("res/menu_item_start1.png"), glm::vec2(0.0f, 0.6f), glm::vec2(0.25f, 0.25f));
|
||||||
|
button_start.SetHoverTexture(render_engine::loader::LoadTexture("res/menu_item_start1_hover.png"));
|
||||||
|
button_start.SetClickedTexture(render_engine::loader::LoadTexture("res/menu_item_start1_click.png"));
|
||||||
|
button_start.SetOnClickAction([]()
|
||||||
|
{
|
||||||
|
std::cout << "Clicked on button: Start!" << std::endl;
|
||||||
|
|
||||||
|
});
|
||||||
|
guis1.push_back(&button_start);
|
||||||
|
|
||||||
|
gui::Button button_calibrate(render_engine::loader::LoadTexture("res/menu_item_calibrate1.png"), glm::vec2(0.0f, 0.0f), glm::vec2(0.25f, 0.25f));
|
||||||
|
button_calibrate.SetHoverTexture(render_engine::loader::LoadTexture("res/menu_item_calibrate1_hover.png"));
|
||||||
|
button_calibrate.SetClickedTexture(render_engine::loader::LoadTexture("res/menu_item_calibrate1_click.png"));
|
||||||
|
button_calibrate.SetOnClickAction([]()
|
||||||
|
{
|
||||||
|
std::cout << "Clicked on button: Calibrate!" << std::endl;
|
||||||
|
|
||||||
|
});
|
||||||
|
guis1.push_back(&button_calibrate);
|
||||||
|
|
||||||
|
gui::Button button_quit(render_engine::loader::LoadTexture("res/menu_item_quit1.png"), glm::vec2(0.0f, -0.6f), glm::vec2(0.25f, 0.25f));
|
||||||
|
button_quit.SetHoverTexture(render_engine::loader::LoadTexture("res/menu_item_quit1_hover.png"));
|
||||||
|
button_quit.SetClickedTexture(render_engine::loader::LoadTexture("res/menu_item_quit1_click.png"));
|
||||||
|
button_quit.SetOnClickAction([]()
|
||||||
|
{
|
||||||
|
std::cout << "Clicked on button: Quit!" << std::endl;
|
||||||
|
});
|
||||||
|
guis1.push_back(&button_quit);
|
||||||
|
|
||||||
|
computervision::ObjectDetection objDetect;
|
||||||
|
cv::Mat cameraFrame;
|
||||||
|
gui::GuiTexture* chosen_item = NULL; //This is the selected menu_item
|
||||||
|
bool hand_closed = false; //Flag to prevent multiple button presses
|
||||||
|
|
||||||
while (return_value == scene::Scenes::STARTUP)
|
while (return_value == scene::Scenes::STARTUP)
|
||||||
{
|
{
|
||||||
render();
|
render();
|
||||||
update(window);
|
update(window);
|
||||||
|
|
||||||
|
if (hand_mode) {
|
||||||
|
cameraFrame = objDetect.readCamera();
|
||||||
|
|
||||||
|
//Get hand state from camera
|
||||||
|
bool hand_detection = objDetect.detectHand(cameraFrame);
|
||||||
|
|
||||||
|
if (hand_detection)
|
||||||
|
{
|
||||||
|
hand_closed = false;
|
||||||
|
std::cout << "hand is opened" << std::endl;
|
||||||
|
|
||||||
|
//Loop through menu items
|
||||||
|
chosen_item = GetMenuItem(true);
|
||||||
|
|
||||||
|
gui::Button* new_button = ConvertGuiTextureToButton(chosen_item);
|
||||||
|
if (new_button != NULL) {
|
||||||
|
const float x_pos = (chosen_item->position.x + 1.0) * WINDOW_WIDTH / 2;
|
||||||
|
const float y_pos = (1.0 - chosen_item->position.y) * WINDOW_HEIGHT / 2;
|
||||||
|
|
||||||
|
//Set cursor to location of selected menu_item
|
||||||
|
glfwSetCursorPos(window, x_pos, y_pos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (!hand_detection)
|
||||||
|
{
|
||||||
|
std::cout << "hand is closed" << std::endl;
|
||||||
|
|
||||||
|
//Gets selected menu_item
|
||||||
|
chosen_item = GetMenuItem(false);
|
||||||
|
gui::Button* new_button = ConvertGuiTextureToButton(chosen_item);
|
||||||
|
|
||||||
|
if (new_button != NULL && !hand_closed) {
|
||||||
|
//Run function click
|
||||||
|
new_button->ForceClick(GLFW_MOUSE_BUTTON_LEFT);
|
||||||
|
hand_closed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
glfwSwapBuffers(window);
|
glfwSwapBuffers(window);
|
||||||
glfwPollEvents();
|
glfwPollEvents();
|
||||||
}
|
}
|
||||||
|
gui_shader1->CleanUp();
|
||||||
|
render_engine::loader::CleanUp();
|
||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* renders the models in the start-up scene
|
|
||||||
*/
|
|
||||||
void scene::Startup_Scene::render()
|
void scene::Startup_Scene::render()
|
||||||
{
|
{
|
||||||
|
render_engine::renderer::Prepare();
|
||||||
|
|
||||||
|
// Render GUI items
|
||||||
|
render_engine::renderer::Render(guis1, *gui_shader1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* updates the variables for the start-up scene
|
|
||||||
*/
|
|
||||||
void scene::Startup_Scene::update(GLFWwindow* window)
|
void scene::Startup_Scene::update(GLFWwindow* window)
|
||||||
{
|
{
|
||||||
|
for (gui::GuiTexture* button : guis1) {
|
||||||
|
gui::Button* new_button = ConvertGuiTextureToButton(button);
|
||||||
|
if (new_button != NULL)
|
||||||
|
new_button->Update(window);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* manages the key input in the start-up scene
|
|
||||||
*/
|
|
||||||
void scene::Startup_Scene::onKey(GLFWwindow* window, int key, int scancode, int action, int mods)
|
void scene::Startup_Scene::onKey(GLFWwindow* window, int key, int scancode, int action, int mods)
|
||||||
{
|
{
|
||||||
if (glfwGetKey(window, GLFW_KEY_SPACE) == GLFW_PRESS)
|
if (glfwGetKey(window, GLFW_KEY_SPACE) == GLFW_PRESS)
|
||||||
{
|
{
|
||||||
return_value = scene::Scenes::INGAME;
|
return_value = scene::Scenes::INGAME;
|
||||||
}
|
}
|
||||||
|
else if (glfwGetKey(window, GLFW_KEY_BACKSPACE) == GLFW_PRESS) {
|
||||||
|
hand_mode = !hand_mode;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "scene.h"
|
#include "scene.h"
|
||||||
#include <map>
|
#include "../gui/gui_element.h"
|
||||||
|
|
||||||
namespace scene
|
namespace scene
|
||||||
{
|
{
|
||||||
@@ -9,41 +9,44 @@ namespace scene
|
|||||||
class Startup_Scene : public scene::Scene
|
class Startup_Scene : public scene::Scene
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
//return_value is an enum that is necessary for the scene switching. Whenever this changes, the scene will change to a different scene.
|
|
||||||
scene::Scenes return_value = scene::Scenes::STARTUP;
|
scene::Scenes return_value = scene::Scenes::STARTUP;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
~Startup_Scene();
|
/**
|
||||||
|
* @brief Constructor of the class Startup_Scene
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
Startup_Scene();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief the method start is the start of the start-up scene where a while loop runs, this runs the scene.
|
* @brief
|
||||||
* @param window the main window of the application
|
*
|
||||||
* @return Scene value that indicates in which scene the application is
|
* @param window
|
||||||
|
* @return
|
||||||
*/
|
*/
|
||||||
Scenes start(GLFWwindow* window) override;
|
Scenes start(GLFWwindow* window) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief this method renders the models for the start-up scene
|
* @brief
|
||||||
* @param
|
*
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
void render() override;
|
void render() override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief this method updates the models/variables for the start-up scene
|
* @brief This method updates all the components on the window
|
||||||
* @param window the main window of the application
|
*
|
||||||
* @return void
|
* @param window Window it updates
|
||||||
*/
|
*/
|
||||||
void update(GLFWwindow* window) override;
|
void update(GLFWwindow* window) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief this method updates the models/variables for the start-up scene
|
* @brief Listener for key events
|
||||||
* @param window the main window of the application
|
*
|
||||||
* @param key this is the keycode on which key has been pressed
|
* @param window Window it listens to for key events
|
||||||
* @param scancode -
|
* @param key Key of event that is activated
|
||||||
* @param action-
|
* @param scancode Code of Key
|
||||||
* @param mods -
|
* @param action
|
||||||
* @return void
|
* @param mods
|
||||||
*/
|
*/
|
||||||
void onKey(GLFWwindow* window, int key, int scancode, int action, int mods) override;
|
void onKey(GLFWwindow* window, int key, int scancode, int action, int mods) override;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -11,10 +11,10 @@ namespace toolbox
|
|||||||
|
|
||||||
// Change these macros to change the window size
|
// Change these macros to change the window size
|
||||||
#define WINDOW_WIDTH 1400.0f
|
#define WINDOW_WIDTH 1400.0f
|
||||||
#define WINDOW_HEIGT 800.0f
|
#define WINDOW_HEIGHT 800.0f
|
||||||
|
|
||||||
#define SCALED_WIDTH (WINDOW_WIDTH/DEFAULT_WIDTH)
|
#define SCALED_WIDTH (WINDOW_WIDTH/DEFAULT_WIDTH)
|
||||||
#define SCALED_HEIGHT (WINDOW_HEIGT/DEFAULT_HEIGHT)
|
#define SCALED_HEIGHT (WINDOW_HEIGHT/DEFAULT_HEIGHT)
|
||||||
//
|
//
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
<ClCompile Include="src\collision\collision_handler.cpp" />
|
<ClCompile Include="src\collision\collision_handler.cpp" />
|
||||||
<ClCompile Include="src\scenes\in_Game_Scene.cpp" />
|
<ClCompile Include="src\scenes\in_Game_Scene.cpp" />
|
||||||
<ClCompile Include="src\computervision\FaceDetector.cpp" />
|
<ClCompile Include="src\computervision\FaceDetector.cpp" />
|
||||||
|
<ClCompile Include="src\computervision\MenuTest.cpp" />
|
||||||
<ClCompile Include="src\computervision\ObjectDetection.cpp" />
|
<ClCompile Include="src\computervision\ObjectDetection.cpp" />
|
||||||
<ClCompile Include="src\computervision\SkinDetector.cpp" />
|
<ClCompile Include="src\computervision\SkinDetector.cpp" />
|
||||||
<ClCompile Include="src\computervision\FingerCount.cpp" />
|
<ClCompile Include="src\computervision\FingerCount.cpp" />
|
||||||
@@ -34,7 +35,6 @@
|
|||||||
<ClCompile Include="src\renderEngine\loader.cpp" />
|
<ClCompile Include="src\renderEngine\loader.cpp" />
|
||||||
<ClCompile Include="src\renderEngine\obj_loader.cpp" />
|
<ClCompile Include="src\renderEngine\obj_loader.cpp" />
|
||||||
<ClCompile Include="src\renderEngine\renderer.cpp" />
|
<ClCompile Include="src\renderEngine\renderer.cpp" />
|
||||||
<ClCompile Include="src\scenes\scene.cpp" />
|
|
||||||
<ClCompile Include="src\shaders\gui_shader.cpp" />
|
<ClCompile Include="src\shaders\gui_shader.cpp" />
|
||||||
<ClCompile Include="src\shaders\shader_program.cpp" />
|
<ClCompile Include="src\shaders\shader_program.cpp" />
|
||||||
<ClCompile Include="src\shaders\entity_shader.cpp" />
|
<ClCompile Include="src\shaders\entity_shader.cpp" />
|
||||||
@@ -49,6 +49,7 @@
|
|||||||
<ClInclude Include="src\computervision\FaceDetector.h" />
|
<ClInclude Include="src\computervision\FaceDetector.h" />
|
||||||
<ClInclude Include="src\computervision\FingerCount.h" />
|
<ClInclude Include="src\computervision\FingerCount.h" />
|
||||||
<ClInclude Include="src\computervision\BackgroundRemover.h" />
|
<ClInclude Include="src\computervision\BackgroundRemover.h" />
|
||||||
|
<ClInclude Include="src\computervision\MenuTest.h" />
|
||||||
<ClInclude Include="src\computervision\SkinDetector.h" />
|
<ClInclude Include="src\computervision\SkinDetector.h" />
|
||||||
<ClInclude Include="src\computervision\ObjectDetection.h" />
|
<ClInclude Include="src\computervision\ObjectDetection.h" />
|
||||||
<ClInclude Include="src\entities\camera.h" />
|
<ClInclude Include="src\entities\camera.h" />
|
||||||
|
|||||||
@@ -75,7 +75,7 @@
|
|||||||
<ClCompile Include="src\computervision\BackgroundRemover.cpp">
|
<ClCompile Include="src\computervision\BackgroundRemover.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="src\scenes\scene.cpp">
|
<ClCompile Include="src\computervision\MenuTest.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
@@ -158,6 +158,9 @@
|
|||||||
<ClInclude Include="src\toolbox\Timer.h">
|
<ClInclude Include="src\toolbox\Timer.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="src\computervision\MenuTest.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Xml Include="res\haarcascade_frontalface_alt.xml" />
|
<Xml Include="res\haarcascade_frontalface_alt.xml" />
|
||||||
|
|||||||