FreeRDP
SDL2/sdl_window.hpp
1 
20 #pragma once
21 
22 #include <string>
23 #include <SDL.h>
24 
25 class SdlWindow
26 {
27  public:
28  SdlWindow(const std::string& title, Sint32 startupX, Sint32 startupY, Sint32 width,
29  Sint32 height, Uint32 flags);
30  SdlWindow(const SdlWindow& other) = delete;
31  SdlWindow(SdlWindow&& other) noexcept;
32  ~SdlWindow();
33 
34  SdlWindow& operator=(const SdlWindow& other) = delete;
35  SdlWindow& operator=(SdlWindow&& other) = delete;
36 
37  [[nodiscard]] Uint32 id() const;
38  [[nodiscard]] int displayIndex() const;
39  [[nodiscard]] SDL_Rect rect() const;
40  [[nodiscard]] SDL_Window* window() const;
41 
42  [[nodiscard]] Sint32 offsetX() const;
43  void setOffsetX(Sint32 x);
44 
45  void setOffsetY(Sint32 y);
46  [[nodiscard]] Sint32 offsetY() const;
47 
48  bool grabKeyboard(bool enable);
49  bool grabMouse(bool enable);
50  void setBordered(bool bordered);
51  void raise();
52  void resizeable(bool use);
53  void fullscreen(bool enter);
54  void minimize();
55 
56  bool fill(Uint8 r = 0x00, Uint8 g = 0x00, Uint8 b = 0x00, Uint8 a = 0xff);
57  bool blit(SDL_Surface* surface, SDL_Rect src, SDL_Rect& dst);
58  void updateSurface();
59 
60  private:
61  SDL_Window* _window = nullptr;
62  Sint32 _offset_x = 0;
63  Sint32 _offset_y = 0;
64 };
SdlWindow(const std::string &title, Sint32 startupX, Sint32 startupY, Sint32 width, Sint32 height, Uint32 flags)