Switch to using -I to find includes, rather than relative paths.
[gemrb.git] / gemrb / plugins / Core / VideoModes.cpp
blob36a807d3eed55faf64cce653e2e54fdbcfb3a276
1 /* GemRB - Infinity Engine Emulator
2 * Copyright (C) 2003 The GemRB Project
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 #include "win32def.h"
22 #include "VideoModes.h"
23 #include "errors.h"
24 #include <vector>
26 using namespace std;
28 VideoModes::VideoModes(void)
32 VideoModes::~VideoModes(void)
36 int VideoModes::AddVideoMode(int w, int h, int bpp, bool fs, bool checkUnique)
38 VideoMode vm( w, h, bpp, fs );
39 if (checkUnique) {
40 for (unsigned int i = 0; i < modes.size(); i++) {
41 if (modes[i] == vm) {
42 return GEM_ERROR;
46 modes.push_back( vm );
47 return GEM_OK;
50 int VideoModes::FindVideoMode(VideoMode& vm)
52 for (unsigned int i = 0; i < modes.size(); i++) {
53 if (modes[i] == vm) {
54 return i;
57 return GEM_ERROR;
60 void VideoModes::RemoveEntry(unsigned int n)
62 if (n >= modes.size()) {
63 return;
65 vector< VideoMode>::iterator m = modes.begin();
66 m += n;
67 modes.erase( m );
70 void VideoModes::Empty(void)
72 vector< VideoMode>::iterator m;
73 for (m = modes.begin(); m != modes.end(); ++m) {
74 modes.erase( m );
78 VideoMode VideoModes::operator[](unsigned int n)
80 if (n >= modes.size()) {
81 return VideoMode();
83 return modes[n];
86 unsigned int VideoModes::Count(void)
88 return (unsigned int) modes.size();