ge211  2021.5.1
A student game engine
ge211_window.hxx
1 #pragma once
2 
3 #include "ge211_forward.hxx"
4 #include "ge211_geometry.hxx"
5 #include "ge211_noexcept.hxx"
6 #include "ge211_util.hxx"
7 
8 #include <SDL_version.h>
9 #include <SDL_video.h>
10 
11 #include <string>
12 
13 namespace ge211 {
14 
16 class Window
17 {
18 public:
20  Dims<int> get_dimensions() const NOEXCEPT;
24 
27  Posn<int> get_position() const NOEXCEPT;
30  void set_position(Posn<int>);
33  static const Posn<int> centered;
34 
35 #if SDL_VERSION_ATLEAST(2, 0, 5)
36  bool get_resizeable() const NOEXCEPT;
39  void set_resizeable(bool) NOEXCEPT;
40 #endif
41 
43  bool get_fullscreen() const NOEXCEPT;
46  void set_fullscreen(bool);
47 
51  Dims<int> max_window_dimensions() const NOEXCEPT;
52 
56  static Dims<int> max_fullscreen_dimensions() NOEXCEPT;
57 
58 private:
59  friend class detail::Engine;
60  friend class detail::Renderer;
61 
62  Window(const std::string&, Dims<int> dim);
63 
64  Borrowed<SDL_Window> get_raw_() const NOEXCEPT { return ptr_.get(); }
65  uint32_t get_flags_() const NOEXCEPT;
66 
67  detail::delete_ptr<SDL_Window, &SDL_DestroyWindow> ptr_;
68 };
69 
70 }
ge211::Window::get_fullscreen
bool get_fullscreen() const
Returns whether the program is in fullscreen mode.
Definition: ge211_window.cxx:68
ge211::Window::get_position
Posn< int > get_position() const
Gets the position of the upper-left corner of the window with respect to the upper-left corner of the...
Definition: ge211_window.cxx:54
ge211::Window::get_dimensions
Dims< int > get_dimensions() const
Returns the current dimensions of this window.
Definition: ge211_window.cxx:27
ge211::Window::set_fullscreen
void set_fullscreen(bool)
Sets whether the program should be in fullscreen mode.
Definition: ge211_window.cxx:73
ge211::Window::max_fullscreen_dimensions
static Dims< int > max_fullscreen_dimensions()
Returns the maximum dimensions for a fullscreen window.
Definition: ge211_window.cxx:81
ge211
The game engine namespace.
Definition: ge211.hxx:4
ge211::Window::set_position
void set_position(Posn< int >)
Sets the position of the upper-left corner of the window with respect to the upper-left corner of the...
Definition: ge211_window.cxx:61
ge211::geometry::Dims< int >
ge211::Window
Provides access to the game window and its properties.
Definition: ge211_window.hxx:17
ge211::Window::max_window_dimensions
Dims< int > max_window_dimensions() const
Returns the maximum dimensions for a non-fullscreen window.
Definition: ge211_window.cxx:88
ge211::Window::centered
static const Posn< int > centered
A special value to pass to set_position(Posn<int>) to center the window on the screen.
Definition: ge211_window.hxx:33
ge211::Window::set_dimensions
void set_dimensions(Dims< int >)
Changes the size of the window.
Definition: ge211_window.cxx:34
ge211::geometry::Posn< int >
ge211::Borrowed
OBJECT_TYPE * Borrowed
Type alias to indicate that the given pointer does not own its object.
Definition: ge211_util.hxx:19