diff options
Diffstat (limited to 'docs/html/presentation_tests_8cpp_source.html')
-rw-r--r-- | docs/html/presentation_tests_8cpp_source.html | 303 |
1 files changed, 303 insertions, 0 deletions
diff --git a/docs/html/presentation_tests_8cpp_source.html b/docs/html/presentation_tests_8cpp_source.html new file mode 100644 index 0000000..2a1d52d --- /dev/null +++ b/docs/html/presentation_tests_8cpp_source.html @@ -0,0 +1,303 @@ +<!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: tests/presentationTests.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">tests/presentationTests.cpp</div> </div> +</div> +<div class="contents"> +<a href="presentation_tests_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 +<a name="l00033"></a>00033 <span class="preprocessor">#include <utility></span> +<a name="l00034"></a>00034 <span class="preprocessor">#include <list></span> +<a name="l00035"></a>00035 <span class="keyword">using namespace </span>std; +<a name="l00036"></a>00036 +<a name="l00037"></a>00037 <span class="preprocessor">#include <gtest/gtest.h></span> +<a name="l00038"></a>00038 +<a name="l00039"></a>00039 <span class="preprocessor">#include "../source/presentation/BitmapStore.h"</span> +<a name="l00040"></a>00040 <span class="preprocessor">#include "../source/presentation/ColourStore.h"</span> +<a name="l00041"></a>00041 <span class="preprocessor">#include "../source/presentation/GamePanel.h"</span> +<a name="l00042"></a>00042 <span class="preprocessor">#include "../source/presentation/Screen.h"</span> +<a name="l00043"></a>00043 +<a name="l00044"></a>00044 <span class="preprocessor">#include "../source/logic/PlayerCar.h"</span> +<a name="l00045"></a>00045 <span class="preprocessor">#include "../source/logic/EnemyCar.h"</span> +<a name="l00046"></a>00046 <span class="preprocessor">#include "../source/logic/Checkpoint.h"</span> +<a name="l00047"></a>00047 <span class="preprocessor">#include "../source/logic/Rock.h"</span> +<a name="l00048"></a>00048 <span class="preprocessor">#include "../source/logic/Smokescreen.h"</span> +<a name="l00049"></a>00049 <span class="preprocessor">#include "../source/logic/Maze.h"</span> +<a name="l00050"></a>00050 <span class="preprocessor">#include "../source/logic/DestroyedObjectPopup.h"</span> +<a name="l00051"></a>00051 +<a name="l00055"></a><a class="code" href="presentation_tests_8cpp.html#a1f28e78cfee8247b7031e29d1db8b088">00055</a> <a class="code" href="data_tests_8cpp.html#a7612e068db66f415f3b230260450eba8" title="Tests that a normal complete config file can be read.">TEST</a>(<a class="code" href="class_bitmap_store.html" title="Class for accessing images in ALLEGRO_BITMAP format and low level drawing.">BitmapStore</a>, returnsBitmapForAllImages) +<a name="l00056"></a>00056 { +<a name="l00057"></a>00057 <a class="code" href="class_bitmap_store.html" title="Class for accessing images in ALLEGRO_BITMAP format and low level drawing.">BitmapStore</a> testStore(50); +<a name="l00058"></a>00058 +<a name="l00059"></a>00059 ALLEGRO_BITMAP* testBitmap = NULL; +<a name="l00060"></a>00060 +<a name="l00061"></a>00061 EXPECT_NO_FATAL_FAILURE(testBitmap = testStore.<a class="code" href="class_bitmap_store.html#aadd437c869c5856c36d920dfafbc6ee4" title="Function to get image for drawing to the screen.">getBitmap</a>(<a class="code" href="class_bitmap_store.html#af3bc66181673def9d0a590cd13c7e386acdaf29947fecd91b452e554a75fb9e92">BitmapStore::PLAYER</a>)); +<a name="l00062"></a>00062 EXPECT_NO_FATAL_FAILURE(testBitmap = testStore.<a class="code" href="class_bitmap_store.html#aadd437c869c5856c36d920dfafbc6ee4" title="Function to get image for drawing to the screen.">getBitmap</a>(<a class="code" href="class_bitmap_store.html#af3bc66181673def9d0a590cd13c7e386a8a7d9a89e243914ca702660237d4f81d">BitmapStore::ENEMY</a>)); +<a name="l00063"></a>00063 EXPECT_NO_FATAL_FAILURE(testBitmap = testStore.<a class="code" href="class_bitmap_store.html#aadd437c869c5856c36d920dfafbc6ee4" title="Function to get image for drawing to the screen.">getBitmap</a>(<a class="code" href="class_bitmap_store.html#af3bc66181673def9d0a590cd13c7e386a780d6b9e20ec37fbaf5a40ca846795d9">BitmapStore::CHECKPOINT</a>)); +<a name="l00064"></a>00064 EXPECT_NO_FATAL_FAILURE(testBitmap = testStore.<a class="code" href="class_bitmap_store.html#aadd437c869c5856c36d920dfafbc6ee4" title="Function to get image for drawing to the screen.">getBitmap</a>(<a class="code" href="class_bitmap_store.html#af3bc66181673def9d0a590cd13c7e386abf3851dc0110fc83020981fcbb5773eb">BitmapStore::ROCK</a>)); +<a name="l00065"></a>00065 EXPECT_NO_FATAL_FAILURE(testBitmap = testStore.<a class="code" href="class_bitmap_store.html#aadd437c869c5856c36d920dfafbc6ee4" title="Function to get image for drawing to the screen.">getBitmap</a>(<a class="code" href="class_bitmap_store.html#af3bc66181673def9d0a590cd13c7e386ae662e77b349a8e22c5826ef35b1b5d9a">BitmapStore::MAZE_WALL</a>)); +<a name="l00066"></a>00066 EXPECT_NO_FATAL_FAILURE(testBitmap = testStore.<a class="code" href="class_bitmap_store.html#aadd437c869c5856c36d920dfafbc6ee4" title="Function to get image for drawing to the screen.">getBitmap</a>(<a class="code" href="class_bitmap_store.html#af3bc66181673def9d0a590cd13c7e386a4e2a075dff2c02bf40b134c9090d1f02">BitmapStore::MAZE_FLOOR</a>)); +<a name="l00067"></a>00067 EXPECT_NO_FATAL_FAILURE(testBitmap = testStore.<a class="code" href="class_bitmap_store.html#aadd437c869c5856c36d920dfafbc6ee4" title="Function to get image for drawing to the screen.">getBitmap</a>(<a class="code" href="class_bitmap_store.html#af3bc66181673def9d0a590cd13c7e386a91fec244d29999552e93ecb7578713fb">BitmapStore::SMOKE</a>)); +<a name="l00068"></a>00068 EXPECT_NO_FATAL_FAILURE(testBitmap = testStore.<a class="code" href="class_bitmap_store.html#aadd437c869c5856c36d920dfafbc6ee4" title="Function to get image for drawing to the screen.">getBitmap</a>(<a class="code" href="class_bitmap_store.html#af3bc66181673def9d0a590cd13c7e386a8b9eb5b79abe467982784ea2227d67e0">BitmapStore::CRASHED_CAR</a>)); +<a name="l00069"></a>00069 EXPECT_NO_FATAL_FAILURE(testBitmap = testStore.<a class="code" href="class_bitmap_store.html#aadd437c869c5856c36d920dfafbc6ee4" title="Function to get image for drawing to the screen.">getBitmap</a>(<a class="code" href="class_bitmap_store.html#af3bc66181673def9d0a590cd13c7e386a824f0021358b88c7f1172d7dece95948">BitmapStore::CLAIMED_CHECKPOINT</a>)); +<a name="l00070"></a>00070 } +<a name="l00071"></a>00071 +<a name="l00075"></a><a class="code" href="presentation_tests_8cpp.html#a93e9b8f162d329b2498f62812b5651f9">00075</a> <a class="code" href="data_tests_8cpp.html#a7612e068db66f415f3b230260450eba8" title="Tests that a normal complete config file can be read.">TEST</a>(<a class="code" href="class_colour_store.html" title="Class for mapping BitmapStore images to colours for use in the minimap.">ColourStore</a>, returnsColourForAllImages) +<a name="l00076"></a>00076 { +<a name="l00077"></a>00077 <a class="code" href="class_colour_store.html" title="Class for mapping BitmapStore images to colours for use in the minimap.">ColourStore</a> testStore; +<a name="l00078"></a>00078 +<a name="l00079"></a>00079 ALLEGRO_COLOR testColour; +<a name="l00080"></a>00080 +<a name="l00081"></a>00081 EXPECT_NO_FATAL_FAILURE(testColour = testStore.<a class="code" href="class_colour_store.html#ac8474c4e9b335215f03ec2c749847ad2" title="Returns the colour associated with a given image.">getColour</a>(<a class="code" href="class_bitmap_store.html#af3bc66181673def9d0a590cd13c7e386acdaf29947fecd91b452e554a75fb9e92">BitmapStore::PLAYER</a>)); +<a name="l00082"></a>00082 EXPECT_NO_FATAL_FAILURE(testColour = testStore.<a class="code" href="class_colour_store.html#ac8474c4e9b335215f03ec2c749847ad2" title="Returns the colour associated with a given image.">getColour</a>(<a class="code" href="class_bitmap_store.html#af3bc66181673def9d0a590cd13c7e386a8a7d9a89e243914ca702660237d4f81d">BitmapStore::ENEMY</a>)); +<a name="l00083"></a>00083 EXPECT_NO_FATAL_FAILURE(testColour = testStore.<a class="code" href="class_colour_store.html#ac8474c4e9b335215f03ec2c749847ad2" title="Returns the colour associated with a given image.">getColour</a>(<a class="code" href="class_bitmap_store.html#af3bc66181673def9d0a590cd13c7e386a780d6b9e20ec37fbaf5a40ca846795d9">BitmapStore::CHECKPOINT</a>)); +<a name="l00084"></a>00084 EXPECT_NO_FATAL_FAILURE(testColour = testStore.<a class="code" href="class_colour_store.html#ac8474c4e9b335215f03ec2c749847ad2" title="Returns the colour associated with a given image.">getColour</a>(<a class="code" href="class_bitmap_store.html#af3bc66181673def9d0a590cd13c7e386abf3851dc0110fc83020981fcbb5773eb">BitmapStore::ROCK</a>)); +<a name="l00085"></a>00085 EXPECT_NO_FATAL_FAILURE(testColour = testStore.<a class="code" href="class_colour_store.html#ac8474c4e9b335215f03ec2c749847ad2" title="Returns the colour associated with a given image.">getColour</a>(<a class="code" href="class_bitmap_store.html#af3bc66181673def9d0a590cd13c7e386ae662e77b349a8e22c5826ef35b1b5d9a">BitmapStore::MAZE_WALL</a>)); +<a name="l00086"></a>00086 EXPECT_NO_FATAL_FAILURE(testColour = testStore.<a class="code" href="class_colour_store.html#ac8474c4e9b335215f03ec2c749847ad2" title="Returns the colour associated with a given image.">getColour</a>(<a class="code" href="class_bitmap_store.html#af3bc66181673def9d0a590cd13c7e386a4e2a075dff2c02bf40b134c9090d1f02">BitmapStore::MAZE_FLOOR</a>)); +<a name="l00087"></a>00087 EXPECT_NO_FATAL_FAILURE(testColour = testStore.<a class="code" href="class_colour_store.html#ac8474c4e9b335215f03ec2c749847ad2" title="Returns the colour associated with a given image.">getColour</a>(<a class="code" href="class_bitmap_store.html#af3bc66181673def9d0a590cd13c7e386a91fec244d29999552e93ecb7578713fb">BitmapStore::SMOKE</a>)); +<a name="l00088"></a>00088 EXPECT_NO_FATAL_FAILURE(testColour = testStore.<a class="code" href="class_colour_store.html#ac8474c4e9b335215f03ec2c749847ad2" title="Returns the colour associated with a given image.">getColour</a>(<a class="code" href="class_bitmap_store.html#af3bc66181673def9d0a590cd13c7e386a8b9eb5b79abe467982784ea2227d67e0">BitmapStore::CRASHED_CAR</a>)); +<a name="l00089"></a>00089 EXPECT_NO_FATAL_FAILURE(testColour = testStore.<a class="code" href="class_colour_store.html#ac8474c4e9b335215f03ec2c749847ad2" title="Returns the colour associated with a given image.">getColour</a>(<a class="code" href="class_bitmap_store.html#af3bc66181673def9d0a590cd13c7e386a824f0021358b88c7f1172d7dece95948">BitmapStore::CLAIMED_CHECKPOINT</a>)); +<a name="l00090"></a>00090 } +<a name="l00091"></a>00091 +<a name="l00095"></a><a class="code" href="presentation_tests_8cpp.html#a09481990af46ae9fd4cced79cce78953">00095</a> <a class="code" href="data_tests_8cpp.html#a7612e068db66f415f3b230260450eba8" title="Tests that a normal complete config file can be read.">TEST</a>(<a class="code" href="class_screen.html" title="Class for creating a window on the screen.">Screen</a>, exceptionOnBadResolution) +<a name="l00096"></a>00096 { +<a name="l00097"></a>00097 <span class="comment">//resolution should be unsupported on most displays</span> +<a name="l00098"></a>00098 <span class="keywordtype">int</span> badWidth = 1000; +<a name="l00099"></a>00099 <span class="keywordtype">int</span> badHeight = 5; +<a name="l00100"></a>00100 +<a name="l00101"></a>00101 EXPECT_ANY_THROW(<a class="code" href="class_screen.html" title="Class for creating a window on the screen.">Screen</a>(badWidth, badHeight, <span class="keyword">true</span>)); +<a name="l00102"></a>00102 } +<a name="l00106"></a><a class="code" href="presentation_tests_8cpp.html#a52ee17980b74b96293db8c102b8245c0">00106</a> <a class="code" href="data_tests_8cpp.html#a7612e068db66f415f3b230260450eba8" title="Tests that a normal complete config file can be read.">TEST</a>(<a class="code" href="class_screen.html" title="Class for creating a window on the screen.">Screen</a>, noExceptionOnWindowed) +<a name="l00107"></a>00107 { +<a name="l00108"></a>00108 <span class="keywordtype">int</span> badWidth = 1000; +<a name="l00109"></a>00109 <span class="keywordtype">int</span> badHeight = 5; +<a name="l00110"></a>00110 +<a name="l00111"></a>00111 EXPECT_NO_THROW(<a class="code" href="class_screen.html" title="Class for creating a window on the screen.">Screen</a>(badWidth, badHeight, <span class="keyword">false</span>)); +<a name="l00112"></a>00112 +<a name="l00113"></a>00113 } +<a name="l00117"></a><a class="code" href="presentation_tests_8cpp.html#a2f96180c4b643bba6a3e9c97a9467f8f">00117</a> <a class="code" href="data_tests_8cpp.html#a7612e068db66f415f3b230260450eba8" title="Tests that a normal complete config file can be read.">TEST</a>(<a class="code" href="class_screen.html" title="Class for creating a window on the screen.">Screen</a>, noExceptionOnGoodResolution) +<a name="l00118"></a>00118 { +<a name="l00119"></a>00119 <span class="comment">//resolution should be supported on most monitors</span> +<a name="l00120"></a>00120 <span class="keywordtype">int</span> goodWidth = 800; +<a name="l00121"></a>00121 <span class="keywordtype">int</span> goodHeight = 600; +<a name="l00122"></a>00122 +<a name="l00123"></a>00123 EXPECT_NO_THROW(<a class="code" href="class_screen.html" title="Class for creating a window on the screen.">Screen</a>(goodWidth, goodHeight, <span class="keyword">true</span>)); +<a name="l00124"></a>00124 } +<a name="l00125"></a>00125 +<a name="l00129"></a><a class="code" href="presentation_tests_8cpp.html#ac0685cd3085971f9d09b22ed8563d766">00129</a> <a class="code" href="data_tests_8cpp.html#a7612e068db66f415f3b230260450eba8" title="Tests that a normal complete config file can be read.">TEST</a>(<a class="code" href="class_screen_panel.html" title="Parent class for panels that are drawn on the screen.">ScreenPanel</a>, drawingToCurrentBackBuffer) +<a name="l00130"></a>00130 { +<a name="l00131"></a>00131 al_init(); +<a name="l00132"></a>00132 +<a name="l00133"></a>00133 ALLEGRO_BITMAP* testBitmapBack = al_create_bitmap(500,500); +<a name="l00134"></a>00134 ALLEGRO_BITMAP* testBitmapFront = al_create_bitmap(500,500); +<a name="l00135"></a>00135 +<a name="l00136"></a>00136 ALLEGRO_COLOR blankColour = al_map_rgb(0,0,0); +<a name="l00137"></a>00137 al_set_target_bitmap(testBitmapBack); +<a name="l00138"></a>00138 al_clear_to_color(blankColour); +<a name="l00139"></a>00139 al_set_target_bitmap(testBitmapFront); +<a name="l00140"></a>00140 al_clear_to_color(blankColour); +<a name="l00141"></a>00141 +<a name="l00142"></a>00142 <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> testPanel(testBitmapBack, testBitmapFront, 0, 0, 500, 500); +<a name="l00143"></a>00143 <a class="code" href="class_maze.html" title="A rectangular 2D boolean array, representing where cars can drive and where they cannot.">Maze</a> testMaze; +<a name="l00144"></a>00144 +<a name="l00145"></a>00145 vector<pair<int,int> > wallsFull; +<a name="l00146"></a>00146 +<a name="l00147"></a>00147 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> x=0; x<20; ++x) +<a name="l00148"></a>00148 { +<a name="l00149"></a>00149 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> y=0; y<20; ++y) +<a name="l00150"></a>00150 { +<a name="l00151"></a>00151 wallsFull.push_back(make_pair(x,y)); +<a name="l00152"></a>00152 } +<a name="l00153"></a>00153 } +<a name="l00154"></a>00154 testMaze.<a class="code" href="class_maze.html#ae238f9a5dbae9418f78f158ced6decf8" title="Generates a new Maze from the vector of wall coordinates.">generateMaze</a>(wallsFull,20,20); +<a name="l00155"></a>00155 +<a name="l00156"></a>00156 list<PlayerCar> players; +<a name="l00157"></a>00157 list<EnemyCar> enemies; +<a name="l00158"></a>00158 list<Checkpoint> checkpoints; +<a name="l00159"></a>00159 list<Rock> rocks; +<a name="l00160"></a>00160 list<Smokescreen> smokescreens; +<a name="l00161"></a>00161 list<DestroyedObjectPopup> popups; +<a name="l00162"></a>00162 +<a name="l00163"></a>00163 testPanel.<a class="code" href="class_game_panel.html#ab093fb770fa8b46ee863947259c72abd" title="Draws the given objects on the screen.">draw</a>(testMaze, players, enemies, checkpoints, rocks, smokescreens, popups); +<a name="l00164"></a>00164 +<a name="l00165"></a>00165 <a class="code" href="class_bitmap_store.html" title="Class for accessing images in ALLEGRO_BITMAP format and low level drawing.">BitmapStore</a> bitmapStore(50); +<a name="l00166"></a>00166 ALLEGRO_BITMAP* wall = bitmapStore.<a class="code" href="class_bitmap_store.html#aadd437c869c5856c36d920dfafbc6ee4" title="Function to get image for drawing to the screen.">getBitmap</a>(<a class="code" href="class_bitmap_store.html#af3bc66181673def9d0a590cd13c7e386ae662e77b349a8e22c5826ef35b1b5d9a">BitmapStore::MAZE_WALL</a>); +<a name="l00167"></a>00167 ALLEGRO_COLOR mazeColour = al_get_pixel(wall, 25, 25); +<a name="l00168"></a>00168 +<a name="l00169"></a>00169 ALLEGRO_COLOR backSample = al_get_pixel(testBitmapBack, 250, 250); +<a name="l00170"></a>00170 ALLEGRO_COLOR frontSample = al_get_pixel(testBitmapFront, 250, 250); +<a name="l00171"></a>00171 +<a name="l00172"></a>00172 EXPECT_FLOAT_EQ(mazeColour.r, backSample.r); +<a name="l00173"></a>00173 EXPECT_FLOAT_EQ(mazeColour.g, backSample.g); +<a name="l00174"></a>00174 EXPECT_FLOAT_EQ(mazeColour.b, backSample.b); +<a name="l00175"></a>00175 EXPECT_FLOAT_EQ(mazeColour.a, backSample.a); +<a name="l00176"></a>00176 +<a name="l00177"></a>00177 EXPECT_FLOAT_EQ(blankColour.r, frontSample.r); +<a name="l00178"></a>00178 EXPECT_FLOAT_EQ(blankColour.g, frontSample.g); +<a name="l00179"></a>00179 EXPECT_FLOAT_EQ(blankColour.b, frontSample.b); +<a name="l00180"></a>00180 EXPECT_FLOAT_EQ(blankColour.a, frontSample.a); +<a name="l00181"></a>00181 +<a name="l00182"></a>00182 al_destroy_bitmap(testBitmapBack); +<a name="l00183"></a>00183 al_destroy_bitmap(testBitmapFront); +<a name="l00184"></a>00184 } +<a name="l00185"></a>00185 +<a name="l00189"></a><a class="code" href="presentation_tests_8cpp.html#a8b8a615a5a6ef5da97b81d626fba41eb">00189</a> <a class="code" href="data_tests_8cpp.html#a7612e068db66f415f3b230260450eba8" title="Tests that a normal complete config file can be read.">TEST</a>(<a class="code" href="class_screen_panel.html" title="Parent class for panels that are drawn on the screen.">ScreenPanel</a>, drawingToCurrentBackBufferAfterFlip) +<a name="l00190"></a>00190 { +<a name="l00191"></a>00191 al_init(); +<a name="l00192"></a>00192 +<a name="l00193"></a>00193 al_set_new_bitmap_flags(ALLEGRO_MEMORY_BITMAP); <span class="comment">//removes dependency on display existing</span> +<a name="l00194"></a>00194 +<a name="l00195"></a>00195 ALLEGRO_BITMAP* testBitmapBack = al_create_bitmap(500,500); +<a name="l00196"></a>00196 ALLEGRO_BITMAP* testBitmapFront = al_create_bitmap(500,500); +<a name="l00197"></a>00197 +<a name="l00198"></a>00198 ALLEGRO_COLOR blankColour = al_map_rgb(0,0,0); +<a name="l00199"></a>00199 al_set_target_bitmap(testBitmapBack); +<a name="l00200"></a>00200 al_clear_to_color(blankColour); +<a name="l00201"></a>00201 al_set_target_bitmap(testBitmapFront); +<a name="l00202"></a>00202 al_clear_to_color(blankColour); +<a name="l00203"></a>00203 +<a name="l00204"></a>00204 <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> testPanel(testBitmapBack, testBitmapFront, 0, 0, 500, 500); +<a name="l00205"></a>00205 <a class="code" href="class_maze.html" title="A rectangular 2D boolean array, representing where cars can drive and where they cannot.">Maze</a> testMaze; +<a name="l00206"></a>00206 +<a name="l00207"></a>00207 vector<pair<int,int> > wallsFull; +<a name="l00208"></a>00208 +<a name="l00209"></a>00209 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> x=0; x<20; ++x) +<a name="l00210"></a>00210 { +<a name="l00211"></a>00211 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> y=0; y<20; ++y) +<a name="l00212"></a>00212 { +<a name="l00213"></a>00213 wallsFull.push_back(make_pair(x,y)); +<a name="l00214"></a>00214 } +<a name="l00215"></a>00215 } +<a name="l00216"></a>00216 testMaze.<a class="code" href="class_maze.html#ae238f9a5dbae9418f78f158ced6decf8" title="Generates a new Maze from the vector of wall coordinates.">generateMaze</a>(wallsFull,20,20); +<a name="l00217"></a>00217 +<a name="l00218"></a>00218 list<PlayerCar> players; +<a name="l00219"></a>00219 list<EnemyCar> enemies; +<a name="l00220"></a>00220 list<Checkpoint> checkpoints; +<a name="l00221"></a>00221 list<Rock> rocks; +<a name="l00222"></a>00222 list<Smokescreen> smokescreens; +<a name="l00223"></a>00223 list<DestroyedObjectPopup> popups; +<a name="l00224"></a>00224 +<a name="l00225"></a>00225 testPanel.<a class="code" href="class_screen_panel.html#ab701d3888b13463d200be112f0eb4d82" title="Swaps the front and back buffers.">flip</a>(); +<a name="l00226"></a>00226 +<a name="l00227"></a>00227 testPanel.<a class="code" href="class_game_panel.html#ab093fb770fa8b46ee863947259c72abd" title="Draws the given objects on the screen.">draw</a>(testMaze, players, enemies, checkpoints, rocks, smokescreens, popups); +<a name="l00228"></a>00228 +<a name="l00229"></a>00229 <a class="code" href="class_bitmap_store.html" title="Class for accessing images in ALLEGRO_BITMAP format and low level drawing.">BitmapStore</a> bitmapStore(50); +<a name="l00230"></a>00230 ALLEGRO_BITMAP* wall = bitmapStore.<a class="code" href="class_bitmap_store.html#aadd437c869c5856c36d920dfafbc6ee4" title="Function to get image for drawing to the screen.">getBitmap</a>(<a class="code" href="class_bitmap_store.html#af3bc66181673def9d0a590cd13c7e386ae662e77b349a8e22c5826ef35b1b5d9a">BitmapStore::MAZE_WALL</a>); +<a name="l00231"></a>00231 ALLEGRO_COLOR mazeColour = al_get_pixel(wall, 25, 25); +<a name="l00232"></a>00232 +<a name="l00233"></a>00233 ALLEGRO_COLOR backSample = al_get_pixel(testBitmapBack, 250, 250); +<a name="l00234"></a>00234 ALLEGRO_COLOR frontSample = al_get_pixel(testBitmapFront, 250, 250); +<a name="l00235"></a>00235 +<a name="l00236"></a>00236 EXPECT_FLOAT_EQ(mazeColour.r, frontSample.r); +<a name="l00237"></a>00237 EXPECT_FLOAT_EQ(mazeColour.g, frontSample.g); +<a name="l00238"></a>00238 EXPECT_FLOAT_EQ(mazeColour.b, frontSample.b); +<a name="l00239"></a>00239 EXPECT_FLOAT_EQ(mazeColour.a, frontSample.a); +<a name="l00240"></a>00240 +<a name="l00241"></a>00241 EXPECT_FLOAT_EQ(blankColour.r, backSample.r); +<a name="l00242"></a>00242 EXPECT_FLOAT_EQ(blankColour.g, backSample.g); +<a name="l00243"></a>00243 EXPECT_FLOAT_EQ(blankColour.b, backSample.b); +<a name="l00244"></a>00244 EXPECT_FLOAT_EQ(blankColour.a, backSample.a); +<a name="l00245"></a>00245 +<a name="l00246"></a>00246 al_destroy_bitmap(testBitmapBack); +<a name="l00247"></a>00247 al_destroy_bitmap(testBitmapFront); +<a name="l00248"></a>00248 } +</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> |