2021-12-20 12:08:25 -05:00
|
|
|
#ifndef OPENGL_WINDOW_H
|
|
|
|
#define OPENGL_WINDOW_H
|
|
|
|
|
2022-01-08 22:36:16 -05:00
|
|
|
#include "Navigator/NavCore.h"
|
2021-12-20 12:08:25 -05:00
|
|
|
#include "Navigator/Window.h"
|
2022-01-22 15:45:37 -05:00
|
|
|
#include "Navigator/Renderer/GraphicsContext.h"
|
2021-12-20 12:08:25 -05:00
|
|
|
#include "GLFW/glfw3.h"
|
|
|
|
|
|
|
|
namespace Navigator {
|
|
|
|
|
2022-01-08 22:36:16 -05:00
|
|
|
class NAV_API OpenGLWindow : public Window
|
2021-12-20 12:08:25 -05:00
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
|
|
|
OpenGLWindow(const WindowProperties& props);
|
|
|
|
virtual ~OpenGLWindow();
|
|
|
|
|
|
|
|
void OnUpdate() override;
|
|
|
|
|
|
|
|
inline void SetEventCallback(const EventCallbackFunc& function) override { m_data.event_callback_func = function; }
|
|
|
|
inline unsigned int GetWidth() const override { return m_data.width; }
|
|
|
|
inline unsigned int GetHeight() const override { return m_data.height; }
|
|
|
|
inline std::string GetName() const override { return m_data.name; }
|
|
|
|
void SetVSync(bool enabled) override;
|
|
|
|
bool IsVSync() const override;
|
|
|
|
|
|
|
|
inline virtual void* GetNativeWindow() const override { return m_window; }
|
|
|
|
private:
|
|
|
|
virtual void Init(const WindowProperties& props);
|
|
|
|
virtual void Shutdown();
|
|
|
|
|
|
|
|
GraphicsContext* m_context;
|
|
|
|
|
|
|
|
GLFWwindow* m_window;
|
|
|
|
|
|
|
|
struct Data
|
|
|
|
{
|
|
|
|
int height, width;
|
|
|
|
std::string name;
|
|
|
|
bool vsyncFlag;
|
|
|
|
EventCallbackFunc event_callback_func;
|
|
|
|
};
|
|
|
|
|
|
|
|
Data m_data;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|