Use raw pointer of GLFWwindow instead shared_ptr
This commit is contained in:
parent
539bd486e0
commit
794246eb02
|
@ -9,12 +9,12 @@
|
|||
namespace simpleengine {
|
||||
class Event : public simpleengine::Destructable {
|
||||
public:
|
||||
explicit Event(std::shared_ptr<GLFWwindow> window = nullptr) : window(window) {}
|
||||
explicit Event(GLFWwindow* window = nullptr) : window(window) {}
|
||||
virtual ~Event() = default;
|
||||
|
||||
virtual void update(const float& delta_time) = 0;
|
||||
virtual void render(std::shared_ptr<GLFWwindow> target) = 0;
|
||||
virtual void render(GLFWwindow* target) = 0;
|
||||
protected:
|
||||
std::shared_ptr<GLFWwindow> window;
|
||||
GLFWwindow* window;
|
||||
};
|
||||
}
|
|
@ -4,7 +4,12 @@
|
|||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#ifdef __linux__
|
||||
#include <GL/glew.h>
|
||||
#elif
|
||||
#include <gl/glew.h>
|
||||
#endif
|
||||
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#include "event/event.h"
|
||||
|
@ -35,14 +40,14 @@ namespace simpleengine {
|
|||
int run();
|
||||
|
||||
//void AddEvent(Event* event);
|
||||
std::shared_ptr<GLFWwindow> get_window();
|
||||
GLFWwindow* get_window();
|
||||
private:
|
||||
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);
|
||||
|
||||
std::shared_ptr<GLFWwindow> window;
|
||||
GLFWwindow* window;
|
||||
std::vector<std::shared_ptr<simpleengine::Event>> events;
|
||||
const bool& window_resizeable;
|
||||
};
|
||||
|
|
|
@ -1,8 +1,14 @@
|
|||
#pragma once
|
||||
|
||||
#include <chrono>
|
||||
|
||||
#ifdef __linux__
|
||||
#include <GL/glew.h>
|
||||
#include <GL/gl.h>
|
||||
#elif
|
||||
#include <gl/glew.h>
|
||||
#include <gl/gl.h>
|
||||
#endif
|
||||
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
|
|
|
@ -1,7 +1,12 @@
|
|||
#pragma once
|
||||
|
||||
#ifdef __linux__
|
||||
#include <GL/glew.h>
|
||||
#include <GL/gl.h>
|
||||
#elif
|
||||
#include <gl/glew.h>
|
||||
#include <gl/gl.h>
|
||||
#endif
|
||||
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
|
|
Loading…
Reference in New Issue