NRE_InternalWindow.hpp
Go to the documentation of this file.
1 
10  #pragma once
11 
12  #include <Header/NRE_Math.hpp>
13  #include <Utility/String/NRE_String.hpp>
14  #include <Utility/Singleton/NRE_Singleton.hpp>
15 
16  #include "../Style/NRE_WindowStyle.hpp"
17  #include "../../Driver/NRE_GraphicsDriver.hpp"
18 
23  namespace NRE {
28  namespace Graphics {
29 
35  private : // Fields
36  NativeWindowType internal;
37  Id id;
38  #ifdef WIN32 // Windows
39  HDC device;
40  LONG_PTR savedStyle;
41  LONG_PTR savedExStyle;
42  bool savedInFullscreen;
43  RECT savedRect;
44  #elif __linux__ // Linux
45  int xId;
46  #endif
47 
48  public : // Methods
49  //## Constructor ##//
53  InternalWindow() = delete;
62  InternalWindow(Id i, Utility::String const& title, Math::Point2D<unsigned int> const& position, Math::Vector2D<unsigned int> const& size, WindowStyle const& style);
70  InternalWindow(Id i, Utility::String const& title, Math::Vector2D<unsigned int> const& size, WindowStyle const& style);
71 
72  //## Copy Constructor ##//
77  InternalWindow(InternalWindow const& inl) = delete;
78 
79  //## Move Constructor ##//
84  InternalWindow(InternalWindow && inl) = delete;
85 
86  //## Deconstructor ##//
90  ~InternalWindow() = default;
91 
92  //## Getter ##//
96  Math::Point2D<unsigned int> getPosition() const;
97  #ifdef _WIN32
98 
101  HDC& getDevice();
102  #elif __linux__
103 
106  int getXId() const;
107  #endif
108 
109  //## Methods ##//
113  void close();
117  void toggleFullscreen(bool inFullscreen);
121  void refresh();
122 
123  //## Assignment Operator ##//
129  InternalWindow& operator =(InternalWindow const& inl) = delete;
135  InternalWindow& operator =(InternalWindow && inl) = delete;
136 
137  private : // Methods
138  #ifdef _WIN32 // Windows
139 
147  static LRESULT CALLBACK internalDispatcher(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
153  static Math::Point2D<unsigned int> computeCenteredPosition(Math::Vector2D<unsigned int> size);
154  #elif __linux__ // Linux
155 
159  void updateStyle(WindowStyle const& style);
165  void finishCreation(WindowStyle const& style, Utility::String const& title);
166  #endif
167  };
168  }
169  }
170 
171  #ifdef _WIN32 // Windows
172  #include "../../../../OS/Windows/Graphics/Window/Internal/NRE_WindowsInternalWindow.tpp"
173  #elif __linux__ // Linux
174  #include "../../../../OS/Linux/Graphics/Window/Internal/NRE_LinuxInternalWindow.tpp"
175  #endif
Manage a window style.
Definition: NRE_WindowStyle.hpp:37
InternalWindow & operator=(InternalWindow const &inl)=delete
Math::Point2D< unsigned int > getPosition() const
The NearlyRealEngine&#39;s global namespace.
void toggleFullscreen(bool inFullscreen)
Definition: NRE_LinuxInternalWindow.cpp:87
Graphics&#39; API.
Manage the internal os-dependant graphics window.
Definition: NRE_InternalWindow.hpp:34