Zepha/src/client/Window.h

52 lines
697 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>
2021-08-29 16:14:23 -07:00
#include "util/GL.h"
#include <GLFW/glfw3.h>
2021-08-04 22:17:40 -07:00
#include "util/Types.h"
#include "util/EventEmitter.h"
2021-08-04 22:17:40 -07:00
#include "Input.h"
namespace {
enum class WinEvt { Resize };
}
class Window : public EventEmitter<Event<WinEvt::Resize, ivec2>> {
2021-08-04 22:17:40 -07:00
public:
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;
2020-11-08 22:57:34 -08:00
GLFWwindow* mainWindow = nullptr;
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;
};