2018-11-26 17:52:44 -08:00
|
|
|
//
|
|
|
|
// Created by aurailus on 26/11/18.
|
|
|
|
//
|
|
|
|
|
2019-08-24 17:39:35 -07:00
|
|
|
#pragma once
|
2018-11-26 17:52:44 -08:00
|
|
|
|
2021-08-04 22:17:40 -07:00
|
|
|
#include <list>
|
2019-09-04 14:21:38 -07:00
|
|
|
#include <GL/glew.h>
|
2019-07-17 22:42:42 -07:00
|
|
|
#include <GLFW/glfw3.h>
|
2020-05-07 17:21:56 -07:00
|
|
|
|
2021-08-04 22:17:40 -07:00
|
|
|
#include "util/Types.h"
|
|
|
|
|
2019-12-13 01:59:42 -08:00
|
|
|
#include "Input.h"
|
2018-11-26 17:52:44 -08:00
|
|
|
|
|
|
|
class Window {
|
2021-08-04 22:17:40 -07:00
|
|
|
public:
|
|
|
|
using RCBLock = sptr<bool>;
|
|
|
|
|
2020-11-08 22:57:34 -08:00
|
|
|
Window();
|
|
|
|
|
2021-08-04 22:17:40 -07:00
|
|
|
Window(ivec2 win);
|
2020-11-08 22:57:34 -08:00
|
|
|
|
|
|
|
void update();
|
|
|
|
|
|
|
|
bool shouldClose();
|
|
|
|
|
|
|
|
void swapBuffers();
|
|
|
|
|
2021-08-04 22:17:40 -07:00
|
|
|
RCBLock onResize(std::function<void(ivec2)> cb);
|
2020-11-08 22:57:34 -08:00
|
|
|
|
2021-08-04 22:17:40 -07:00
|
|
|
ivec2 getSize();
|
2020-11-08 22:57:34 -08:00
|
|
|
|
|
|
|
void setCursorHand(bool hand);
|
|
|
|
|
|
|
|
~Window();
|
|
|
|
|
|
|
|
Input input;
|
|
|
|
GLFWwindow* mainWindow = nullptr;
|
2021-08-04 22:17:40 -07:00
|
|
|
|
|
|
|
private:
|
|
|
|
static void scrollCallback(GLFWwindow* window, f64 xO, f64 yO);
|
2020-11-08 22:57:34 -08:00
|
|
|
|
2021-08-04 22:17:40 -07:00
|
|
|
static void resizeCallback(GLFWwindow* window, i32 width, i32 height);
|
2020-11-08 22:57:34 -08:00
|
|
|
|
|
|
|
GLFWcursor* handCursor = nullptr;
|
|
|
|
|
2021-08-04 22:17:40 -07:00
|
|
|
ivec2 win;
|
|
|
|
ivec2 center;
|
2020-11-08 22:57:34 -08:00
|
|
|
|
2021-08-04 22:17:40 -07:00
|
|
|
std::list<std::pair<RCBLock, std::function<void(ivec2)>>> resizeCallbacks {};
|
2018-11-26 17:52:44 -08:00
|
|
|
};
|
|
|
|
|