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 
27 namespace Graphics {
28 
32 struct Mode {
33  int16 width;
34  int16 height;
35 
36  Mode(const int16 w, const int16 h) :
37  width(w),
38  height(h) {}
39 
40  bool operator<(const Mode &other) const {
41  return width < other.width && height < other.height;
42  }
43 };
44 
46 
51  int16 width;
52  int16 height;
53  bool hasFormat;
55 
56  ModeWithFormat(const int16 w, const int16 h) :
57  width(w), height(h), hasFormat(false) {}
58  ModeWithFormat(const int16 w, const int16 h, const Graphics::PixelFormat &f) :
59  width(w), height(h), hasFormat(true), format(f) {}
60  ModeWithFormat(const int16 w, const int16 h, const Graphics::PixelFormat *f) :
61  width(w), height(h), hasFormat(f != nullptr) {
62  if (f != nullptr)
63  format = *f;
64  }
65 };
66 
68 
69 }
70 
71 #endif
int16 width
The width in pixels.
Definition: mode.h:51
int16 height
The height in pixels.
Definition: mode.h:52
Definition: mode.h:32
Definition: array.h:52
Definition: pixelformat.h:138
Definition: mode.h:50
Definition: formatinfo.h:28
Graphics::PixelFormat format
Pixel format.
Definition: mode.h:54
bool hasFormat
Whether pixel format is valid.
Definition: mode.h:53
int16 height
The height in pixels.
Definition: mode.h:34
int16 width
The width in pixels.
Definition: mode.h:33