refactor: reduce Window references
This commit is contained in:
parent
896ab3597a
commit
74a94f869c
@ -5,7 +5,6 @@
|
||||
#include "content/ContentBuilder.hpp"
|
||||
#include "io/io.hpp"
|
||||
#include "io/engine_paths.hpp"
|
||||
#include "window/Window.hpp"
|
||||
#include "window/Events.hpp"
|
||||
#include "window/input.hpp"
|
||||
#include "voxels/Block.hpp"
|
||||
|
||||
@ -253,7 +253,7 @@ void Hud::updateHotbarControl() {
|
||||
i <= static_cast<int>(keycode::NUM_9);
|
||||
i++
|
||||
) {
|
||||
if (Events::jpressed(i)) {
|
||||
if (Events::jpressed(static_cast<keycode>(i))) {
|
||||
player.setChosenSlot(i - static_cast<int>(keycode::NUM_1));
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,7 +16,6 @@
|
||||
#include "settings.hpp"
|
||||
#include "coders/commons.hpp"
|
||||
#include "util/stringutil.hpp"
|
||||
#include "window/Window.hpp"
|
||||
|
||||
#include <filesystem>
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
@ -34,14 +34,15 @@ void MenuScreen::draw(float delta) {
|
||||
Window::clear();
|
||||
Window::setBgColor(glm::vec3(0.2f));
|
||||
|
||||
uint width = Window::width;
|
||||
uint height = Window::height;
|
||||
|
||||
uicamera->setFov(Window::height);
|
||||
uicamera->setAspectRatio(width / static_cast<float>(height));
|
||||
auto uishader = assets->get<Shader>("ui");
|
||||
uishader->use();
|
||||
uishader->uniformMatrix("u_projview", uicamera->getProjView());
|
||||
|
||||
uint width = Window::width;
|
||||
uint height = Window::height;
|
||||
|
||||
auto bg = assets->get<Texture>("gui/menubg");
|
||||
batch->begin();
|
||||
batch->texture(bg);
|
||||
|
||||
@ -16,4 +16,8 @@ public:
|
||||
glm::ivec2 size() const {
|
||||
return glm::ivec2(width, height);
|
||||
}
|
||||
|
||||
float getRatio() const {
|
||||
return width / static_cast<float>(height);
|
||||
}
|
||||
};
|
||||
|
||||
@ -11,7 +11,6 @@
|
||||
#include "objects/Player.hpp"
|
||||
#include "voxels/Block.hpp"
|
||||
#include "voxels/Chunks.hpp"
|
||||
#include "window/Window.hpp"
|
||||
#include "world/Level.hpp"
|
||||
|
||||
BlockWrapsRenderer::BlockWrapsRenderer(
|
||||
|
||||
@ -6,7 +6,6 @@
|
||||
#include "graphics/core/Atlas.hpp"
|
||||
#include "graphics/core/Texture.hpp"
|
||||
#include "assets/Assets.hpp"
|
||||
#include "window/Window.hpp"
|
||||
#include "voxels/Chunks.hpp"
|
||||
#include "lighting/Lightmap.hpp"
|
||||
#include "settings.hpp"
|
||||
|
||||
@ -4,11 +4,11 @@
|
||||
#include "maths/util.hpp"
|
||||
#include "assets/Assets.hpp"
|
||||
#include "window/Camera.hpp"
|
||||
#include "window/Window.hpp"
|
||||
#include "maths/FrustumCulling.hpp"
|
||||
#include "graphics/core/Font.hpp"
|
||||
#include "graphics/core/Batch3D.hpp"
|
||||
#include "graphics/core/Shader.hpp"
|
||||
#include "graphics/core/DrawContext.hpp"
|
||||
#include "presets/NotePreset.hpp"
|
||||
#include "constants.hpp"
|
||||
|
||||
@ -66,6 +66,7 @@ void TextsRenderer::renderNote(
|
||||
xvec *= 1.0f + scale;
|
||||
yvec *= 1.0f + scale;
|
||||
}
|
||||
const auto& viewport = context.getViewport();
|
||||
if (preset.displayMode == NoteDisplayMode::PROJECTED) {
|
||||
float scale = 1.0f;
|
||||
if (glm::abs(preset.perspective) > 0.0001f) {
|
||||
@ -84,14 +85,14 @@ void TextsRenderer::renderNote(
|
||||
}
|
||||
pos /= projpos.w;
|
||||
pos.z = 0;
|
||||
xvec = {2.0f/Window::width*scale, 0, 0};
|
||||
yvec = {0, 2.0f/Window::height*scale, 0};
|
||||
xvec = {2.0f / viewport.getWidth() * scale, 0, 0};
|
||||
yvec = {0, 2.0f / viewport.getHeight() * scale, 0};
|
||||
} else {
|
||||
auto matrix = camera.getProjView();
|
||||
auto screenPos = matrix * glm::vec4(pos, 1.0f);
|
||||
|
||||
xvec = glm::vec3(2.0f/Window::width*scale, 0, 0);
|
||||
yvec = glm::vec3(0, 2.0f/Window::height*scale, 0);
|
||||
|
||||
xvec = glm::vec3(2.0f / viewport.getWidth() * scale, 0, 0);
|
||||
yvec = glm::vec3(0, 2.0f / viewport.getHeight() * scale, 0);
|
||||
|
||||
pos = screenPos / screenPos.w;
|
||||
}
|
||||
|
||||
@ -338,8 +338,8 @@ void WorldRenderer::draw(
|
||||
|
||||
auto world = level.getWorld();
|
||||
|
||||
const Viewport& vp = pctx.getViewport();
|
||||
camera.aspect = vp.getWidth() / static_cast<float>(vp.getHeight());
|
||||
const auto& vp = pctx.getViewport();
|
||||
camera.setAspectRatio(vp.getRatio());
|
||||
|
||||
const auto& settings = engine.getSettings();
|
||||
const auto& worldInfo = world->getInfo();
|
||||
|
||||
@ -115,8 +115,10 @@ void GUI::actMouse(float delta) {
|
||||
}
|
||||
if (hover) {
|
||||
hover->setHover(true);
|
||||
if (Events::scroll) {
|
||||
hover->scrolled(Events::scroll);
|
||||
|
||||
int scroll = Events::getScroll();
|
||||
if (scroll) {
|
||||
hover->scrolled(scroll);
|
||||
}
|
||||
}
|
||||
this->hover = hover;
|
||||
@ -229,6 +231,7 @@ void GUI::draw(const DrawContext& pctx, const Assets& assets) {
|
||||
}
|
||||
menu->setPos((wsize - menu->getSize()) / 2.0f);
|
||||
uicamera->setFov(wsize.y);
|
||||
uicamera->setAspectRatio(viewport.getRatio());
|
||||
|
||||
auto uishader = assets.get<Shader>("ui");
|
||||
uishader->use();
|
||||
|
||||
@ -68,11 +68,11 @@ void guiutil::alert(
|
||||
));
|
||||
panel->refresh();
|
||||
|
||||
panel->keepAlive(Events::keyCallbacks[keycode::ENTER].add([on_hidden_final](){
|
||||
panel->keepAlive(Events::addKeyCallback(keycode::ENTER, [on_hidden_final](){
|
||||
on_hidden_final();
|
||||
return true;
|
||||
}));
|
||||
panel->keepAlive(Events::keyCallbacks[keycode::ESCAPE].add([on_hidden_final](){
|
||||
panel->keepAlive(Events::addKeyCallback(keycode::ESCAPE, [on_hidden_final](){
|
||||
on_hidden_final();
|
||||
return true;
|
||||
}));
|
||||
@ -130,11 +130,11 @@ void guiutil::confirm(
|
||||
}));
|
||||
|
||||
panel->add(subpanel);
|
||||
panel->keepAlive(Events::keyCallbacks[keycode::ENTER].add([=](){
|
||||
panel->keepAlive(Events::addKeyCallback(keycode::ENTER, [=](){
|
||||
on_confirm_final();
|
||||
return true;
|
||||
}));
|
||||
panel->keepAlive(Events::keyCallbacks[keycode::ESCAPE].add([=](){
|
||||
panel->keepAlive(Events::addKeyCallback(keycode::ESCAPE, [=](){
|
||||
on_deny_final();
|
||||
return true;
|
||||
}));
|
||||
|
||||
@ -18,7 +18,6 @@
|
||||
#include "util/listutil.hpp"
|
||||
#include "util/platform.hpp"
|
||||
#include "window/Events.hpp"
|
||||
#include "window/Window.hpp"
|
||||
#include "world/Level.hpp"
|
||||
#include "world/generator/WorldGenerator.hpp"
|
||||
|
||||
|
||||
@ -42,7 +42,7 @@ static int l_add_callback(lua::State* L) {
|
||||
std::string prefix = bindname.substr(0, pos);
|
||||
if (prefix == "key") {
|
||||
auto key = input_util::keycode_from(bindname.substr(pos + 1));
|
||||
handler = Events::keyCallbacks[key].add(actual_callback);
|
||||
handler = Events::addKeyCallback(key, actual_callback);
|
||||
}
|
||||
}
|
||||
auto callback = [=]() -> bool {
|
||||
|
||||
@ -3,8 +3,6 @@
|
||||
#include <cmath>
|
||||
#include <glm/ext.hpp>
|
||||
|
||||
#include "Window.hpp"
|
||||
|
||||
Camera::Camera(glm::vec3 position, float fov) : fov(fov), position(position) {
|
||||
updateVectors();
|
||||
}
|
||||
@ -30,17 +28,13 @@ void Camera::rotate(float x, float y, float z) {
|
||||
}
|
||||
|
||||
glm::mat4 Camera::getProjection() const {
|
||||
constexpr float epsilon = 1e-6f; // 0.000001
|
||||
float aspect_ratio = this->aspect;
|
||||
if (std::fabs(aspect_ratio) < epsilon) {
|
||||
aspect_ratio = Window::width / static_cast<float>(Window::height);
|
||||
}
|
||||
constexpr float epsilon = 1e-6f;
|
||||
if (perspective) {
|
||||
return glm::perspective(fov * zoom, aspect_ratio, near, far);
|
||||
return glm::perspective(fov * zoom, ar, near, far);
|
||||
} else if (flipped) {
|
||||
return glm::ortho(-0.5f, fov * aspect_ratio-0.5f, fov, 0.0f);
|
||||
return glm::ortho(0.0f, fov * ar, fov, 0.0f);
|
||||
} else {
|
||||
return glm::ortho(-0.5f, fov * aspect_ratio-0.5f, 0.0f, fov);
|
||||
return glm::ortho(0.0f, fov * ar, 0.0f, fov);
|
||||
}
|
||||
}
|
||||
|
||||
@ -69,5 +63,9 @@ float Camera::getFov() const {
|
||||
}
|
||||
|
||||
float Camera::getAspectRatio() const {
|
||||
return aspect;
|
||||
return ar;
|
||||
}
|
||||
|
||||
void Camera::setAspectRatio(float ar) {
|
||||
this->ar = ar;
|
||||
}
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
|
||||
class Camera {
|
||||
float fov = 1.0f;
|
||||
float ar = 0.0f;
|
||||
public:
|
||||
glm::vec3 front {};
|
||||
glm::vec3 up {};
|
||||
@ -17,7 +18,6 @@ public:
|
||||
glm::mat4 rotation {1.0f};
|
||||
bool perspective = true;
|
||||
bool flipped = false;
|
||||
float aspect = 0.0f;
|
||||
float near = 0.05f;
|
||||
float far = 1500.0f;
|
||||
|
||||
@ -37,4 +37,5 @@ public:
|
||||
float getFov() const;
|
||||
|
||||
float getAspectRatio() const;
|
||||
void setAspectRatio(float ar);
|
||||
};
|
||||
|
||||
@ -12,18 +12,27 @@ static debug::Logger logger("events");
|
||||
|
||||
inline constexpr short _MOUSE_KEYS_OFFSET = 1024;
|
||||
|
||||
bool Events::keys[KEYS_BUFFER_SIZE] = {};
|
||||
uint Events::frames[KEYS_BUFFER_SIZE] = {};
|
||||
uint Events::currentFrame = 0;
|
||||
namespace {
|
||||
bool keys[KEYS_BUFFER_SIZE] = {};
|
||||
uint frames[KEYS_BUFFER_SIZE] = {};
|
||||
uint current_frame = 0;
|
||||
bool cursor_drag = false;
|
||||
bool cursor_locked = false;
|
||||
std::unordered_map<keycode, util::HandlersList<>> key_callbacks;
|
||||
}
|
||||
|
||||
int Events::scroll = 0;
|
||||
|
||||
glm::vec2 Events::delta = {};
|
||||
glm::vec2 Events::cursor = {};
|
||||
bool Events::cursorDrag = false;
|
||||
bool Events::cursorLocked = false;
|
||||
|
||||
std::vector<uint> Events::codepoints;
|
||||
std::vector<keycode> Events::pressedKeys;
|
||||
std::unordered_map<std::string, Binding> Events::bindings;
|
||||
std::unordered_map<keycode, util::HandlersList<>> Events::keyCallbacks;
|
||||
|
||||
int Events::getScroll() {
|
||||
return scroll;
|
||||
}
|
||||
|
||||
bool Events::pressed(keycode keycode) {
|
||||
return pressed(static_cast<int>(keycode));
|
||||
@ -41,7 +50,7 @@ bool Events::jpressed(keycode keycode) {
|
||||
}
|
||||
|
||||
bool Events::jpressed(int keycode) {
|
||||
return Events::pressed(keycode) && frames[keycode] == currentFrame;
|
||||
return Events::pressed(keycode) && frames[keycode] == current_frame;
|
||||
}
|
||||
|
||||
bool Events::clicked(mousecode button) {
|
||||
@ -61,15 +70,15 @@ bool Events::jclicked(int button) {
|
||||
}
|
||||
|
||||
void Events::toggleCursor() {
|
||||
cursorDrag = false;
|
||||
cursorLocked = !cursorLocked;
|
||||
cursor_drag = false;
|
||||
cursor_locked = !cursor_locked;
|
||||
Window::setCursorMode(
|
||||
cursorLocked ? GLFW_CURSOR_DISABLED : GLFW_CURSOR_NORMAL
|
||||
cursor_locked ? GLFW_CURSOR_DISABLED : GLFW_CURSOR_NORMAL
|
||||
);
|
||||
}
|
||||
|
||||
void Events::pollEvents() {
|
||||
currentFrame++;
|
||||
current_frame++;
|
||||
delta.x = 0.f;
|
||||
delta.y = 0.f;
|
||||
scroll = 0;
|
||||
@ -155,11 +164,11 @@ bool Events::jactive(const std::string& name) {
|
||||
}
|
||||
|
||||
void Events::setKey(int key, bool b) {
|
||||
Events::keys[key] = b;
|
||||
Events::frames[key] = currentFrame;
|
||||
::keys[key] = b;
|
||||
::frames[key] = current_frame;
|
||||
if (b) {
|
||||
const auto& callbacks = keyCallbacks.find(static_cast<keycode>(key));
|
||||
if (callbacks != keyCallbacks.end()) {
|
||||
const auto& callbacks = ::key_callbacks.find(static_cast<keycode>(key));
|
||||
if (callbacks != ::key_callbacks.end()) {
|
||||
callbacks->second.notify();
|
||||
}
|
||||
}
|
||||
@ -170,18 +179,18 @@ void Events::setButton(int button, bool b) {
|
||||
}
|
||||
|
||||
void Events::setPosition(float xpos, float ypos) {
|
||||
if (Events::cursorDrag) {
|
||||
if (::cursor_drag) {
|
||||
Events::delta.x += xpos - Events::cursor.x;
|
||||
Events::delta.y += ypos - Events::cursor.y;
|
||||
} else {
|
||||
Events::cursorDrag = true;
|
||||
::cursor_drag = true;
|
||||
}
|
||||
Events::cursor.x = xpos;
|
||||
Events::cursor.y = ypos;
|
||||
}
|
||||
|
||||
observer_handler Events::addKeyCallback(keycode key, KeyCallback callback) {
|
||||
return keyCallbacks[key].add(std::move(callback));
|
||||
return ::key_callbacks[key].add(std::move(callback));
|
||||
}
|
||||
|
||||
#include "coders/json.hpp"
|
||||
@ -251,5 +260,5 @@ void Events::enableBindings() {
|
||||
}
|
||||
|
||||
bool Events::isCursorLocked() {
|
||||
return cursorLocked;
|
||||
return cursor_locked;
|
||||
}
|
||||
|
||||
@ -15,56 +15,52 @@ enum class BindType {
|
||||
REBIND = 1
|
||||
};
|
||||
|
||||
class Events {
|
||||
static bool keys[KEYS_BUFFER_SIZE];
|
||||
static uint frames[KEYS_BUFFER_SIZE];
|
||||
static uint currentFrame;
|
||||
static bool cursorDrag;
|
||||
static bool cursorLocked;
|
||||
public:
|
||||
static int scroll;
|
||||
static glm::vec2 delta;
|
||||
static glm::vec2 cursor;
|
||||
static std::vector<uint> codepoints;
|
||||
static std::vector<keycode> pressedKeys;
|
||||
static std::unordered_map<std::string, Binding> bindings;
|
||||
static std::unordered_map<keycode, util::HandlersList<>> keyCallbacks;
|
||||
namespace Events {
|
||||
extern int scroll;
|
||||
extern glm::vec2 delta;
|
||||
extern glm::vec2 cursor;
|
||||
extern std::vector<uint> codepoints;
|
||||
extern std::vector<keycode> pressedKeys;
|
||||
extern std::unordered_map<std::string, Binding> bindings;
|
||||
|
||||
static void pollEvents();
|
||||
void pollEvents();
|
||||
|
||||
static bool pressed(keycode keycode);
|
||||
static bool pressed(int keycode);
|
||||
static bool jpressed(keycode keycode);
|
||||
static bool jpressed(int keycode);
|
||||
int getScroll();
|
||||
|
||||
static bool clicked(mousecode button);
|
||||
static bool clicked(int button);
|
||||
static bool jclicked(mousecode button);
|
||||
static bool jclicked(int button);
|
||||
bool pressed(keycode keycode);
|
||||
bool pressed(int keycode);
|
||||
bool jpressed(keycode keycode);
|
||||
bool jpressed(int keycode);
|
||||
|
||||
static void toggleCursor();
|
||||
bool clicked(mousecode button);
|
||||
bool clicked(int button);
|
||||
bool jclicked(mousecode button);
|
||||
bool jclicked(int button);
|
||||
|
||||
static Binding& getBinding(const std::string& name);
|
||||
static void bind(const std::string& name, inputtype type, keycode code);
|
||||
static void bind(const std::string& name, inputtype type, mousecode code);
|
||||
static void bind(const std::string& name, inputtype type, int code);
|
||||
static void rebind(const std::string& name, inputtype type, int code);
|
||||
static bool active(const std::string& name);
|
||||
static bool jactive(const std::string& name);
|
||||
void toggleCursor();
|
||||
|
||||
static observer_handler addKeyCallback(keycode key, KeyCallback callback);
|
||||
Binding& getBinding(const std::string& name);
|
||||
void bind(const std::string& name, inputtype type, keycode code);
|
||||
void bind(const std::string& name, inputtype type, mousecode code);
|
||||
void bind(const std::string& name, inputtype type, int code);
|
||||
void rebind(const std::string& name, inputtype type, int code);
|
||||
bool active(const std::string& name);
|
||||
bool jactive(const std::string& name);
|
||||
|
||||
static void setKey(int key, bool b);
|
||||
static void setButton(int button, bool b);
|
||||
observer_handler addKeyCallback(keycode key, KeyCallback callback);
|
||||
|
||||
static void setPosition(float xpos, float ypos);
|
||||
void setKey(int key, bool b);
|
||||
void setButton(int button, bool b);
|
||||
|
||||
static std::string writeBindings();
|
||||
static void loadBindings(
|
||||
const std::string& filename, const std::string& source,
|
||||
void setPosition(float xpos, float ypos);
|
||||
|
||||
std::string writeBindings();
|
||||
void loadBindings(
|
||||
const std::string& filename,
|
||||
const std::string& source,
|
||||
BindType bindType
|
||||
);
|
||||
static void enableBindings();
|
||||
void enableBindings();
|
||||
|
||||
static bool isCursorLocked();
|
||||
bool isCursorLocked();
|
||||
};
|
||||
|
||||
@ -19,18 +19,21 @@
|
||||
|
||||
static debug::Logger logger("window");
|
||||
|
||||
GLFWwindow* Window::window = nullptr;
|
||||
DisplaySettings* Window::settings = nullptr;
|
||||
std::stack<glm::vec4> Window::scissorStack;
|
||||
glm::vec4 Window::scissorArea;
|
||||
namespace {
|
||||
GLFWwindow* window = nullptr;
|
||||
DisplaySettings* settings = nullptr;
|
||||
std::stack<glm::vec4> scissorStack;
|
||||
glm::vec4 scissorArea;
|
||||
int framerate = -1;
|
||||
double prevSwap = 0.0;
|
||||
bool fullscreen = false;
|
||||
CursorShape cursor = CursorShape::ARROW;
|
||||
int posX = 0;
|
||||
int posY = 0;
|
||||
}
|
||||
|
||||
uint Window::width = 0;
|
||||
uint Window::height = 0;
|
||||
int Window::posX = 0;
|
||||
int Window::posY = 0;
|
||||
int Window::framerate = -1;
|
||||
double Window::prevSwap = 0.0;
|
||||
bool Window::fullscreen = false;
|
||||
CursorShape Window::cursor = CursorShape::ARROW;
|
||||
|
||||
static util::ObjectsKeeper observers_keeper;
|
||||
static std::unordered_set<std::string> extensionsCache;
|
||||
@ -173,7 +176,7 @@ static void glfw_error_callback(int error, const char* description) {
|
||||
static GLFWcursor* standard_cursors[static_cast<int>(CursorShape::LAST) + 1] = {};
|
||||
|
||||
int Window::initialize(DisplaySettings* settings) {
|
||||
Window::settings = settings;
|
||||
::settings = settings;
|
||||
Window::width = settings->width.get();
|
||||
Window::height = settings->height.get();
|
||||
|
||||
@ -381,10 +384,10 @@ void Window::setShouldClose(bool flag) {
|
||||
}
|
||||
|
||||
void Window::setFramerate(int framerate) {
|
||||
if ((framerate != -1) != (Window::framerate != -1)) {
|
||||
if ((framerate != -1) != (::framerate != -1)) {
|
||||
glfwSwapInterval(framerate == -1);
|
||||
}
|
||||
Window::framerate = framerate;
|
||||
::framerate = framerate;
|
||||
}
|
||||
|
||||
void Window::toggleFullscreen() {
|
||||
@ -472,7 +475,7 @@ void Window::setClipboardText(const char* text) {
|
||||
glfwSetClipboardString(window, text);
|
||||
}
|
||||
|
||||
bool Window::tryToMaximize(GLFWwindow* window, GLFWmonitor* monitor) {
|
||||
static bool try_to_maximize(GLFWwindow* window, GLFWmonitor* monitor) {
|
||||
glm::ivec4 windowFrame(0);
|
||||
glm::ivec4 workArea(0);
|
||||
glfwGetWindowFrameSize(
|
||||
|
||||
@ -10,60 +10,45 @@
|
||||
|
||||
class ImageData;
|
||||
struct DisplaySettings;
|
||||
struct GLFWwindow;
|
||||
struct GLFWmonitor;
|
||||
|
||||
class Window {
|
||||
static GLFWwindow* window;
|
||||
static DisplaySettings* settings;
|
||||
static std::stack<glm::vec4> scissorStack;
|
||||
static glm::vec4 scissorArea;
|
||||
static bool fullscreen;
|
||||
static int framerate;
|
||||
static double prevSwap;
|
||||
static CursorShape cursor;
|
||||
namespace Window {
|
||||
extern uint width;
|
||||
extern uint height;
|
||||
|
||||
static bool tryToMaximize(GLFWwindow* window, GLFWmonitor* monitor);
|
||||
static bool isGlExtensionSupported(const char *extension);
|
||||
public:
|
||||
static int posX;
|
||||
static int posY;
|
||||
static uint width;
|
||||
static uint height;
|
||||
static int initialize(DisplaySettings* settings);
|
||||
static void terminate();
|
||||
int initialize(DisplaySettings* settings);
|
||||
void terminate();
|
||||
|
||||
static void viewport(int x, int y, int width, int height);
|
||||
static void setCursorMode(int mode);
|
||||
static bool isShouldClose();
|
||||
static void setShouldClose(bool flag);
|
||||
static void swapBuffers();
|
||||
static void setFramerate(int interval);
|
||||
static void toggleFullscreen();
|
||||
static bool isFullscreen();
|
||||
static bool isMaximized();
|
||||
static bool isFocused();
|
||||
static bool isIconified();
|
||||
void viewport(int x, int y, int width, int height);
|
||||
void setCursorMode(int mode);
|
||||
bool isShouldClose();
|
||||
void setShouldClose(bool flag);
|
||||
void swapBuffers();
|
||||
void setFramerate(int interval);
|
||||
void toggleFullscreen();
|
||||
bool isFullscreen();
|
||||
bool isMaximized();
|
||||
bool isFocused();
|
||||
bool isIconified();
|
||||
|
||||
static void pushScissor(glm::vec4 area);
|
||||
static void popScissor();
|
||||
static void resetScissor();
|
||||
void pushScissor(glm::vec4 area);
|
||||
void popScissor();
|
||||
void resetScissor();
|
||||
|
||||
static void setCursor(CursorShape shape);
|
||||
void setCursor(CursorShape shape);
|
||||
|
||||
static void clear();
|
||||
static void clearDepth();
|
||||
static void setBgColor(glm::vec3 color);
|
||||
static void setBgColor(glm::vec4 color);
|
||||
static double time();
|
||||
static const char* getClipboardText();
|
||||
static void setClipboardText(const char* text);
|
||||
static DisplaySettings* getSettings();
|
||||
static void setIcon(const ImageData* image);
|
||||
void clear();
|
||||
void clearDepth();
|
||||
void setBgColor(glm::vec3 color);
|
||||
void setBgColor(glm::vec4 color);
|
||||
double time();
|
||||
const char* getClipboardText();
|
||||
void setClipboardText(const char* text);
|
||||
DisplaySettings* getSettings();
|
||||
void setIcon(const ImageData* image);
|
||||
|
||||
static glm::vec2 size() {
|
||||
inline glm::vec2 size() {
|
||||
return glm::vec2(width, height);
|
||||
}
|
||||
|
||||
static std::unique_ptr<ImageData> takeScreenshot();
|
||||
std::unique_ptr<ImageData> takeScreenshot();
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user