diff --git a/inferno/src/inferno/render/context.cpp b/inferno/src/inferno/render/context.cpp index 41ed0e2..558a517 100644 --- a/inferno/src/inferno/render/context.cpp +++ b/inferno/src/inferno/render/context.cpp @@ -13,6 +13,8 @@ namespace Inferno { { } +// ----------------------------------------- + void Context::initialize() { // Initialize glad @@ -34,7 +36,7 @@ namespace Inferno { } // Set viewport - glViewport(0, 0, w.getWidth(), w.getHeight()); + this->setViewport(0, 0, w.getWidth(), w.getHeight()); // Enable z-buffer / depth buffer glEnable(GL_DEPTH_TEST); @@ -49,4 +51,10 @@ namespace Inferno { { } +// ----------------------------------------- + + void Context::setViewport(int x, int y, int width, int height) const + { + glViewport(x, y, width, height); + } } diff --git a/inferno/src/inferno/render/context.h b/inferno/src/inferno/render/context.h index 6296ff5..c012705 100644 --- a/inferno/src/inferno/render/context.h +++ b/inferno/src/inferno/render/context.h @@ -10,11 +10,17 @@ namespace Inferno { Context(GLFWwindow* window); // virtual ~Context(); +// ----------------------------------------- + void initialize(); void update(); // void render(); void destroy(); +// ----------------------------------------- + + void setViewport(int x, int y, int width, int height) const; + private: GLFWwindow* m_window; }; diff --git a/inferno/src/inferno/window.cpp b/inferno/src/inferno/window.cpp index 23a6547..cce7b89 100644 --- a/inferno/src/inferno/window.cpp +++ b/inferno/src/inferno/window.cpp @@ -33,6 +33,8 @@ namespace Inferno { this->destroy(); } +// ----------------------------------------- + void Window::initialize() { const char* title = m_windowProperties.title; @@ -173,6 +175,8 @@ namespace Inferno { } } +// ----------------------------------------- + void Window::setWindowMonitor() { GLFWmonitor* monitor = glfwGetPrimaryMonitor(); diff --git a/inferno/src/inferno/window.h b/inferno/src/inferno/window.h index 5b57d55..7748d73 100644 --- a/inferno/src/inferno/window.h +++ b/inferno/src/inferno/window.h @@ -12,8 +12,8 @@ namespace Inferno { struct WindowProperties { const char* title = "Inferno"; - unsigned int width = 1280; - unsigned int height = 720; + int width = 1280; + int height = 720; const char* fullscreen = "windowed"; // windowed/fullscreen/borderless bool vsync = true; }; @@ -23,6 +23,8 @@ namespace Inferno { Window(); virtual ~Window(); +// ----------------------------------------- + void initialize(); void update(); // void render(); @@ -37,6 +39,7 @@ namespace Inferno { inline bool isVSync() const { return m_windowProperties.vsync; } inline GLFWwindow* getWindow() const { return m_window; } + inline Context* getContext() const { return m_context; } inline void setEventCallback(std::function callback) { m_eventCallback = callback; }