singleton for window

This commit is contained in:
arthur.jamet
2021-05-21 12:38:10 +02:00
parent 5d2493ad63
commit e4bd77197a
11 changed files with 47 additions and 24 deletions

View File

@@ -22,14 +22,14 @@
namespace RAY {
class Window: public Canvas {
public:
//! @brief Creates window, and opens it if openNow is set to true
Window(int width, int height, const std::string title, bool openNow = false);
//! @return A widow insta,ce. Only one window can be open at a time
static Window &getInstance(int width, int height, const std::string &title, bool openNow = true);
//! @brief A default copy constructor
Window(const Window &window) = default;
Window(const Window &window) = delete;
//! @brief A window is assignable
Window &operator=(const Window &window) = default;
Window &operator=(const Window &window) = delete;
//! @brief Closes window if still open
~Window() = default;
@@ -108,6 +108,8 @@ namespace RAY {
void draw(const Mesh &mesh, const Material &material, const Matrix &transform);
private:
//! @brief Creates window, and opens it if openNow is set to true
Window(int width, int height, const std::string &title, bool openNow = true);
//! @brief Dimension of window
RAY::Vector2 _dimensions;