Zepha/src/client/Window.h

53 lines
786 B
C
Raw Normal View History

//
// Created by aurailus on 26/11/18.
//
#pragma once
2021-08-04 22:17:40 -07:00
#include <list>
2019-09-04 14:21:38 -07:00
#include <GL/glew.h>
#include <GLFW/glfw3.h>
2021-08-04 22:17:40 -07:00
#include "util/Types.h"
#include "Input.h"
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 {};
};