Inexor
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ScreenManager.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <SDL.h>
4 
5 #include "SDL_video.h" // for SDL_GLContext, SDL_Window
7 #include "inexor/network/SharedVar.hpp" // for SharedVar
8 
10 #define SCR_MINW 320
11 #define SCR_MINH 200
12 #define SCR_MAXW 10000
13 #define SCR_MAXH 10000
14 #define SCR_DEFAULTW 1024
15 #define SCR_DEFAULTH 768
16 
17 namespace inexor {
18 namespace rendering {
19 namespace screen {
20 
23 {
24  public:
26  ScreenManager();
27 
29  virtual ~ScreenManager();
30 
32  void screenres(int w, int h);
33 
35  void setfullscreen(bool enable);
36 
39  void setupscreen(int &useddepthbits, int &usedfsaa);
40 
43  void restoregamma();
44 
46  void cleargamma();
47 
49  void restorevsync();
50 
52  void cleanupSDL();
53 
57  void swapbuffers(bool overlay = true);
58 
59  void set_minimized(bool minimized);
60  bool is_minimized();
61 
63  int screenw;
64  int screenh;
65  int desktopw;
66  int desktoph;
67 
69  bool minimized;
70 
72 
73  int curgamma;
74 
76  SDL_Window *sdl_window;
77  SDL_GLContext glcontext = nullptr;
78 
79  private:
80 
81 };
82 
83 // Provide global exports
84 
86 // TODO: for now: not part of the ScreenManager
90 extern SharedVar<int> fsaa;
91 
92 extern int screenw, screenh;
93 
94 }
95 }
96 }
void restorevsync()
"use this function to set the swap interval for the current OpenGL context" (VSYNC) ...
Definition: ScreenManager.cpp:191
void screenres(int w, int h)
Changes the screen resolution.
Definition: ScreenManager.cpp:48
SharedVar< int > vsynctear
void setfullscreen(bool enable)
Switch to fullscreen or windowed mode.
Definition: ScreenManager.cpp:69
int desktopw
Definition: ScreenManager.hpp:65
int curgamma
Definition: ScreenManager.hpp:73
SharedVar< int > scr_h
Definition: ScreenManager.hpp:87
SDL_Window * sdl_window
Simple DirectMedia Window and Layer.
Definition: ScreenManager.hpp:76
SharedVar< int > fsaa
int desktoph
Definition: ScreenManager.hpp:66
bool is_minimized()
Definition: ScreenManager.cpp:221
bool minimized
If true, the window is minimized.
Definition: ScreenManager.hpp:69
int screenh
Definition: ScreenManager.hpp:64
int screenw
screen resolution management
Definition: ScreenManager.hpp:63
SDL_GLContext glcontext
Definition: ScreenManager.hpp:77
void setupscreen(int &useddepthbits, int &usedfsaa)
Setting up screen using various attempts with different options.
Definition: ScreenManager.cpp:86
void enable()
Definition: explosion.cpp:92
bool initwindowpos
Definition: ScreenManager.hpp:71
SharedVar< int > colorbits
void restoregamma()
Set screen gamma using float value.
Definition: ScreenManager.cpp:177
void swapbuffers(bool overlay=true)
swapping buffers allows to render to a new buffer while the other is being presented to the screen ...
Definition: ScreenManager.cpp:209
ScreenManager screen_manager
Singleton instnace of the screenmanager.
Definition: ScreenManager.cpp:227
SharedVar< int > stencilbits
The screen manager manages the SDL window.
Definition: ScreenManager.hpp:22
virtual ~ScreenManager()
The default destructor.
Definition: ScreenManager.cpp:44
ScreenManager()
The default constructor.
Definition: ScreenManager.cpp:32
void set_minimized(bool minimized)
Definition: ScreenManager.cpp:216
void cleargamma()
Set screen to normal gamma.
Definition: ScreenManager.cpp:183
SharedVar wrapper for primitive/immutable objects.
Definition: SharedVar.hpp:55
void cleanupSDL()
Clean up SDL.
Definition: ScreenManager.cpp:197
SharedVar< int > fullscreen
Definition: ScreenManager.hpp:88
SharedVar< int > scr_w
Definition: ScreenManager.hpp:87
SharedVar< int > vsync
Definition: ScreenManager.hpp:88
SharedVar< int > depthbits