SimpleEngine/include/simpleengine/game.h

58 lines
1.7 KiB
C
Raw Normal View History

//
// Created by SeanOMik on 7/2/2020.
// Github: https://github.com/SeanOMik
//
#ifndef SIMPLEENGINE_GAME_H
#define SIMPLEENGINE_GAME_H
2021-11-20 05:48:47 +00:00
#include <string>
#include <memory>
#include <vector>
2021-11-20 05:48:47 +00:00
#include <gl/glew.h>
#include <GLFW/glfw3.h>
2020-07-03 20:26:44 +00:00
#include "event/event.h"
namespace simpleengine {
class Game {
private:
using self = simpleengine::Game;
public:
2021-11-20 05:48:47 +00:00
/**
* @brief Construct a new Game object. Initializes GLEW and OpenGL
*
* @param w Width of viewport
* @param h Height of viewport
* @param window_name The name of the window
*/
Game(int w, int h, const std::string& window_name, const int& gl_profile = GLFW_OPENGL_CORE_PROFILE, const int& major_version = 4,
const int& minor_version = 4, const bool& resizeable = false, const int& forward_compat = GL_TRUE);
virtual ~Game();
void add_event(std::shared_ptr<simpleengine::Event> event);
2021-11-20 05:48:47 +00:00
void update();
void handle_input();
2021-11-20 05:48:47 +00:00
void render_window();
void render_items();
void exit();
int run();
2021-03-13 03:01:33 +00:00
2021-11-20 05:48:47 +00:00
//void AddEvent(Event* event);
std::shared_ptr<GLFWwindow> get_window();
private:
2021-11-20 05:48:47 +00:00
static void framebuffer_resize_callback(GLFWwindow*, int fbW, int fbH);
void initialize(const int& gl_profile, const int& major_version, const int& minor_version,
const bool& resizeable, const int& forward_compat = GL_TRUE);
2021-11-20 05:48:47 +00:00
std::shared_ptr<GLFWwindow> window;
std::vector<std::shared_ptr<simpleengine::Event>> events;
const bool& window_resizeable;
};
}
#endif //GAMEENGINE_GAME_H