ScummVM API documentation
ScreenSettings.h
1/* ScummVM - Graphic Adventure Engine
2 *
3 * ScummVM is the legal property of its developers, whose names
4 * are too numerous to list here. Please refer to the COPYRIGHT
5 * file distributed with this source distribution.
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 *
20 */
21
22/*
23 * This code is based on the CRAB engine
24 *
25 * Copyright (c) Arvind Raja Yadav
26 *
27 * Licensed under MIT
28 *
29 */
30
31#ifndef CRAB_SCREENSETTINGS_H
32#define CRAB_SCREENSETTINGS_H
33
34#include "crab/rapidxml/rapidxml.hpp"
35
36namespace Crab {
37
38struct Dimension {
39 int w, h;
40 Dimension() {
41 w = 1280;
42 h = 720;
43 }
44
45 bool operator<(const Dimension &d) { return (w < d.w && h < d.h); }
46};
47
49public:
50 // Frames per second
51 int _fps;
52
53 // The current screen dimensions
54 Dimension _cur;
55
56 // The minimum dimension where we draw the image without scaling
57 // Any lower than this and we draw at the minimum resolution, then scale it down
58 // Dimension min;
59
60 // Is the window full-screen?
61 bool _fullscreen;
62
63 // Does the window have a border?
64 bool _border;
65
66 // Is vertical sync enabled?
67 bool _vsync;
68
69 // The brightness of a window
70 float _gamma;
71
72 // The video flags
73 uint32 _videoflags;
74
75 // should we save on exit?
76 bool _saveOnExit;
77
78 // This flag is true if we want to load high quality images, false otherwise
79 bool _quality;
80
81 // Is the mouse trapped within the window
82 bool _mouseTrap;
83
84 // The text speed (used only for popup text)
85 float _textSpeed;
86
88 _fps = 60;
89 _fullscreen = false;
90 _border = true;
91 _vsync = true;
92 _saveOnExit = true;
93 _quality = true;
94 _mouseTrap = false;
95 _gamma = 1.0f;
96 _textSpeed = 1.0f;
97 _videoflags = 0; //SDL_WINDOW_SHOWN;
98 }
99};
100
101// Screen attributes
103
104public:
105 // The desktop dimensions
106 Dimension _desktop;
107
108 // True if we are in game, false otherwise
109 bool _inGame;
110
111 // Set to true when we have to call setUI() for rearranging UI after a resolution change
112 bool _changeInterface;
113
114 // The version of the settings
115 uint _version;
116
118 _inGame = false;
119 _version = 0;
120 _changeInterface = false;
121 }
122 ~ScreenSettings() {}
123
124 bool validDimension(Dimension d) {
125 return d.w <= _desktop.w && d.h <= _desktop.h;
126 }
127
128 void load(rapidxml::xml_node<char> *node);
129
130 void internalEvents();
131
132 void toggleFullScreen();
133 void toggleVsync();
134
135 void saveState();
136};
137
138}
139
140#endif // CRAB_SCREENSETTINGS_H
Definition: ScreenSettings.h:48
Definition: ScreenSettings.h:102
Definition: ScreenSettings.h:38