106 lines
2.2 KiB
C++
106 lines
2.2 KiB
C++
#include "Window.hpp"
|
|
#include "raylib.h"
|
|
|
|
namespace DREAM {
|
|
// TODO: Implement Window functions
|
|
|
|
// TODO: Replace anonymous namespace with struct when config
|
|
// exists.
|
|
namespace {
|
|
int m_width = 1280;
|
|
int m_height = 720;
|
|
|
|
int m_windowX;
|
|
int m_windowY;
|
|
|
|
std::string m_title;
|
|
|
|
bool m_fullscreen = false;
|
|
bool m_vsync = false;
|
|
bool m_resizable = false;
|
|
}
|
|
|
|
// void Window::init(WindowConfig &config) {
|
|
|
|
// }
|
|
|
|
void Window::setWidth(int width) {
|
|
SetWindowSize(width, m_height);
|
|
m_width = width;
|
|
}
|
|
|
|
void Window::setHeight(int height) {
|
|
SetWindowSize(m_height, height);
|
|
m_height = height;
|
|
}
|
|
|
|
void Window::setSize(int width, int height) {
|
|
SetWindowSize(width, height);
|
|
m_width = width;
|
|
m_height = height;
|
|
}
|
|
|
|
void Window::setFullscreen(bool enabled) {
|
|
if (m_fullscreen != enabled) {
|
|
ToggleFullscreen();
|
|
m_fullscreen = enabled;
|
|
}
|
|
}
|
|
|
|
void Window::toggleFullscreen() {
|
|
ToggleFullscreen();
|
|
m_fullscreen = !m_fullscreen;
|
|
}
|
|
|
|
void Window::setTitle(const std::string &title) {
|
|
SetWindowTitle(title.c_str());
|
|
m_title = title;
|
|
}
|
|
|
|
void Window::setPosition(int x, int y) {
|
|
SetWindowPosition(x, y);
|
|
m_windowX = x;
|
|
m_windowY = y;
|
|
}
|
|
|
|
int Window::getWidth() {
|
|
return GetScreenWidth();
|
|
}
|
|
|
|
int Window::getHeight() {
|
|
return GetScreenHeight();
|
|
}
|
|
|
|
float Window::getAspectRatio() {
|
|
return static_cast<float>(m_width) / static_cast<float>(m_height);
|
|
}
|
|
|
|
bool Window::isFullscreen() {
|
|
return m_fullscreen;
|
|
}
|
|
|
|
bool Window::isVSyncEnabled() {
|
|
return m_vsync;
|
|
}
|
|
|
|
bool Window::isResizable() {
|
|
return m_resizable;
|
|
}
|
|
|
|
int Window::getMonitorIndex() {
|
|
return GetCurrentMonitor();
|
|
}
|
|
|
|
int Window::getMonitorRefreshRate() {
|
|
return GetMonitorRefreshRate(getMonitorIndex());
|
|
}
|
|
|
|
int Window::getMonitorWidth() {
|
|
return GetMonitorWidth(getMonitorIndex());
|
|
}
|
|
|
|
int Window::getMonitorHeight() {
|
|
return GetMonitorHeight(getMonitorIndex());
|
|
}
|
|
}
|