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>
|
2021-08-29 16:14:23 -07:00
|
|
|
#include "util/GL.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"
|
2021-10-11 12:46:57 -07:00
|
|
|
#include "util/EventEmitter.h"
|
2021-08-04 22:17:40 -07:00
|
|
|
|
2019-12-13 01:59:42 -08:00
|
|
|
#include "Input.h"
|
2018-11-26 17:52:44 -08:00
|
|
|
|
2021-10-11 12:46:57 -07:00
|
|
|
namespace {
|
|
|
|
enum class WinEvt { Resize };
|
|
|
|
}
|
|
|
|
|
|
|
|
class Window : public EventEmitter<Event<WinEvt::Resize, ivec2>> {
|
2021-08-04 22:17:40 -07:00
|
|
|
public:
|
2021-10-11 12:46:57 -07:00
|
|
|
typedef WinEvt Event;
|
|
|
|
|
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
|
|
|
ivec2 getSize();
|
2020-11-08 22:57:34 -08:00
|
|
|
|
|
|
|
void setCursorHand(bool hand);
|
|
|
|
|
|
|
|
~Window();
|
|
|
|
|
|
|
|
Input input;
|
2021-08-23 23:31:29 -07:00
|
|
|
|
2020-11-08 22:57:34 -08:00
|
|
|
GLFWwindow* mainWindow = nullptr;
|
|
|
|
|
2021-08-23 23:31:29 -07:00
|
|
|
private:
|
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;
|
2018-11-26 17:52:44 -08:00
|
|
|
};
|
|
|
|
|