Working on Window
This commit is contained in:
@@ -1,3 +1,103 @@
|
||||
#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 (enabled) {
|
||||
// IsWindowFullscreen();
|
||||
// }
|
||||
// }
|
||||
|
||||
void Window::toggleFullscreen() {
|
||||
ToggleFullscreen();
|
||||
}
|
||||
|
||||
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 GetScreen
|
||||
// }
|
||||
|
||||
bool Window::isFullscreen() {
|
||||
return IsWindowFullscreen();
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user