sculpto
window.h
Go to the documentation of this file.
1/*!****************************************************************//*!*
2 * \file window.h
3 * \brief Abstract, platform independent class definition module.
4 *
5 * \author Sabitov Kirill
6 * \date 22 June 2022
7 *********************************************************************/
8
9#pragma once
10
11#include "input.h"
12#include "../events/events.h"
14
15namespace scl
16{
18 class window
19 {
20 public:
22 struct data
23 {
24 public:
28 std::string Title;
29
31 data() = default;
32 data(const data &Other) = default;
33 data(int Width, int Height, const std::string &Title) :
35 };
36
38 static const int ViewportId = 0;
39
40 protected:
42 bool IsInitialised { false };
43 bool IsFullscreen { false };
45
46 public:
48 const data &GetWindowData() const { return Data; }
50 const window_handle &GetHandle() const { return Handle; }
52 bool GetIsInitialised() const { return IsInitialised; }
53
54 public:
55 /*!**
56 * Copying and moving constructors,
57 * lvalue and rvalue copy assigment and move assigment operators
58 * removal due to window concept (window loop execution at runtime).
59 ***/
60 window(const window &) = delete;
61 window(const window &&) = delete;
62 window &operator=(const window &) = delete;
63 window &operator=(const window &&) = delete;
64 window operator=(const window &) const = delete;
65 window operator=(const window &&) const = delete;
66
67 /*!*
68 * Windows OS specific window construcotor.
69 * Initialise window, but don't shows it and don't start message loop.
70 * If initialisation successful 'IsStartupSuccess' would be set to true
71 * and then window message loop could be started.
72 *
73 * \param Width - Width of the creating window in pixels.
74 * \param Height - Height of creating window in pixels.
75 * \param Name - Title of the creating window.
76 * \param VSync - vertical syncrosination enabling flag.
77 */
78 window(int Width, int Height, const std::string &Title);
79
80 /*!*
81 * Create window depends on platform function.
82 *
83 * \param Width - Width of the creating window in pixels.
84 * \param Height - Height of creating window in pixels.
85 * \param Title - Title of the creating window.
86 * \param VSync - vertical syncrosination enabling flag.
87 * \Return Created window pointer.
88 */
89 static unique<window> Create(int Width, int Height, const std::string &Title);
90
91 /*!*
92 * Window update function.
93 *
94 * \param None.
95 * \return None.
96 */
97 virtual void Update() {}
98
99 /*!*
100 * Woggle window display mode (fullscreen/windowed) function.
101 *
102 * \param None.
103 * \return None.
104 */
105 virtual void FlipFullscreen() {}
106
107 /*!*
108 * Change window title to specified.
109 *
110 * \param NewTitle - new window title.
111 * \return None.
112 */
113 virtual void ChangeTitle(const std::string &NewTitle) {}
114
115 /*!*
116 * Window shut down function. Closes window and create window close event.
117 *
118 * \param None.
119 * \return None.
120 */
121 virtual void ShutDown() = 0;
122 };
123}
virtual void Update()
Definition: window.h:97
virtual void ChangeTitle(const std::string &NewTitle)
Definition: window.h:113
window_handle Handle
Definition: window.h:41
static const int ViewportId
Definition: window.h:38
data Data
Definition: window.h:44
window(const window &&)=delete
window(const window &)=delete
bool GetIsInitialised() const
Definition: window.h:52
window & operator=(const window &&)=delete
const data & GetWindowData() const
Definition: window.h:48
static unique< window > Create(int Width, int Height, const std::string &Title)
Definition: window.cpp:20
const window_handle & GetHandle() const
Definition: window.h:50
window operator=(const window &&) const =delete
virtual void ShutDown()=0
window & operator=(const window &)=delete
bool IsInitialised
Definition: window.h:42
virtual void FlipFullscreen()
Definition: window.h:105
window operator=(const window &) const =delete
bool IsFullscreen
Definition: window.h:43
Event dispatcher class implementation module.
Abstract, platform independent input system definition mpdule.
Definition: base.h:33
std::unique_ptr< T > unique
Definition: smart_ptr.h:25
int window_handle
Definition: base.h:55
data(int Width, int Height, const std::string &Title)
Definition: window.h:33
std::string Title
Definition: window.h:28
data(const data &Other)=default