ScummVM API documentation
mode.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 #ifndef GRAPHICS_MODE_H
23 #define GRAPHICS_MODE_H
24 
25 #include "common/array.h"
26 #include "graphics/pixelformat.h"
27 
28 namespace Graphics {
29 
33 struct Mode {
34  int16 width;
35  int16 height;
36 
37  Mode(const int16 w, const int16 h) :
38  width(w),
39  height(h) {}
40 
41  bool operator<(const Mode &other) const {
42  return width < other.width && height < other.height;
43  }
44 };
45 
47 
52  int16 width;
53  int16 height;
54  bool hasFormat;
56 
57  ModeWithFormat(const int16 w, const int16 h) :
58  width(w), height(h), hasFormat(false) {}
59  ModeWithFormat(const int16 w, const int16 h, const Graphics::PixelFormat &f) :
60  width(w), height(h), hasFormat(true), format(f) {}
61  ModeWithFormat(const int16 w, const int16 h, const Graphics::PixelFormat *f) :
62  width(w), height(h), hasFormat(f != nullptr) {
63  if (f != nullptr)
64  format = *f;
65  }
66 };
67 
69 
70 }
71 
72 #endif
int16 width
The width in pixels.
Definition: mode.h:52
int16 height
The height in pixels.
Definition: mode.h:53
Definition: mode.h:33
Definition: array.h:52
Definition: pixelformat.h:138
Definition: mode.h:51
Definition: formatinfo.h:28
Graphics::PixelFormat format
Pixel format.
Definition: mode.h:55
bool hasFormat
Whether pixel format is valid.
Definition: mode.h:54
int16 height
The height in pixels.
Definition: mode.h:35
int16 width
The width in pixels.
Definition: mode.h:34