COSC-3P98-Final-Project/include/render/window.h

68 lines
1.4 KiB
C
Raw Permalink Normal View History

/*
* Created by Brett Terpstra 6920201 on 16/01/23.
* Copyright (c) Brett Terpstra 2023 All Rights Reserved
*/
#ifndef FINAL_PROJECT_WINDOW_H
#define FINAL_PROJECT_WINDOW_H
2023-02-08 23:23:42 -05:00
#ifndef FP_FAR_PLANE
#define FP_FAR_PLANE 1000.0f
#define FP_NEAR_PLANE 0.1f
#endif
2023-02-08 13:42:39 -05:00
// emscripten provides its own gl bindings.
#ifndef __EMSCRIPTEN__
#include <glad/gl.h>
2023-02-11 16:26:47 -05:00
#else
2023-02-13 23:37:18 -05:00
#include <GLES2/gl2.h>
2023-02-11 16:26:47 -05:00
#include <emscripten.h>
#define GL_GLEXT_PROTOTYPES
2023-02-13 23:37:18 -05:00
#define EGL_EGLEXT_PROTOTYPES
2023-02-08 13:42:39 -05:00
#endif
#include <GLFW/glfw3.h>
#include <blt/math/math.h>
namespace fp::window {
2023-02-08 23:23:42 -05:00
/**
* Handles all the init setup for creating a GLFW window.
* @param width width of the window
* @param height height of the window
*/
2023-02-08 13:42:39 -05:00
void init(int width = 1440, int height = 720);
2023-02-08 13:42:39 -05:00
void update();
2023-02-08 13:42:39 -05:00
void close();
2023-02-08 13:42:39 -05:00
bool isCloseRequested();
2023-02-08 13:42:39 -05:00
GLFWwindow* getWindow();
2023-02-08 13:42:39 -05:00
bool isKeyPressed(int key);
2023-02-08 13:42:39 -05:00
bool isMousePressed(int button);
2023-02-08 13:42:39 -05:00
bool mouseState();
bool keyState();
2023-02-11 16:26:47 -05:00
bool mouseGrabbed();
void mouseGrabbed(bool state);
float mouseDX();
float mouseDY();
// seconds
double getFrameDelta();
// nanoseconds
long getFrameDeltaRaw();
2023-03-05 15:21:35 -05:00
// nanoseconds, from current time not last frame
long getCurrentDelta();
2023-02-11 16:26:47 -05:00
2023-02-08 13:42:39 -05:00
const blt::mat4x4& getPerspectiveMatrix();
2023-02-08 23:23:42 -05:00
void setFOV(float new_fov);
}
#endif //FINAL_PROJECT_WINDOW_H