[ADD] added base for loading scene
This commit is contained in:
47
src/scenes/loading_Scene.cpp
Normal file
47
src/scenes/loading_Scene.cpp
Normal file
@@ -0,0 +1,47 @@
|
||||
#include "loading_Scene.h"
|
||||
#include "../renderEngine/Renderer.h"
|
||||
#include "../renderEngine/Loader.h"
|
||||
#include "../gui/gui_element.h"
|
||||
|
||||
namespace scene
|
||||
{
|
||||
|
||||
Loading_Scene::Loading_Scene()
|
||||
{
|
||||
gui_shader = new shaders::GuiShader();
|
||||
gui_shader->Init();
|
||||
}
|
||||
|
||||
Loading_Scene::~Loading_Scene()
|
||||
{
|
||||
delete gui_shader;
|
||||
}
|
||||
|
||||
Scenes Loading_Scene::start(GLFWwindow* window)
|
||||
{
|
||||
render();
|
||||
|
||||
}
|
||||
|
||||
void Loading_Scene::render()
|
||||
{
|
||||
render_engine::renderer::Prepare();
|
||||
|
||||
gui::GuiTexture loading_image = { render_engine::loader::LoadTexture("res/menu_item_start1.png"),
|
||||
glm::vec2(0,0),glm::vec2(1,1) };
|
||||
|
||||
std::vector<gui::GuiTexture*> image_list;
|
||||
image_list.push_back(&loading_image);
|
||||
|
||||
render_engine::renderer::Render(image_list, *gui_shader);
|
||||
}
|
||||
|
||||
void Loading_Scene::update(GLFWwindow* window)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void Loading_Scene::onKey(GLFWwindow* window, int key, int scancode, int action, int mods)
|
||||
{
|
||||
}
|
||||
}
|
||||
63
src/scenes/loading_Scene.h
Normal file
63
src/scenes/loading_Scene.h
Normal file
@@ -0,0 +1,63 @@
|
||||
#pragma once
|
||||
#pragma once
|
||||
#include "scene.h"
|
||||
#include "../gui/gui_element.h"
|
||||
#include "../shaders/gui_shader.h"
|
||||
|
||||
namespace scene
|
||||
{
|
||||
extern GLFWwindow* window;
|
||||
|
||||
|
||||
class Loading_Scene : public scene::Scene
|
||||
{
|
||||
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::LOADING;
|
||||
shaders::GuiShader* gui_shader;
|
||||
|
||||
|
||||
public:
|
||||
/**
|
||||
* @brief Constructor of the class Startup_Scene
|
||||
*
|
||||
*/
|
||||
Loading_Scene();
|
||||
|
||||
~Loading_Scene();
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
* @param window
|
||||
* @return
|
||||
*/
|
||||
Scenes start(GLFWwindow* window) override;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
*/
|
||||
void render() override;
|
||||
|
||||
/**
|
||||
* @brief This method updates all the components on the window
|
||||
*
|
||||
* @param window Window it updates
|
||||
*/
|
||||
void update(GLFWwindow* window) override;
|
||||
|
||||
/**
|
||||
* @brief Listener for key events
|
||||
*
|
||||
* @param window Window it listens to for key events
|
||||
* @param key Key of event that is activated
|
||||
* @param scancode Code of Key
|
||||
* @param action
|
||||
* @param mods
|
||||
*/
|
||||
void onKey(GLFWwindow* window, int key, int scancode, int action, int mods) override;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ namespace scene {
|
||||
*/
|
||||
enum class Scenes
|
||||
{
|
||||
LOADING,
|
||||
STARTUP,
|
||||
INGAME,
|
||||
GAMEOVER,
|
||||
|
||||
@@ -211,6 +211,7 @@ namespace scene
|
||||
{
|
||||
if (glfwGetKey(window, GLFW_KEY_SPACE) == GLFW_PRESS)
|
||||
{
|
||||
|
||||
return_value = scene::Scenes::INGAME;
|
||||
cv::destroyWindow("camera");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user