diff --git a/cmake-build-debug/Testing/Temporary/LastTest.log b/cmake-build-debug/Testing/Temporary/LastTest.log index 93ffc61..a143b58 100644 --- a/cmake-build-debug/Testing/Temporary/LastTest.log +++ b/cmake-build-debug/Testing/Temporary/LastTest.log @@ -1,3 +1,3 @@ -Start testing: Jan 16 14:18 EST +Start testing: Jan 17 09:27 EST ---------------------------------------------------------- -End testing: Jan 16 14:18 EST +End testing: Jan 17 09:27 EST diff --git a/include/window/window.h b/include/window/window.h index d6ada62..64be93f 100644 --- a/include/window/window.h +++ b/include/window/window.h @@ -9,25 +9,20 @@ #include class glut_window : public blt::window { -private: - +protected: + void createGLUTWindow(); + void destroyGLUTWindow(); public: - glut_window(); - virtual void createWindow() override; - virtual void destroyWindow() override; - virtual ~glut_window(); + glut_window() = default; + glut_window(int width, int height); + void createWindow() override; + void destroyWindow() override; + ~glut_window() override; - virtual bool setResizeable(bool resizeEnabled) override; - virtual bool setWindowSize(int width, int height) override; - virtual int getWidth() override; - virtual int getHeight() override; + bool setResizeable(bool resizeEnabled) override; + bool setWindowSize(int width, int height) override; - virtual bool isKeyDown(int key) override; - virtual bool isMouseDown(int button) override; - // Function signature is window pointer to this, key press, pressed/released (true/false) - virtual void registerKeyListener(std::function listener) override; - // Function signature is window pointer to this, mouse button press, pressed/released (true/false) - virtual void registerMouseListener(std::function listener) override; + void render(); }; #endif //FINAL_PROJECT_WINDOW_H diff --git a/libraries/BLT b/libraries/BLT index 0d2292e..12ec6a9 160000 --- a/libraries/BLT +++ b/libraries/BLT @@ -1 +1 @@ -Subproject commit 0d2292e1d428f10d0102005e4580f1cbb5803a27 +Subproject commit 12ec6a9334f4343e0815059070fc93ef86474633 diff --git a/src/window/window.cpp b/src/window/window.cpp index 0b4503a..199c2e1 100644 --- a/src/window/window.cpp +++ b/src/window/window.cpp @@ -3,21 +3,22 @@ * Copyright (c) Brett Terpstra 2023 All Rights Reserved */ #include +#include -glut_window::glut_window() { - +glut_window::glut_window(int width, int height) : window(width, height) { + createGLUTWindow(); } void glut_window::createWindow() { - + createGLUTWindow(); } void glut_window::destroyWindow() { - + destroyGLUTWindow(); } glut_window::~glut_window() { - + destroyGLUTWindow(); } bool glut_window::setResizeable(bool resizeEnabled) { @@ -25,29 +26,34 @@ bool glut_window::setResizeable(bool resizeEnabled) { } bool glut_window::setWindowSize(int width, int height) { - return false; + m_width = width; + m_height = height; + return true; } -int glut_window::getWidth() { - return 0; +// TODO: a less hacky way of doing this. +blt::window* currentlyActiveWindow = nullptr; + +void glut_window_render(){ + if (currentlyActiveWindow != nullptr) + ((glut_window*)currentlyActiveWindow)->render(); } -int glut_window::getHeight() { - return 0; +void glut_window::createGLUTWindow() { + glutInit(nullptr, nullptr); + glutInitWindowSize(m_width, m_height); + glutInitDisplayMode(GLUT_RGBA); + glutCreateWindow("UwU Final Project!"); + + currentlyActiveWindow = this; + glutDisplayFunc(glut_window_render); } -bool glut_window::isKeyDown(int key) { - return false; -} - -bool glut_window::isMouseDown(int button) { - return false; -} - -void glut_window::registerKeyListener(std::function<(void) (bool)...> listener) { +void glut_window::destroyGLUTWindow() { } -void glut_window::registerMouseListener(std::function<(void) (bool)...> listener) { - +void glut_window::render() { + for (const auto& HelloTAThisIsAVeryLargeNameForNoGoodReasonItIsntEvenDescriptive : renderFunctions) + HelloTAThisIsAVeryLargeNameForNoGoodReasonItIsntEvenDescriptive(this); }