1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>Rally X: source/presentation/Screen.cpp Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
</head>
<body>
<div id="top"><!-- do not remove this div! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectlogo"><img alt="Logo" src="car.PNG"/></td>
<td style="padding-left: 0.5em;">
<div id="projectname">Rally X
</div>
<div id="projectbrief">ELEN3009 Project by Justin Wernick and David Schneider</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.7.5.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File List</span></a></li>
<li><a href="globals.html"><span>File Members</span></a></li>
</ul>
</div>
<div class="header">
<div class="headertitle">
<div class="title">source/presentation/Screen.cpp</div> </div>
</div>
<div class="contents">
<a href="_screen_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#include "<a class="code" href="_screen_8h.html">Screen.h</a>"</span>
<a name="l00002"></a>00002
<a name="l00003"></a><a class="code" href="class_screen.html#aa430a980cb3dcca13c837f70bf801511">00003</a> <a class="code" href="class_screen.html#aa430a980cb3dcca13c837f70bf801511" title="Creates a Screen with the given width and height in pixels, and the given fullscreen setting...">Screen::Screen</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> screenWidth, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> screenHeight, <span class="keywordtype">bool</span> fullscreen)
<a name="l00004"></a>00004 :_exitClicked(false),
<a name="l00005"></a>00005 _screenWidth(screenWidth),
<a name="l00006"></a>00006 _screenHeight(screenHeight),
<a name="l00007"></a>00007 _gameAreaWidth(_screenWidth*0.75),
<a name="l00008"></a>00008 _infoPanelWidth(_screenWidth - _gameAreaWidth)
<a name="l00009"></a>00009 {
<a name="l00010"></a>00010 <span class="keywordflow">if</span> (fullscreen)
<a name="l00011"></a>00011 {
<a name="l00012"></a>00012 al_set_new_display_flags(ALLEGRO_FULLSCREEN_WINDOW);
<a name="l00013"></a>00013 <span class="keywordflow">if</span> (!<a class="code" href="class_screen.html#a6480d57328a39c579f312774b5fbf571" title="Checks the current resolution (_screenWidth and _screenHeight) against the screen's supported resolut...">resolutionSupported</a>())
<a name="l00014"></a>00014 {
<a name="l00015"></a>00015 al_show_native_message_box(NULL, <span class="stringliteral">"Fatal error"</span>, <span class="stringliteral">"Fatal error"</span>, <span class="stringliteral">"The fullscreen resolution specified in config.txt is not supported by your system. Please open config.txt and change the resolution to a supported resolution, or change fullscreen to false."</span>, NULL, ALLEGRO_MESSAGEBOX_ERROR);
<a name="l00016"></a>00016 <span class="keywordflow">throw</span> <a class="code" href="class_bad_resolution.html" title="Exception that is thrown if the Config file requests a resolution that can not work.">BadResolution</a>();
<a name="l00017"></a>00017 }
<a name="l00018"></a>00018 }
<a name="l00019"></a>00019 <span class="keywordflow">else</span>
<a name="l00020"></a>00020 {
<a name="l00021"></a>00021 al_set_new_display_flags(ALLEGRO_WINDOWED);
<a name="l00022"></a>00022 <span class="comment">//need to add error checking for windows that are way too big</span>
<a name="l00023"></a>00023 }
<a name="l00024"></a>00024
<a name="l00025"></a>00025 al_set_new_display_option(ALLEGRO_VSYNC, 1, ALLEGRO_SUGGEST);
<a name="l00026"></a>00026
<a name="l00027"></a>00027 <a class="code" href="class_screen.html#a4972e24cf3677e51b18feac34a563ba0" title="The window created on the player's monitor to see the game.">_display</a> = al_create_display(<a class="code" href="class_screen.html#a5931238a3eb8cf1a14b0f8b8d7044b65" title="Horizontal number of pixels per row on the screen.">_screenWidth</a>, <a class="code" href="class_screen.html#a8784c86e10d2b6af0dd99d710f3955e9" title="Vertical number of pixels per column on the screen.">_screenHeight</a>);
<a name="l00028"></a>00028
<a name="l00029"></a>00029 al_hide_mouse_cursor(<a class="code" href="class_screen.html#a4972e24cf3677e51b18feac34a563ba0" title="The window created on the player's monitor to see the game.">_display</a>);
<a name="l00030"></a>00030 <a class="code" href="class_screen.html#aa4ea622368bdf47a3b22d026048ee83a" title="Events caught by the screen, checked for an exit command.">_windowEvents</a> = al_create_event_queue();
<a name="l00031"></a>00031 al_register_event_source(<a class="code" href="class_screen.html#aa4ea622368bdf47a3b22d026048ee83a" title="Events caught by the screen, checked for an exit command.">_windowEvents</a>, al_get_display_event_source(<a class="code" href="class_screen.html#a4972e24cf3677e51b18feac34a563ba0" title="The window created on the player's monitor to see the game.">_display</a>));
<a name="l00032"></a>00032 <span class="comment">//used so that ESC can be pressed to exit.</span>
<a name="l00033"></a>00033 al_register_event_source(<a class="code" href="class_screen.html#aa4ea622368bdf47a3b22d026048ee83a" title="Events caught by the screen, checked for an exit command.">_windowEvents</a>, al_get_keyboard_event_source());
<a name="l00034"></a>00034
<a name="l00035"></a>00035 <a class="code" href="class_screen.html#a42a627863a8f9d1529278cb060d4102b" title="Font used in drawing splash screens.">_font</a> = al_load_font(<span class="stringliteral">"junction 02.ttf"</span>, <a class="code" href="class_screen.html#a5931238a3eb8cf1a14b0f8b8d7044b65" title="Horizontal number of pixels per row on the screen.">_screenWidth</a>/10, 0);
<a name="l00036"></a>00036 <span class="keywordflow">if</span> (<a class="code" href="class_screen.html#a42a627863a8f9d1529278cb060d4102b" title="Font used in drawing splash screens.">_font</a> == NULL)
<a name="l00037"></a>00037 {
<a name="l00038"></a>00038 al_show_native_message_box(NULL, <span class="stringliteral">"Fatal error"</span>, <span class="stringliteral">"Fatal error"</span>, <span class="stringliteral">"The file 'junction 02.ttf' was not found. Ensure that it is located in the working directory."</span>, NULL, ALLEGRO_MESSAGEBOX_ERROR);
<a name="l00039"></a>00039 al_destroy_event_queue(<a class="code" href="class_screen.html#aa4ea622368bdf47a3b22d026048ee83a" title="Events caught by the screen, checked for an exit command.">_windowEvents</a>);
<a name="l00040"></a>00040 al_destroy_display(<a class="code" href="class_screen.html#a4972e24cf3677e51b18feac34a563ba0" title="The window created on the player's monitor to see the game.">_display</a>);
<a name="l00041"></a>00041 <span class="keywordflow">throw</span> <a class="code" href="class_install_failure.html" title="Exception to be thrown if any component of Allegro fails to install at runtime.">InstallFailure</a>();
<a name="l00042"></a>00042 }
<a name="l00043"></a>00043
<a name="l00044"></a>00044 ALLEGRO_BITMAP* front = al_get_backbuffer(<a class="code" href="class_screen.html#a4972e24cf3677e51b18feac34a563ba0" title="The window created on the player's monitor to see the game.">_display</a>);
<a name="l00045"></a>00045 al_flip_display();
<a name="l00046"></a>00046 ALLEGRO_BITMAP* back = al_get_backbuffer(<a class="code" href="class_screen.html#a4972e24cf3677e51b18feac34a563ba0" title="The window created on the player's monitor to see the game.">_display</a>);
<a name="l00047"></a>00047
<a name="l00048"></a>00048 <a class="code" href="class_screen.html#a30ba66122613181e312e0d7586d2a814" title="Polymorphic container used to encapsulate the different types of drawing to the screen.">_panels</a>.push_back(<span class="keyword">new</span> <a class="code" href="class_game_panel.html" title="ScreenPanel to be drawn on the screen to draw the area where the game takes place.">GamePanel</a>(back, front, 0, 0, <a class="code" href="class_screen.html#a7cba9fb0069d763055ef351452a15227" title="Width of the GamePanel created.">_gameAreaWidth</a>, <a class="code" href="class_screen.html#a8784c86e10d2b6af0dd99d710f3955e9" title="Vertical number of pixels per column on the screen.">_screenHeight</a>));
<a name="l00049"></a>00049 <a class="code" href="class_screen.html#a30ba66122613181e312e0d7586d2a814" title="Polymorphic container used to encapsulate the different types of drawing to the screen.">_panels</a>.push_back(<span class="keyword">new</span> <a class="code" href="class_info_panel.html" title="ScreenPanel to be drawn on the screen to give the player information.">InfoPanel</a>(back, front, <a class="code" href="class_screen.html#a7cba9fb0069d763055ef351452a15227" title="Width of the GamePanel created.">_gameAreaWidth</a>, 0, <a class="code" href="class_screen.html#ab895e588a89e1943303487d47a2b9216" title="Width of the InfoPanel created. The InfoPanel is placed directly to the right of the GamePanel...">_infoPanelWidth</a>, <a class="code" href="class_screen.html#a8784c86e10d2b6af0dd99d710f3955e9" title="Vertical number of pixels per column on the screen.">_screenHeight</a>));
<a name="l00050"></a>00050 }
<a name="l00051"></a>00051
<a name="l00052"></a><a class="code" href="class_screen.html#a4243bc17596af96415b09ac48205676d">00052</a> <a class="code" href="class_screen.html#a4243bc17596af96415b09ac48205676d" title="Destructor to ensure that the display and any ScreenPanels are destroyed properly.">Screen::~Screen</a>()
<a name="l00053"></a>00053 {
<a name="l00054"></a>00054 <span class="keywordflow">for</span> (vector<ScreenPanel*>::iterator iter = <a class="code" href="class_screen.html#a30ba66122613181e312e0d7586d2a814" title="Polymorphic container used to encapsulate the different types of drawing to the screen.">_panels</a>.begin(); iter!=<a class="code" href="class_screen.html#a30ba66122613181e312e0d7586d2a814" title="Polymorphic container used to encapsulate the different types of drawing to the screen.">_panels</a>.end(); ++iter)
<a name="l00055"></a>00055 {
<a name="l00056"></a>00056 <span class="keyword">delete</span> (*iter);
<a name="l00057"></a>00057 }
<a name="l00058"></a>00058 <a class="code" href="class_screen.html#a30ba66122613181e312e0d7586d2a814" title="Polymorphic container used to encapsulate the different types of drawing to the screen.">_panels</a>.clear();
<a name="l00059"></a>00059
<a name="l00060"></a>00060 al_destroy_font(<a class="code" href="class_screen.html#a42a627863a8f9d1529278cb060d4102b" title="Font used in drawing splash screens.">_font</a>);
<a name="l00061"></a>00061 al_destroy_event_queue(<a class="code" href="class_screen.html#aa4ea622368bdf47a3b22d026048ee83a" title="Events caught by the screen, checked for an exit command.">_windowEvents</a>);
<a name="l00062"></a>00062 al_destroy_display(<a class="code" href="class_screen.html#a4972e24cf3677e51b18feac34a563ba0" title="The window created on the player's monitor to see the game.">_display</a>);
<a name="l00063"></a>00063 }
<a name="l00064"></a>00064
<a name="l00065"></a><a class="code" href="class_screen.html#a45d06e513491e40f76013fb670c6c6cc">00065</a> <span class="keywordtype">string</span> <a class="code" href="class_screen.html#a45d06e513491e40f76013fb670c6c6cc" title="Presents the player with a file dialog, requesting a level file to be selected.">Screen::getLevel</a>()
<a name="l00066"></a>00066 {
<a name="l00067"></a>00067 <span class="keywordtype">string</span> result(<span class="stringliteral">""</span>);
<a name="l00068"></a>00068 ALLEGRO_FILECHOOSER* filechooser = al_create_native_file_dialog(<span class="stringliteral">"."</span>, <span class="stringliteral">"Choose your level"</span>, <span class="stringliteral">"*.lvl"</span>,ALLEGRO_FILECHOOSER_FILE_MUST_EXIST);
<a name="l00069"></a>00069 al_show_native_file_dialog(<a class="code" href="class_screen.html#a4972e24cf3677e51b18feac34a563ba0" title="The window created on the player's monitor to see the game.">_display</a>, filechooser);
<a name="l00070"></a>00070 <span class="keywordflow">if</span> (al_get_native_file_dialog_count(filechooser)==0)
<a name="l00071"></a>00071 {
<a name="l00072"></a>00072 <a class="code" href="class_screen.html#ae7f213f79bf9680e0ff3f4b52ebf051f" title="Set to true when the user chooses to quit the game.">_exitClicked</a> = <span class="keyword">true</span>;
<a name="l00073"></a>00073 }
<a name="l00074"></a>00074 <span class="keywordflow">else</span>
<a name="l00075"></a>00075 {
<a name="l00076"></a>00076 result = al_get_native_file_dialog_path(filechooser, 0);
<a name="l00077"></a>00077 }
<a name="l00078"></a>00078
<a name="l00079"></a>00079 al_destroy_native_file_dialog(filechooser);
<a name="l00080"></a>00080 <span class="keywordflow">return</span> result;
<a name="l00081"></a>00081 }
<a name="l00082"></a>00082
<a name="l00083"></a><a class="code" href="class_screen.html#aec3c5c20e14d6ef033c8a6a559a84872">00083</a> <span class="keywordtype">void</span> <a class="code" href="class_screen.html#aec3c5c20e14d6ef033c8a6a559a84872" title="Draws the given objects on the screen.">Screen::draw</a>(<span class="keyword">const</span> <a class="code" href="class_maze.html" title="A rectangular 2D boolean array, representing where cars can drive and where they cannot.">Maze</a>& maze, <span class="keyword">const</span> list<PlayerCar>& players, <span class="keyword">const</span> list<EnemyCar>& enemies, <span class="keyword">const</span> list<Checkpoint>& checkpoints, <span class="keyword">const</span> list<Rock>& rocks, <span class="keyword">const</span> list<Smokescreen>& smokescreens, <span class="keyword">const</span> list<DestroyedObjectPopup>& popups)
<a name="l00084"></a>00084 {
<a name="l00085"></a>00085 <span class="keywordflow">for</span> (vector<ScreenPanel*>::iterator iter = <a class="code" href="class_screen.html#a30ba66122613181e312e0d7586d2a814" title="Polymorphic container used to encapsulate the different types of drawing to the screen.">_panels</a>.begin(); iter!=<a class="code" href="class_screen.html#a30ba66122613181e312e0d7586d2a814" title="Polymorphic container used to encapsulate the different types of drawing to the screen.">_panels</a>.end(); ++iter)
<a name="l00086"></a>00086 {
<a name="l00087"></a>00087 (*iter)->draw(maze, players, enemies, checkpoints, rocks, smokescreens, popups);
<a name="l00088"></a>00088 }
<a name="l00089"></a>00089 <a class="code" href="class_screen.html#abd12bddd241c8d214d2423804fe20ffb" title="Flips the display's buffers, as well as those for all of the ScreenPanels.">flip</a>();
<a name="l00090"></a>00090 }
<a name="l00091"></a>00091
<a name="l00092"></a><a class="code" href="class_screen.html#abd12bddd241c8d214d2423804fe20ffb">00092</a> <span class="keywordtype">void</span> <a class="code" href="class_screen.html#abd12bddd241c8d214d2423804fe20ffb" title="Flips the display's buffers, as well as those for all of the ScreenPanels.">Screen::flip</a>()
<a name="l00093"></a>00093 {
<a name="l00094"></a>00094 al_flip_display();
<a name="l00095"></a>00095 <span class="keywordflow">for</span> (vector<ScreenPanel*>::iterator iter = <a class="code" href="class_screen.html#a30ba66122613181e312e0d7586d2a814" title="Polymorphic container used to encapsulate the different types of drawing to the screen.">_panels</a>.begin(); iter!=<a class="code" href="class_screen.html#a30ba66122613181e312e0d7586d2a814" title="Polymorphic container used to encapsulate the different types of drawing to the screen.">_panels</a>.end(); ++iter)
<a name="l00096"></a>00096 {
<a name="l00097"></a>00097 (*iter)->flip();
<a name="l00098"></a>00098 }
<a name="l00099"></a>00099 }
<a name="l00100"></a>00100
<a name="l00101"></a><a class="code" href="class_screen.html#ad4c1281e4d59eb89377dd87bba8a310e">00101</a> <span class="keywordtype">void</span> <a class="code" href="class_screen.html#ad4c1281e4d59eb89377dd87bba8a310e" title="Draws a splash screen when the level has been won.">Screen::drawWin</a>()
<a name="l00102"></a>00102 {
<a name="l00103"></a>00103 <a class="code" href="class_screen.html#abd12bddd241c8d214d2423804fe20ffb" title="Flips the display's buffers, as well as those for all of the ScreenPanels.">flip</a>();
<a name="l00104"></a>00104
<a name="l00105"></a>00105 ALLEGRO_COLOR transBlack = al_map_rgba(0,0,0,200);
<a name="l00106"></a>00106 al_draw_filled_rectangle(0,0,<a class="code" href="class_screen.html#a5931238a3eb8cf1a14b0f8b8d7044b65" title="Horizontal number of pixels per row on the screen.">_screenWidth</a>,<a class="code" href="class_screen.html#a8784c86e10d2b6af0dd99d710f3955e9" title="Vertical number of pixels per column on the screen.">_screenHeight</a>, transBlack);
<a name="l00107"></a>00107
<a name="l00108"></a>00108 ALLEGRO_COLOR textColour = al_map_rgb(255,255,255);
<a name="l00109"></a>00109 al_draw_text(<a class="code" href="class_screen.html#a42a627863a8f9d1529278cb060d4102b" title="Font used in drawing splash screens.">_font</a>, textColour, <a class="code" href="class_screen.html#a5931238a3eb8cf1a14b0f8b8d7044b65" title="Horizontal number of pixels per row on the screen.">_screenWidth</a>/2, <a class="code" href="class_screen.html#a8784c86e10d2b6af0dd99d710f3955e9" title="Vertical number of pixels per column on the screen.">_screenHeight</a>/2, ALLEGRO_ALIGN_CENTRE , <span class="stringliteral">"You win!"</span>);
<a name="l00110"></a>00110
<a name="l00111"></a>00111 <a class="code" href="class_screen.html#abd12bddd241c8d214d2423804fe20ffb" title="Flips the display's buffers, as well as those for all of the ScreenPanels.">flip</a>();
<a name="l00112"></a>00112 }
<a name="l00113"></a>00113
<a name="l00114"></a><a class="code" href="class_screen.html#aab9ab8447df2b526985970d2ac80c919">00114</a> <span class="keywordtype">void</span> <a class="code" href="class_screen.html#aab9ab8447df2b526985970d2ac80c919" title="Draws a splash screen when the level has been lost.">Screen::drawLoss</a>()
<a name="l00115"></a>00115 {
<a name="l00116"></a>00116 <a class="code" href="class_screen.html#abd12bddd241c8d214d2423804fe20ffb" title="Flips the display's buffers, as well as those for all of the ScreenPanels.">flip</a>();
<a name="l00117"></a>00117
<a name="l00118"></a>00118 ALLEGRO_COLOR transBlack = al_map_rgba(0,0,0,200);
<a name="l00119"></a>00119 al_draw_filled_rectangle(0,0,<a class="code" href="class_screen.html#a5931238a3eb8cf1a14b0f8b8d7044b65" title="Horizontal number of pixels per row on the screen.">_screenWidth</a>,<a class="code" href="class_screen.html#a8784c86e10d2b6af0dd99d710f3955e9" title="Vertical number of pixels per column on the screen.">_screenHeight</a>, transBlack);
<a name="l00120"></a>00120
<a name="l00121"></a>00121 ALLEGRO_COLOR textColour = al_map_rgb(255,255,255);
<a name="l00122"></a>00122 al_draw_text(<a class="code" href="class_screen.html#a42a627863a8f9d1529278cb060d4102b" title="Font used in drawing splash screens.">_font</a>, textColour, <a class="code" href="class_screen.html#a5931238a3eb8cf1a14b0f8b8d7044b65" title="Horizontal number of pixels per row on the screen.">_screenWidth</a>/2, <a class="code" href="class_screen.html#a8784c86e10d2b6af0dd99d710f3955e9" title="Vertical number of pixels per column on the screen.">_screenHeight</a>/2, ALLEGRO_ALIGN_CENTRE , <span class="stringliteral">"You lose!"</span>);
<a name="l00123"></a>00123
<a name="l00124"></a>00124 <a class="code" href="class_screen.html#abd12bddd241c8d214d2423804fe20ffb" title="Flips the display's buffers, as well as those for all of the ScreenPanels.">flip</a>();
<a name="l00125"></a>00125 }
<a name="l00126"></a>00126
<a name="l00127"></a><a class="code" href="class_screen.html#acca34443ba0ad97922069658d688ea9a">00127</a> <span class="keywordtype">bool</span> <a class="code" href="class_screen.html#acca34443ba0ad97922069658d688ea9a" title="Function to find if the player has chosen to exit the game.">Screen::exitClicked</a>()
<a name="l00128"></a>00128 {
<a name="l00129"></a>00129 <span class="keywordflow">if</span> (<a class="code" href="class_screen.html#ae7f213f79bf9680e0ff3f4b52ebf051f" title="Set to true when the user chooses to quit the game.">_exitClicked</a>) <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00130"></a>00130
<a name="l00131"></a>00131 ALLEGRO_EVENT event;
<a name="l00132"></a>00132 <span class="keywordflow">while</span> (al_get_next_event(<a class="code" href="class_screen.html#aa4ea622368bdf47a3b22d026048ee83a" title="Events caught by the screen, checked for an exit command.">_windowEvents</a>, &event))
<a name="l00133"></a>00133 {
<a name="l00134"></a>00134 <span class="keywordflow">if</span> (event.type==ALLEGRO_EVENT_DISPLAY_CLOSE || (event.type==ALLEGRO_EVENT_KEY_CHAR && event.keyboard.keycode==ALLEGRO_KEY_ESCAPE))
<a name="l00135"></a>00135 {
<a name="l00136"></a>00136 al_flush_event_queue(<a class="code" href="class_screen.html#aa4ea622368bdf47a3b22d026048ee83a" title="Events caught by the screen, checked for an exit command.">_windowEvents</a>);
<a name="l00137"></a>00137 <a class="code" href="class_screen.html#ae7f213f79bf9680e0ff3f4b52ebf051f" title="Set to true when the user chooses to quit the game.">_exitClicked</a> = <span class="keyword">true</span>;
<a name="l00138"></a>00138 <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00139"></a>00139 }
<a name="l00140"></a>00140 }
<a name="l00141"></a>00141
<a name="l00142"></a>00142 <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00143"></a>00143 }
<a name="l00144"></a>00144
<a name="l00145"></a><a class="code" href="class_screen.html#a6480d57328a39c579f312774b5fbf571">00145</a> <span class="keywordtype">bool</span> <a class="code" href="class_screen.html#a6480d57328a39c579f312774b5fbf571" title="Checks the current resolution (_screenWidth and _screenHeight) against the screen's supported resolut...">Screen::resolutionSupported</a>()
<a name="l00146"></a>00146 {
<a name="l00147"></a>00147 ALLEGRO_DISPLAY_MODE mode;
<a name="l00148"></a>00148 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i=0; i<al_get_num_display_modes(); ++i)
<a name="l00149"></a>00149 {
<a name="l00150"></a>00150 al_get_display_mode(i, &mode);
<a name="l00151"></a>00151
<a name="l00152"></a>00152 <span class="keywordflow">if</span> (static_cast<unsigned int>(mode.width)==<a class="code" href="class_screen.html#a5931238a3eb8cf1a14b0f8b8d7044b65" title="Horizontal number of pixels per row on the screen.">_screenWidth</a> && static_cast<unsigned int>(mode.height)==<a class="code" href="class_screen.html#a8784c86e10d2b6af0dd99d710f3955e9" title="Vertical number of pixels per column on the screen.">_screenHeight</a>)
<a name="l00153"></a>00153 {
<a name="l00154"></a>00154 <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00155"></a>00155 }
<a name="l00156"></a>00156 }
<a name="l00157"></a>00157
<a name="l00158"></a>00158 <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00159"></a>00159 }
</pre></div></div>
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark"> </span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark"> </span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark"> </span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark"> </span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark"> </span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark"> </span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark"> </span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark"> </span>Enumerator</a></div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<hr class="footer"/><address class="footer"><small>
Generated on Wed Oct 5 2011 20:08:31 for Rally X by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.5.1
</small></address>
</body>
</html>
|