v1
Brett 2023-01-17 11:13:25 -05:00
parent 4269e52e31
commit 30eb1938cc
2 changed files with 4 additions and 15 deletions

View File

@ -19,16 +19,10 @@
namespace blt { namespace blt {
class window;
#define WINDOW_MAP BLT_MAP_FUNC<window*, window*>
extern WINDOW_MAP activeWindows;
class window { class window {
protected: protected:
bool m_windowOpen = true; bool m_windowOpen = true;
int m_width, m_height; int m_width = 800, m_height = 600;
std::vector<std::function<void(window*)>> renderFunctions{}; std::vector<std::function<void(window*)>> renderFunctions{};
std::vector<std::function<void(window*, int, bool)>> keyListeners{}; std::vector<std::function<void(window*, int, bool)>> keyListeners{};
@ -37,20 +31,15 @@ class window {
KEY_MAP keysDown{}; KEY_MAP keysDown{};
KEY_MAP mouseDown{}; KEY_MAP mouseDown{};
public: public:
window() { window() = default;
activeWindows.insert({this, this});
}
window(int width, int height) { window(int width, int height) {
activeWindows.insert({this, this});
m_width = width; m_width = width;
m_height = height; m_height = height;
} }
virtual void createWindow() = 0; virtual void createWindow() = 0;
virtual void startMainLoop() = 0; virtual void startMainLoop() = 0;
virtual void destroyWindow() = 0; virtual void destroyWindow() = 0;
virtual ~window() { virtual ~window() = 0;
activeWindows.insert({this, nullptr});
};
virtual inline bool setResizeable(bool resizeEnabled) = 0; virtual inline bool setResizeable(bool resizeEnabled) = 0;
virtual inline bool setWindowSize(int width, int height) = 0; virtual inline bool setWindowSize(int width, int height) = 0;

View File

@ -6,5 +6,5 @@
#include <blt/window/window.h> #include <blt/window/window.h>
namespace blt { namespace blt {
WINDOW_MAP activeWindows;
} }