From 98ba22e7064db57316dfff1ae127feb3dceeb73e Mon Sep 17 00:00:00 2001 From: Justin Worthe Date: Thu, 31 Jul 2014 13:58:22 +0200 Subject: Initial commit --- docs/html/_allegro_wrappers_8cpp.html | 110 +++ docs/html/_allegro_wrappers_8cpp_source.html | 223 +++++ docs/html/_allegro_wrappers_8h.html | 127 +++ docs/html/_allegro_wrappers_8h_source.html | 159 +++ docs/html/_bitmap_store_8cpp.html | 110 +++ docs/html/_bitmap_store_8cpp_source.html | 345 +++++++ docs/html/_bitmap_store_8h.html | 125 +++ docs/html/_bitmap_store_8h_source.html | 156 +++ docs/html/_car_8cpp.html | 110 +++ docs/html/_car_8cpp_source.html | 182 ++++ docs/html/_car_8h.html | 121 +++ docs/html/_car_8h_source.html | 134 +++ docs/html/_checkpoint_8cpp.html | 110 +++ docs/html/_checkpoint_8cpp_source.html | 137 +++ docs/html/_checkpoint_8h.html | 119 +++ docs/html/_checkpoint_8h_source.html | 132 +++ docs/html/_collision_detector_8cpp.html | 110 +++ docs/html/_collision_detector_8cpp_source.html | 171 ++++ docs/html/_collision_detector_8h.html | 123 +++ docs/html/_collision_detector_8h_source.html | 137 +++ docs/html/_colour_store_8cpp.html | 110 +++ docs/html/_colour_store_8cpp_source.html | 132 +++ docs/html/_colour_store_8h.html | 119 +++ docs/html/_colour_store_8h_source.html | 132 +++ docs/html/_config_8cpp.html | 110 +++ docs/html/_config_8cpp_source.html | 212 ++++ docs/html/_config_8h.html | 121 +++ docs/html/_config_8h_source.html | 158 +++ docs/html/_destroyed_object_popup_8cpp.html | 110 +++ docs/html/_destroyed_object_popup_8cpp_source.html | 113 +++ docs/html/_destroyed_object_popup_8h.html | 119 +++ docs/html/_destroyed_object_popup_8h_source.html | 125 +++ docs/html/_enemy_car_8cpp.html | 110 +++ docs/html/_enemy_car_8cpp_source.html | 211 ++++ docs/html/_enemy_car_8h.html | 123 +++ docs/html/_enemy_car_8h_source.html | 148 +++ docs/html/_game_8cpp.html | 110 +++ docs/html/_game_8cpp_source.html | 292 ++++++ docs/html/_game_8h.html | 133 +++ docs/html/_game_8h_source.html | 177 ++++ docs/html/_game_object_8cpp.html | 110 +++ docs/html/_game_object_8cpp_source.html | 134 +++ docs/html/_game_object_8h.html | 119 +++ docs/html/_game_object_8h_source.html | 139 +++ docs/html/_game_panel_8cpp.html | 110 +++ docs/html/_game_panel_8cpp_source.html | 240 +++++ docs/html/_game_panel_8h.html | 127 +++ docs/html/_game_panel_8h_source.html | 151 +++ docs/html/_info_panel_8cpp.html | 110 +++ docs/html/_info_panel_8cpp_source.html | 218 +++++ docs/html/_info_panel_8h.html | 128 +++ docs/html/_info_panel_8h_source.html | 159 +++ docs/html/_keyboard_handler_8cpp.html | 110 +++ docs/html/_keyboard_handler_8cpp_source.html | 221 +++++ docs/html/_keyboard_handler_8h.html | 120 +++ docs/html/_keyboard_handler_8h_source.html | 148 +++ docs/html/_level_reader_8cpp.html | 110 +++ docs/html/_level_reader_8cpp_source.html | 161 ++++ docs/html/_level_reader_8h.html | 129 +++ docs/html/_level_reader_8h_source.html | 146 +++ docs/html/_limited_time_object_8cpp.html | 110 +++ docs/html/_limited_time_object_8cpp_source.html | 123 +++ docs/html/_limited_time_object_8h.html | 120 +++ docs/html/_limited_time_object_8h_source.html | 128 +++ docs/html/_maze_8cpp.html | 110 +++ docs/html/_maze_8cpp_source.html | 184 ++++ docs/html/_maze_8h.html | 119 +++ docs/html/_maze_8h_source.html | 142 +++ docs/html/_maze_math_8cpp.html | 110 +++ docs/html/_maze_math_8cpp_source.html | 125 +++ docs/html/_maze_math_8h.html | 118 +++ docs/html/_maze_math_8h_source.html | 126 +++ docs/html/_player_car_8cpp.html | 110 +++ docs/html/_player_car_8cpp_source.html | 194 ++++ docs/html/_player_car_8h.html | 124 +++ docs/html/_player_car_8h_source.html | 149 +++ docs/html/_rock_8cpp.html | 110 +++ docs/html/_rock_8cpp_source.html | 113 +++ docs/html/_rock_8h.html | 119 +++ docs/html/_rock_8h_source.html | 122 +++ docs/html/_screen_8cpp.html | 110 +++ docs/html/_screen_8cpp_source.html | 266 +++++ docs/html/_screen_8h.html | 135 +++ docs/html/_screen_8h_source.html | 177 ++++ docs/html/_screen_panel_8cpp.html | 110 +++ docs/html/_screen_panel_8cpp_source.html | 131 +++ docs/html/_screen_panel_8h.html | 127 +++ docs/html/_screen_panel_8h_source.html | 150 +++ docs/html/_smokescreen_8cpp.html | 110 +++ docs/html/_smokescreen_8cpp_source.html | 113 +++ docs/html/_smokescreen_8h.html | 119 +++ docs/html/_smokescreen_8h_source.html | 124 +++ docs/html/annotated.html | 139 +++ docs/html/bc_s.png | Bin 0 -> 705 bytes docs/html/car.PNG | Bin 0 -> 515 bytes docs/html/carBig.PNG | Bin 0 -> 4104 bytes docs/html/class_allegro_drawing_init-members.html | 115 +++ docs/html/class_allegro_drawing_init.html | 241 +++++ docs/html/class_allegro_init-members.html | 114 +++ docs/html/class_allegro_init.html | 225 +++++ docs/html/class_allegro_keyboard_init-members.html | 115 +++ docs/html/class_allegro_keyboard_init.html | 247 +++++ docs/html/class_bad_resolution.html | 124 +++ docs/html/class_bitmap_store-members.html | 138 +++ docs/html/class_bitmap_store.html | 665 +++++++++++++ docs/html/class_car-members.html | 126 +++ docs/html/class_car.html | 302 ++++++ docs/html/class_car.png | Bin 0 -> 687 bytes docs/html/class_checkpoint-members.html | 127 +++ docs/html/class_checkpoint.html | 301 ++++++ docs/html/class_checkpoint.png | Bin 0 -> 408 bytes docs/html/class_collision_detector-members.html | 115 +++ docs/html/class_collision_detector.html | 360 +++++++ docs/html/class_colour_store-members.html | 117 +++ docs/html/class_colour_store.html | 297 ++++++ docs/html/class_config-members.html | 130 +++ docs/html/class_config.html | 681 +++++++++++++ .../html/class_destroyed_object_popup-members.html | 125 +++ docs/html/class_destroyed_object_popup.html | 215 +++++ docs/html/class_destroyed_object_popup.png | Bin 0 -> 727 bytes docs/html/class_enemy_car-members.html | 138 +++ docs/html/class_enemy_car.html | 480 ++++++++++ docs/html/class_enemy_car.png | Bin 0 -> 508 bytes docs/html/class_file_open_error.html | 125 +++ docs/html/class_game-members.html | 134 +++ docs/html/class_game.html | 643 +++++++++++++ docs/html/class_game_object-members.html | 121 +++ docs/html/class_game_object.html | 421 ++++++++ docs/html/class_game_object.png | Bin 0 -> 1614 bytes docs/html/class_game_panel-members.html | 131 +++ docs/html/class_game_panel.html | 580 +++++++++++ docs/html/class_game_panel.png | Bin 0 -> 409 bytes docs/html/class_info_panel-members.html | 137 +++ docs/html/class_info_panel.html | 695 ++++++++++++++ docs/html/class_info_panel.png | Bin 0 -> 380 bytes docs/html/class_install_failure.html | 124 +++ docs/html/class_keyboard_handler-members.html | 130 +++ docs/html/class_keyboard_handler.html | 559 +++++++++++ docs/html/class_level_reader-members.html | 118 +++ docs/html/class_level_reader.html | 347 +++++++ docs/html/class_limited_time_object-members.html | 124 +++ docs/html/class_limited_time_object.html | 247 +++++ docs/html/class_limited_time_object.png | Bin 0 -> 954 bytes docs/html/class_maze-members.html | 125 +++ docs/html/class_maze.html | 450 +++++++++ docs/html/class_maze_math-members.html | 115 +++ docs/html/class_maze_math.html | 288 ++++++ docs/html/class_player_car-members.html | 137 +++ docs/html/class_player_car.html | 435 +++++++++ docs/html/class_player_car.png | Bin 0 -> 499 bytes docs/html/class_rock-members.html | 122 +++ docs/html/class_rock.html | 184 ++++ docs/html/class_rock.png | Bin 0 -> 373 bytes docs/html/class_screen-members.html | 133 +++ docs/html/class_screen.html | 699 ++++++++++++++ docs/html/class_screen_panel-members.html | 122 +++ docs/html/class_screen_panel.html | 508 ++++++++++ docs/html/class_screen_panel.png | Bin 0 -> 517 bytes docs/html/class_smokescreen-members.html | 125 +++ docs/html/class_smokescreen.html | 208 ++++ docs/html/class_smokescreen.png | Bin 0 -> 636 bytes docs/html/classes.html | 142 +++ docs/html/closed.png | Bin 0 -> 126 bytes docs/html/data_tests_8cpp.html | 305 ++++++ docs/html/data_tests_8cpp_source.html | 261 +++++ docs/html/doxygen.css | 946 ++++++++++++++++++ docs/html/doxygen.png | Bin 0 -> 3942 bytes docs/html/files.html | 159 +++ docs/html/functions.html | 377 ++++++++ docs/html/functions_0x61.html | 154 +++ docs/html/functions_0x62.html | 166 ++++ docs/html/functions_0x63.html | 197 ++++ docs/html/functions_0x64.html | 203 ++++ docs/html/functions_0x65.html | 160 ++++ docs/html/functions_0x66.html | 167 ++++ docs/html/functions_0x67.html | 186 ++++ docs/html/functions_0x68.html | 148 +++ docs/html/functions_0x69.html | 157 +++ docs/html/functions_0x6b.html | 148 +++ docs/html/functions_0x6c.html | 157 +++ docs/html/functions_0x6d.html | 163 ++++ docs/html/functions_0x6f.html | 156 +++ docs/html/functions_0x70.html | 172 ++++ docs/html/functions_0x72.html | 178 ++++ docs/html/functions_0x73.html | 199 ++++ docs/html/functions_0x75.html | 160 ++++ docs/html/functions_0x77.html | 154 +++ docs/html/functions_0x78.html | 148 +++ docs/html/functions_0x79.html | 148 +++ docs/html/functions_0x7e.html | 175 ++++ docs/html/functions_enum.html | 126 +++ docs/html/functions_eval.html | 162 ++++ docs/html/functions_func.html | 548 +++++++++++ docs/html/functions_type.html | 120 +++ docs/html/functions_vars.html | 483 ++++++++++ docs/html/globals.html | 132 +++ docs/html/globals_func.html | 132 +++ docs/html/hierarchy.html | 147 +++ docs/html/index.html | 101 ++ docs/html/installdox | 112 +++ docs/html/jquery.js | 54 ++ docs/html/logic_tests_8cpp.html | 1013 ++++++++++++++++++++ docs/html/logic_tests_8cpp_source.html | 656 +++++++++++++ docs/html/main_8cpp.html | 136 +++ docs/html/main_8cpp_source.html | 128 +++ docs/html/nav_f.png | Bin 0 -> 159 bytes docs/html/nav_h.png | Bin 0 -> 97 bytes docs/html/open.png | Bin 0 -> 118 bytes docs/html/presentation_tests_8cpp.html | 371 +++++++ docs/html/presentation_tests_8cpp_source.html | 303 ++++++ docs/html/search/all_5f.html | 487 ++++++++++ docs/html/search/all_61.html | 60 ++ docs/html/search/all_62.html | 81 ++ docs/html/search/all_63.html | 194 ++++ docs/html/search/all_64.html | 155 +++ docs/html/search/all_65.html | 63 ++ docs/html/search/all_66.html | 70 ++ docs/html/search/all_67.html | 145 +++ docs/html/search/all_68.html | 26 + docs/html/search/all_69.html | 60 ++ docs/html/search/all_6b.html | 40 + docs/html/search/all_6c.html | 75 ++ docs/html/search/all_6d.html | 94 ++ docs/html/search/all_6f.html | 36 + docs/html/search/all_70.html | 92 ++ docs/html/search/all_72.html | 94 ++ docs/html/search/all_73.html | 169 ++++ docs/html/search/all_74.html | 65 ++ docs/html/search/all_75.html | 49 + docs/html/search/all_77.html | 38 + docs/html/search/all_78.html | 26 + docs/html/search/all_79.html | 26 + docs/html/search/all_7e.html | 80 ++ docs/html/search/classes_61.html | 35 + docs/html/search/classes_62.html | 30 + docs/html/search/classes_63.html | 45 + docs/html/search/classes_64.html | 25 + docs/html/search/classes_65.html | 25 + docs/html/search/classes_66.html | 25 + docs/html/search/classes_67.html | 35 + docs/html/search/classes_69.html | 30 + docs/html/search/classes_6b.html | 25 + docs/html/search/classes_6c.html | 30 + docs/html/search/classes_6d.html | 30 + docs/html/search/classes_70.html | 25 + docs/html/search/classes_72.html | 25 + docs/html/search/classes_73.html | 35 + docs/html/search/close.png | Bin 0 -> 273 bytes docs/html/search/enums_64.html | 26 + docs/html/search/enums_69.html | 26 + docs/html/search/enums_73.html | 26 + docs/html/search/enumvalues_62.html | 26 + docs/html/search/enumvalues_63.html | 44 + docs/html/search/enumvalues_64.html | 26 + docs/html/search/enumvalues_65.html | 26 + docs/html/search/enumvalues_6c.html | 26 + docs/html/search/enumvalues_6d.html | 32 + docs/html/search/enumvalues_70.html | 26 + docs/html/search/enumvalues_72.html | 32 + docs/html/search/enumvalues_73.html | 26 + docs/html/search/enumvalues_75.html | 26 + docs/html/search/files_61.html | 30 + docs/html/search/files_62.html | 30 + docs/html/search/files_63.html | 70 ++ docs/html/search/files_64.html | 35 + docs/html/search/files_65.html | 30 + docs/html/search/files_67.html | 50 + docs/html/search/files_69.html | 30 + docs/html/search/files_6b.html | 30 + docs/html/search/files_6c.html | 45 + docs/html/search/files_6d.html | 45 + docs/html/search/files_70.html | 35 + docs/html/search/files_72.html | 30 + docs/html/search/files_73.html | 50 + docs/html/search/functions_61.html | 47 + docs/html/search/functions_62.html | 41 + docs/html/search/functions_63.html | 106 ++ docs/html/search/functions_64.html | 119 +++ docs/html/search/functions_65.html | 38 + docs/html/search/functions_66.html | 47 + docs/html/search/functions_67.html | 110 +++ docs/html/search/functions_68.html | 26 + docs/html/search/functions_69.html | 41 + docs/html/search/functions_6b.html | 29 + docs/html/search/functions_6c.html | 32 + docs/html/search/functions_6d.html | 53 + docs/html/search/functions_6f.html | 36 + docs/html/search/functions_70.html | 38 + docs/html/search/functions_72.html | 62 ++ docs/html/search/functions_73.html | 86 ++ docs/html/search/functions_74.html | 65 ++ docs/html/search/functions_75.html | 37 + docs/html/search/functions_77.html | 32 + docs/html/search/functions_78.html | 26 + docs/html/search/functions_79.html | 26 + docs/html/search/functions_7e.html | 80 ++ docs/html/search/mag_sel.png | Bin 0 -> 563 bytes docs/html/search/nomatches.html | 12 + docs/html/search/search.css | 233 +++++ docs/html/search/search.js | 740 ++++++++++++++ docs/html/search/search_l.png | Bin 0 -> 604 bytes docs/html/search/search_m.png | Bin 0 -> 158 bytes docs/html/search/search_r.png | Bin 0 -> 612 bytes docs/html/search/typedefs_62.html | 26 + docs/html/search/variables_5f.html | 487 ++++++++++ docs/html/search/variables_62.html | 32 + docs/html/search/variables_63.html | 26 + docs/html/search/variables_64.html | 26 + docs/html/search/variables_65.html | 26 + docs/html/search/variables_66.html | 38 + docs/html/search/variables_6c.html | 26 + docs/html/search/variables_70.html | 50 + docs/html/search/variables_72.html | 32 + docs/html/search/variables_73.html | 56 ++ docs/html/search/variables_75.html | 26 + docs/html/search/variables_77.html | 26 + docs/html/tab_a.png | Bin 0 -> 140 bytes docs/html/tab_b.png | Bin 0 -> 178 bytes docs/html/tab_h.png | Bin 0 -> 192 bytes docs/html/tab_s.png | Bin 0 -> 189 bytes docs/html/tabs.css | 59 ++ exe/Junction 02.ttf | Bin 0 -> 46248 bytes exe/Junction FONTLOG.txt | 32 + exe/RallyX.exe | Bin 0 -> 558592 bytes exe/allegro-5.0.3-monolith-md-debug.dll | Bin 0 -> 7609251 bytes exe/config.txt | 3 + exe/level1.lvl | 31 + exe/level2.lvl | 25 + exe/level3.lvl | 57 ++ exe/libgcc_s_dw2-1.dll | Bin 0 -> 43008 bytes exe/rallyx-test.exe | Bin 0 -> 948736 bytes source/data/Config.cpp | 105 ++ source/data/Config.h | 136 +++ source/data/LevelReader.cpp | 54 ++ source/data/LevelReader.h | 71 ++ source/logic/AllegroWrappers.cpp | 116 +++ source/logic/AllegroWrappers.h | 112 +++ source/logic/Car.cpp | 75 ++ source/logic/Car.h | 57 ++ source/logic/Checkpoint.cpp | 30 + source/logic/Checkpoint.h | 53 + source/logic/CollisionDetector.cpp | 64 ++ source/logic/CollisionDetector.h | 75 ++ source/logic/DestroyedObjectPopup.cpp | 6 + source/logic/DestroyedObjectPopup.h | 33 + source/logic/EnemyCar.cpp | 104 ++ source/logic/EnemyCar.h | 97 ++ source/logic/Game.cpp | 185 ++++ source/logic/Game.h | 135 +++ source/logic/GameObject.cpp | 27 + source/logic/GameObject.h | 82 ++ source/logic/LimitedTimeObject.cpp | 16 + source/logic/LimitedTimeObject.h | 45 + source/logic/Maze.cpp | 77 ++ source/logic/Maze.h | 100 ++ source/logic/MazeMath.cpp | 18 + source/logic/MazeMath.h | 59 ++ source/logic/PlayerCar.cpp | 87 ++ source/logic/PlayerCar.h | 99 ++ source/logic/Rock.cpp | 6 + source/logic/Rock.h | 29 + source/logic/Smokescreen.cpp | 6 + source/logic/Smokescreen.h | 31 + source/main.cpp | 21 + source/presentation/BitmapStore.cpp | 238 +++++ source/presentation/BitmapStore.h | 140 +++ source/presentation/ColourStore.cpp | 25 + source/presentation/ColourStore.h | 60 ++ source/presentation/GamePanel.cpp | 133 +++ source/presentation/GamePanel.h | 117 +++ source/presentation/InfoPanel.cpp | 111 +++ source/presentation/InfoPanel.h | 140 +++ source/presentation/KeyboardHandler.cpp | 114 +++ source/presentation/KeyboardHandler.h | 83 ++ source/presentation/Screen.cpp | 159 +++ source/presentation/Screen.h | 159 +++ source/presentation/ScreenPanel.cpp | 24 + source/presentation/ScreenPanel.h | 98 ++ tests/dataTests.cpp | 184 ++++ tests/logicTests.cpp | 685 +++++++++++++ tests/presentationTests.cpp | 248 +++++ 381 files changed, 48956 insertions(+) create mode 100644 docs/html/_allegro_wrappers_8cpp.html create mode 100644 docs/html/_allegro_wrappers_8cpp_source.html create mode 100644 docs/html/_allegro_wrappers_8h.html create mode 100644 docs/html/_allegro_wrappers_8h_source.html create mode 100644 docs/html/_bitmap_store_8cpp.html create mode 100644 docs/html/_bitmap_store_8cpp_source.html create mode 100644 docs/html/_bitmap_store_8h.html create mode 100644 docs/html/_bitmap_store_8h_source.html create mode 100644 docs/html/_car_8cpp.html create mode 100644 docs/html/_car_8cpp_source.html create mode 100644 docs/html/_car_8h.html create mode 100644 docs/html/_car_8h_source.html create mode 100644 docs/html/_checkpoint_8cpp.html create mode 100644 docs/html/_checkpoint_8cpp_source.html create mode 100644 docs/html/_checkpoint_8h.html create mode 100644 docs/html/_checkpoint_8h_source.html create mode 100644 docs/html/_collision_detector_8cpp.html create mode 100644 docs/html/_collision_detector_8cpp_source.html create mode 100644 docs/html/_collision_detector_8h.html create mode 100644 docs/html/_collision_detector_8h_source.html create mode 100644 docs/html/_colour_store_8cpp.html create mode 100644 docs/html/_colour_store_8cpp_source.html create mode 100644 docs/html/_colour_store_8h.html create mode 100644 docs/html/_colour_store_8h_source.html create mode 100644 docs/html/_config_8cpp.html create mode 100644 docs/html/_config_8cpp_source.html create mode 100644 docs/html/_config_8h.html create mode 100644 docs/html/_config_8h_source.html create mode 100644 docs/html/_destroyed_object_popup_8cpp.html create mode 100644 docs/html/_destroyed_object_popup_8cpp_source.html create mode 100644 docs/html/_destroyed_object_popup_8h.html create mode 100644 docs/html/_destroyed_object_popup_8h_source.html create mode 100644 docs/html/_enemy_car_8cpp.html create mode 100644 docs/html/_enemy_car_8cpp_source.html create mode 100644 docs/html/_enemy_car_8h.html create mode 100644 docs/html/_enemy_car_8h_source.html create mode 100644 docs/html/_game_8cpp.html create mode 100644 docs/html/_game_8cpp_source.html create mode 100644 docs/html/_game_8h.html create mode 100644 docs/html/_game_8h_source.html create mode 100644 docs/html/_game_object_8cpp.html create mode 100644 docs/html/_game_object_8cpp_source.html create mode 100644 docs/html/_game_object_8h.html create mode 100644 docs/html/_game_object_8h_source.html create mode 100644 docs/html/_game_panel_8cpp.html create mode 100644 docs/html/_game_panel_8cpp_source.html create mode 100644 docs/html/_game_panel_8h.html create mode 100644 docs/html/_game_panel_8h_source.html create mode 100644 docs/html/_info_panel_8cpp.html create mode 100644 docs/html/_info_panel_8cpp_source.html create mode 100644 docs/html/_info_panel_8h.html create mode 100644 docs/html/_info_panel_8h_source.html create mode 100644 docs/html/_keyboard_handler_8cpp.html create mode 100644 docs/html/_keyboard_handler_8cpp_source.html create mode 100644 docs/html/_keyboard_handler_8h.html create mode 100644 docs/html/_keyboard_handler_8h_source.html create mode 100644 docs/html/_level_reader_8cpp.html create mode 100644 docs/html/_level_reader_8cpp_source.html create mode 100644 docs/html/_level_reader_8h.html create mode 100644 docs/html/_level_reader_8h_source.html create mode 100644 docs/html/_limited_time_object_8cpp.html create mode 100644 docs/html/_limited_time_object_8cpp_source.html create mode 100644 docs/html/_limited_time_object_8h.html create mode 100644 docs/html/_limited_time_object_8h_source.html create mode 100644 docs/html/_maze_8cpp.html create mode 100644 docs/html/_maze_8cpp_source.html create mode 100644 docs/html/_maze_8h.html create mode 100644 docs/html/_maze_8h_source.html create mode 100644 docs/html/_maze_math_8cpp.html create mode 100644 docs/html/_maze_math_8cpp_source.html create mode 100644 docs/html/_maze_math_8h.html create mode 100644 docs/html/_maze_math_8h_source.html create mode 100644 docs/html/_player_car_8cpp.html create mode 100644 docs/html/_player_car_8cpp_source.html create mode 100644 docs/html/_player_car_8h.html create mode 100644 docs/html/_player_car_8h_source.html create mode 100644 docs/html/_rock_8cpp.html create mode 100644 docs/html/_rock_8cpp_source.html create mode 100644 docs/html/_rock_8h.html create mode 100644 docs/html/_rock_8h_source.html create mode 100644 docs/html/_screen_8cpp.html create mode 100644 docs/html/_screen_8cpp_source.html create mode 100644 docs/html/_screen_8h.html create mode 100644 docs/html/_screen_8h_source.html create mode 100644 docs/html/_screen_panel_8cpp.html create mode 100644 docs/html/_screen_panel_8cpp_source.html create mode 100644 docs/html/_screen_panel_8h.html create mode 100644 docs/html/_screen_panel_8h_source.html create mode 100644 docs/html/_smokescreen_8cpp.html create mode 100644 docs/html/_smokescreen_8cpp_source.html create mode 100644 docs/html/_smokescreen_8h.html create mode 100644 docs/html/_smokescreen_8h_source.html create mode 100644 docs/html/annotated.html create mode 100644 docs/html/bc_s.png create mode 100644 docs/html/car.PNG create mode 100644 docs/html/carBig.PNG create mode 100644 docs/html/class_allegro_drawing_init-members.html create mode 100644 docs/html/class_allegro_drawing_init.html create mode 100644 docs/html/class_allegro_init-members.html create mode 100644 docs/html/class_allegro_init.html create mode 100644 docs/html/class_allegro_keyboard_init-members.html create mode 100644 docs/html/class_allegro_keyboard_init.html create mode 100644 docs/html/class_bad_resolution.html create mode 100644 docs/html/class_bitmap_store-members.html create mode 100644 docs/html/class_bitmap_store.html create mode 100644 docs/html/class_car-members.html create mode 100644 docs/html/class_car.html create mode 100644 docs/html/class_car.png create mode 100644 docs/html/class_checkpoint-members.html create mode 100644 docs/html/class_checkpoint.html create mode 100644 docs/html/class_checkpoint.png create mode 100644 docs/html/class_collision_detector-members.html create mode 100644 docs/html/class_collision_detector.html create mode 100644 docs/html/class_colour_store-members.html create mode 100644 docs/html/class_colour_store.html create mode 100644 docs/html/class_config-members.html create mode 100644 docs/html/class_config.html create mode 100644 docs/html/class_destroyed_object_popup-members.html create mode 100644 docs/html/class_destroyed_object_popup.html create mode 100644 docs/html/class_destroyed_object_popup.png create mode 100644 docs/html/class_enemy_car-members.html create mode 100644 docs/html/class_enemy_car.html create mode 100644 docs/html/class_enemy_car.png create mode 100644 docs/html/class_file_open_error.html create mode 100644 docs/html/class_game-members.html create mode 100644 docs/html/class_game.html create mode 100644 docs/html/class_game_object-members.html create mode 100644 docs/html/class_game_object.html create mode 100644 docs/html/class_game_object.png create mode 100644 docs/html/class_game_panel-members.html create mode 100644 docs/html/class_game_panel.html create mode 100644 docs/html/class_game_panel.png create mode 100644 docs/html/class_info_panel-members.html create mode 100644 docs/html/class_info_panel.html create mode 100644 docs/html/class_info_panel.png create mode 100644 docs/html/class_install_failure.html create mode 100644 docs/html/class_keyboard_handler-members.html create mode 100644 docs/html/class_keyboard_handler.html create mode 100644 docs/html/class_level_reader-members.html create mode 100644 docs/html/class_level_reader.html create mode 100644 docs/html/class_limited_time_object-members.html create mode 100644 docs/html/class_limited_time_object.html create mode 100644 docs/html/class_limited_time_object.png create mode 100644 docs/html/class_maze-members.html create mode 100644 docs/html/class_maze.html create mode 100644 docs/html/class_maze_math-members.html create mode 100644 docs/html/class_maze_math.html create mode 100644 docs/html/class_player_car-members.html create mode 100644 docs/html/class_player_car.html create mode 100644 docs/html/class_player_car.png create mode 100644 docs/html/class_rock-members.html create mode 100644 docs/html/class_rock.html create mode 100644 docs/html/class_rock.png create mode 100644 docs/html/class_screen-members.html create mode 100644 docs/html/class_screen.html create mode 100644 docs/html/class_screen_panel-members.html create mode 100644 docs/html/class_screen_panel.html create mode 100644 docs/html/class_screen_panel.png create mode 100644 docs/html/class_smokescreen-members.html create mode 100644 docs/html/class_smokescreen.html create mode 100644 docs/html/class_smokescreen.png create mode 100644 docs/html/classes.html create mode 100644 docs/html/closed.png create mode 100644 docs/html/data_tests_8cpp.html create mode 100644 docs/html/data_tests_8cpp_source.html create mode 100644 docs/html/doxygen.css create mode 100644 docs/html/doxygen.png create mode 100644 docs/html/files.html create mode 100644 docs/html/functions.html create mode 100644 docs/html/functions_0x61.html create mode 100644 docs/html/functions_0x62.html create mode 100644 docs/html/functions_0x63.html create mode 100644 docs/html/functions_0x64.html create mode 100644 docs/html/functions_0x65.html create mode 100644 docs/html/functions_0x66.html create mode 100644 docs/html/functions_0x67.html create mode 100644 docs/html/functions_0x68.html create mode 100644 docs/html/functions_0x69.html create mode 100644 docs/html/functions_0x6b.html create mode 100644 docs/html/functions_0x6c.html create mode 100644 docs/html/functions_0x6d.html create mode 100644 docs/html/functions_0x6f.html create mode 100644 docs/html/functions_0x70.html create mode 100644 docs/html/functions_0x72.html create mode 100644 docs/html/functions_0x73.html create mode 100644 docs/html/functions_0x75.html create mode 100644 docs/html/functions_0x77.html create mode 100644 docs/html/functions_0x78.html create mode 100644 docs/html/functions_0x79.html create mode 100644 docs/html/functions_0x7e.html create mode 100644 docs/html/functions_enum.html create mode 100644 docs/html/functions_eval.html create mode 100644 docs/html/functions_func.html create mode 100644 docs/html/functions_type.html create mode 100644 docs/html/functions_vars.html create mode 100644 docs/html/globals.html create mode 100644 docs/html/globals_func.html create mode 100644 docs/html/hierarchy.html create mode 100644 docs/html/index.html create mode 100644 docs/html/installdox create mode 100644 docs/html/jquery.js create mode 100644 docs/html/logic_tests_8cpp.html create mode 100644 docs/html/logic_tests_8cpp_source.html create mode 100644 docs/html/main_8cpp.html create mode 100644 docs/html/main_8cpp_source.html create mode 100644 docs/html/nav_f.png create mode 100644 docs/html/nav_h.png create mode 100644 docs/html/open.png create mode 100644 docs/html/presentation_tests_8cpp.html create mode 100644 docs/html/presentation_tests_8cpp_source.html create mode 100644 docs/html/search/all_5f.html create mode 100644 docs/html/search/all_61.html create mode 100644 docs/html/search/all_62.html create mode 100644 docs/html/search/all_63.html create mode 100644 docs/html/search/all_64.html create mode 100644 docs/html/search/all_65.html create mode 100644 docs/html/search/all_66.html create mode 100644 docs/html/search/all_67.html create mode 100644 docs/html/search/all_68.html create mode 100644 docs/html/search/all_69.html create mode 100644 docs/html/search/all_6b.html create mode 100644 docs/html/search/all_6c.html create mode 100644 docs/html/search/all_6d.html create mode 100644 docs/html/search/all_6f.html create mode 100644 docs/html/search/all_70.html create mode 100644 docs/html/search/all_72.html create mode 100644 docs/html/search/all_73.html create mode 100644 docs/html/search/all_74.html create mode 100644 docs/html/search/all_75.html create mode 100644 docs/html/search/all_77.html create mode 100644 docs/html/search/all_78.html create mode 100644 docs/html/search/all_79.html create mode 100644 docs/html/search/all_7e.html create mode 100644 docs/html/search/classes_61.html create mode 100644 docs/html/search/classes_62.html create mode 100644 docs/html/search/classes_63.html create mode 100644 docs/html/search/classes_64.html create mode 100644 docs/html/search/classes_65.html create mode 100644 docs/html/search/classes_66.html create mode 100644 docs/html/search/classes_67.html create mode 100644 docs/html/search/classes_69.html create mode 100644 docs/html/search/classes_6b.html create mode 100644 docs/html/search/classes_6c.html create mode 100644 docs/html/search/classes_6d.html create mode 100644 docs/html/search/classes_70.html create mode 100644 docs/html/search/classes_72.html create mode 100644 docs/html/search/classes_73.html create mode 100644 docs/html/search/close.png create mode 100644 docs/html/search/enums_64.html create mode 100644 docs/html/search/enums_69.html create mode 100644 docs/html/search/enums_73.html create mode 100644 docs/html/search/enumvalues_62.html create mode 100644 docs/html/search/enumvalues_63.html create mode 100644 docs/html/search/enumvalues_64.html create mode 100644 docs/html/search/enumvalues_65.html create mode 100644 docs/html/search/enumvalues_6c.html create mode 100644 docs/html/search/enumvalues_6d.html create mode 100644 docs/html/search/enumvalues_70.html create mode 100644 docs/html/search/enumvalues_72.html create mode 100644 docs/html/search/enumvalues_73.html create mode 100644 docs/html/search/enumvalues_75.html create mode 100644 docs/html/search/files_61.html create mode 100644 docs/html/search/files_62.html create mode 100644 docs/html/search/files_63.html create mode 100644 docs/html/search/files_64.html create mode 100644 docs/html/search/files_65.html create mode 100644 docs/html/search/files_67.html create mode 100644 docs/html/search/files_69.html create mode 100644 docs/html/search/files_6b.html create mode 100644 docs/html/search/files_6c.html create mode 100644 docs/html/search/files_6d.html create mode 100644 docs/html/search/files_70.html create mode 100644 docs/html/search/files_72.html create mode 100644 docs/html/search/files_73.html create mode 100644 docs/html/search/functions_61.html create mode 100644 docs/html/search/functions_62.html create mode 100644 docs/html/search/functions_63.html create mode 100644 docs/html/search/functions_64.html create mode 100644 docs/html/search/functions_65.html create mode 100644 docs/html/search/functions_66.html create mode 100644 docs/html/search/functions_67.html create mode 100644 docs/html/search/functions_68.html create mode 100644 docs/html/search/functions_69.html create mode 100644 docs/html/search/functions_6b.html create mode 100644 docs/html/search/functions_6c.html create mode 100644 docs/html/search/functions_6d.html create mode 100644 docs/html/search/functions_6f.html create mode 100644 docs/html/search/functions_70.html create mode 100644 docs/html/search/functions_72.html create mode 100644 docs/html/search/functions_73.html create mode 100644 docs/html/search/functions_74.html create mode 100644 docs/html/search/functions_75.html create mode 100644 docs/html/search/functions_77.html create mode 100644 docs/html/search/functions_78.html create mode 100644 docs/html/search/functions_79.html create mode 100644 docs/html/search/functions_7e.html create mode 100644 docs/html/search/mag_sel.png create mode 100644 docs/html/search/nomatches.html create mode 100644 docs/html/search/search.css create mode 100644 docs/html/search/search.js create mode 100644 docs/html/search/search_l.png create mode 100644 docs/html/search/search_m.png create mode 100644 docs/html/search/search_r.png create mode 100644 docs/html/search/typedefs_62.html create mode 100644 docs/html/search/variables_5f.html create mode 100644 docs/html/search/variables_62.html create mode 100644 docs/html/search/variables_63.html create mode 100644 docs/html/search/variables_64.html create mode 100644 docs/html/search/variables_65.html create mode 100644 docs/html/search/variables_66.html create mode 100644 docs/html/search/variables_6c.html create mode 100644 docs/html/search/variables_70.html create mode 100644 docs/html/search/variables_72.html create mode 100644 docs/html/search/variables_73.html create mode 100644 docs/html/search/variables_75.html create mode 100644 docs/html/search/variables_77.html create mode 100644 docs/html/tab_a.png create mode 100644 docs/html/tab_b.png create mode 100644 docs/html/tab_h.png create mode 100644 docs/html/tab_s.png create mode 100644 docs/html/tabs.css create mode 100644 exe/Junction 02.ttf create mode 100644 exe/Junction FONTLOG.txt create mode 100644 exe/RallyX.exe create mode 100644 exe/allegro-5.0.3-monolith-md-debug.dll create mode 100644 exe/config.txt create mode 100644 exe/level1.lvl create mode 100644 exe/level2.lvl create mode 100644 exe/level3.lvl create mode 100644 exe/libgcc_s_dw2-1.dll create mode 100644 exe/rallyx-test.exe create mode 100644 source/data/Config.cpp create mode 100644 source/data/Config.h create mode 100644 source/data/LevelReader.cpp create mode 100644 source/data/LevelReader.h create mode 100644 source/logic/AllegroWrappers.cpp create mode 100644 source/logic/AllegroWrappers.h create mode 100644 source/logic/Car.cpp create mode 100644 source/logic/Car.h create mode 100644 source/logic/Checkpoint.cpp create mode 100644 source/logic/Checkpoint.h create mode 100644 source/logic/CollisionDetector.cpp create mode 100644 source/logic/CollisionDetector.h create mode 100644 source/logic/DestroyedObjectPopup.cpp create mode 100644 source/logic/DestroyedObjectPopup.h create mode 100644 source/logic/EnemyCar.cpp create mode 100644 source/logic/EnemyCar.h create mode 100644 source/logic/Game.cpp create mode 100644 source/logic/Game.h create mode 100644 source/logic/GameObject.cpp create mode 100644 source/logic/GameObject.h create mode 100644 source/logic/LimitedTimeObject.cpp create mode 100644 source/logic/LimitedTimeObject.h create mode 100644 source/logic/Maze.cpp create mode 100644 source/logic/Maze.h create mode 100644 source/logic/MazeMath.cpp create mode 100644 source/logic/MazeMath.h create mode 100644 source/logic/PlayerCar.cpp create mode 100644 source/logic/PlayerCar.h create mode 100644 source/logic/Rock.cpp create mode 100644 source/logic/Rock.h create mode 100644 source/logic/Smokescreen.cpp create mode 100644 source/logic/Smokescreen.h create mode 100644 source/main.cpp create mode 100644 source/presentation/BitmapStore.cpp create mode 100644 source/presentation/BitmapStore.h create mode 100644 source/presentation/ColourStore.cpp create mode 100644 source/presentation/ColourStore.h create mode 100644 source/presentation/GamePanel.cpp create mode 100644 source/presentation/GamePanel.h create mode 100644 source/presentation/InfoPanel.cpp create mode 100644 source/presentation/InfoPanel.h create mode 100644 source/presentation/KeyboardHandler.cpp create mode 100644 source/presentation/KeyboardHandler.h create mode 100644 source/presentation/Screen.cpp create mode 100644 source/presentation/Screen.h create mode 100644 source/presentation/ScreenPanel.cpp create mode 100644 source/presentation/ScreenPanel.h create mode 100644 tests/dataTests.cpp create mode 100644 tests/logicTests.cpp create mode 100644 tests/presentationTests.cpp diff --git a/docs/html/_allegro_wrappers_8cpp.html b/docs/html/_allegro_wrappers_8cpp.html new file mode 100644 index 0000000..3b59859 --- /dev/null +++ b/docs/html/_allegro_wrappers_8cpp.html @@ -0,0 +1,110 @@ + + + + +Rally X: source/logic/AllegroWrappers.cpp File Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
+
source/logic/AllegroWrappers.cpp File Reference
+
+
+
#include "AllegroWrappers.h"
+
+

Go to the source code of this file.

+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_allegro_wrappers_8cpp_source.html b/docs/html/_allegro_wrappers_8cpp_source.html new file mode 100644 index 0000000..60278e3 --- /dev/null +++ b/docs/html/_allegro_wrappers_8cpp_source.html @@ -0,0 +1,223 @@ + + + + +Rally X: source/logic/AllegroWrappers.cpp Source File + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
source/logic/AllegroWrappers.cpp
+
+
+Go to the documentation of this file.
00001 #include "AllegroWrappers.h"
+00002 
+00003 int AllegroInit::_initCount = 0;
+00004 
+00005 AllegroInit::AllegroInit()
+00006 {
+00007     if (_initCount==0)
+00008     {
+00009         if (!al_init())
+00010         {
+00011             throw InstallFailure();
+00012         }
+00013     }
+00014     ++_initCount;
+00015 }
+00016 
+00017 AllegroInit::AllegroInit(const AllegroInit& ref)
+00018 {
+00019     if (_initCount==0)
+00020     {
+00021         if (!al_init())
+00022         {
+00023             throw InstallFailure();
+00024         }
+00025     }
+00026     ++_initCount;
+00027 }
+00028 
+00029 AllegroInit::~AllegroInit()
+00030 {
+00031     --_initCount;
+00032     if (_initCount==0)
+00033     {
+00034         al_uninstall_system();
+00035     }
+00036 }
+00037 
+00038 
+00039 int AllegroKeyboardInit::_initCount = 0;
+00040 
+00041 AllegroKeyboardInit::AllegroKeyboardInit()
+00042 {
+00043     if (_initCount==0)
+00044     {
+00045         if (!al_install_keyboard())
+00046         {
+00047             throw InstallFailure();
+00048         }
+00049     }
+00050     ++_initCount;
+00051 }
+00052 
+00053 AllegroKeyboardInit::AllegroKeyboardInit(const AllegroKeyboardInit& ref)
+00054 {
+00055     if (_initCount==0)
+00056     {
+00057         if (!al_install_keyboard())
+00058         {
+00059             throw InstallFailure();
+00060         }
+00061     }
+00062     ++_initCount;
+00063 }
+00064 
+00065 AllegroKeyboardInit::~AllegroKeyboardInit()
+00066 {
+00067     --_initCount;
+00068     if (_initCount==0) al_uninstall_keyboard();
+00069 }
+00070 
+00071 int AllegroDrawingInit::_initCount = 0;
+00072 
+00073 AllegroDrawingInit::AllegroDrawingInit()
+00074 {
+00075     if (_initCount==0)
+00076     {
+00077         if (!al_init_primitives_addon())
+00078         {
+00079             throw InstallFailure();
+00080         }
+00081         al_init_font_addon();
+00082         if (!al_init_ttf_addon())
+00083         {
+00084             throw InstallFailure();
+00085         }
+00086     }
+00087     ++_initCount;
+00088 }
+00089 
+00090 AllegroDrawingInit::AllegroDrawingInit(const AllegroDrawingInit& ref)
+00091 {
+00092     if (_initCount==0)
+00093     {
+00094         if (!al_init_primitives_addon())
+00095         {
+00096             throw InstallFailure();
+00097         }
+00098         al_init_font_addon();
+00099         if (!al_init_ttf_addon())
+00100         {
+00101             throw InstallFailure();
+00102         }
+00103     }
+00104     ++_initCount;
+00105 }
+00106 
+00107 AllegroDrawingInit::~AllegroDrawingInit()
+00108 {
+00109     --_initCount;
+00110     if (_initCount==0)
+00111     {
+00112         al_shutdown_ttf_addon();
+00113         al_shutdown_font_addon();
+00114         al_shutdown_primitives_addon();
+00115     }
+00116 }
+
+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_allegro_wrappers_8h.html b/docs/html/_allegro_wrappers_8h.html new file mode 100644 index 0000000..275e146 --- /dev/null +++ b/docs/html/_allegro_wrappers_8h.html @@ -0,0 +1,127 @@ + + + + +Rally X: source/logic/AllegroWrappers.h File Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+ +
+
source/logic/AllegroWrappers.h File Reference
+
+
+
#include <allegro5/allegro.h>
+#include <allegro5/allegro_primitives.h>
+#include <allegro5/allegro_font.h>
+#include <allegro5/allegro_ttf.h>
+
+

Go to the source code of this file.

+ + + + + + + + + + +

+Classes

class  InstallFailure
 Exception to be thrown if any component of Allegro fails to install at runtime. More...
class  AllegroInit
 Class ensures that Allegro is initialized and uninstalled when appropriate. More...
class  AllegroKeyboardInit
 Class ensures that Allegro's keyboard is installed and uninstalled when appropriate. More...
class  AllegroDrawingInit
 Class ensures that Allegro's primitive and text drawing is installed and uninstalled when appropriate. More...
+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_allegro_wrappers_8h_source.html b/docs/html/_allegro_wrappers_8h_source.html new file mode 100644 index 0000000..5325bcd --- /dev/null +++ b/docs/html/_allegro_wrappers_8h_source.html @@ -0,0 +1,159 @@ + + + + +Rally X: source/logic/AllegroWrappers.h Source File + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
source/logic/AllegroWrappers.h
+
+
+Go to the documentation of this file.
00001 #ifndef ALLEGRO_WRAPPERS_H
+00002 #define ALLEGRO_WRAPPERS_H
+00003 
+00004 #include <allegro5/allegro.h>
+00005 #include <allegro5/allegro_primitives.h>
+00006 #include <allegro5/allegro_font.h>
+00007 #include <allegro5/allegro_ttf.h>
+00008 
+00015 class InstallFailure {};
+00016 
+00025 class AllegroInit
+00026 {
+00027     public:
+00031         AllegroInit();
+00035         AllegroInit(const AllegroInit& ref);
+00040         //assignment operator provided by compiler. _initCount does not need incrementing on assignment,
+00041         //because assignment does not make a new instance, just changes one.
+00042 
+00043         ~AllegroInit();
+00044     private:
+00045         static int _initCount; 
+00046 };
+00047 
+00057 class AllegroKeyboardInit
+00058 {
+00059     public:
+00063         AllegroKeyboardInit();
+00067         AllegroKeyboardInit(const AllegroKeyboardInit& ref);
+00071         ~AllegroKeyboardInit();
+00072     private:
+00073         static int _initCount; 
+00074         AllegroInit _allegro; 
+00075 
+00076         //assignment operator provided by compiler. _initCount does not need incrementing on assignment,
+00077         //because assignment does not make a new instance, just changes one.
+00078 };
+00079 
+00089 class AllegroDrawingInit
+00090 {
+00091     public:
+00095         AllegroDrawingInit();
+00099         AllegroDrawingInit(const AllegroDrawingInit& ref);
+00103         ~AllegroDrawingInit();
+00104     private:
+00105         static int _initCount;
+00106         AllegroInit _allegro;
+00107 
+00108         //assignment operator provided by compiler. _initCount does not need incrementing on assignment,
+00109         //because assignment does not make a new instance, just changes one.
+00110 };
+00111 
+00112 #endif
+
+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_bitmap_store_8cpp.html b/docs/html/_bitmap_store_8cpp.html new file mode 100644 index 0000000..c21a751 --- /dev/null +++ b/docs/html/_bitmap_store_8cpp.html @@ -0,0 +1,110 @@ + + + + +Rally X: source/presentation/BitmapStore.cpp File Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
+
source/presentation/BitmapStore.cpp File Reference
+
+
+
#include "BitmapStore.h"
+
+

Go to the source code of this file.

+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_bitmap_store_8cpp_source.html b/docs/html/_bitmap_store_8cpp_source.html new file mode 100644 index 0000000..0f739cf --- /dev/null +++ b/docs/html/_bitmap_store_8cpp_source.html @@ -0,0 +1,345 @@ + + + + +Rally X: source/presentation/BitmapStore.cpp Source File + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
source/presentation/BitmapStore.cpp
+
+
+Go to the documentation of this file.
00001 #include "BitmapStore.h"
+00002 
+00003 BitmapStore::BitmapStore(unsigned int blockWidth)
+00004     :_blockWidth(blockWidth)
+00005 {
+00006     _bitmapFont = al_load_font("junction 02.ttf", blockWidth/6, 0);
+00007     if (_bitmapFont == NULL)
+00008     {
+00009         al_show_native_message_box(NULL, "Fatal error", "Fatal error", "The file 'junction 02.ttf' was not found. Ensure that it is located in the working directory.", NULL, ALLEGRO_MESSAGEBOX_ERROR);
+00010         throw InstallFailure();
+00011     }
+00012 }
+00013 
+00014 BitmapStore::~BitmapStore()
+00015 {
+00016     for (map<Image,ALLEGRO_BITMAP*>::iterator iter = _bitmaps.begin();
+00017         iter != _bitmaps.end(); ++iter)
+00018     {
+00019         al_destroy_bitmap(iter->second);
+00020     }
+00021     _bitmaps.clear();
+00022     al_destroy_font(_bitmapFont);
+00023 }
+00024 
+00025 ALLEGRO_BITMAP* BitmapStore::getBitmap(Image image)
+00026 {
+00027     map<Image,ALLEGRO_BITMAP*>::const_iterator iter = _bitmaps.find(image);
+00028     if (iter != _bitmaps.end())
+00029     {
+00030         return iter->second;
+00031     }
+00032     else
+00033     {
+00034         ALLEGRO_BITMAP* newImage = al_create_bitmap(_blockWidth, _blockWidth);
+00035         switch (image)
+00036         {
+00037             case PLAYER:
+00038                 drawPlayerCar(newImage);
+00039                 break;
+00040             case ENEMY:
+00041                 drawEnemyCar(newImage);
+00042                 break;
+00043             case CHECKPOINT:
+00044                 drawCheckpoint(newImage);
+00045                 break;
+00046             case ROCK:
+00047                 drawRock(newImage);
+00048                 break;
+00049             case MAZE_WALL:
+00050                 drawMazeWall(newImage);
+00051                 break;
+00052             case MAZE_FLOOR:
+00053                 drawMazeFloor(newImage);
+00054                 break;
+00055             case SMOKE:
+00056                 drawSmoke(newImage);
+00057                 break;
+00058             case CRASHED_CAR:
+00059                 drawCrashedCar(newImage);
+00060                 break;
+00061             case CLAIMED_CHECKPOINT:
+00062                 drawClaimedCheckpoint(newImage);
+00063                 break;
+00064         }
+00065 
+00066         _bitmaps.insert(make_pair(image, newImage));
+00067         return newImage;
+00068     }
+00069 }
+00070 
+00071 void BitmapStore::drawPlayerCar(ALLEGRO_BITMAP* canvas)
+00072 {
+00073     ALLEGRO_BITMAP* prev_draw = al_get_target_bitmap();
+00074     al_set_target_bitmap(canvas);
+00075 
+00076     //car body
+00077     al_draw_filled_rounded_rectangle(_blockWidth*0.2, 0, _blockWidth*0.8, _blockWidth*0.96, _blockWidth*0.1, _blockWidth*0.1, al_map_rgb(0,0,255));
+00078 
+00079     //racing stripes
+00080     al_draw_filled_rectangle(_blockWidth*0.35, 0, _blockWidth*0.4, _blockWidth*0.3, al_map_rgb(255,255,255));
+00081     al_draw_filled_rectangle(_blockWidth*0.6, 0, _blockWidth*0.65, _blockWidth*0.3, al_map_rgb(255,255,255));
+00082 
+00083     //windscreen
+00084     al_draw_filled_rectangle(_blockWidth*0.3, _blockWidth*0.3, _blockWidth*0.7, _blockWidth*0.5, al_map_rgb (0,0,0));
+00085 
+00086     //roof
+00087     al_draw_rounded_rectangle(_blockWidth*0.3, _blockWidth*0.5, _blockWidth*0.7, _blockWidth*0.9, _blockWidth*0.04, _blockWidth*0.04, al_map_rgb (25,25, 112), _blockWidth*0.04);
+00088 
+00089     //spoiler
+00090     al_draw_filled_rectangle(_blockWidth*0.2, _blockWidth*0.96, _blockWidth*0.8, _blockWidth, al_map_rgb (0,0, 225));
+00091     al_draw_rectangle(_blockWidth*0.2, _blockWidth*0.96, _blockWidth*0.8, _blockWidth, al_map_rgb(25,25, 112),_blockWidth*0.04);
+00092 
+00093     //headlights
+00094     al_draw_filled_rectangle (_blockWidth*0.3,0,_blockWidth*0.35,_blockWidth*0.06, al_map_rgb(255,225,0));
+00095     al_draw_filled_rectangle (_blockWidth*0.65,0,_blockWidth*0.7,_blockWidth*0.06, al_map_rgb(255,225,0));
+00096 
+00097     //tyres
+00098     al_draw_filled_rounded_rectangle (_blockWidth*0.1,_blockWidth*0.13,_blockWidth*0.2,_blockWidth*0.37,_blockWidth*0.03,_blockWidth*0.03, al_map_rgb(131,139,131));
+00099     al_draw_filled_rounded_rectangle (_blockWidth*0.8,_blockWidth*0.13,_blockWidth*0.9,_blockWidth*0.37,_blockWidth*0.03,_blockWidth*0.03, al_map_rgb(131,139,131));
+00100     al_draw_filled_rounded_rectangle (_blockWidth*0.1,_blockWidth*0.63,_blockWidth*0.2,_blockWidth*0.87,_blockWidth*0.03,_blockWidth*0.03, al_map_rgb(131,139,131));
+00101     al_draw_filled_rounded_rectangle (_blockWidth*0.8,_blockWidth*0.63,_blockWidth*0.9,_blockWidth*0.87,_blockWidth*0.03,_blockWidth*0.03, al_map_rgb(131,139,131));
+00102 
+00103     al_set_target_bitmap(prev_draw);
+00104 }
+00105 void BitmapStore::drawEnemyCar(ALLEGRO_BITMAP* canvas)
+00106 {
+00107     ALLEGRO_BITMAP* prev_draw = al_get_target_bitmap();
+00108     al_set_target_bitmap(canvas);
+00109 
+00110     //car body
+00111     al_draw_filled_rounded_rectangle(_blockWidth*0.2, 0, _blockWidth*0.8, _blockWidth*0.96, _blockWidth*0.1, _blockWidth*0.1, al_map_rgb(255,0,0));
+00112 
+00113     //racing stripes
+00114     al_draw_filled_rectangle(_blockWidth*0.35, 0, _blockWidth*0.4, _blockWidth*0.3, al_map_rgb(255,255,255));
+00115     al_draw_filled_rectangle(_blockWidth*0.6, 0, _blockWidth*0.65, _blockWidth*0.3, al_map_rgb(255,255,255));
+00116 
+00117     //windscreen
+00118     al_draw_filled_rectangle(_blockWidth*0.3, _blockWidth*0.3, _blockWidth*0.7, _blockWidth*0.5, al_map_rgb (0,0,0));
+00119 
+00120     //roof
+00121     al_draw_rounded_rectangle(_blockWidth*0.3, _blockWidth*0.5, _blockWidth*0.7, _blockWidth*0.9, _blockWidth*0.04, _blockWidth*0.04, al_map_rgb (25,25, 112), _blockWidth*0.04);
+00122 
+00123     //spoiler
+00124     al_draw_filled_rectangle(_blockWidth*0.2, _blockWidth*0.96, _blockWidth*0.8, _blockWidth, al_map_rgb (0,0, 225));
+00125     al_draw_rectangle(_blockWidth*0.2, _blockWidth*0.96, _blockWidth*0.8, _blockWidth, al_map_rgb(25,25, 112),_blockWidth*0.04);
+00126 
+00127     //headlights
+00128     al_draw_filled_rectangle (_blockWidth*0.3,0,_blockWidth*0.35,_blockWidth*0.06, al_map_rgb(255,225,0));
+00129     al_draw_filled_rectangle (_blockWidth*0.65,0,_blockWidth*0.7,_blockWidth*0.06, al_map_rgb(255,225,0));
+00130 
+00131     //tyres
+00132     al_draw_filled_rounded_rectangle (_blockWidth*0.1,_blockWidth*0.13,_blockWidth*0.2,_blockWidth*0.37,_blockWidth*0.03,_blockWidth*0.03, al_map_rgb(131,139,131));
+00133     al_draw_filled_rounded_rectangle (_blockWidth*0.8,_blockWidth*0.13,_blockWidth*0.9,_blockWidth*0.37,_blockWidth*0.03,_blockWidth*0.03, al_map_rgb(131,139,131));
+00134     al_draw_filled_rounded_rectangle (_blockWidth*0.1,_blockWidth*0.63,_blockWidth*0.2,_blockWidth*0.87,_blockWidth*0.03,_blockWidth*0.03, al_map_rgb(131,139,131));
+00135     al_draw_filled_rounded_rectangle (_blockWidth*0.8,_blockWidth*0.63,_blockWidth*0.9,_blockWidth*0.87,_blockWidth*0.03,_blockWidth*0.03, al_map_rgb(131,139,131));
+00136 
+00137     al_set_target_bitmap(prev_draw);
+00138 }
+00139 void BitmapStore::drawRock(ALLEGRO_BITMAP* canvas)
+00140 {
+00141     ALLEGRO_BITMAP* prev_draw = al_get_target_bitmap();
+00142     al_set_target_bitmap(canvas);
+00143 
+00144     ALLEGRO_COLOR colour = al_map_rgb(131,139,131);
+00145     al_draw_filled_circle(_blockWidth/2, _blockWidth/2, _blockWidth/2-1, colour);
+00146 
+00147     al_draw_filled_circle(_blockWidth/2, _blockWidth/2, _blockWidth/2-6, colour);
+00148     al_draw_filled_circle(_blockWidth/4, _blockWidth/4, _blockWidth/4-1, al_map_rgb(205,197,191));
+00149     al_draw_filled_circle(_blockWidth/3.2, _blockWidth/4.2, _blockWidth/4-2, al_map_rgb(205,197,191));
+00150     al_draw_filled_circle(_blockWidth/1.2, _blockWidth/2, _blockWidth/2-15, al_map_rgb(205,197,191));
+00151     al_draw_filled_circle(_blockWidth/2, _blockWidth/2, _blockWidth/2-8, al_map_rgb(205,205,193));
+00152 
+00153     al_set_target_bitmap(prev_draw);
+00154 }
+00155 void BitmapStore::drawCheckpoint(ALLEGRO_BITMAP* canvas)
+00156 {
+00157     ALLEGRO_BITMAP* prev_draw = al_get_target_bitmap();
+00158     al_set_target_bitmap(canvas);
+00159 
+00160     ALLEGRO_COLOR colour = al_map_rgb(255,255,0);
+00161 
+00162     al_draw_filled_rectangle (_blockWidth*0.44, _blockWidth*0.1, _blockWidth*0.5, _blockWidth*0.9, colour);
+00163     al_draw_filled_rounded_rectangle (_blockWidth*0.34, _blockWidth*0.9, _blockWidth*0.6, _blockWidth*0.98, _blockWidth*0.01, _blockWidth*0.01, colour);
+00164     al_draw_filled_circle (_blockWidth*0.47, _blockWidth*0.14, _blockWidth*0.1, colour);
+00165     al_draw_filled_triangle (_blockWidth*0.44, _blockWidth*0.26, _blockWidth*0.44, _blockWidth*0.58, _blockWidth*0.8, _blockWidth*0.42, colour);
+00166 
+00167     al_set_target_bitmap(prev_draw);
+00168 }
+00169 void BitmapStore::drawMazeWall(ALLEGRO_BITMAP* canvas)
+00170 {
+00171     ALLEGRO_BITMAP* prev_draw = al_get_target_bitmap();
+00172     al_set_target_bitmap(canvas);
+00173 
+00174     ALLEGRO_COLOR colour = al_map_rgb(203,255,151);
+00175     al_clear_to_color(colour);
+00176 
+00177     al_set_target_bitmap(prev_draw);
+00178 }
+00179 void BitmapStore::drawMazeFloor(ALLEGRO_BITMAP* canvas)
+00180 {
+00181     ALLEGRO_BITMAP* prev_draw = al_get_target_bitmap();
+00182     al_set_target_bitmap(canvas);
+00183 
+00184     ALLEGRO_COLOR colour = al_map_rgb(0,0,0);
+00185     al_clear_to_color(colour);
+00186 
+00187     al_set_target_bitmap(prev_draw);
+00188 }
+00189 void BitmapStore::drawSmoke(ALLEGRO_BITMAP* canvas)
+00190 {
+00191     ALLEGRO_BITMAP* prev_draw = al_get_target_bitmap();
+00192     al_set_target_bitmap(canvas);
+00193 
+00194     ALLEGRO_COLOR colour = al_map_rgb(255,255,255);
+00195     al_draw_circle (_blockWidth/2.3, _blockWidth/2.1, _blockWidth/2-1, colour,1);
+00196     al_draw_circle (_blockWidth/4, _blockWidth/4, _blockWidth/4, colour,2);
+00197     al_draw_circle (_blockWidth/5, _blockWidth/1.5, _blockWidth/4, colour,4);
+00198     al_draw_circle (_blockWidth/2.5, _blockWidth/2.7, _blockWidth/3, colour,3);
+00199     al_draw_circle (_blockWidth/1.2, _blockWidth/1.8, _blockWidth/3.7, colour,2);
+00200     al_draw_circle (_blockWidth/2.8, _blockWidth/2.2, _blockWidth/6, colour,3);
+00201     al_draw_circle (_blockWidth/1.1, _blockWidth/1.2, _blockWidth/3, colour,2);
+00202     al_draw_circle (_blockWidth/1.2, _blockWidth/1.7, _blockWidth/2, colour,3);
+00203     al_draw_circle (_blockWidth/1.3, _blockWidth/1.3, _blockWidth/5, colour,2);
+00204 
+00205     al_set_target_bitmap(prev_draw);
+00206 }
+00207 
+00208 void BitmapStore::drawCrashedCar(ALLEGRO_BITMAP* canvas)
+00209 {
+00210     ALLEGRO_BITMAP* prev_draw = al_get_target_bitmap();
+00211     al_set_target_bitmap(canvas);
+00212 
+00213     al_draw_filled_rounded_rectangle(_blockWidth/3.33, _blockWidth/5, _blockWidth/1.25, _blockWidth/1.04, 5, 5, al_map_rgb (200, 200, 200));
+00214     al_draw_circle (_blockWidth/2.3, _blockWidth/2.1, _blockWidth/2-1, al_map_rgb (255, 0, 0),1);
+00215     al_draw_circle (_blockWidth/4, _blockWidth/4, _blockWidth/4, al_map_rgb (100, 100, 100),2);
+00216     al_draw_circle (_blockWidth/5, _blockWidth/1.5, _blockWidth/4, al_map_rgb (255, 0, 0),4);
+00217     al_draw_filled_rectangle(_blockWidth/2.5, _blockWidth/2, _blockWidth/1.43, _blockWidth/1.7, al_map_rgb (0,0, 0));
+00218     al_draw_circle (_blockWidth/2.5, _blockWidth/2.7, _blockWidth/3, al_map_rgb (100, 100, 100),3);
+00219     al_draw_circle (_blockWidth/1.2, _blockWidth/1.8, _blockWidth/3.7, al_map_rgb (255, 0, 0),2);
+00220     al_draw_rectangle(_blockWidth/3.13, _blockWidth/1.04, _blockWidth/1.25, _blockWidth, al_map_rgb (25,25, 112),1);
+00221     al_draw_circle (_blockWidth/2.8, _blockWidth/2.2, _blockWidth/6, al_map_rgb (255, 0, 0),3);
+00222     al_draw_circle (_blockWidth/1.1, _blockWidth/1.2, _blockWidth/3, al_map_rgb (100, 100, 100),2);
+00223     al_draw_circle (_blockWidth/1.2, _blockWidth/1.7, _blockWidth/2, al_map_rgb (100, 100, 100),3);
+00224     al_draw_circle (_blockWidth/1.3, _blockWidth/1.3, _blockWidth/5, al_map_rgb (255, 0, 0),2);
+00225 
+00226     al_set_target_bitmap(prev_draw);
+00227 }
+00228 
+00229 void BitmapStore::drawClaimedCheckpoint(ALLEGRO_BITMAP* canvas)
+00230 {
+00231     ALLEGRO_BITMAP* prev_draw = al_get_target_bitmap();
+00232     al_set_target_bitmap(canvas);
+00233 
+00234     ALLEGRO_COLOR colour = al_map_rgb(255,255,255);
+00235     al_draw_text(_bitmapFont, colour, _blockWidth/2, _blockWidth/2, ALLEGRO_ALIGN_CENTRE , "GOTCHA");
+00236 
+00237     al_set_target_bitmap(prev_draw);
+00238 }
+
+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_bitmap_store_8h.html b/docs/html/_bitmap_store_8h.html new file mode 100644 index 0000000..b28903f --- /dev/null +++ b/docs/html/_bitmap_store_8h.html @@ -0,0 +1,125 @@ + + + + +Rally X: source/presentation/BitmapStore.h File Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+ +
+
source/presentation/BitmapStore.h File Reference
+
+
+
#include <string>
+#include <map>
+#include <allegro5/allegro.h>
+#include <allegro5/allegro_primitives.h>
+#include <allegro5/allegro_font.h>
+#include <allegro5/allegro_ttf.h>
+#include <allegro5/allegro_native_dialog.h>
+#include "../logic/AllegroWrappers.h"
+
+

Go to the source code of this file.

+ + + + +

+Classes

class  BitmapStore
 Class for accessing images in ALLEGRO_BITMAP format and low level drawing. More...
+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_bitmap_store_8h_source.html b/docs/html/_bitmap_store_8h_source.html new file mode 100644 index 0000000..499cfc9 --- /dev/null +++ b/docs/html/_bitmap_store_8h_source.html @@ -0,0 +1,156 @@ + + + + +Rally X: source/presentation/BitmapStore.h Source File + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
source/presentation/BitmapStore.h
+
+
+Go to the documentation of this file.
00001 #ifndef BITMAPSTORE_H
+00002 #define BITMAPSTORE_H
+00003 
+00004 #include <string>
+00005 #include <map>
+00006 using namespace std;
+00007 
+00008 #include <allegro5/allegro.h>
+00009 #include <allegro5/allegro_primitives.h>
+00010 #include <allegro5/allegro_font.h>
+00011 #include <allegro5/allegro_ttf.h>
+00012 #include <allegro5/allegro_native_dialog.h>
+00013 
+00014 #include "../logic/AllegroWrappers.h"
+00015 
+00030 class BitmapStore
+00031 {
+00032     public:
+00038         BitmapStore(unsigned int blockWidth);
+00042         ~BitmapStore();
+00043 
+00047         enum Image {PLAYER, ENEMY, ROCK, CHECKPOINT, MAZE_WALL, MAZE_FLOOR, SMOKE, CRASHED_CAR, CLAIMED_CHECKPOINT};
+00048 
+00055         ALLEGRO_BITMAP* getBitmap(Image image);
+00056 
+00057     private:
+00063         BitmapStore(const BitmapStore& ref);
+00069         BitmapStore& operator=(const BitmapStore& rhs);
+00070 
+00076         void drawPlayerCar(ALLEGRO_BITMAP* canvas);
+00082         void drawEnemyCar(ALLEGRO_BITMAP* canvas);
+00088         void drawRock(ALLEGRO_BITMAP* canvas);
+00094         void drawCheckpoint(ALLEGRO_BITMAP* canvas);
+00100         void drawMazeWall(ALLEGRO_BITMAP* canvas);
+00106         void drawMazeFloor(ALLEGRO_BITMAP* canvas);
+00112         void drawSmoke(ALLEGRO_BITMAP* canvas);
+00118         void drawCrashedCar(ALLEGRO_BITMAP* canvas);
+00124         void drawClaimedCheckpoint(ALLEGRO_BITMAP* canvas);
+00125 
+00126         AllegroDrawingInit _drawingInstalls; 
+00127 
+00128         ALLEGRO_FONT* _bitmapFont; 
+00129 
+00135         map<Image, ALLEGRO_BITMAP*> _bitmaps;
+00136 
+00137         unsigned int _blockWidth; 
+00138 };
+00139 
+00140 #endif // BITMAPSTORE_H
+
+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_car_8cpp.html b/docs/html/_car_8cpp.html new file mode 100644 index 0000000..85b89ff --- /dev/null +++ b/docs/html/_car_8cpp.html @@ -0,0 +1,110 @@ + + + + +Rally X: source/logic/Car.cpp File Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
+
source/logic/Car.cpp File Reference
+
+
+
#include "Car.h"
+
+

Go to the source code of this file.

+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_car_8cpp_source.html b/docs/html/_car_8cpp_source.html new file mode 100644 index 0000000..86062e9 --- /dev/null +++ b/docs/html/_car_8cpp_source.html @@ -0,0 +1,182 @@ + + + + +Rally X: source/logic/Car.cpp Source File + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
source/logic/Car.cpp
+
+
+Go to the documentation of this file.
00001 #include "Car.h"
+00002 
+00003 Car::Car(double x, double y, BitmapStore::Image image, Maze::Direction facing)
+00004     :GameObject(x,y,image,facing),
+00005     _speed(_baseSpeed)
+00006 {
+00007 }
+00008 
+00009 double Car::speed() const
+00010 {
+00011     return _speed;
+00012 }
+00013 
+00014 void Car::move(const Maze& maze)
+00015 {
+00016     double targetX = 0;
+00017     double targetY = 0;
+00018 
+00019     int checkX = 0;
+00020     int checkY = 0;
+00021 
+00022     switch(_facing)
+00023     {
+00024         case Maze::UP:
+00025             targetX = MazeMath::round(_x);
+00026             targetY = _y - _speed;
+00027             checkX = floor(targetX);
+00028             checkY = floor(targetY);
+00029             break;
+00030         case Maze::DOWN:
+00031             targetX = MazeMath::round(_x);
+00032             targetY = _y + _speed;
+00033             checkX = floor(targetX);
+00034             checkY = ceil(targetY);
+00035             break;
+00036         case Maze::LEFT:
+00037             targetX = _x - _speed;
+00038             targetY = MazeMath::round(_y);
+00039             checkX = floor(targetX);
+00040             checkY = floor(targetY);
+00041             break;
+00042         case Maze::RIGHT:
+00043             targetX = _x + _speed;
+00044             targetY = MazeMath::round(_y);
+00045             checkX = ceil(targetX);
+00046             checkY = floor(targetY);
+00047             break;
+00048     }
+00049 
+00050     if (!maze.getSolid(checkX, checkY))
+00051     {
+00052         //can move that way
+00053         _x = targetX;
+00054         _y = targetY;
+00055     }
+00056     else
+00057     {
+00058         //can not move to targetX and targetY, but move to the edge of current block
+00059         switch(_facing)
+00060         {
+00061             case Maze::UP:
+00062                 _y = floor(_y);
+00063                 break;
+00064             case Maze::DOWN:
+00065                 _y = ceil(_y);
+00066                 break;
+00067             case Maze::LEFT:
+00068                 _x = floor(_x);
+00069                 break;
+00070             case Maze::RIGHT:
+00071                 _x = ceil(_x);
+00072                 break;
+00073         }
+00074     }
+00075 }
+
+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_car_8h.html b/docs/html/_car_8h.html new file mode 100644 index 0000000..9e43493 --- /dev/null +++ b/docs/html/_car_8h.html @@ -0,0 +1,121 @@ + + + + +Rally X: source/logic/Car.h File Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+ +
+
source/logic/Car.h File Reference
+
+
+
#include <cmath>
+#include "../presentation/BitmapStore.h"
+#include "../logic/GameObject.h"
+#include "../logic/MazeMath.h"
+
+

Go to the source code of this file.

+ + + + +

+Classes

class  Car
 GameObject that moves through the maze and changes direction. More...
+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_car_8h_source.html b/docs/html/_car_8h_source.html new file mode 100644 index 0000000..ea3d522 --- /dev/null +++ b/docs/html/_car_8h_source.html @@ -0,0 +1,134 @@ + + + + +Rally X: source/logic/Car.h Source File + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
source/logic/Car.h
+
+
+Go to the documentation of this file.
00001 #ifndef CAR_H
+00002 #define CAR_H
+00003 
+00004 #include <cmath>
+00005 using namespace std;
+00006 
+00007 #include "../presentation/BitmapStore.h"
+00008 #include "../logic/GameObject.h"
+00009 #include "../logic/MazeMath.h"
+00010 
+00020 class Car : public GameObject
+00021 {
+00022     public:
+00031         Car(double x, double y, BitmapStore::Image image, Maze::Direction facing);
+00032 
+00033         //assignment and copy constructors have been left with the compiler generated versions
+00034 
+00040         double speed() const;
+00041 
+00042     protected:
+00051         void move(const Maze& maze);
+00052 
+00053         double _speed; 
+00054         static const double _baseSpeed = 0.1; 
+00055 };
+00056 
+00057 #endif // CAR_H
+
+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_checkpoint_8cpp.html b/docs/html/_checkpoint_8cpp.html new file mode 100644 index 0000000..0d53ea6 --- /dev/null +++ b/docs/html/_checkpoint_8cpp.html @@ -0,0 +1,110 @@ + + + + +Rally X: source/logic/Checkpoint.cpp File Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
+
source/logic/Checkpoint.cpp File Reference
+
+
+
#include "Checkpoint.h"
+
+

Go to the source code of this file.

+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_checkpoint_8cpp_source.html b/docs/html/_checkpoint_8cpp_source.html new file mode 100644 index 0000000..0f2071d --- /dev/null +++ b/docs/html/_checkpoint_8cpp_source.html @@ -0,0 +1,137 @@ + + + + +Rally X: source/logic/Checkpoint.cpp Source File + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
source/logic/Checkpoint.cpp
+
+
+Go to the documentation of this file.
00001 #include "Checkpoint.h"
+00002 
+00003 int Checkpoint::_checkpointCount = 0;
+00004 
+00005 Checkpoint::Checkpoint(double x, double y)
+00006     :GameObject(x,y,BitmapStore::CHECKPOINT)
+00007 {
+00008     ++_checkpointCount;
+00009 }
+00010 
+00011 Checkpoint::Checkpoint(const Checkpoint& ref)
+00012     :GameObject(ref._x,ref._y,ref._image)
+00013 {
+00014     ++_checkpointCount;
+00015 }
+00016 
+00017 Checkpoint::~Checkpoint()
+00018 {
+00019     --_checkpointCount;
+00020 }
+00021 
+00022 int Checkpoint::checkpointCount()
+00023 {
+00024     return _checkpointCount;
+00025 }
+00026 
+00027 void Checkpoint::collect()
+00028 {
+00029     _destroyed = true;
+00030 }
+
+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_checkpoint_8h.html b/docs/html/_checkpoint_8h.html new file mode 100644 index 0000000..7fb441b --- /dev/null +++ b/docs/html/_checkpoint_8h.html @@ -0,0 +1,119 @@ + + + + +Rally X: source/logic/Checkpoint.h File Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+ +
+
source/logic/Checkpoint.h File Reference
+
+
+
#include "../logic/GameObject.h"
+#include "../presentation/BitmapStore.h"
+
+

Go to the source code of this file.

+ + + + +

+Classes

class  Checkpoint
 GameObject that the player needs to pick up by driving over. More...
+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_checkpoint_8h_source.html b/docs/html/_checkpoint_8h_source.html new file mode 100644 index 0000000..27a7f35 --- /dev/null +++ b/docs/html/_checkpoint_8h_source.html @@ -0,0 +1,132 @@ + + + + +Rally X: source/logic/Checkpoint.h Source File + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
source/logic/Checkpoint.h
+
+
+Go to the documentation of this file.
00001 #ifndef CHECKPOINT_H
+00002 #define CHECKPOINT_H
+00003 
+00004 #include "../logic/GameObject.h"
+00005 #include "../presentation/BitmapStore.h"
+00006 
+00015 class Checkpoint: public GameObject
+00016 {
+00017     public:
+00023         static int checkpointCount();
+00024 
+00031         Checkpoint(double x, double y);
+00035         Checkpoint(const Checkpoint& ref);
+00036 
+00037         //assignment operator has been left with the compiler generated version.
+00038 
+00042         ~Checkpoint();
+00043 
+00047         void collect();
+00048 
+00049     private:
+00050         static int _checkpointCount; 
+00051 };
+00052 
+00053 #endif // CHECKPOINT_H
+
+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_collision_detector_8cpp.html b/docs/html/_collision_detector_8cpp.html new file mode 100644 index 0000000..3d34fe5 --- /dev/null +++ b/docs/html/_collision_detector_8cpp.html @@ -0,0 +1,110 @@ + + + + +Rally X: source/logic/CollisionDetector.cpp File Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
+
source/logic/CollisionDetector.cpp File Reference
+
+
+
#include "CollisionDetector.h"
+
+

Go to the source code of this file.

+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_collision_detector_8cpp_source.html b/docs/html/_collision_detector_8cpp_source.html new file mode 100644 index 0000000..4c6b1e4 --- /dev/null +++ b/docs/html/_collision_detector_8cpp_source.html @@ -0,0 +1,171 @@ + + + + +Rally X: source/logic/CollisionDetector.cpp Source File + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
source/logic/CollisionDetector.cpp
+
+
+Go to the documentation of this file.
00001 #include "CollisionDetector.h"
+00002 
+00003 void CollisionDetector::checkCollisions(list<PlayerCar>& players, list<EnemyCar>& enemies, list<Checkpoint>& checkpoints, list<Rock>& rocks, list<Smokescreen>& smokescreens)
+00004 {
+00005     for (list<PlayerCar>::iterator playIter = players.begin(); playIter!=players.end(); ++playIter)
+00006     {
+00007         for (list<EnemyCar>::iterator enemyIter = enemies.begin(); enemyIter!=enemies.end(); ++enemyIter)
+00008         {
+00009             if ((abs(playIter->x() - enemyIter->x())<1)&&(abs(playIter->y() - enemyIter->y())<1))
+00010             {
+00011                 collision(*playIter, *enemyIter);
+00012             }
+00013         }
+00014 
+00015         for (list<Checkpoint>::iterator checkIter = checkpoints.begin(); checkIter!=checkpoints.end(); ++checkIter)
+00016         {
+00017             if ((abs(playIter->x() - checkIter->x())<1)&&(abs(playIter->y() - checkIter->y())<1))
+00018             {
+00019                 collision(*playIter, *checkIter);
+00020             }
+00021         }
+00022 
+00023         for (list<Rock>::iterator rockIter = rocks.begin(); rockIter!=rocks.end(); ++rockIter)
+00024         {
+00025             if ((abs(playIter->x() - rockIter->x())<1)&&(abs(playIter->y() - rockIter->y())<1))
+00026             {
+00027                 collision(*playIter, *rockIter);
+00028             }
+00029         }
+00030     }
+00031 
+00032     for (list<EnemyCar>::iterator enemyIter = enemies.begin(); enemyIter!=enemies.end(); ++enemyIter)
+00033     {
+00034         for (list<Smokescreen>::iterator smokeIter = smokescreens.begin(); smokeIter!=smokescreens.end(); ++smokeIter)
+00035         {
+00036             if ((abs(enemyIter->x() - smokeIter->x())<1)&&(abs(enemyIter->y() - smokeIter->y())<1))
+00037             {
+00038                 collision(*enemyIter, *smokeIter);
+00039             }
+00040         }
+00041     }
+00042 }
+00043 
+00044 void CollisionDetector::collision(PlayerCar& player, Checkpoint& checkpoint)
+00045 {
+00046     player.gotCheckpoint();
+00047     checkpoint.collect();
+00048 }
+00049 
+00050 void CollisionDetector::collision(PlayerCar& player, Rock& rock)
+00051 {
+00052     player.crash();
+00053 }
+00054 
+00055 void CollisionDetector::collision(PlayerCar& player, EnemyCar& enemy)
+00056 {
+00057     player.crash();
+00058     enemy.crash();
+00059 }
+00060 
+00061 void CollisionDetector::collision(EnemyCar& enemy, Smokescreen& smokescreen)
+00062 {
+00063     enemy.blind();
+00064 }
+
+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_collision_detector_8h.html b/docs/html/_collision_detector_8h.html new file mode 100644 index 0000000..6c4eea3 --- /dev/null +++ b/docs/html/_collision_detector_8h.html @@ -0,0 +1,123 @@ + + + + +Rally X: source/logic/CollisionDetector.h File Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+ +
+
source/logic/CollisionDetector.h File Reference
+
+
+
#include <list>
+#include "../logic/PlayerCar.h"
+#include "../logic/EnemyCar.h"
+#include "../logic/Checkpoint.h"
+#include "../logic/Rock.h"
+#include "../logic/Smokescreen.h"
+
+

Go to the source code of this file.

+ + + + +

+Classes

class  CollisionDetector
 Object for handling collisions between GameObjects. More...
+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_collision_detector_8h_source.html b/docs/html/_collision_detector_8h_source.html new file mode 100644 index 0000000..675431f --- /dev/null +++ b/docs/html/_collision_detector_8h_source.html @@ -0,0 +1,137 @@ + + + + +Rally X: source/logic/CollisionDetector.h Source File + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
source/logic/CollisionDetector.h
+
+
+Go to the documentation of this file.
00001 #ifndef COLLISIONDETECTOR_H
+00002 #define COLLISIONDETECTOR_H
+00003 
+00004 #include <list>
+00005 using namespace std;
+00006 
+00007 #include "../logic/PlayerCar.h"
+00008 #include "../logic/EnemyCar.h"
+00009 #include "../logic/Checkpoint.h"
+00010 #include "../logic/Rock.h"
+00011 #include "../logic/Smokescreen.h"
+00012 
+00022 class CollisionDetector
+00023 {
+00024     public:
+00037         void checkCollisions(list<PlayerCar>& players, list<EnemyCar>& enemies, list<Checkpoint>& checkpoints, list<Rock>& rocks, list<Smokescreen>& smokescreens);
+00038 
+00039         //assignment and copy constructors have been left with the compiler generated versions
+00040 
+00041     private:
+00048         void collision(PlayerCar& player, Checkpoint& checkpoint);
+00049 
+00056         void collision(PlayerCar& player, EnemyCar& enemy);
+00057 
+00064         void collision(PlayerCar& player, Rock& rock);
+00065 
+00072         void collision(EnemyCar& enemy, Smokescreen& smokescreen);
+00073 };
+00074 
+00075 #endif // COLLISIONDETECTOR_H
+
+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_colour_store_8cpp.html b/docs/html/_colour_store_8cpp.html new file mode 100644 index 0000000..ead690a --- /dev/null +++ b/docs/html/_colour_store_8cpp.html @@ -0,0 +1,110 @@ + + + + +Rally X: source/presentation/ColourStore.cpp File Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
+
source/presentation/ColourStore.cpp File Reference
+
+
+
#include "ColourStore.h"
+
+

Go to the source code of this file.

+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_colour_store_8cpp_source.html b/docs/html/_colour_store_8cpp_source.html new file mode 100644 index 0000000..8b28e13 --- /dev/null +++ b/docs/html/_colour_store_8cpp_source.html @@ -0,0 +1,132 @@ + + + + +Rally X: source/presentation/ColourStore.cpp Source File + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
source/presentation/ColourStore.cpp
+
+
+Go to the documentation of this file.
00001 #include "ColourStore.h"
+00002 
+00003 ColourStore::ColourStore()
+00004 {
+00005     populateColours();
+00006 }
+00007 
+00008 void ColourStore::populateColours()
+00009 {
+00010     _colours[BitmapStore::PLAYER] = al_map_rgb(0,255,255);
+00011     _colours[BitmapStore::ENEMY] = al_map_rgb(255,0,0);
+00012     _colours[BitmapStore::CHECKPOINT] = al_map_rgb(0,255,0);
+00013     _colours[BitmapStore::MAZE_WALL] = al_map_rgb(255,255,255);
+00014     _colours[BitmapStore::MAZE_FLOOR] = al_map_rgb(0,0,0);
+00015     _transparent = al_map_rgba(0,0,0,0);
+00016 }
+00017 
+00018 ALLEGRO_COLOR ColourStore::getColour(BitmapStore::Image image)
+00019 {
+00020     if (_colours.find(image) != _colours.end())
+00021     {
+00022         return _colours[image];
+00023     }
+00024     else return _transparent;
+00025 }
+
+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_colour_store_8h.html b/docs/html/_colour_store_8h.html new file mode 100644 index 0000000..2a66a98 --- /dev/null +++ b/docs/html/_colour_store_8h.html @@ -0,0 +1,119 @@ + + + + +Rally X: source/presentation/ColourStore.h File Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+ +
+
source/presentation/ColourStore.h File Reference
+
+
+
#include <allegro5/allegro.h>
+#include "../presentation/BitmapStore.h"
+
+

Go to the source code of this file.

+ + + + +

+Classes

class  ColourStore
 Class for mapping BitmapStore images to colours for use in the minimap. More...
+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_colour_store_8h_source.html b/docs/html/_colour_store_8h_source.html new file mode 100644 index 0000000..9f47a79 --- /dev/null +++ b/docs/html/_colour_store_8h_source.html @@ -0,0 +1,132 @@ + + + + +Rally X: source/presentation/ColourStore.h Source File + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
source/presentation/ColourStore.h
+
+
+Go to the documentation of this file.
00001 #ifndef COLOURSTORE_H
+00002 #define COLOURSTORE_H
+00003 
+00004 #include <allegro5/allegro.h>
+00005 
+00006 #include "../presentation/BitmapStore.h"
+00007 
+00014 class ColourStore
+00015 {
+00016     public:
+00020         ColourStore();
+00021 
+00032         ALLEGRO_COLOR getColour(BitmapStore::Image image);
+00033     private:
+00039         ColourStore(const ColourStore& ref);
+00045         ColourStore& operator=(const ColourStore& rhs);
+00046 
+00047         map<BitmapStore::Image, ALLEGRO_COLOR> _colours;
+00048 
+00052         ALLEGRO_COLOR _transparent;
+00053 
+00057         void populateColours();
+00058 };
+00059 
+00060 #endif // COLOURSTORE_H
+
+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_config_8cpp.html b/docs/html/_config_8cpp.html new file mode 100644 index 0000000..cb9e56a --- /dev/null +++ b/docs/html/_config_8cpp.html @@ -0,0 +1,110 @@ + + + + +Rally X: source/data/Config.cpp File Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
+
source/data/Config.cpp File Reference
+
+
+
#include "Config.h"
+
+

Go to the source code of this file.

+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_config_8cpp_source.html b/docs/html/_config_8cpp_source.html new file mode 100644 index 0000000..47e38eb --- /dev/null +++ b/docs/html/_config_8cpp_source.html @@ -0,0 +1,212 @@ + + + + +Rally X: source/data/Config.cpp Source File + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
source/data/Config.cpp
+
+
+Go to the documentation of this file.
00001 #include "Config.h"
+00002 
+00003 const string Config::SCREEN_WIDTH_KEY("screen_width");
+00004 const string Config::SCREEN_HEIGHT_KEY("screen_height");
+00005 const string Config::FULLSCREEN_KEY("fullscreen");
+00006 
+00007 const string Config::SCREEN_WIDTH_DEFAULT("800");
+00008 const string Config::SCREEN_HEIGHT_DEFAULT("600");
+00009 const string Config::FULLSCREEN_DEFAULT("false");
+00010 
+00011 
+00012 Config::Config(const string& filename)
+00013     :_screenWidth(0),
+00014     _screenHeight(0)
+00015 {
+00016     ifstream inStream(filename.c_str(), fstream::in);
+00017 
+00018     map<string, string> readValues;
+00019     map<string, string> unfoundValues;
+00020     readFile(inStream, readValues);
+00021     fillValues(readValues, unfoundValues);
+00022 
+00023     inStream.close();
+00024 
+00025     ofstream outStream(filename.c_str(), fstream::app);
+00026 
+00027     writeUnfoundValues(outStream, unfoundValues);
+00028 
+00029     outStream.close();
+00030 }
+00031 
+00032 unsigned int Config::screenWidth() const
+00033 {
+00034     return _screenWidth;
+00035 }
+00036 unsigned int Config::screenHeight() const
+00037 {
+00038     return _screenHeight;
+00039 }
+00040 bool Config::fullscreen() const
+00041 {
+00042     return _fullscreen;
+00043 }
+00044 
+00045 void Config::readFile(ifstream& file, map<string,string>& map)
+00046 {
+00047     if (!file.is_open()) return;
+00048 
+00049     string nextEntry;
+00050     while(!file.eof())
+00051     {
+00052         file >> nextEntry;
+00053 
+00054         string::size_type equalsIndex = nextEntry.find("=",0);
+00055         if (equalsIndex!=string::npos)
+00056         {
+00057             string key = nextEntry.substr(0,equalsIndex);
+00058             string value = nextEntry.substr(equalsIndex+1);
+00059 
+00060             map[key] = value;
+00061         }
+00062     }
+00063 }
+00064 
+00065 void Config::fillValues(const map<string, string>& readValues, map<string, string>& unfoundValues)
+00066 {
+00067     setScreenWidth(extractValue(readValues, unfoundValues, SCREEN_WIDTH_KEY, SCREEN_WIDTH_DEFAULT));
+00068     setScreenHeight(extractValue(readValues, unfoundValues, SCREEN_HEIGHT_KEY, SCREEN_HEIGHT_DEFAULT));
+00069     setFullscreen(extractValue(readValues, unfoundValues, FULLSCREEN_KEY, FULLSCREEN_DEFAULT));
+00070 }
+00071 
+00072 string Config::extractValue(const map<string, string>& readValues, map<string, string>& unfoundValues, const string& key, const string& defaultValue)
+00073 {
+00074     map<string, string>::const_iterator findIter = readValues.find(key);
+00075     if (findIter != readValues.end())
+00076     {
+00077         return findIter->second;
+00078     }
+00079     else
+00080     {
+00081         unfoundValues[key] = defaultValue;
+00082         return defaultValue;
+00083     }
+00084 }
+00085 
+00086 void Config::writeUnfoundValues(ofstream& file, const map<string, string>& unfoundValues)
+00087 {
+00088     for (map<string, string>::const_iterator iter = unfoundValues.begin(); iter!=unfoundValues.end(); ++iter)
+00089     {
+00090         file << iter->first << "=" << iter->second << endl;
+00091     }
+00092 }
+00093 
+00094 void Config::setScreenWidth(const string& screenWidthStr)
+00095 {
+00096     _screenWidth = atoi(screenWidthStr.c_str());
+00097 }
+00098 void Config::setScreenHeight(const string& screenHeightStr)
+00099 {
+00100     _screenHeight = atoi(screenHeightStr.c_str());
+00101 }
+00102 void Config::setFullscreen(const string& fullscreenStr)
+00103 {
+00104     _fullscreen = fullscreenStr=="true";
+00105 }
+
+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_config_8h.html b/docs/html/_config_8h.html new file mode 100644 index 0000000..9d7180b --- /dev/null +++ b/docs/html/_config_8h.html @@ -0,0 +1,121 @@ + + + + +Rally X: source/data/Config.h File Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+ +
+
source/data/Config.h File Reference
+
+
+
#include <cstdlib>
+#include <string>
+#include <fstream>
+#include <map>
+
+

Go to the source code of this file.

+ + + + +

+Classes

class  Config
 Object for handling user settings loaded from a file. More...
+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_config_8h_source.html b/docs/html/_config_8h_source.html new file mode 100644 index 0000000..f62730d --- /dev/null +++ b/docs/html/_config_8h_source.html @@ -0,0 +1,158 @@ + + + + +Rally X: source/data/Config.h Source File + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
source/data/Config.h
+
+
+Go to the documentation of this file.
00001 #ifndef CONFIG_H
+00002 #define CONFIG_H
+00003 
+00004 #include <cstdlib>
+00005 #include <string>
+00006 #include <fstream>
+00007 #include <map>
+00008 using namespace std;
+00009 
+00020 class Config
+00021 {
+00022     public:
+00032         Config(const string& filename);
+00033 
+00034         //Assignment and copy operations are handled by the compiler generated versions
+00035 
+00041         unsigned int screenWidth() const;
+00042 
+00048         unsigned int screenHeight() const;
+00049 
+00055         bool fullscreen() const;
+00056 
+00057     private:
+00067         void readFile(ifstream& file, map<string,string>& map);
+00068 
+00078         void fillValues(const map<string, string>& readValues, map<string, string>& unfoundValues);
+00079 
+00092         string extractValue(const map<string, string>& readValues, map<string, string>& unfoundValues, const string& key, const string& defaultValue);
+00093 
+00100         void writeUnfoundValues(ofstream& file, const map<string, string>& unfoundValues);
+00101 
+00107         void setScreenWidth(const string& screenWidthStr);
+00108 
+00114         void setScreenHeight(const string& screenHeightStr);
+00115 
+00121         void setFullscreen(const string& fullscreenStr);
+00122 
+00123         unsigned int _screenWidth; 
+00124         unsigned int _screenHeight; 
+00125         bool _fullscreen; 
+00126 
+00127         static const string SCREEN_WIDTH_KEY; 
+00128         static const string SCREEN_HEIGHT_KEY; 
+00129         static const string FULLSCREEN_KEY; 
+00130 
+00131         static const string SCREEN_WIDTH_DEFAULT; 
+00132         static const string SCREEN_HEIGHT_DEFAULT; 
+00133         static const string FULLSCREEN_DEFAULT; 
+00134 };
+00135 
+00136 #endif // CONFIG_H
+
+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_destroyed_object_popup_8cpp.html b/docs/html/_destroyed_object_popup_8cpp.html new file mode 100644 index 0000000..5946fd0 --- /dev/null +++ b/docs/html/_destroyed_object_popup_8cpp.html @@ -0,0 +1,110 @@ + + + + +Rally X: source/logic/DestroyedObjectPopup.cpp File Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
+
source/logic/DestroyedObjectPopup.cpp File Reference
+
+
+ +

Go to the source code of this file.

+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_destroyed_object_popup_8cpp_source.html b/docs/html/_destroyed_object_popup_8cpp_source.html new file mode 100644 index 0000000..1eb43e2 --- /dev/null +++ b/docs/html/_destroyed_object_popup_8cpp_source.html @@ -0,0 +1,113 @@ + + + + +Rally X: source/logic/DestroyedObjectPopup.cpp Source File + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
source/logic/DestroyedObjectPopup.cpp
+
+
+Go to the documentation of this file.
00001 #include "DestroyedObjectPopup.h"
+00002 
+00003 DestroyedObjectPopup::DestroyedObjectPopup(double x, double y, BitmapStore::Image image)
+00004     :LimitedTimeObject(x, y, image, POPUP_TIME)
+00005 {
+00006 }
+
+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_destroyed_object_popup_8h.html b/docs/html/_destroyed_object_popup_8h.html new file mode 100644 index 0000000..5248b7d --- /dev/null +++ b/docs/html/_destroyed_object_popup_8h.html @@ -0,0 +1,119 @@ + + + + +Rally X: source/logic/DestroyedObjectPopup.h File Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+ +
+
source/logic/DestroyedObjectPopup.h File Reference
+
+
+
#include "../logic/LimitedTimeObject.h"
+#include "../presentation/BitmapStore.h"
+
+

Go to the source code of this file.

+ + + + +

+Classes

class  DestroyedObjectPopup
 Object that appears on the screen for a short time when another object has been destroyed. More...
+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_destroyed_object_popup_8h_source.html b/docs/html/_destroyed_object_popup_8h_source.html new file mode 100644 index 0000000..f5653ba --- /dev/null +++ b/docs/html/_destroyed_object_popup_8h_source.html @@ -0,0 +1,125 @@ + + + + +Rally X: source/logic/DestroyedObjectPopup.h Source File + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
source/logic/DestroyedObjectPopup.h
+
+
+Go to the documentation of this file.
00001 #ifndef DESTROYEDOBJECTPOPUP_H
+00002 #define DESTROYEDOBJECTPOPUP_H
+00003 
+00004 #include "../logic/LimitedTimeObject.h"
+00005 #include "../presentation/BitmapStore.h"
+00006 
+00015 class DestroyedObjectPopup : public LimitedTimeObject
+00016 {
+00017     public:
+00025         DestroyedObjectPopup(double x, double y, BitmapStore::Image image);
+00026 
+00027         //assignment and copy constructors have been left with the compiler generated versions
+00028 
+00029     private:
+00030         static const int POPUP_TIME = 30; 
+00031 };
+00032 
+00033 #endif // DESTROYEDOBJECTPOPUP_H
+
+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_enemy_car_8cpp.html b/docs/html/_enemy_car_8cpp.html new file mode 100644 index 0000000..e0445e1 --- /dev/null +++ b/docs/html/_enemy_car_8cpp.html @@ -0,0 +1,110 @@ + + + + +Rally X: source/logic/EnemyCar.cpp File Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
+
source/logic/EnemyCar.cpp File Reference
+
+
+
#include "EnemyCar.h"
+
+

Go to the source code of this file.

+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_enemy_car_8cpp_source.html b/docs/html/_enemy_car_8cpp_source.html new file mode 100644 index 0000000..446e3f1 --- /dev/null +++ b/docs/html/_enemy_car_8cpp_source.html @@ -0,0 +1,211 @@ + + + + +Rally X: source/logic/EnemyCar.cpp Source File + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
source/logic/EnemyCar.cpp
+
+
+Go to the documentation of this file.
00001 #include "EnemyCar.h"
+00002 
+00003 EnemyCar::EnemyCar(double x, double y)
+00004     :Car(x,y,BitmapStore::ENEMY,Maze::UP),
+00005     _state(CHASING),
+00006     _targetX(x),
+00007     _targetY(y)
+00008 {
+00009 }
+00010 
+00011 void EnemyCar::update(const Maze& maze, const list<PlayerCar>& players, const list<Rock>& rocks)
+00012 {
+00013     if (!players.empty()) checkFacing(maze, players.front().x(), players.front().y(), rocks);
+00014 
+00015     if (_state!=BLINDED)
+00016     {
+00017         move(maze);
+00018     }
+00019     else
+00020     {
+00021         _state = CHASING;
+00022         _speed = _baseSpeed;
+00023     }
+00024 }
+00025 
+00026 void EnemyCar::checkFacing(const Maze& maze, double chasingX, double chasingY, const list<Rock>& rocks)
+00027 {
+00028     if (abs(_x - _targetX)>_speed || abs(_y - _targetY)>_speed) return;
+00029 
+00030     map<Maze::Direction, pair<double, double> > adjacentBlocks;
+00031     pair<double, double> evaluatingTarget;
+00032 
+00033     adjacentBlocks[Maze::LEFT] = make_pair(MazeMath::round(_x-1), MazeMath::round(_y));
+00034     adjacentBlocks[Maze::RIGHT] = make_pair(MazeMath::round(_x+1), MazeMath::round(_y));
+00035     adjacentBlocks[Maze::UP] = make_pair(MazeMath::round(_x), MazeMath::round(_y-1));
+00036     adjacentBlocks[Maze::DOWN] = make_pair(MazeMath::round(_x), MazeMath::round(_y+1));
+00037 
+00038     //remove adjacent blocks that would result in crashing into a rock or a wall
+00039     for (map<Maze::Direction, pair<double, double> >::iterator iter=adjacentBlocks.begin(); iter!=adjacentBlocks.end(); )
+00040     {
+00041         if (rockAtLocation(iter->second.first, iter->second.second, rocks) || maze.getSolid(static_cast<int>(iter->second.first),static_cast<int>(iter->second.second)))
+00042         {
+00043             adjacentBlocks.erase(iter);
+00044             iter = adjacentBlocks.begin();
+00045         }
+00046         else
+00047         {
+00048             ++iter;
+00049         }
+00050     }
+00051 
+00052     if (adjacentBlocks.empty())
+00053     {
+00054         _speed = 0;
+00055         return;
+00056     }
+00057     else
+00058     {
+00059         _speed = _baseSpeed;
+00060     }
+00061 
+00062     map<Maze::Direction, pair<double, double> >::iterator reverseFacing = adjacentBlocks.find(Maze::backwards(_facing));
+00063     if ((reverseFacing != adjacentBlocks.end()) && (adjacentBlocks.size()>1))
+00064     {
+00065         adjacentBlocks.erase(reverseFacing);
+00066     }
+00067 
+00068     map<Maze::Direction, pair<double, double> >::const_iterator closestAdjacent = adjacentBlocks.begin();
+00069     double closestDistance = MazeMath::distance(closestAdjacent->second.first, closestAdjacent->second.second, chasingX, chasingY);
+00070 
+00071     for (map<Maze::Direction, pair<double, double> >::const_iterator iter = ++adjacentBlocks.begin(); iter!=adjacentBlocks.end(); ++iter)
+00072     {
+00073         double newDistance = MazeMath::distance(iter->second.first, iter->second.second, chasingX, chasingY);
+00074         if (newDistance < closestDistance)
+00075         {
+00076             closestDistance = newDistance;
+00077             closestAdjacent = iter;
+00078         }
+00079     }
+00080 
+00081     _targetX = closestAdjacent->second.first;
+00082     _targetY = closestAdjacent->second.second;
+00083     _facing = closestAdjacent->first;
+00084 }
+00085 
+00086 bool EnemyCar::rockAtLocation(double x, double y, const list<Rock>& rocks)
+00087 {
+00088     for (list<Rock>::const_iterator iter = rocks.begin(); iter!=rocks.end(); ++iter)
+00089     {
+00090         if (abs(x - iter->x())<1 && abs(y - iter->y())<1) return true;
+00091     }
+00092     return false;
+00093 }
+00094 
+00095 void EnemyCar::crash()
+00096 {
+00097     _destroyed = true;
+00098 }
+00099 
+00100 void EnemyCar::blind()
+00101 {
+00102     _state = BLINDED;
+00103     _speed = 0;
+00104 }
+
+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_enemy_car_8h.html b/docs/html/_enemy_car_8h.html new file mode 100644 index 0000000..c1ae24a --- /dev/null +++ b/docs/html/_enemy_car_8h.html @@ -0,0 +1,123 @@ + + + + +Rally X: source/logic/EnemyCar.h File Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+ +
+
source/logic/EnemyCar.h File Reference
+
+
+
#include <cmath>
+#include "../presentation/BitmapStore.h"
+#include "../logic/Car.h"
+#include "../logic/PlayerCar.h"
+#include "../logic/Rock.h"
+#include "../logic/MazeMath.h"
+
+

Go to the source code of this file.

+ + + + +

+Classes

class  EnemyCar
 GameObject that chases the player around the maze. More...
+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_enemy_car_8h_source.html b/docs/html/_enemy_car_8h_source.html new file mode 100644 index 0000000..a436efe --- /dev/null +++ b/docs/html/_enemy_car_8h_source.html @@ -0,0 +1,148 @@ + + + + +Rally X: source/logic/EnemyCar.h Source File + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
source/logic/EnemyCar.h
+
+
+Go to the documentation of this file.
00001 #ifndef ENEMYCAR_H
+00002 #define ENEMYCAR_H
+00003 
+00004 #include <cmath>
+00005 
+00006 #include "../presentation/BitmapStore.h"
+00007 
+00008 #include "../logic/Car.h"
+00009 #include "../logic/PlayerCar.h"
+00010 #include "../logic/Rock.h"
+00011 #include "../logic/MazeMath.h"
+00012 
+00021 class EnemyCar: public Car
+00022 {
+00023     public:
+00030         EnemyCar(double x, double y);
+00031 
+00032         //assignment and copy constructors have been left with the compiler generated versions
+00033 
+00043         void update(const Maze& maze, const list<PlayerCar>& players, const list<Rock>& rocks);
+00044 
+00048         void crash();
+00049 
+00053         void blind();
+00054 
+00055     private:
+00061         enum States {
+00062             BLINDED, 
+00063             CHASING 
+00064             };
+00065 
+00066         States _state; 
+00067         double _targetX; 
+00068         double _targetY; 
+00069 
+00085         void checkFacing(const Maze& maze, double chasingX, double chasingY, const list<Rock>& rocks);
+00086 
+00094         bool rockAtLocation(double x, double y, const list<Rock>& rocks);
+00095 };
+00096 
+00097 #endif // ENEMYCAR_H
+
+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_game_8cpp.html b/docs/html/_game_8cpp.html new file mode 100644 index 0000000..38dd1bc --- /dev/null +++ b/docs/html/_game_8cpp.html @@ -0,0 +1,110 @@ + + + + +Rally X: source/logic/Game.cpp File Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
+
source/logic/Game.cpp File Reference
+
+
+
#include "Game.h"
+
+

Go to the source code of this file.

+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_game_8cpp_source.html b/docs/html/_game_8cpp_source.html new file mode 100644 index 0000000..677b9f0 --- /dev/null +++ b/docs/html/_game_8cpp_source.html @@ -0,0 +1,292 @@ + + + + +Rally X: source/logic/Game.cpp Source File + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
source/logic/Game.cpp
+
+
+Go to the documentation of this file.
00001 #include "Game.h"
+00002 
+00003 Game::Game()
+00004     :_config("config.txt"),
+00005     _screen(_config.screenWidth(), _config.screenHeight(), _config.fullscreen())
+00006 {
+00007     _timer  = al_create_timer(1.0/FPS);
+00008     _timerEvents = al_create_event_queue();
+00009     al_register_event_source(_timerEvents, al_get_timer_event_source(_timer));
+00010 }
+00011 
+00012 Game::~Game()
+00013 {
+00014     al_destroy_event_queue(_timerEvents);
+00015     al_destroy_timer(_timer);
+00016 
+00017 }
+00018 
+00019 void Game::start()
+00020 {
+00021     while (!_screen.exitClicked())
+00022     {
+00023         string filename = _screen.getLevel();
+00024         if (!filename.empty())
+00025         {
+00026             initLevel(filename);
+00027             runloop();
+00028         }
+00029     }
+00030 }
+00031 
+00032 void Game::initLevel(const string& levelFile)
+00033 {
+00034     clearLists();
+00035     LevelReader reader(levelFile);
+00036     reader.readLevel(_maze, _players, _enemies, _checkpoints, _rocks);
+00037 }
+00038 
+00039 void Game::runloop()
+00040 {
+00041     bool gameWon = false;
+00042     bool gameLost = false;
+00043     al_start_timer(_timer);
+00044 
+00045     while (!_screen.exitClicked())
+00046     {
+00047         al_wait_for_event(_timerEvents, NULL);
+00048         al_flush_event_queue(_timerEvents);
+00049 
+00050         update();
+00051         _collisionDetector.checkCollisions(_players, _enemies, _checkpoints, _rocks, _smokescreens);
+00052         cleanup();
+00053         _screen.draw(_maze, _players, _enemies, _checkpoints, _rocks, _smokescreens, _popups);
+00054 
+00055         gameLost = _players.empty();
+00056         gameWon = Checkpoint::checkpointCount()==0;
+00057 
+00058         if (gameLost)
+00059         {
+00060             _screen.drawLoss();
+00061             for (int i=0; i<90; i++)
+00062             {
+00063                 al_wait_for_event(_timerEvents, NULL);
+00064                 al_drop_next_event(_timerEvents);
+00065             }
+00066             break;
+00067         }
+00068         else if (gameWon)
+00069         {
+00070             _screen.drawWin();
+00071             for (int i=0; i<90; i++)
+00072             {
+00073                 al_wait_for_event(_timerEvents, NULL);
+00074                 al_drop_next_event(_timerEvents);
+00075             }
+00076             break;
+00077         }
+00078     }
+00079     al_stop_timer(_timer);
+00080 }
+00081 
+00082 void Game::update()
+00083 {
+00084     for (list<PlayerCar>::iterator iter = _players.begin(); iter!=_players.end(); ++iter)
+00085     {
+00086         iter->update(_maze, _smokescreens);
+00087     }
+00088 
+00089     for (list<EnemyCar>::iterator iter = _enemies.begin(); iter!=_enemies.end(); ++iter)
+00090     {
+00091         iter->update(_maze, _players, _rocks);
+00092     }
+00093 
+00094     for (list<Smokescreen>::iterator iter = _smokescreens.begin(); iter!=_smokescreens.end(); ++iter)
+00095     {
+00096         iter->update();
+00097     }
+00098     for (list<DestroyedObjectPopup>::iterator iter = _popups.begin(); iter!=_popups.end(); ++iter)
+00099     {
+00100         iter->update();
+00101     }
+00102 }
+00103 
+00104 void Game::cleanup()
+00105 {
+00106     for (list<PlayerCar>::iterator iter = _players.begin(); iter!=_players.end();)
+00107     {
+00108         if (iter->destroyed())
+00109         {
+00110             _popups.push_back(DestroyedObjectPopup(iter->x(), iter->y(), BitmapStore::CRASHED_CAR));
+00111             iter = _players.erase(iter);
+00112         }
+00113         else
+00114         {
+00115             ++iter;
+00116         }
+00117     }
+00118     for (list<EnemyCar>::iterator iter = _enemies.begin(); iter!=_enemies.end();)
+00119     {
+00120         if (iter->destroyed())
+00121         {
+00122             _popups.push_back(DestroyedObjectPopup(iter->x(), iter->y(), BitmapStore::CRASHED_CAR));
+00123             iter = _enemies.erase(iter);
+00124         }
+00125         else
+00126         {
+00127             ++iter;
+00128         }
+00129     }
+00130     for (list<Checkpoint>::iterator iter = _checkpoints.begin(); iter!=_checkpoints.end();)
+00131     {
+00132         if (iter->destroyed())
+00133         {
+00134             _popups.push_back(DestroyedObjectPopup(iter->x(), iter->y(), BitmapStore::CLAIMED_CHECKPOINT));
+00135             iter = _checkpoints.erase(iter);
+00136         }
+00137         else
+00138         {
+00139             ++iter;
+00140         }
+00141     }
+00142     for (list<Rock>::iterator iter = _rocks.begin(); iter!=_rocks.end();)
+00143     {
+00144         if (iter->destroyed())
+00145         {
+00146             iter = _rocks.erase(iter);
+00147         }
+00148         else
+00149         {
+00150             ++iter;
+00151         }
+00152     }
+00153     for (list<Smokescreen>::iterator iter = _smokescreens.begin(); iter!=_smokescreens.end();)
+00154     {
+00155         if (iter->destroyed())
+00156         {
+00157             iter = _smokescreens.erase(iter);
+00158         }
+00159         else
+00160         {
+00161             ++iter;
+00162         }
+00163     }
+00164     for (list<DestroyedObjectPopup>::iterator iter = _popups.begin(); iter!=_popups.end();)
+00165     {
+00166         if (iter->destroyed())
+00167         {
+00168             iter = _popups.erase(iter);
+00169         }
+00170         else
+00171         {
+00172             ++iter;
+00173         }
+00174     }
+00175 }
+00176 
+00177 void Game::clearLists()
+00178 {
+00179     _players.clear();
+00180     _enemies.clear();
+00181     _checkpoints.clear();
+00182     _rocks.clear();
+00183     _smokescreens.clear();
+00184     _popups.clear();
+00185 }
+
+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_game_8h.html b/docs/html/_game_8h.html new file mode 100644 index 0000000..cfe326d --- /dev/null +++ b/docs/html/_game_8h.html @@ -0,0 +1,133 @@ + + + + +Rally X: source/logic/Game.h File Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+ +
+
source/logic/Game.h File Reference
+
+
+
#include <list>
+#include <algorithm>
+#include <allegro5/allegro.h>
+#include "../presentation/Screen.h"
+#include "../presentation/BitmapStore.h"
+#include "../logic/Maze.h"
+#include "../logic/PlayerCar.h"
+#include "../logic/EnemyCar.h"
+#include "../logic/Checkpoint.h"
+#include "../logic/Rock.h"
+#include "../logic/Smokescreen.h"
+#include "../logic/DestroyedObjectPopup.h"
+#include "../logic/AllegroWrappers.h"
+#include "../logic/CollisionDetector.h"
+#include "../data/LevelReader.h"
+#include "../data/Config.h"
+
+

Go to the source code of this file.

+ + + + +

+Classes

class  Game
 The object that controls the flow of the game, and the launch point of the game. More...
+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_game_8h_source.html b/docs/html/_game_8h_source.html new file mode 100644 index 0000000..e487b02 --- /dev/null +++ b/docs/html/_game_8h_source.html @@ -0,0 +1,177 @@ + + + + +Rally X: source/logic/Game.h Source File + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
source/logic/Game.h
+
+
+Go to the documentation of this file.
00001 #ifndef GAME_H
+00002 #define GAME_H
+00003 
+00004 #include <list>
+00005 #include <algorithm>
+00006 using namespace std;
+00007 
+00008 #include <allegro5/allegro.h>
+00009 
+00010 #include "../presentation/Screen.h"
+00011 #include "../presentation/BitmapStore.h"
+00012 
+00013 #include "../logic/Maze.h"
+00014 #include "../logic/PlayerCar.h"
+00015 #include "../logic/EnemyCar.h"
+00016 #include "../logic/Checkpoint.h"
+00017 #include "../logic/Rock.h"
+00018 #include "../logic/Smokescreen.h"
+00019 #include "../logic/DestroyedObjectPopup.h"
+00020 #include "../logic/AllegroWrappers.h"
+00021 #include "../logic/CollisionDetector.h"
+00022 
+00023 #include "../data/LevelReader.h"
+00024 #include "../data/Config.h"
+00025 
+00036 class Game
+00037 {
+00038     public:
+00039         static const unsigned int FPS = 30; 
+00040 
+00044         Game();
+00045 
+00049         ~Game();
+00050 
+00054         void start();
+00055 
+00056     private:
+00062         Game(const Game& ref);
+00068         Game& operator=(const Game& rhs);
+00069 
+00075         void initLevel(const string& levelFile);
+00076 
+00088         void runloop();
+00089 
+00093         void update();
+00097         void cleanup();
+00098 
+00104         void clearLists();
+00105 
+00106         AllegroInit _allegro; 
+00107 
+00108         Config _config; 
+00109         Screen _screen; 
+00110         ALLEGRO_TIMER* _timer; 
+00111         ALLEGRO_EVENT_QUEUE* _timerEvents; 
+00112 
+00113         Maze _maze; 
+00114 
+00124         list<PlayerCar> _players;
+00125 
+00126         list<EnemyCar> _enemies; 
+00127         list<Checkpoint> _checkpoints; 
+00128         list<Rock> _rocks; 
+00129         list<Smokescreen> _smokescreens; 
+00130         list<DestroyedObjectPopup> _popups; 
+00131 
+00132         CollisionDetector _collisionDetector; 
+00133 };
+00134 
+00135 #endif // GAME_H
+
+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_game_object_8cpp.html b/docs/html/_game_object_8cpp.html new file mode 100644 index 0000000..59491a7 --- /dev/null +++ b/docs/html/_game_object_8cpp.html @@ -0,0 +1,110 @@ + + + + +Rally X: source/logic/GameObject.cpp File Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
+
source/logic/GameObject.cpp File Reference
+
+
+
#include "GameObject.h"
+
+

Go to the source code of this file.

+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_game_object_8cpp_source.html b/docs/html/_game_object_8cpp_source.html new file mode 100644 index 0000000..ad01cb1 --- /dev/null +++ b/docs/html/_game_object_8cpp_source.html @@ -0,0 +1,134 @@ + + + + +Rally X: source/logic/GameObject.cpp Source File + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
source/logic/GameObject.cpp
+
+
+Go to the documentation of this file.
00001 #include "GameObject.h"
+00002 
+00003 GameObject::GameObject(double x, double y, BitmapStore::Image image, Maze::Direction facing)
+00004     :_x(x), _y(y), _destroyed(false), _image(image), _facing(facing)
+00005 {
+00006 }
+00007 
+00008 double GameObject::x() const
+00009 {
+00010     return _x;
+00011 }
+00012 double GameObject::y() const
+00013 {
+00014     return _y;
+00015 }
+00016 bool GameObject::destroyed() const
+00017 {
+00018     return _destroyed;
+00019 }
+00020 BitmapStore::Image GameObject::image() const
+00021 {
+00022     return _image;
+00023 }
+00024 Maze::Direction GameObject::facing() const
+00025 {
+00026     return _facing;
+00027 }
+
+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_game_object_8h.html b/docs/html/_game_object_8h.html new file mode 100644 index 0000000..ff9c230 --- /dev/null +++ b/docs/html/_game_object_8h.html @@ -0,0 +1,119 @@ + + + + +Rally X: source/logic/GameObject.h File Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+ +
+
source/logic/GameObject.h File Reference
+
+
+
#include "../presentation/BitmapStore.h"
+#include "../logic/Maze.h"
+
+

Go to the source code of this file.

+ + + + +

+Classes

class  GameObject
 Parent class for objects that are placed in the maze. More...
+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_game_object_8h_source.html b/docs/html/_game_object_8h_source.html new file mode 100644 index 0000000..2816fa8 --- /dev/null +++ b/docs/html/_game_object_8h_source.html @@ -0,0 +1,139 @@ + + + + +Rally X: source/logic/GameObject.h Source File + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
source/logic/GameObject.h
+
+
+Go to the documentation of this file.
00001 #ifndef GAMEOBJECT_H
+00002 #define GAMEOBJECT_H
+00003 
+00004 #include "../presentation/BitmapStore.h"
+00005 #include "../logic/Maze.h"
+00006 
+00023 class GameObject
+00024 {
+00025     public:
+00035         GameObject(double x, double y, BitmapStore::Image image, Maze::Direction facing=Maze::UP);
+00036 
+00037         //assignment and copy constructors have been left with the compiler generated versions
+00038 
+00044         double x() const;
+00045 
+00051         double y() const;
+00052 
+00058         bool destroyed() const;
+00059 
+00065         BitmapStore::Image image() const;
+00066 
+00072         Maze::Direction facing() const;
+00073 
+00074     protected:
+00075         double _x; 
+00076         double _y; 
+00077         bool _destroyed; 
+00078         BitmapStore::Image _image; 
+00079         Maze::Direction _facing; 
+00080 };
+00081 
+00082 #endif // GAMEOBJECT_H
+
+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_game_panel_8cpp.html b/docs/html/_game_panel_8cpp.html new file mode 100644 index 0000000..79143c2 --- /dev/null +++ b/docs/html/_game_panel_8cpp.html @@ -0,0 +1,110 @@ + + + + +Rally X: source/presentation/GamePanel.cpp File Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
+
source/presentation/GamePanel.cpp File Reference
+
+
+
#include "GamePanel.h"
+
+

Go to the source code of this file.

+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_game_panel_8cpp_source.html b/docs/html/_game_panel_8cpp_source.html new file mode 100644 index 0000000..3511c39 --- /dev/null +++ b/docs/html/_game_panel_8cpp_source.html @@ -0,0 +1,240 @@ + + + + +Rally X: source/presentation/GamePanel.cpp Source File + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
source/presentation/GamePanel.cpp
+
+
+Go to the documentation of this file.
00001 #include "GamePanel.h"
+00002 
+00003 GamePanel::GamePanel(ALLEGRO_BITMAP* back, ALLEGRO_BITMAP* front, int x, int y, int width, int height)
+00004     :ScreenPanel(back, front, x, y, width, height),
+00005     _mazeblockWidth(_width/BLOCKS_PER_ROW),
+00006     _offsetX(0),
+00007     _offsetY(0),
+00008     _bitmapStore(_mazeblockWidth)
+00009 {
+00010 }
+00011 
+00012 void GamePanel::draw(const Maze& maze, const list<PlayerCar>& players, const list<EnemyCar>& enemies, const list<Checkpoint>& checkpoints, const list<Rock>& rocks, const list<Smokescreen>& smokescreens, const list<DestroyedObjectPopup>& popups)
+00013 {
+00014     ALLEGRO_BITMAP* prev_draw = al_get_target_bitmap();
+00015     al_set_target_bitmap(_back);
+00016 
+00017     al_clear_to_color(BLANK);
+00018 
+00019     float _maxOffsetX = getPanelX(maze.width()) - _width;
+00020     float _maxOffsetY = getPanelY(maze.height()) - _height;
+00021 
+00022     if (!players.empty())
+00023     {
+00024         _offsetX = getPanelX(players.front().x()) - _width/2;
+00025         if (_offsetX < 0) _offsetX = 0;
+00026         else if (_offsetX > _maxOffsetX) _offsetX = _maxOffsetX;
+00027 
+00028         _offsetY = getPanelY(players.front().y()) - _height/2;
+00029         if (_offsetY < 0) _offsetY = 0;
+00030         else if (_offsetY > _maxOffsetY) _offsetY = _maxOffsetY;
+00031     }
+00032 
+00033     draw(maze);
+00034 
+00035     for (list<PlayerCar>::const_iterator iter = players.begin(); iter != players.end(); ++iter)
+00036     {
+00037         draw(*iter);
+00038     }
+00039     for (list<EnemyCar>::const_iterator iter = enemies.begin(); iter != enemies.end(); ++iter)
+00040     {
+00041         draw(*iter);
+00042     }
+00043     for (list<Checkpoint>::const_iterator iter = checkpoints.begin(); iter != checkpoints.end(); ++iter)
+00044     {
+00045         draw(*iter);
+00046     }
+00047     for (list<Rock>::const_iterator iter = rocks.begin(); iter != rocks.end(); ++iter)
+00048     {
+00049         draw(*iter);
+00050     }
+00051     for (list<Smokescreen>::const_iterator iter = smokescreens.begin(); iter != smokescreens.end(); ++iter)
+00052     {
+00053         draw(*iter);
+00054     }
+00055     for (list<DestroyedObjectPopup>::const_iterator iter = popups.begin(); iter != popups.end(); ++iter)
+00056     {
+00057         draw(*iter);
+00058     }
+00059 
+00060     al_set_target_bitmap(prev_draw);
+00061 }
+00062 
+00063 void GamePanel::draw(const Maze& maze)
+00064 {
+00065     //only draws a parts of the maze that would appear on the screen
+00066     int minX = floor((_offsetX-_mazeblockWidth)/_mazeblockWidth);
+00067     int maxX = ceil((_offsetX+_width)/_mazeblockWidth);
+00068     int minY = floor((_offsetY-_mazeblockWidth)/_mazeblockWidth);
+00069     int maxY = ceil((_offsetY+_height)/_mazeblockWidth);
+00070 
+00071     ALLEGRO_BITMAP* wallBitmap = _bitmapStore.getBitmap(BitmapStore::MAZE_WALL);
+00072     ALLEGRO_BITMAP* floorBitmap = _bitmapStore.getBitmap(BitmapStore::MAZE_FLOOR);
+00073     //used to only have one al_draw_bitmap command
+00074     ALLEGRO_BITMAP* currentBitmap = floorBitmap;
+00075     for (int x=minX; x<maxX&&x<maze.width(); ++x)
+00076     {
+00077         for (int y=minY; y<maxY&&y<maze.height(); ++y)
+00078         {
+00079             if (maze.getSolid(x,y))
+00080             {
+00081                 currentBitmap = wallBitmap;
+00082             }
+00083             else
+00084             {
+00085                 currentBitmap = floorBitmap;
+00086             }
+00087             al_draw_bitmap(currentBitmap, getPanelX(x)-_offsetX, getPanelY(y)-_offsetY, 0);
+00088         }
+00089     }
+00090 }
+00091 
+00092 void GamePanel::draw(const GameObject& object)
+00093 {
+00094     //only draws a gameobject if it would appear on the screen
+00095     if (object.x() < (_offsetX-_mazeblockWidth)/_mazeblockWidth) return;
+00096     if (object.x() > (_offsetX+_width)/_mazeblockWidth) return;
+00097     if (object.y() < (_offsetY-_mazeblockWidth)/_mazeblockWidth) return;
+00098     if (object.y() > (_offsetY+_height)/_mazeblockWidth) return;
+00099 
+00100     ALLEGRO_BITMAP* bitmap = _bitmapStore.getBitmap(object.image());
+00101 
+00102     float angle = 0;
+00103     switch(object.facing())
+00104     {
+00105         case Maze::UP:
+00106             angle = 0;
+00107             break;
+00108         case Maze::RIGHT:
+00109             angle = ALLEGRO_PI/2;
+00110             break;
+00111         case Maze::DOWN:
+00112             angle = ALLEGRO_PI;
+00113             break;
+00114         case Maze::LEFT:
+00115             angle = 3*ALLEGRO_PI/2;
+00116             break;
+00117     }
+00118 
+00119     float objectX = getPanelX(object.x());
+00120     float objectY = getPanelY(object.y());
+00121     float center = _mazeblockWidth/2;
+00122 
+00123     al_draw_rotated_bitmap(bitmap, center , center , objectX+center-_offsetX, objectY+center-_offsetY, angle, 0);
+00124 }
+00125 
+00126 float GamePanel::getPanelX(const double& x) const
+00127 {
+00128     return static_cast<float>(x*_mazeblockWidth);
+00129 }
+00130 float GamePanel::getPanelY(const double& y) const
+00131 {
+00132     return static_cast<float>(y*_mazeblockWidth);
+00133 }
+
+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_game_panel_8h.html b/docs/html/_game_panel_8h.html new file mode 100644 index 0000000..b496b00 --- /dev/null +++ b/docs/html/_game_panel_8h.html @@ -0,0 +1,127 @@ + + + + +Rally X: source/presentation/GamePanel.h File Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+ +
+
source/presentation/GamePanel.h File Reference
+
+
+
#include "../presentation/ScreenPanel.h"
+#include "../logic/Maze.h"
+#include "../logic/GameObject.h"
+#include "../logic/PlayerCar.h"
+#include "../logic/EnemyCar.h"
+#include "../logic/Checkpoint.h"
+#include "../logic/Rock.h"
+#include "../logic/Smokescreen.h"
+#include "../logic/DestroyedObjectPopup.h"
+#include "../logic/AllegroWrappers.h"
+
+

Go to the source code of this file.

+ + + + +

+Classes

class  GamePanel
 ScreenPanel to be drawn on the screen to draw the area where the game takes place. More...
+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_game_panel_8h_source.html b/docs/html/_game_panel_8h_source.html new file mode 100644 index 0000000..235ea59 --- /dev/null +++ b/docs/html/_game_panel_8h_source.html @@ -0,0 +1,151 @@ + + + + +Rally X: source/presentation/GamePanel.h Source File + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
source/presentation/GamePanel.h
+
+
+Go to the documentation of this file.
00001 #ifndef GAMEPANEL_H
+00002 #define GAMEPANEL_H
+00003 
+00004 #include "../presentation/ScreenPanel.h"
+00005 #include "../logic/Maze.h"
+00006 #include "../logic/GameObject.h"
+00007 #include "../logic/PlayerCar.h"
+00008 #include "../logic/EnemyCar.h"
+00009 #include "../logic/Checkpoint.h"
+00010 #include "../logic/Rock.h"
+00011 #include "../logic/Smokescreen.h"
+00012 #include "../logic/DestroyedObjectPopup.h"
+00013 #include "../logic/AllegroWrappers.h"
+00014 
+00023 class GamePanel : public ScreenPanel
+00024 {
+00025     public:
+00040         GamePanel(ALLEGRO_BITMAP* back, ALLEGRO_BITMAP* front, int x, int y, int width, int height);
+00041 
+00042 
+00057         virtual void draw(const Maze& maze, const list<PlayerCar>& players, const list<EnemyCar>& enemies, const list<Checkpoint>& checkpoints, const list<Rock>& rocks, const list<Smokescreen>& smokescreens, const list<DestroyedObjectPopup>& popups);
+00058     private:
+00062         GamePanel(const GamePanel& ref);
+00066         GamePanel& operator=(const GamePanel& rhs);
+00075         float getPanelX(const double& x) const;
+00084         float getPanelY(const double& y) const;
+00085 
+00094         void draw(const Maze& maze);
+00095 
+00103         void draw(const GameObject& object);
+00104 
+00105         const static int BLOCKS_PER_ROW = 15; 
+00106 
+00107         unsigned int _mazeblockWidth; 
+00108 
+00109         float _offsetX; 
+00110         float _offsetY; 
+00111 
+00112         BitmapStore _bitmapStore; 
+00113 
+00114         AllegroInit _allegro; 
+00115 };
+00116 
+00117 #endif // GAMEPANEL_H
+
+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_info_panel_8cpp.html b/docs/html/_info_panel_8cpp.html new file mode 100644 index 0000000..d0e0acb --- /dev/null +++ b/docs/html/_info_panel_8cpp.html @@ -0,0 +1,110 @@ + + + + +Rally X: source/presentation/InfoPanel.cpp File Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
+
source/presentation/InfoPanel.cpp File Reference
+
+
+
#include "InfoPanel.h"
+
+

Go to the source code of this file.

+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_info_panel_8cpp_source.html b/docs/html/_info_panel_8cpp_source.html new file mode 100644 index 0000000..59e5a49 --- /dev/null +++ b/docs/html/_info_panel_8cpp_source.html @@ -0,0 +1,218 @@ + + + + +Rally X: source/presentation/InfoPanel.cpp Source File + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
source/presentation/InfoPanel.cpp
+
+
+Go to the documentation of this file.
00001 #include "InfoPanel.h"
+00002 
+00003 InfoPanel::InfoPanel(ALLEGRO_BITMAP* back, ALLEGRO_BITMAP* front, int x, int y, int width, int height)
+00004     :ScreenPanel(back, front, x, y, width, height),
+00005     _petrolHeadingY(_width/10),
+00006     _petrolGuageY(_petrolHeadingY + _width/10),
+00007     _petrolGuageHeight(_width/10),
+00008     _checkpointHeadingY(_petrolGuageY + _petrolGuageHeight + _width/10),
+00009     _checkpointValueY(_checkpointHeadingY + _width/10),
+00010     _miniMazeY(_checkpointValueY + _width/5),
+00011     _miniMazeHeight(_height - _miniMazeY),
+00012     _miniMazeblockWidth(0)
+00013 {
+00014     _panelFont = al_load_font("junction 02.ttf", _width/10, 0);
+00015     if (_panelFont == NULL)
+00016     {
+00017         al_show_native_message_box(NULL, "Fatal error", "Fatal error", "The file 'junction 02.ttf' was not found. Ensure that it is located in the working directory.", NULL, ALLEGRO_MESSAGEBOX_ERROR);
+00018         throw InstallFailure();
+00019     }
+00020 }
+00021 
+00022 InfoPanel::~InfoPanel()
+00023 {
+00024     al_destroy_font(_panelFont);
+00025 }
+00026 
+00027 void InfoPanel::draw(const Maze& maze, const list<PlayerCar>& players, const list<EnemyCar>& enemies, const list<Checkpoint>& checkpoints, const list<Rock>& rocks, const list<Smokescreen>& smokescreens, const list<DestroyedObjectPopup>& popups)
+00028 {
+00029     ALLEGRO_BITMAP* prev_draw = al_get_target_bitmap();
+00030     al_set_target_bitmap(_back);
+00031 
+00032     double petrol = 0;
+00033     if (!players.empty())
+00034     {
+00035         petrol = players.front().petrol();
+00036     }
+00037 
+00038     al_clear_to_color(_colourStore.getColour(BitmapStore::MAZE_FLOOR));
+00039 
+00040     //gets a mazeblock width the fits the current maze
+00041     _miniMazeblockWidth = min(static_cast<float>(_width)/maze.width(), static_cast<float>(_miniMazeHeight)/maze.height());
+00042 
+00043     //draws petrol heading and bar
+00044     al_draw_text(_panelFont, al_map_rgb(255,255,255), 1, _petrolHeadingY, ALLEGRO_ALIGN_LEFT , "Petrol");
+00045     al_draw_filled_rectangle(0,_petrolGuageY,_width*petrol, _petrolGuageY+_petrolGuageHeight, al_map_rgb(255,128,0));
+00046 
+00047     //draws checkpoints remaining heading and value
+00048     al_draw_text(_panelFont, al_map_rgb(255,255,255), 1, _checkpointHeadingY, ALLEGRO_ALIGN_LEFT , "Checkpoints");
+00049     stringstream checkpointCountString;
+00050     checkpointCountString << Checkpoint::checkpointCount();
+00051     al_draw_text(_panelFont, al_map_rgb(255,255,255), 1, _checkpointValueY, ALLEGRO_ALIGN_LEFT , checkpointCountString.str().c_str());
+00052 
+00053     draw(maze);
+00054     for (list<PlayerCar>::const_iterator iter = players.begin(); iter != players.end(); ++iter)
+00055     {
+00056         draw(*iter);
+00057     }
+00058     for (list<EnemyCar>::const_iterator iter = enemies.begin(); iter != enemies.end(); ++iter)
+00059     {
+00060         draw(*iter);
+00061     }
+00062     for (list<Checkpoint>::const_iterator iter = checkpoints.begin(); iter != checkpoints.end(); ++iter)
+00063     {
+00064         draw(*iter);
+00065     }
+00066 
+00067     //restore draw target
+00068     al_set_target_bitmap(prev_draw);
+00069 }
+00070 
+00071 void InfoPanel::draw(const Maze& maze)
+00072 {
+00073     ALLEGRO_COLOR wallColour = _colourStore.getColour(BitmapStore::MAZE_WALL);
+00074     ALLEGRO_COLOR floorColour = _colourStore.getColour(BitmapStore::MAZE_FLOOR);
+00075 
+00076     for (int x=0; x<maze.width(); ++x)
+00077     {
+00078         for (int y=0; y<maze.height(); ++y)
+00079         {
+00080             float x1 = getPanelX(x);
+00081             float x2 = x1 + _miniMazeblockWidth;
+00082             float y1 = getPanelY(y) + _miniMazeY;
+00083             float y2 = y1 + _miniMazeblockWidth;
+00084             if (maze.getSolid(x,y))
+00085             {
+00086                 al_draw_filled_rectangle(x1, y1, x2, y2, wallColour);
+00087             }
+00088             else
+00089             {
+00090                 al_draw_filled_rectangle(x1, y1, x2, y2, floorColour);
+00091             }
+00092         }
+00093     }
+00094 }
+00095 
+00096 void InfoPanel::draw(const GameObject& object)
+00097 {
+00098     float r = _miniMazeblockWidth/2;
+00099     float cx = getPanelX(object.x()) + r;
+00100     float cy = getPanelY(object.y()) + _miniMazeY + r;
+00101     al_draw_filled_circle(cx, cy, r, _colourStore.getColour(object.image()));
+00102 }
+00103 
+00104 float InfoPanel::getPanelX(const double& x) const
+00105 {
+00106     return static_cast<float>(x*_miniMazeblockWidth);
+00107 }
+00108 float InfoPanel::getPanelY(const double& y) const
+00109 {
+00110     return static_cast<float>(y*_miniMazeblockWidth);
+00111 }
+
+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_info_panel_8h.html b/docs/html/_info_panel_8h.html new file mode 100644 index 0000000..14b4fb7 --- /dev/null +++ b/docs/html/_info_panel_8h.html @@ -0,0 +1,128 @@ + + + + +Rally X: source/presentation/InfoPanel.h File Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+ +
+
source/presentation/InfoPanel.h File Reference
+
+
+
#include <allegro5/allegro.h>
+#include <allegro5/allegro_primitives.h>
+#include <sstream>
+#include "../presentation/ScreenPanel.h"
+#include "../presentation/ColourStore.h"
+#include "../logic/Maze.h"
+#include "../logic/GameObject.h"
+#include "../logic/PlayerCar.h"
+#include "../logic/EnemyCar.h"
+#include "../logic/Checkpoint.h"
+#include "../logic/AllegroWrappers.h"
+
+

Go to the source code of this file.

+ + + + +

+Classes

class  InfoPanel
 ScreenPanel to be drawn on the screen to give the player information. More...
+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_info_panel_8h_source.html b/docs/html/_info_panel_8h_source.html new file mode 100644 index 0000000..d28f366 --- /dev/null +++ b/docs/html/_info_panel_8h_source.html @@ -0,0 +1,159 @@ + + + + +Rally X: source/presentation/InfoPanel.h Source File + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
source/presentation/InfoPanel.h
+
+
+Go to the documentation of this file.
00001 #ifndef INFOPANEL_H
+00002 #define INFOPANEL_H
+00003 
+00004 #include <allegro5/allegro.h>
+00005 #include <allegro5/allegro_primitives.h>
+00006 
+00007 #include <sstream>
+00008 using namespace std;
+00009 
+00010 #include "../presentation/ScreenPanel.h"
+00011 #include "../presentation/ColourStore.h"
+00012 #include "../logic/Maze.h"
+00013 #include "../logic/GameObject.h"
+00014 #include "../logic/PlayerCar.h"
+00015 #include "../logic/EnemyCar.h"
+00016 #include "../logic/Checkpoint.h"
+00017 #include "../logic/AllegroWrappers.h"
+00018 
+00030 class InfoPanel : public ScreenPanel
+00031 {
+00032     public:
+00047         InfoPanel(ALLEGRO_BITMAP* back, ALLEGRO_BITMAP* front, int x, int y, int width, int height);
+00048 
+00054         ~InfoPanel();
+00055 
+00074         virtual void draw(const Maze& maze, const list<PlayerCar>& players, const list<EnemyCar>& enemies, const list<Checkpoint>& checkpoints, const list<Rock>& rocks, const list<Smokescreen>& smokescreens, const list<DestroyedObjectPopup>& popups);
+00075     private:
+00079         InfoPanel(const InfoPanel& ref);
+00083         InfoPanel& operator=(const InfoPanel& rhs);
+00092         float getPanelX(const double& x) const;
+00101         float getPanelY(const double& y) const;
+00102 
+00113         void draw(const Maze& maze);
+00114 
+00123         void draw(const GameObject& object);
+00124 
+00125         AllegroDrawingInit _drawing; 
+00126         ColourStore _colourStore; 
+00127 
+00128         float _petrolHeadingY; 
+00129         float _petrolGuageY; 
+00130         float _petrolGuageHeight; 
+00131         float _checkpointHeadingY; 
+00132         float _checkpointValueY; 
+00133         float _miniMazeY; 
+00134         float _miniMazeHeight; 
+00135         float _miniMazeblockWidth; 
+00136 
+00137         ALLEGRO_FONT* _panelFont; 
+00138 };
+00139 
+00140 #endif // INFOPANEL_H
+
+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_keyboard_handler_8cpp.html b/docs/html/_keyboard_handler_8cpp.html new file mode 100644 index 0000000..767cfc6 --- /dev/null +++ b/docs/html/_keyboard_handler_8cpp.html @@ -0,0 +1,110 @@ + + + + +Rally X: source/presentation/KeyboardHandler.cpp File Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
+
source/presentation/KeyboardHandler.cpp File Reference
+
+
+
#include "KeyboardHandler.h"
+
+

Go to the source code of this file.

+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_keyboard_handler_8cpp_source.html b/docs/html/_keyboard_handler_8cpp_source.html new file mode 100644 index 0000000..67174e5 --- /dev/null +++ b/docs/html/_keyboard_handler_8cpp_source.html @@ -0,0 +1,221 @@ + + + + +Rally X: source/presentation/KeyboardHandler.cpp Source File + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
source/presentation/KeyboardHandler.cpp
+
+
+Go to the documentation of this file.
00001 #include "KeyboardHandler.h"
+00002 
+00003 KeyboardHandler::KeyboardHandler(Maze::Direction currentFacing)
+00004     :_up(false),
+00005     _down(false),
+00006     _left(false),
+00007     _right(false),
+00008     _smokescreen(false),
+00009     _previousFacing(currentFacing)
+00010 {
+00011     _keyboardEvents = al_create_event_queue();
+00012     al_register_event_source(_keyboardEvents, al_get_keyboard_event_source());
+00013 }
+00014 
+00015 KeyboardHandler::KeyboardHandler(const KeyboardHandler& ref)
+00016     :_up(ref._up),
+00017     _down(ref._down),
+00018     _left(ref._left),
+00019     _right(ref._right),
+00020     _smokescreen(ref._smokescreen),
+00021     _previousFacing(ref._previousFacing)
+00022 {
+00023     _keyboardEvents = al_create_event_queue();
+00024     al_register_event_source(_keyboardEvents, al_get_keyboard_event_source());
+00025 }
+00026 
+00027 KeyboardHandler& KeyboardHandler::operator=(const KeyboardHandler& rhs)
+00028 {
+00029     _up = rhs._up;
+00030     _down = rhs._down;
+00031     _left = rhs._left;
+00032     _right = rhs._right;
+00033     _smokescreen = rhs._smokescreen;
+00034     _previousFacing = rhs._previousFacing;
+00035 
+00036     if (_keyboardEvents!=rhs._keyboardEvents) al_destroy_event_queue(_keyboardEvents);
+00037 
+00038     _keyboardEvents = al_create_event_queue();
+00039     al_register_event_source(_keyboardEvents, al_get_keyboard_event_source());
+00040 
+00041     return *this;
+00042 }
+00043 
+00044 KeyboardHandler::~KeyboardHandler()
+00045 {
+00046     al_destroy_event_queue(_keyboardEvents);
+00047 }
+00048 
+00049 void KeyboardHandler::updateFlags()
+00050 {
+00051     ALLEGRO_EVENT event;
+00052     while (al_get_next_event(_keyboardEvents, &event))
+00053     {
+00054         if (event.type==ALLEGRO_EVENT_KEY_DOWN)
+00055         {
+00056             switch (event.keyboard.keycode)
+00057             {
+00058                 case UP_KEY:
+00059                     _up = true;
+00060                     break;
+00061                 case DOWN_KEY:
+00062                     _down = true;
+00063                     break;
+00064                 case LEFT_KEY:
+00065                     _left = true;
+00066                     break;
+00067                 case RIGHT_KEY:
+00068                     _right = true;
+00069                     break;
+00070                 case SMOKESCREEN_KEY:
+00071                     _smokescreen = true;
+00072                     break;
+00073             }
+00074         }
+00075         else if (event.type==ALLEGRO_EVENT_KEY_UP)
+00076         {
+00077             switch (event.keyboard.keycode)
+00078             {
+00079                 case UP_KEY:
+00080                     _up = false;
+00081                     break;
+00082                 case DOWN_KEY:
+00083                     _down = false;
+00084                     break;
+00085                 case LEFT_KEY:
+00086                     _left = false;
+00087                     break;
+00088                 case RIGHT_KEY:
+00089                     _right = false;
+00090                     break;
+00091                 case SMOKESCREEN_KEY:
+00092                     _smokescreen = false;
+00093                     break;
+00094             }
+00095         }
+00096     }
+00097 }
+00098 
+00099 Maze::Direction KeyboardHandler::getFacing()
+00100 {
+00101     updateFlags();
+00102 
+00103     if (_up) _previousFacing = Maze::UP;
+00104     else if (_down) _previousFacing = Maze::DOWN;
+00105     else if (_left) _previousFacing = Maze::LEFT;
+00106     else if (_right) _previousFacing = Maze::RIGHT;
+00107 
+00108     return _previousFacing;
+00109 }
+00110 
+00111 bool KeyboardHandler::getSmokescreen()
+00112 {
+00113     return _smokescreen;
+00114 }
+
+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_keyboard_handler_8h.html b/docs/html/_keyboard_handler_8h.html new file mode 100644 index 0000000..e4d6017 --- /dev/null +++ b/docs/html/_keyboard_handler_8h.html @@ -0,0 +1,120 @@ + + + + +Rally X: source/presentation/KeyboardHandler.h File Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+ +
+
source/presentation/KeyboardHandler.h File Reference
+
+
+
#include <allegro5/allegro.h>
+#include "../logic/Maze.h"
+#include "../logic/AllegroWrappers.h"
+
+

Go to the source code of this file.

+ + + + +

+Classes

class  KeyboardHandler
 Class for handling keyboard related game inputs from the player. More...
+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_keyboard_handler_8h_source.html b/docs/html/_keyboard_handler_8h_source.html new file mode 100644 index 0000000..1764633 --- /dev/null +++ b/docs/html/_keyboard_handler_8h_source.html @@ -0,0 +1,148 @@ + + + + +Rally X: source/presentation/KeyboardHandler.h Source File + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
source/presentation/KeyboardHandler.h
+
+
+Go to the documentation of this file.
00001 #ifndef KEYBOARDHANDLER_H
+00002 #define KEYBOARDHANDLER_H
+00003 
+00004 #include <allegro5/allegro.h>
+00005 
+00006 #include "../logic/Maze.h"
+00007 #include "../logic/AllegroWrappers.h"
+00008 
+00019 class KeyboardHandler
+00020 {
+00021     public:
+00027         KeyboardHandler(Maze::Direction currentFacing);
+00031         KeyboardHandler(const KeyboardHandler& ref);
+00035         KeyboardHandler& operator=(const KeyboardHandler& rhs);
+00039         ~KeyboardHandler();
+00040 
+00051         Maze::Direction getFacing();
+00052 
+00058         bool getSmokescreen();
+00059 
+00060     private:
+00061         AllegroKeyboardInit _keyboard; 
+00062 
+00066         void updateFlags();
+00067 
+00068         bool _up; 
+00069         bool _down; 
+00070         bool _left; 
+00071         bool _right; 
+00072         bool _smokescreen; 
+00073         Maze::Direction _previousFacing; 
+00074         ALLEGRO_EVENT_QUEUE* _keyboardEvents; 
+00075 
+00076         static const int UP_KEY = ALLEGRO_KEY_UP; 
+00077         static const int DOWN_KEY = ALLEGRO_KEY_DOWN; 
+00078         static const int LEFT_KEY = ALLEGRO_KEY_LEFT; 
+00079         static const int RIGHT_KEY = ALLEGRO_KEY_RIGHT; 
+00080         static const int SMOKESCREEN_KEY = ALLEGRO_KEY_SPACE; 
+00081 };
+00082 
+00083 #endif // KEYBOARDHANDLER_H
+
+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_level_reader_8cpp.html b/docs/html/_level_reader_8cpp.html new file mode 100644 index 0000000..92758bd --- /dev/null +++ b/docs/html/_level_reader_8cpp.html @@ -0,0 +1,110 @@ + + + + +Rally X: source/data/LevelReader.cpp File Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
+
source/data/LevelReader.cpp File Reference
+
+
+
#include "LevelReader.h"
+
+

Go to the source code of this file.

+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_level_reader_8cpp_source.html b/docs/html/_level_reader_8cpp_source.html new file mode 100644 index 0000000..f06bb16 --- /dev/null +++ b/docs/html/_level_reader_8cpp_source.html @@ -0,0 +1,161 @@ + + + + +Rally X: source/data/LevelReader.cpp Source File + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
source/data/LevelReader.cpp
+
+
+Go to the documentation of this file.
00001 #include "LevelReader.h"
+00002 
+00003 LevelReader::LevelReader(string filename)
+00004     :_filename(filename)
+00005 {}
+00006 
+00007 void LevelReader::readLevel(Maze& maze, list<PlayerCar>& players, list<EnemyCar>& enemies, list<Checkpoint>& checkpoints, list<Rock>& rocks)
+00008 {
+00009     ifstream file(_filename.c_str());
+00010     if (!file)
+00011     {
+00012         al_show_native_message_box(NULL, "Fatal error", "Fatal error", "The requested level file could not be opened.", NULL, ALLEGRO_MESSAGEBOX_ERROR);
+00013         throw FileOpenError();
+00014     }
+00015 
+00016     int maxX = 0;
+00017     int maxY = 0;
+00018 
+00019     string line;
+00020     char element;
+00021     int y = 0;
+00022     vector <pair<int, int> > walls;
+00023 
+00024     while (!file.eof())
+00025     {
+00026         getline (file, line);
+00027 
+00028         for (int x = 0; x < static_cast<int>(line.length()); ++x)
+00029         {
+00030             element = line.at(x);
+00031             switch (element)
+00032             {
+00033                 case PLAYER_CHAR: players.push_back(PlayerCar(x,y));
+00034                 break;
+00035                 case ENEMY_CHAR: enemies.push_back (EnemyCar(x,y));
+00036                 break;
+00037                 case CHECKPOINT_CHAR: checkpoints.push_back(Checkpoint(x,y));
+00038                 break;
+00039                 case ROCK_CHAR: rocks.push_back(Rock(x,y));
+00040                 break;
+00041                 case WALL_CHAR: walls.push_back (make_pair(x,y));
+00042                 break;
+00043             }
+00044             if (maxX < x) maxX = x;
+00045             if (maxY < y) maxY = y;
+00046         }
+00047 
+00048         ++y;
+00049     }
+00050 
+00051     maze.generateMaze (walls, maxX, maxY);
+00052 
+00053     file.close();
+00054 }
+
+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_level_reader_8h.html b/docs/html/_level_reader_8h.html new file mode 100644 index 0000000..5c3bbab --- /dev/null +++ b/docs/html/_level_reader_8h.html @@ -0,0 +1,129 @@ + + + + +Rally X: source/data/LevelReader.h File Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+ +
+
source/data/LevelReader.h File Reference
+
+
+
#include <vector>
+#include <list>
+#include <string>
+#include <fstream>
+#include <allegro5/allegro_native_dialog.h>
+#include "../logic/Maze.h"
+#include "../logic/PlayerCar.h"
+#include "../logic/EnemyCar.h"
+#include "../logic/Checkpoint.h"
+#include "../logic/Rock.h"
+
+

Go to the source code of this file.

+ + + + + + +

+Classes

class  FileOpenError
 An exception that is thrown if the file selected for opening does not exist. More...
class  LevelReader
 Reads the game objects from a text file and calls relevant constructors. More...
+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_level_reader_8h_source.html b/docs/html/_level_reader_8h_source.html new file mode 100644 index 0000000..6f76b60 --- /dev/null +++ b/docs/html/_level_reader_8h_source.html @@ -0,0 +1,146 @@ + + + + +Rally X: source/data/LevelReader.h Source File + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
source/data/LevelReader.h
+
+
+Go to the documentation of this file.
00001 #ifndef MAZEREADER_H
+00002 #define MAZEREADER_H
+00003 
+00004 #include <vector>
+00005 #include <list>
+00006 #include <string>
+00007 #include <fstream>
+00008 using namespace std;
+00009 
+00010 #include <allegro5/allegro_native_dialog.h>
+00011 
+00012 #include "../logic/Maze.h"
+00013 #include "../logic/PlayerCar.h"
+00014 #include "../logic/EnemyCar.h"
+00015 #include "../logic/Checkpoint.h"
+00016 #include "../logic/Rock.h"
+00017 
+00027 class FileOpenError{};
+00028 
+00035 class LevelReader
+00036 {
+00037     public:
+00043         LevelReader(string filename);
+00044 
+00045         //Assignment and copy operations are handled by the compiler generated versions
+00046 
+00059         void readLevel(Maze& maze, list<PlayerCar>& players, list<EnemyCar>& enemies, list<Checkpoint>& checkpoints, list<Rock>& rocks);
+00060 
+00061     private:
+00062         static const char PLAYER_CHAR = '@'; 
+00063         static const char ENEMY_CHAR = 'X'; 
+00064         static const char CHECKPOINT_CHAR = 'P'; 
+00065         static const char ROCK_CHAR = 'O'; 
+00066         static const char WALL_CHAR = '#'; 
+00067 
+00068         string _filename; 
+00069 };
+00070 
+00071 #endif // MAZEREADER_H
+
+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_limited_time_object_8cpp.html b/docs/html/_limited_time_object_8cpp.html new file mode 100644 index 0000000..ee23b88 --- /dev/null +++ b/docs/html/_limited_time_object_8cpp.html @@ -0,0 +1,110 @@ + + + + +Rally X: source/logic/LimitedTimeObject.cpp File Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
+
source/logic/LimitedTimeObject.cpp File Reference
+
+
+
#include "LimitedTimeObject.h"
+
+

Go to the source code of this file.

+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_limited_time_object_8cpp_source.html b/docs/html/_limited_time_object_8cpp_source.html new file mode 100644 index 0000000..78c0425 --- /dev/null +++ b/docs/html/_limited_time_object_8cpp_source.html @@ -0,0 +1,123 @@ + + + + +Rally X: source/logic/LimitedTimeObject.cpp Source File + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
source/logic/LimitedTimeObject.cpp
+
+
+Go to the documentation of this file.
00001 #include "LimitedTimeObject.h"
+00002 
+00003 LimitedTimeObject::LimitedTimeObject(double x, double y, BitmapStore::Image image, int time)
+00004     :GameObject(x,y,image),
+00005     _remainingTime(time)
+00006 {
+00007 }
+00008 
+00009 void LimitedTimeObject::update()
+00010 {
+00011     --_remainingTime;
+00012     if (_remainingTime<=0)
+00013     {
+00014         _destroyed = true;
+00015     }
+00016 }
+
+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_limited_time_object_8h.html b/docs/html/_limited_time_object_8h.html new file mode 100644 index 0000000..c0acfab --- /dev/null +++ b/docs/html/_limited_time_object_8h.html @@ -0,0 +1,120 @@ + + + + +Rally X: source/logic/LimitedTimeObject.h File Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+ +
+
source/logic/LimitedTimeObject.h File Reference
+
+
+
#include "../logic/GameObject.h"
+#include "../logic/Maze.h"
+#include "../presentation/BitmapStore.h"
+
+

Go to the source code of this file.

+ + + + +

+Classes

class  LimitedTimeObject
 Parent class for GameObjects that are created, exist for a given time, and are then destroyed. More...
+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_limited_time_object_8h_source.html b/docs/html/_limited_time_object_8h_source.html new file mode 100644 index 0000000..586bdc0 --- /dev/null +++ b/docs/html/_limited_time_object_8h_source.html @@ -0,0 +1,128 @@ + + + + +Rally X: source/logic/LimitedTimeObject.h Source File + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
source/logic/LimitedTimeObject.h
+
+
+Go to the documentation of this file.
00001 #ifndef LIMITEDTIMEOBJECT_H
+00002 #define LIMITEDTIMEOBJECT_H
+00003 
+00004 #include "../logic/GameObject.h"
+00005 #include "../logic/Maze.h"
+00006 #include "../presentation/BitmapStore.h"
+00007 
+00014 class LimitedTimeObject: public GameObject
+00015 {
+00016     public:
+00025         LimitedTimeObject(double x, double y, BitmapStore::Image image, int time);
+00026 
+00027         //assignment and copy constructors have been left with the compiler generated versions
+00028 
+00034         void update();
+00035 
+00036     private:
+00042         int _remainingTime;
+00043 };
+00044 
+00045 #endif // LIMITEDTIMEOBJECT_H
+
+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_maze_8cpp.html b/docs/html/_maze_8cpp.html new file mode 100644 index 0000000..89a7600 --- /dev/null +++ b/docs/html/_maze_8cpp.html @@ -0,0 +1,110 @@ + + + + +Rally X: source/logic/Maze.cpp File Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
+
source/logic/Maze.cpp File Reference
+
+
+
#include "Maze.h"
+
+

Go to the source code of this file.

+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_maze_8cpp_source.html b/docs/html/_maze_8cpp_source.html new file mode 100644 index 0000000..fa9de73 --- /dev/null +++ b/docs/html/_maze_8cpp_source.html @@ -0,0 +1,184 @@ + + + + +Rally X: source/logic/Maze.cpp Source File + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
source/logic/Maze.cpp
+
+
+Go to the documentation of this file.
00001 #include "Maze.h"
+00002 
+00003 Maze::Maze()
+00004     :_width(0),
+00005     _height(0)
+00006 {
+00007 }
+00008 
+00009 void Maze::generateMaze(const vector<pair<int,int> >& walls, int maxObjectX, int maxObjectY)
+00010 {
+00011     //find bounds so that rectangular vector can be generated
+00012     int maxX = maxObjectX;
+00013     int maxY = maxObjectY;
+00014     for (vector<pair<int,int> >::const_iterator iter = walls.begin(); iter!=walls.end(); ++iter)
+00015     {
+00016         if (iter->first > maxX) maxX = iter->first;
+00017         if (iter->second > maxY) maxY = iter->second;
+00018     }
+00019     _width = maxX+1; //need to convert from highest index to required size
+00020     _height = maxY+1;
+00021 
+00022 
+00023     _wallLocations.clear();
+00024 
+00025     for (int x=0; x<_width; ++x)
+00026     {
+00027         _wallLocations.push_back(vector<bool>());
+00028         for (int y=0; y<_height; ++y)
+00029         {
+00030             _wallLocations.back().push_back(false);
+00031         }
+00032     }
+00033 
+00034     for (vector<pair<int,int> >::const_iterator iter = walls.begin(); iter!=walls.end(); ++iter)
+00035     {
+00036         _wallLocations.at(iter->first).at(iter->second) = true;
+00037     }
+00038 }
+00039 
+00040 bool Maze::getSolid(const int& x, const int& y) const
+00041 {
+00042     if (x<0 || y<0) return true;
+00043     if (x>=width() || y>=height()) return true;
+00044     //bounds have already been checked, can use more efficient, less safe, indexing
+00045     return _wallLocations[x][y];
+00046 }
+00047 
+00048 int Maze::width() const
+00049 {
+00050     return _width;
+00051 }
+00052 int Maze::height() const
+00053 {
+00054     return _height;
+00055 }
+00056 
+00057 Maze::Direction Maze::backwards(Direction forwards)
+00058 {
+00059     Direction backwards;
+00060     switch (forwards)
+00061     {
+00062         case LEFT:
+00063             backwards = RIGHT;
+00064             break;
+00065         case RIGHT:
+00066             backwards = LEFT;
+00067             break;
+00068         case UP:
+00069             backwards = DOWN;
+00070             break;
+00071         case DOWN:
+00072             backwards = UP;
+00073             break;
+00074     }
+00075 
+00076     return backwards;
+00077 }
+
+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_maze_8h.html b/docs/html/_maze_8h.html new file mode 100644 index 0000000..7a90bf9 --- /dev/null +++ b/docs/html/_maze_8h.html @@ -0,0 +1,119 @@ + + + + +Rally X: source/logic/Maze.h File Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+ +
+
source/logic/Maze.h File Reference
+
+
+
#include <vector>
+#include <utility>
+
+

Go to the source code of this file.

+ + + + +

+Classes

class  Maze
 A rectangular 2D boolean array, representing where cars can drive and where they cannot. More...
+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_maze_8h_source.html b/docs/html/_maze_8h_source.html new file mode 100644 index 0000000..24e5923 --- /dev/null +++ b/docs/html/_maze_8h_source.html @@ -0,0 +1,142 @@ + + + + +Rally X: source/logic/Maze.h Source File + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
source/logic/Maze.h
+
+
+Go to the documentation of this file.
00001 #ifndef MAZE_H
+00002 #define MAZE_H
+00003 
+00004 #include <vector>
+00005 #include <utility>
+00006 using namespace std;
+00007 
+00014 class Maze
+00015 {
+00016     public:
+00020         enum Direction {UP, DOWN, LEFT, RIGHT};
+00021 
+00025         Maze();
+00026 
+00027         //assignment and copy constructors have been left with the compiler generated versions
+00028 
+00040         void generateMaze(const vector<pair<int,int> >& walls, int maxObjectX=0, int maxObjectY=0);
+00041 
+00057         bool getSolid(const int& x, const int& y) const;
+00058 
+00064         int width() const;
+00070         int height() const;
+00071 
+00079         static Direction backwards(Direction forwards);
+00080 
+00081     private:
+00085         typedef vector<vector<bool> > BoolGrid;
+00086 
+00094         BoolGrid _wallLocations;
+00095 
+00096         int _width; 
+00097         int _height; 
+00098 };
+00099 
+00100 #endif // MAZE_H
+
+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_maze_math_8cpp.html b/docs/html/_maze_math_8cpp.html new file mode 100644 index 0000000..3b56bf5 --- /dev/null +++ b/docs/html/_maze_math_8cpp.html @@ -0,0 +1,110 @@ + + + + +Rally X: source/logic/MazeMath.cpp File Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
+
source/logic/MazeMath.cpp File Reference
+
+
+
#include "MazeMath.h"
+
+

Go to the source code of this file.

+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_maze_math_8cpp_source.html b/docs/html/_maze_math_8cpp_source.html new file mode 100644 index 0000000..f3bf757 --- /dev/null +++ b/docs/html/_maze_math_8cpp_source.html @@ -0,0 +1,125 @@ + + + + +Rally X: source/logic/MazeMath.cpp Source File + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
source/logic/MazeMath.cpp
+
+
+Go to the documentation of this file.
00001 #include "MazeMath.h"
+00002 
+00003 double MazeMath::round(double value)
+00004 {
+00005     if (static_cast<int>(value*10)%10 < 5)
+00006     {
+00007         return floor(value);
+00008     }
+00009     else
+00010     {
+00011         return ceil(value);
+00012     }
+00013 }
+00014 
+00015 double MazeMath::distance(double x1, double y1, double x2, double y2)
+00016 {
+00017     return sqrt(pow(x1-x2, 2) + pow(y1-y2, 2));
+00018 }
+
+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_maze_math_8h.html b/docs/html/_maze_math_8h.html new file mode 100644 index 0000000..1b6ff22 --- /dev/null +++ b/docs/html/_maze_math_8h.html @@ -0,0 +1,118 @@ + + + + +Rally X: source/logic/MazeMath.h File Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+ +
+
source/logic/MazeMath.h File Reference
+
+
+
#include <cmath>
+
+

Go to the source code of this file.

+ + + + +

+Classes

class  MazeMath
 Class of static methods for common math functions that occur in the 2D maze setting. More...
+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_maze_math_8h_source.html b/docs/html/_maze_math_8h_source.html new file mode 100644 index 0000000..b50eadf --- /dev/null +++ b/docs/html/_maze_math_8h_source.html @@ -0,0 +1,126 @@ + + + + +Rally X: source/logic/MazeMath.h Source File + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
source/logic/MazeMath.h
+
+
+Go to the documentation of this file.
00001 #ifndef MAZEMATH_H
+00002 #define MAZEMATH_H
+00003 
+00004 #include <cmath>
+00005 
+00012 class MazeMath
+00013 {
+00014     public:
+00025         static double round(double value);
+00026 
+00039         static double distance(double x1, double y1, double x2, double y2);
+00040 
+00041     private:
+00048         MazeMath();
+00052         MazeMath(const MazeMath& ref);
+00056         MazeMath& operator=(const MazeMath& rhs);
+00057 };
+00058 
+00059 #endif // MAZEMATH_H
+
+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_player_car_8cpp.html b/docs/html/_player_car_8cpp.html new file mode 100644 index 0000000..635dd97 --- /dev/null +++ b/docs/html/_player_car_8cpp.html @@ -0,0 +1,110 @@ + + + + +Rally X: source/logic/PlayerCar.cpp File Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
+
source/logic/PlayerCar.cpp File Reference
+
+
+
#include "PlayerCar.h"
+
+

Go to the source code of this file.

+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_player_car_8cpp_source.html b/docs/html/_player_car_8cpp_source.html new file mode 100644 index 0000000..b82ee16 --- /dev/null +++ b/docs/html/_player_car_8cpp_source.html @@ -0,0 +1,194 @@ + + + + +Rally X: source/logic/PlayerCar.cpp Source File + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
source/logic/PlayerCar.cpp
+
+
+Go to the documentation of this file.
00001 #include "PlayerCar.h"
+00002 
+00003 PlayerCar::PlayerCar(double x, double y, Maze::Direction facing)
+00004     :Car(x,y,BitmapStore::PLAYER, facing),
+00005     _input(_facing),
+00006     _petrol(1)
+00007 {
+00008 }
+00009 
+00010 void PlayerCar::update(const Maze& maze, list<Smokescreen>& currentSmoke)
+00011 {
+00012     _petrol -= PETROL_USE_RATE;
+00013     if (_petrol<0)
+00014     {
+00015         _speed = _baseSpeed/2;
+00016         _petrol = 0;
+00017     }
+00018 
+00019     _facing = _input.getFacing();
+00020     move(maze);
+00021 
+00022     if (_input.getSmokescreen())
+00023     {
+00024         makeSmoke(currentSmoke);
+00025     }
+00026 }
+00027 
+00028 void PlayerCar::makeSmoke(list<Smokescreen>& currentSmoke)
+00029 {
+00030     if (_petrol < PETROL_USE_SMOKESCREEN) return;
+00031 
+00032     double targetX = 0;
+00033     double targetY = 0;
+00034 
+00035     switch(_facing)
+00036     {
+00037         case Maze::UP:
+00038             targetX = round(_x);
+00039             targetY = round(_y+1);
+00040             break;
+00041         case Maze::DOWN:
+00042             targetX = round(_x);
+00043             targetY = round(_y-1);
+00044             break;
+00045         case Maze::LEFT:
+00046             targetX = round(_x+1);
+00047             targetY = round(_y);
+00048             break;
+00049         case Maze::RIGHT:
+00050             targetX = round(_x-1);
+00051             targetY = round(_y);
+00052             break;
+00053     }
+00054 
+00055     bool overlap = false;
+00056 
+00057     for (list<Smokescreen>::const_iterator iter = currentSmoke.begin(); iter!=currentSmoke.end(); ++iter)
+00058     {
+00059         if ((abs(iter->x() - targetX)<1)&&(abs(iter->y() - targetY)<1))
+00060         {
+00061             overlap = true;
+00062             break;
+00063         }
+00064     }
+00065 
+00066     if (!overlap)
+00067     {
+00068         currentSmoke.push_back(Smokescreen(targetX, targetY));
+00069         _petrol -= PETROL_USE_SMOKESCREEN;
+00070     }
+00071 }
+00072 
+00073 void PlayerCar::crash()
+00074 {
+00075     _destroyed = true;
+00076 }
+00077 
+00078 void PlayerCar::gotCheckpoint()
+00079 {
+00080     _petrol+=PETROL_FROM_CHECKPOINT;
+00081     _speed = _baseSpeed;
+00082 }
+00083 
+00084 double PlayerCar::petrol() const
+00085 {
+00086     return _petrol;
+00087 }
+
+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_player_car_8h.html b/docs/html/_player_car_8h.html new file mode 100644 index 0000000..8392950 --- /dev/null +++ b/docs/html/_player_car_8h.html @@ -0,0 +1,124 @@ + + + + +Rally X: source/logic/PlayerCar.h File Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+ +
+
source/logic/PlayerCar.h File Reference
+
+
+
#include <cmath>
+#include <list>
+#include "../presentation/KeyboardHandler.h"
+#include "../presentation/BitmapStore.h"
+#include "../logic/Car.h"
+#include "../logic/Maze.h"
+#include "../logic/Smokescreen.h"
+
+

Go to the source code of this file.

+ + + + +

+Classes

class  PlayerCar
 A GameObject that is controlled by the player. More...
+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_player_car_8h_source.html b/docs/html/_player_car_8h_source.html new file mode 100644 index 0000000..876ff7b --- /dev/null +++ b/docs/html/_player_car_8h_source.html @@ -0,0 +1,149 @@ + + + + +Rally X: source/logic/PlayerCar.h Source File + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
source/logic/PlayerCar.h
+
+
+Go to the documentation of this file.
00001 #ifndef PLAYERCAR_H
+00002 #define PLAYERCAR_H
+00003 
+00004 #include <cmath>
+00005 #include <list>
+00006 using namespace std;
+00007 
+00008 #include "../presentation/KeyboardHandler.h"
+00009 #include "../presentation/BitmapStore.h"
+00010 
+00011 #include "../logic/Car.h"
+00012 #include "../logic/Maze.h"
+00013 #include "../logic/Smokescreen.h"
+00014 
+00023 class PlayerCar: public Car
+00024 {
+00025     public:
+00037         PlayerCar(double x, double y, Maze::Direction facing=Maze::UP);
+00038 
+00039         //assignment and copy constructors have been left with the compiler generated versions
+00040 
+00052         void update(const Maze& maze, list<Smokescreen>& currentSmoke);
+00053 
+00064         void makeSmoke(list<Smokescreen>& currentSmoke);
+00065 
+00071         void gotCheckpoint();
+00072 
+00076         void crash();
+00077 
+00081         double petrol() const;
+00082 
+00083     private:
+00084         KeyboardHandler _input; 
+00085 
+00092         double _petrol;
+00093 
+00094         static const double PETROL_USE_RATE = 0.0007; 
+00095         static const double PETROL_USE_SMOKESCREEN = 0.05; 
+00096         static const double PETROL_FROM_CHECKPOINT = 0.2; 
+00097 };
+00098 
+00099 #endif // PLAYERCAR_H
+
+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_rock_8cpp.html b/docs/html/_rock_8cpp.html new file mode 100644 index 0000000..6cd052b --- /dev/null +++ b/docs/html/_rock_8cpp.html @@ -0,0 +1,110 @@ + + + + +Rally X: source/logic/Rock.cpp File Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
+
source/logic/Rock.cpp File Reference
+
+
+
#include "Rock.h"
+
+

Go to the source code of this file.

+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_rock_8cpp_source.html b/docs/html/_rock_8cpp_source.html new file mode 100644 index 0000000..b367cc7 --- /dev/null +++ b/docs/html/_rock_8cpp_source.html @@ -0,0 +1,113 @@ + + + + +Rally X: source/logic/Rock.cpp Source File + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
source/logic/Rock.cpp
+
+
+Go to the documentation of this file.
00001 #include "Rock.h"
+00002 
+00003 Rock::Rock(double x, double y)
+00004     :GameObject(x,y,BitmapStore::ROCK)
+00005 {
+00006 }
+
+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_rock_8h.html b/docs/html/_rock_8h.html new file mode 100644 index 0000000..580e7d8 --- /dev/null +++ b/docs/html/_rock_8h.html @@ -0,0 +1,119 @@ + + + + +Rally X: source/logic/Rock.h File Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+ +
+
source/logic/Rock.h File Reference
+
+
+
#include "../logic/GameObject.h"
+#include "../presentation/BitmapStore.h"
+
+

Go to the source code of this file.

+ + + + +

+Classes

class  Rock
 A game object that acts as an obstacle to the player. More...
+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_rock_8h_source.html b/docs/html/_rock_8h_source.html new file mode 100644 index 0000000..4ce60fb --- /dev/null +++ b/docs/html/_rock_8h_source.html @@ -0,0 +1,122 @@ + + + + +Rally X: source/logic/Rock.h Source File + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
source/logic/Rock.h
+
+
+Go to the documentation of this file.
00001 #ifndef ROCK_H
+00002 #define ROCK_H
+00003 
+00004 #include "../logic/GameObject.h"
+00005 #include "../presentation/BitmapStore.h"
+00006 
+00015 class Rock: public GameObject
+00016 {
+00017     public:
+00024         Rock(double x, double y);
+00025 
+00026         //assignment and copy constructors have been left with the compiler generated versions
+00027 };
+00028 
+00029 #endif // ROCK_H
+
+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_screen_8cpp.html b/docs/html/_screen_8cpp.html new file mode 100644 index 0000000..af0b451 --- /dev/null +++ b/docs/html/_screen_8cpp.html @@ -0,0 +1,110 @@ + + + + +Rally X: source/presentation/Screen.cpp File Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
+
source/presentation/Screen.cpp File Reference
+
+
+
#include "Screen.h"
+
+

Go to the source code of this file.

+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_screen_8cpp_source.html b/docs/html/_screen_8cpp_source.html new file mode 100644 index 0000000..0bb1da9 --- /dev/null +++ b/docs/html/_screen_8cpp_source.html @@ -0,0 +1,266 @@ + + + + +Rally X: source/presentation/Screen.cpp Source File + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
source/presentation/Screen.cpp
+
+
+Go to the documentation of this file.
00001 #include "Screen.h"
+00002 
+00003 Screen::Screen(unsigned int screenWidth, unsigned int screenHeight, bool fullscreen)
+00004     :_exitClicked(false),
+00005     _screenWidth(screenWidth),
+00006     _screenHeight(screenHeight),
+00007     _gameAreaWidth(_screenWidth*0.75),
+00008     _infoPanelWidth(_screenWidth - _gameAreaWidth)
+00009 {
+00010     if (fullscreen)
+00011     {
+00012         al_set_new_display_flags(ALLEGRO_FULLSCREEN_WINDOW);
+00013         if (!resolutionSupported())
+00014         {
+00015             al_show_native_message_box(NULL, "Fatal error", "Fatal error", "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.", NULL, ALLEGRO_MESSAGEBOX_ERROR);
+00016             throw BadResolution();
+00017         }
+00018     }
+00019     else
+00020     {
+00021         al_set_new_display_flags(ALLEGRO_WINDOWED);
+00022         //need to add error checking for windows that are way too big
+00023     }
+00024 
+00025     al_set_new_display_option(ALLEGRO_VSYNC, 1, ALLEGRO_SUGGEST);
+00026 
+00027     _display = al_create_display(_screenWidth, _screenHeight);
+00028 
+00029     al_hide_mouse_cursor(_display);
+00030     _windowEvents = al_create_event_queue();
+00031     al_register_event_source(_windowEvents, al_get_display_event_source(_display));
+00032     //used so that ESC can be pressed to exit.
+00033     al_register_event_source(_windowEvents, al_get_keyboard_event_source());
+00034 
+00035     _font = al_load_font("junction 02.ttf", _screenWidth/10, 0);
+00036     if (_font == NULL)
+00037     {
+00038         al_show_native_message_box(NULL, "Fatal error", "Fatal error", "The file 'junction 02.ttf' was not found. Ensure that it is located in the working directory.", NULL, ALLEGRO_MESSAGEBOX_ERROR);
+00039         al_destroy_event_queue(_windowEvents);
+00040         al_destroy_display(_display);
+00041         throw InstallFailure();
+00042     }
+00043 
+00044     ALLEGRO_BITMAP* front = al_get_backbuffer(_display);
+00045     al_flip_display();
+00046     ALLEGRO_BITMAP* back = al_get_backbuffer(_display);
+00047 
+00048     _panels.push_back(new GamePanel(back, front, 0, 0, _gameAreaWidth, _screenHeight));
+00049     _panels.push_back(new InfoPanel(back, front, _gameAreaWidth, 0, _infoPanelWidth, _screenHeight));
+00050 }
+00051 
+00052 Screen::~Screen()
+00053 {
+00054     for (vector<ScreenPanel*>::iterator iter = _panels.begin(); iter!=_panels.end(); ++iter)
+00055     {
+00056         delete (*iter);
+00057     }
+00058     _panels.clear();
+00059 
+00060     al_destroy_font(_font);
+00061     al_destroy_event_queue(_windowEvents);
+00062     al_destroy_display(_display);
+00063 }
+00064 
+00065 string Screen::getLevel()
+00066 {
+00067     string result("");
+00068     ALLEGRO_FILECHOOSER* filechooser = al_create_native_file_dialog(".", "Choose your level", "*.lvl",ALLEGRO_FILECHOOSER_FILE_MUST_EXIST);
+00069     al_show_native_file_dialog(_display, filechooser);
+00070     if (al_get_native_file_dialog_count(filechooser)==0)
+00071     {
+00072         _exitClicked = true;
+00073     }
+00074     else
+00075     {
+00076         result = al_get_native_file_dialog_path(filechooser, 0);
+00077     }
+00078 
+00079     al_destroy_native_file_dialog(filechooser);
+00080     return result;
+00081 }
+00082 
+00083 void Screen::draw(const Maze& maze, const list<PlayerCar>& players, const list<EnemyCar>& enemies, const list<Checkpoint>& checkpoints, const list<Rock>& rocks, const list<Smokescreen>& smokescreens, const list<DestroyedObjectPopup>& popups)
+00084 {
+00085     for (vector<ScreenPanel*>::iterator iter =  _panels.begin(); iter!=_panels.end(); ++iter)
+00086     {
+00087         (*iter)->draw(maze, players, enemies, checkpoints, rocks, smokescreens, popups);
+00088     }
+00089     flip();
+00090 }
+00091 
+00092 void Screen::flip()
+00093 {
+00094     al_flip_display();
+00095     for (vector<ScreenPanel*>::iterator iter =  _panels.begin(); iter!=_panels.end(); ++iter)
+00096     {
+00097         (*iter)->flip();
+00098     }
+00099 }
+00100 
+00101 void Screen::drawWin()
+00102 {
+00103     flip();
+00104 
+00105     ALLEGRO_COLOR transBlack = al_map_rgba(0,0,0,200);
+00106     al_draw_filled_rectangle(0,0,_screenWidth,_screenHeight, transBlack);
+00107 
+00108     ALLEGRO_COLOR textColour = al_map_rgb(255,255,255);
+00109     al_draw_text(_font, textColour, _screenWidth/2, _screenHeight/2, ALLEGRO_ALIGN_CENTRE , "You win!");
+00110 
+00111     flip();
+00112 }
+00113 
+00114 void Screen::drawLoss()
+00115 {
+00116     flip();
+00117 
+00118     ALLEGRO_COLOR transBlack = al_map_rgba(0,0,0,200);
+00119     al_draw_filled_rectangle(0,0,_screenWidth,_screenHeight, transBlack);
+00120 
+00121     ALLEGRO_COLOR textColour = al_map_rgb(255,255,255);
+00122     al_draw_text(_font, textColour, _screenWidth/2, _screenHeight/2, ALLEGRO_ALIGN_CENTRE , "You lose!");
+00123 
+00124     flip();
+00125 }
+00126 
+00127 bool Screen::exitClicked()
+00128 {
+00129     if (_exitClicked) return true;
+00130 
+00131     ALLEGRO_EVENT event;
+00132     while (al_get_next_event(_windowEvents, &event))
+00133     {
+00134         if (event.type==ALLEGRO_EVENT_DISPLAY_CLOSE || (event.type==ALLEGRO_EVENT_KEY_CHAR && event.keyboard.keycode==ALLEGRO_KEY_ESCAPE))
+00135         {
+00136             al_flush_event_queue(_windowEvents);
+00137             _exitClicked = true;
+00138             return true;
+00139         }
+00140     }
+00141 
+00142     return false;
+00143 }
+00144 
+00145 bool Screen::resolutionSupported()
+00146 {
+00147     ALLEGRO_DISPLAY_MODE mode;
+00148     for (int i=0; i<al_get_num_display_modes(); ++i)
+00149     {
+00150         al_get_display_mode(i, &mode);
+00151 
+00152         if (static_cast<unsigned int>(mode.width)==_screenWidth && static_cast<unsigned int>(mode.height)==_screenHeight)
+00153         {
+00154             return true;
+00155         }
+00156     }
+00157 
+00158     return false;
+00159 }
+
+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_screen_8h.html b/docs/html/_screen_8h.html new file mode 100644 index 0000000..03120a6 --- /dev/null +++ b/docs/html/_screen_8h.html @@ -0,0 +1,135 @@ + + + + +Rally X: source/presentation/Screen.h File Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+ +
+
source/presentation/Screen.h File Reference
+
+
+
#include <list>
+#include <algorithm>
+#include <sstream>
+#include <allegro5/allegro.h>
+#include <allegro5/allegro_native_dialog.h>
+#include "../logic/Maze.h"
+#include "../logic/GameObject.h"
+#include "../logic/PlayerCar.h"
+#include "../logic/EnemyCar.h"
+#include "../logic/Checkpoint.h"
+#include "../logic/Rock.h"
+#include "../logic/Smokescreen.h"
+#include "../logic/DestroyedObjectPopup.h"
+#include "../logic/AllegroWrappers.h"
+#include "../presentation/GamePanel.h"
+#include "../presentation/InfoPanel.h"
+
+

Go to the source code of this file.

+ + + + + + +

+Classes

class  BadResolution
 Exception that is thrown if the Config file requests a resolution that can not work. More...
class  Screen
 Class for creating a window on the screen. More...
+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_screen_8h_source.html b/docs/html/_screen_8h_source.html new file mode 100644 index 0000000..1cb09ea --- /dev/null +++ b/docs/html/_screen_8h_source.html @@ -0,0 +1,177 @@ + + + + +Rally X: source/presentation/Screen.h Source File + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
source/presentation/Screen.h
+
+
+Go to the documentation of this file.
00001 #ifndef SCREEN_H
+00002 #define SCREEN_H
+00003 
+00004 #include <list>
+00005 #include <algorithm>
+00006 #include <sstream>
+00007 using namespace std;
+00008 
+00009 #include <allegro5/allegro.h>
+00010 #include <allegro5/allegro_native_dialog.h>
+00011 
+00012 #include "../logic/Maze.h"
+00013 #include "../logic/GameObject.h"
+00014 #include "../logic/PlayerCar.h"
+00015 #include "../logic/EnemyCar.h"
+00016 #include "../logic/Checkpoint.h"
+00017 #include "../logic/Rock.h"
+00018 #include "../logic/Smokescreen.h"
+00019 #include "../logic/DestroyedObjectPopup.h"
+00020 #include "../logic/AllegroWrappers.h"
+00021 
+00022 #include "../presentation/GamePanel.h"
+00023 #include "../presentation/InfoPanel.h"
+00024 
+00031 class BadResolution{};
+00032 
+00044 class Screen
+00045 {
+00046     public:
+00054         Screen(unsigned int screenWidth, unsigned int screenHeight, bool fullscreen);
+00055 
+00059         ~Screen();
+00060 
+00069         string getLevel();
+00070 
+00085         void draw(const Maze& maze, const list<PlayerCar>& players, const list<EnemyCar>& enemies, const list<Checkpoint>& checkpoints, const list<Rock>& rocks, const list<Smokescreen>& smokescreens, const list<DestroyedObjectPopup>& popups);
+00086 
+00095         bool exitClicked();
+00096 
+00100         void drawWin();
+00104         void drawLoss();
+00105 
+00106     private:
+00112         Screen(const Screen& ref);
+00118         Screen& operator=(const Screen& rhs);
+00119 
+00123         void flip();
+00124 
+00132         bool resolutionSupported();
+00133 
+00134         AllegroInit _allegro; 
+00135         AllegroKeyboardInit _keyboard; 
+00136         AllegroDrawingInit _drawing; 
+00137 
+00138         bool _exitClicked; 
+00139 
+00140         unsigned int _screenWidth; 
+00141         unsigned int _screenHeight; 
+00142 
+00143         unsigned int _gameAreaWidth; 
+00144         unsigned int _infoPanelWidth; 
+00145 
+00146         ALLEGRO_DISPLAY* _display; 
+00147         ALLEGRO_EVENT_QUEUE* _windowEvents; 
+00148         ALLEGRO_FONT* _font; 
+00149 
+00156         vector<ScreenPanel*> _panels;
+00157 };
+00158 
+00159 #endif // SCREEN_H
+
+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_screen_panel_8cpp.html b/docs/html/_screen_panel_8cpp.html new file mode 100644 index 0000000..34d12e2 --- /dev/null +++ b/docs/html/_screen_panel_8cpp.html @@ -0,0 +1,110 @@ + + + + +Rally X: source/presentation/ScreenPanel.cpp File Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
+
source/presentation/ScreenPanel.cpp File Reference
+
+
+
#include "ScreenPanel.h"
+
+

Go to the source code of this file.

+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_screen_panel_8cpp_source.html b/docs/html/_screen_panel_8cpp_source.html new file mode 100644 index 0000000..e970de8 --- /dev/null +++ b/docs/html/_screen_panel_8cpp_source.html @@ -0,0 +1,131 @@ + + + + +Rally X: source/presentation/ScreenPanel.cpp Source File + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
source/presentation/ScreenPanel.cpp
+
+
+Go to the documentation of this file.
00001 #include "ScreenPanel.h"
+00002 
+00003 const ALLEGRO_COLOR ScreenPanel::BLANK = al_map_rgb(0,0,0);
+00004 
+00005 ScreenPanel::ScreenPanel(ALLEGRO_BITMAP* back, ALLEGRO_BITMAP* front, int x, int y, int width, int height)
+00006     :_width(width),
+00007     _height(height)
+00008 {
+00009     _back = al_create_sub_bitmap(back, x, y, _width, _height);
+00010     _front = al_create_sub_bitmap(front, x, y, _width, _height);
+00011 }
+00012 
+00013 ScreenPanel::~ScreenPanel()
+00014 {
+00015     al_destroy_bitmap(_back);
+00016     al_destroy_bitmap(_front);
+00017 }
+00018 
+00019 void ScreenPanel::flip()
+00020 {
+00021     ALLEGRO_BITMAP* temp = _back;
+00022     _back = _front;
+00023     _front = temp;
+00024 }
+
+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_screen_panel_8h.html b/docs/html/_screen_panel_8h.html new file mode 100644 index 0000000..751705e --- /dev/null +++ b/docs/html/_screen_panel_8h.html @@ -0,0 +1,127 @@ + + + + +Rally X: source/presentation/ScreenPanel.h File Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+ +
+
source/presentation/ScreenPanel.h File Reference
+
+
+
#include <allegro5/allegro.h>
+#include "../logic/Maze.h"
+#include "../logic/GameObject.h"
+#include "../logic/PlayerCar.h"
+#include "../logic/EnemyCar.h"
+#include "../logic/Checkpoint.h"
+#include "../logic/Rock.h"
+#include "../logic/Smokescreen.h"
+#include "../logic/DestroyedObjectPopup.h"
+#include "../logic/AllegroWrappers.h"
+
+

Go to the source code of this file.

+ + + + +

+Classes

class  ScreenPanel
 Parent class for panels that are drawn on the screen. More...
+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_screen_panel_8h_source.html b/docs/html/_screen_panel_8h_source.html new file mode 100644 index 0000000..4f86b51 --- /dev/null +++ b/docs/html/_screen_panel_8h_source.html @@ -0,0 +1,150 @@ + + + + +Rally X: source/presentation/ScreenPanel.h Source File + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
source/presentation/ScreenPanel.h
+
+
+Go to the documentation of this file.
00001 #ifndef SCREENPANEL_H
+00002 #define SCREENPANEL_H
+00003 
+00004 #include <allegro5/allegro.h>
+00005 
+00006 #include "../logic/Maze.h"
+00007 #include "../logic/GameObject.h"
+00008 #include "../logic/PlayerCar.h"
+00009 #include "../logic/EnemyCar.h"
+00010 #include "../logic/Checkpoint.h"
+00011 #include "../logic/Rock.h"
+00012 #include "../logic/Smokescreen.h"
+00013 #include "../logic/DestroyedObjectPopup.h"
+00014 #include "../logic/AllegroWrappers.h"
+00015 
+00029 class ScreenPanel
+00030 {
+00031     public:
+00046         ScreenPanel(ALLEGRO_BITMAP* back, ALLEGRO_BITMAP* front, int x, int y, int width, int height);
+00047 
+00051         virtual ~ScreenPanel();
+00052 
+00067         virtual void draw(const Maze& maze, const list<PlayerCar>& players, const list<EnemyCar>& enemies, const list<Checkpoint>& checkpoints, const list<Rock>& rocks, const list<Smokescreen>& smokescreens, const list<DestroyedObjectPopup>& popups) = 0;
+00068 
+00074         virtual void flip();
+00075 
+00076     protected:
+00077         static const ALLEGRO_COLOR BLANK; 
+00078 
+00079         ALLEGRO_BITMAP* _back; 
+00080 
+00081         int _width; 
+00082         int _height; 
+00083     private:
+00087         ScreenPanel(const ScreenPanel& ref);
+00091         ScreenPanel& operator=(const ScreenPanel& rhs);
+00092 
+00093         AllegroInit _allegro; 
+00094 
+00095         ALLEGRO_BITMAP* _front; 
+00096 };
+00097 
+00098 #endif // SCREENPANEL_H
+
+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_smokescreen_8cpp.html b/docs/html/_smokescreen_8cpp.html new file mode 100644 index 0000000..c4d18b6 --- /dev/null +++ b/docs/html/_smokescreen_8cpp.html @@ -0,0 +1,110 @@ + + + + +Rally X: source/logic/Smokescreen.cpp File Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
+
source/logic/Smokescreen.cpp File Reference
+
+
+
#include "Smokescreen.h"
+
+

Go to the source code of this file.

+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_smokescreen_8cpp_source.html b/docs/html/_smokescreen_8cpp_source.html new file mode 100644 index 0000000..905054a --- /dev/null +++ b/docs/html/_smokescreen_8cpp_source.html @@ -0,0 +1,113 @@ + + + + +Rally X: source/logic/Smokescreen.cpp Source File + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
source/logic/Smokescreen.cpp
+
+
+Go to the documentation of this file.
00001 #include "Smokescreen.h"
+00002 
+00003 Smokescreen::Smokescreen(double x, double y)
+00004     :LimitedTimeObject(x,y,BitmapStore::SMOKE,SMOKE_TIME)
+00005 {
+00006 }
+
+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_smokescreen_8h.html b/docs/html/_smokescreen_8h.html new file mode 100644 index 0000000..39f0616 --- /dev/null +++ b/docs/html/_smokescreen_8h.html @@ -0,0 +1,119 @@ + + + + +Rally X: source/logic/Smokescreen.h File Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+ +
+
source/logic/Smokescreen.h File Reference
+
+
+
#include "../logic/LimitedTimeObject.h"
+#include "../presentation/BitmapStore.h"
+
+

Go to the source code of this file.

+ + + + +

+Classes

class  Smokescreen
 GameObject that causes the EnemyCar to be delayed if they crash into it. More...
+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/_smokescreen_8h_source.html b/docs/html/_smokescreen_8h_source.html new file mode 100644 index 0000000..222ae3d --- /dev/null +++ b/docs/html/_smokescreen_8h_source.html @@ -0,0 +1,124 @@ + + + + +Rally X: source/logic/Smokescreen.h Source File + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
source/logic/Smokescreen.h
+
+
+Go to the documentation of this file.
00001 #ifndef SMOKESCREEN_H
+00002 #define SMOKESCREEN_H
+00003 
+00004 #include "../logic/LimitedTimeObject.h"
+00005 #include "../presentation/BitmapStore.h"
+00006 
+00015 class Smokescreen : public LimitedTimeObject
+00016 {
+00017     public:
+00024         Smokescreen(double x, double y);
+00025 
+00026         //assignment and copy constructors have been left with the compiler generated versions
+00027     private:
+00028         static const int SMOKE_TIME = 60; 
+00029 };
+00030 
+00031 #endif // SMOKESCREEN_H
+
+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/annotated.html b/docs/html/annotated.html new file mode 100644 index 0000000..0f5f45f --- /dev/null +++ b/docs/html/annotated.html @@ -0,0 +1,139 @@ + + + + +Rally X: Class List + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
+
Class List
+
+
+
Here are the classes, structs, unions and interfaces with brief descriptions:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AllegroDrawingInitClass ensures that Allegro's primitive and text drawing is installed and uninstalled when appropriate
AllegroInitClass ensures that Allegro is initialized and uninstalled when appropriate
AllegroKeyboardInitClass ensures that Allegro's keyboard is installed and uninstalled when appropriate
BadResolutionException that is thrown if the Config file requests a resolution that can not work
BitmapStoreClass for accessing images in ALLEGRO_BITMAP format and low level drawing
CarGameObject that moves through the maze and changes direction
CheckpointGameObject that the player needs to pick up by driving over
CollisionDetectorObject for handling collisions between GameObjects
ColourStoreClass for mapping BitmapStore images to colours for use in the minimap
ConfigObject for handling user settings loaded from a file
DestroyedObjectPopupObject that appears on the screen for a short time when another object has been destroyed
EnemyCarGameObject that chases the player around the maze
FileOpenErrorAn exception that is thrown if the file selected for opening does not exist
GameThe object that controls the flow of the game, and the launch point of the game
GameObjectParent class for objects that are placed in the maze
GamePanelScreenPanel to be drawn on the screen to draw the area where the game takes place
InfoPanelScreenPanel to be drawn on the screen to give the player information
InstallFailureException to be thrown if any component of Allegro fails to install at runtime
KeyboardHandlerClass for handling keyboard related game inputs from the player
LevelReaderReads the game objects from a text file and calls relevant constructors
LimitedTimeObjectParent class for GameObjects that are created, exist for a given time, and are then destroyed
MazeA rectangular 2D boolean array, representing where cars can drive and where they cannot
MazeMathClass of static methods for common math functions that occur in the 2D maze setting
PlayerCarA GameObject that is controlled by the player
RockA game object that acts as an obstacle to the player
ScreenClass for creating a window on the screen
ScreenPanelParent class for panels that are drawn on the screen
SmokescreenGameObject that causes the EnemyCar to be delayed if they crash into it
+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/bc_s.png b/docs/html/bc_s.png new file mode 100644 index 0000000..51ba006 Binary files /dev/null and b/docs/html/bc_s.png differ diff --git a/docs/html/car.PNG b/docs/html/car.PNG new file mode 100644 index 0000000..93126c7 Binary files /dev/null and b/docs/html/car.PNG differ diff --git a/docs/html/carBig.PNG b/docs/html/carBig.PNG new file mode 100644 index 0000000..dc3a68e Binary files /dev/null and b/docs/html/carBig.PNG differ diff --git a/docs/html/class_allegro_drawing_init-members.html b/docs/html/class_allegro_drawing_init-members.html new file mode 100644 index 0000000..b983f4a --- /dev/null +++ b/docs/html/class_allegro_drawing_init-members.html @@ -0,0 +1,115 @@ + + + + +Rally X: Member List + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
+
AllegroDrawingInit Member List
+
+
+This is the complete list of members for AllegroDrawingInit, including all inherited members. + + + + + +
_allegroAllegroDrawingInit [private]
_initCountAllegroDrawingInit [private, static]
AllegroDrawingInit()AllegroDrawingInit
AllegroDrawingInit(const AllegroDrawingInit &ref)AllegroDrawingInit
~AllegroDrawingInit()AllegroDrawingInit
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/class_allegro_drawing_init.html b/docs/html/class_allegro_drawing_init.html new file mode 100644 index 0000000..2196ad0 --- /dev/null +++ b/docs/html/class_allegro_drawing_init.html @@ -0,0 +1,241 @@ + + + + +Rally X: AllegroDrawingInit Class Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+ +
+
AllegroDrawingInit Class Reference
+
+
+ +

Class ensures that Allegro's primitive and text drawing is installed and uninstalled when appropriate. + More...

+ +

#include <AllegroWrappers.h>

+ +

List of all members.

+ + + + + + + + + + + + +

+Public Member Functions

 AllegroDrawingInit ()
 Constructor calls al_init_primitives_addon(), al_init_font_addon(), and al_init_ttf_addon() if it is the first instance.
 AllegroDrawingInit (const AllegroDrawingInit &ref)
 Copy constructor, implemented to be included in instance count.
 ~AllegroDrawingInit ()
 Destructor calls al_shutdown_primitives_addon(), al_shutdown_font_addon(), and al_shutdown_ttf_addon() if it is the last instant.

+Private Attributes

AllegroInit _allegro

+Static Private Attributes

static int _initCount = 0
+

Detailed Description

+

Class ensures that Allegro's primitive and text drawing is installed and uninstalled when appropriate.

+

Any classes that draw primitives should include this class as a data member. This class includes AllegroInit, so both of them do not need to be included.

+
Author:
Justin Wernick
+
+David Schneider
+ +

Definition at line 89 of file AllegroWrappers.h.

+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + +
AllegroDrawingInit::AllegroDrawingInit ()
+
+
+ +

Constructor calls al_init_primitives_addon(), al_init_font_addon(), and al_init_ttf_addon() if it is the first instance.

+ +

Definition at line 73 of file AllegroWrappers.cpp.

+ +
+
+ +
+
+ + + + + + + + +
AllegroDrawingInit::AllegroDrawingInit (const AllegroDrawingInitref)
+
+
+ +

Copy constructor, implemented to be included in instance count.

+ +

Definition at line 90 of file AllegroWrappers.cpp.

+ +
+
+ +
+
+ + + + + + + +
AllegroDrawingInit::~AllegroDrawingInit ()
+
+
+ +

Destructor calls al_shutdown_primitives_addon(), al_shutdown_font_addon(), and al_shutdown_ttf_addon() if it is the last instant.

+ +

Definition at line 107 of file AllegroWrappers.cpp.

+ +
+
+

Member Data Documentation

+ +
+ +
+ +

Definition at line 106 of file AllegroWrappers.h.

+ +
+
+ +
+
+ + + + +
int AllegroDrawingInit::_initCount = 0 [static, private]
+
+
+ +

Definition at line 105 of file AllegroWrappers.h.

+ +
+
+
The documentation for this class was generated from the following files: +
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/class_allegro_init-members.html b/docs/html/class_allegro_init-members.html new file mode 100644 index 0000000..d7fd0e5 --- /dev/null +++ b/docs/html/class_allegro_init-members.html @@ -0,0 +1,114 @@ + + + + +Rally X: Member List + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
+
AllegroInit Member List
+
+
+This is the complete list of members for AllegroInit, including all inherited members. + + + + +
_initCountAllegroInit [private, static]
AllegroInit()AllegroInit
AllegroInit(const AllegroInit &ref)AllegroInit
~AllegroInit()AllegroInit
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/class_allegro_init.html b/docs/html/class_allegro_init.html new file mode 100644 index 0000000..bd7e6a7 --- /dev/null +++ b/docs/html/class_allegro_init.html @@ -0,0 +1,225 @@ + + + + +Rally X: AllegroInit Class Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+ +
+
AllegroInit Class Reference
+
+
+ +

Class ensures that Allegro is initialized and uninstalled when appropriate. + More...

+ +

#include <AllegroWrappers.h>

+ +

List of all members.

+ + + + + + + + + + + +

+Public Member Functions

 AllegroInit ()
 Constructor calls al_init() if it is the first instance.
 AllegroInit (const AllegroInit &ref)
 Copy constructor, implemented to be included in instance count.
 ~AllegroInit ()
 Destructor calls al_uninstall_system() if it is the last instant.

+Static Private Attributes

static int _initCount = 0
 Count of the current number of initialised AllegroInit objects.
+

Detailed Description

+

Class ensures that Allegro is initialized and uninstalled when appropriate.

+

Any classes that use Allegro should include this class as a data member.

+
Author:
Justin Wernick
+
+David Schneider
+ +

Definition at line 25 of file AllegroWrappers.h.

+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + +
AllegroInit::AllegroInit ()
+
+
+ +

Constructor calls al_init() if it is the first instance.

+ +

Definition at line 5 of file AllegroWrappers.cpp.

+ +
+
+ +
+
+ + + + + + + + +
AllegroInit::AllegroInit (const AllegroInitref)
+
+
+ +

Copy constructor, implemented to be included in instance count.

+ +

Definition at line 17 of file AllegroWrappers.cpp.

+ +
+
+ +
+
+ + + + + + + +
AllegroInit::~AllegroInit ()
+
+
+ +

Destructor calls al_uninstall_system() if it is the last instant.

+ +

Definition at line 29 of file AllegroWrappers.cpp.

+ +
+
+

Member Data Documentation

+ +
+
+ + + + +
int AllegroInit::_initCount = 0 [static, private]
+
+
+ +

Count of the current number of initialised AllegroInit objects.

+ +

Definition at line 45 of file AllegroWrappers.h.

+ +
+
+
The documentation for this class was generated from the following files: +
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/class_allegro_keyboard_init-members.html b/docs/html/class_allegro_keyboard_init-members.html new file mode 100644 index 0000000..80ceb5d --- /dev/null +++ b/docs/html/class_allegro_keyboard_init-members.html @@ -0,0 +1,115 @@ + + + + +Rally X: Member List + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
+
AllegroKeyboardInit Member List
+
+
+This is the complete list of members for AllegroKeyboardInit, including all inherited members. + + + + + +
_allegroAllegroKeyboardInit [private]
_initCountAllegroKeyboardInit [private, static]
AllegroKeyboardInit()AllegroKeyboardInit
AllegroKeyboardInit(const AllegroKeyboardInit &ref)AllegroKeyboardInit
~AllegroKeyboardInit()AllegroKeyboardInit
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/class_allegro_keyboard_init.html b/docs/html/class_allegro_keyboard_init.html new file mode 100644 index 0000000..da380c1 --- /dev/null +++ b/docs/html/class_allegro_keyboard_init.html @@ -0,0 +1,247 @@ + + + + +Rally X: AllegroKeyboardInit Class Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+ +
+
AllegroKeyboardInit Class Reference
+
+
+ +

Class ensures that Allegro's keyboard is installed and uninstalled when appropriate. + More...

+ +

#include <AllegroWrappers.h>

+ +

List of all members.

+ + + + + + + + + + + + + + +

+Public Member Functions

 AllegroKeyboardInit ()
 Constructor calls al_install_keyboard() if it is the first instance.
 AllegroKeyboardInit (const AllegroKeyboardInit &ref)
 Copy constructor, implemented to be included in instance count.
 ~AllegroKeyboardInit ()
 Destructor calls al_uninstall_keyboard() if it is the last instant.

+Private Attributes

AllegroInit _allegro
 Depends on Allegro being initialised.

+Static Private Attributes

static int _initCount = 0
 Count of the current number of initialised AllegroKeyboardInit objects.
+

Detailed Description

+

Class ensures that Allegro's keyboard is installed and uninstalled when appropriate.

+

Any classes that use the keyboard for input should include this class as a data member. This class includes AllegroInit, so both of them do not need to be included.

+
Author:
Justin Wernick
+
+David Schneider
+ +

Definition at line 57 of file AllegroWrappers.h.

+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + +
AllegroKeyboardInit::AllegroKeyboardInit ()
+
+
+ +

Constructor calls al_install_keyboard() if it is the first instance.

+ +

Definition at line 41 of file AllegroWrappers.cpp.

+ +
+
+ +
+
+ + + + + + + + +
AllegroKeyboardInit::AllegroKeyboardInit (const AllegroKeyboardInitref)
+
+
+ +

Copy constructor, implemented to be included in instance count.

+ +

Definition at line 53 of file AllegroWrappers.cpp.

+ +
+
+ +
+
+ + + + + + + +
AllegroKeyboardInit::~AllegroKeyboardInit ()
+
+
+ +

Destructor calls al_uninstall_keyboard() if it is the last instant.

+ +

Definition at line 65 of file AllegroWrappers.cpp.

+ +
+
+

Member Data Documentation

+ +
+ +
+ +

Depends on Allegro being initialised.

+ +

Definition at line 74 of file AllegroWrappers.h.

+ +
+
+ +
+
+ + + + +
int AllegroKeyboardInit::_initCount = 0 [static, private]
+
+
+ +

Count of the current number of initialised AllegroKeyboardInit objects.

+ +

Definition at line 73 of file AllegroWrappers.h.

+ +
+
+
The documentation for this class was generated from the following files: +
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/class_bad_resolution.html b/docs/html/class_bad_resolution.html new file mode 100644 index 0000000..464a3d3 --- /dev/null +++ b/docs/html/class_bad_resolution.html @@ -0,0 +1,124 @@ + + + + +Rally X: BadResolution Class Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
+
BadResolution Class Reference
+
+
+ +

Exception that is thrown if the Config file requests a resolution that can not work. + More...

+ +

#include <Screen.h>

+

Detailed Description

+

Exception that is thrown if the Config file requests a resolution that can not work.

+
Author:
Justin Wernick
+
+David Schneider
+ +

Definition at line 31 of file Screen.h.

+

The documentation for this class was generated from the following file: +
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/class_bitmap_store-members.html b/docs/html/class_bitmap_store-members.html new file mode 100644 index 0000000..aff17b8 --- /dev/null +++ b/docs/html/class_bitmap_store-members.html @@ -0,0 +1,138 @@ + + + + +Rally X: Member List + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
+
BitmapStore Member List
+
+
+This is the complete list of members for BitmapStore, including all inherited members. + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
_bitmapFontBitmapStore [private]
_bitmapsBitmapStore [private]
_blockWidthBitmapStore [private]
_drawingInstallsBitmapStore [private]
BitmapStore(unsigned int blockWidth)BitmapStore
BitmapStore(const BitmapStore &ref)BitmapStore [private]
CHECKPOINT enum valueBitmapStore
CLAIMED_CHECKPOINT enum valueBitmapStore
CRASHED_CAR enum valueBitmapStore
drawCheckpoint(ALLEGRO_BITMAP *canvas)BitmapStore [private]
drawClaimedCheckpoint(ALLEGRO_BITMAP *canvas)BitmapStore [private]
drawCrashedCar(ALLEGRO_BITMAP *canvas)BitmapStore [private]
drawEnemyCar(ALLEGRO_BITMAP *canvas)BitmapStore [private]
drawMazeFloor(ALLEGRO_BITMAP *canvas)BitmapStore [private]
drawMazeWall(ALLEGRO_BITMAP *canvas)BitmapStore [private]
drawPlayerCar(ALLEGRO_BITMAP *canvas)BitmapStore [private]
drawRock(ALLEGRO_BITMAP *canvas)BitmapStore [private]
drawSmoke(ALLEGRO_BITMAP *canvas)BitmapStore [private]
ENEMY enum valueBitmapStore
getBitmap(Image image)BitmapStore
Image enum nameBitmapStore
MAZE_FLOOR enum valueBitmapStore
MAZE_WALL enum valueBitmapStore
operator=(const BitmapStore &rhs)BitmapStore [private]
PLAYER enum valueBitmapStore
ROCK enum valueBitmapStore
SMOKE enum valueBitmapStore
~BitmapStore()BitmapStore
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/class_bitmap_store.html b/docs/html/class_bitmap_store.html new file mode 100644 index 0000000..6a7bf4a --- /dev/null +++ b/docs/html/class_bitmap_store.html @@ -0,0 +1,665 @@ + + + + +Rally X: BitmapStore Class Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+ +
+
BitmapStore Class Reference
+
+
+ +

Class for accessing images in ALLEGRO_BITMAP format and low level drawing. + More...

+ +

#include <BitmapStore.h>

+ +

List of all members.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Public Types

enum  Image {
+  PLAYER, +ENEMY, +ROCK, +CHECKPOINT, +
+  MAZE_WALL, +MAZE_FLOOR, +SMOKE, +CRASHED_CAR, +
+  CLAIMED_CHECKPOINT +
+ }
 Type used to define which image should be returned. More...

+Public Member Functions

 BitmapStore (unsigned int blockWidth)
 Constructor for creating a BitmapStore with a set image size.
 ~BitmapStore ()
 Destructor for clearing cache.
ALLEGRO_BITMAP * getBitmap (Image image)
 Function to get image for drawing to the screen.

+Private Member Functions

 BitmapStore (const BitmapStore &ref)
 Unimplemented copy constructor, prevents copying of BitmapStore objects.
BitmapStoreoperator= (const BitmapStore &rhs)
 Unimplemented assignment operator.
void drawPlayerCar (ALLEGRO_BITMAP *canvas)
 Draws the image representing the player.
void drawEnemyCar (ALLEGRO_BITMAP *canvas)
 Draws the image representing an enemy.
void drawRock (ALLEGRO_BITMAP *canvas)
 Draws the image representing a rock.
void drawCheckpoint (ALLEGRO_BITMAP *canvas)
 Draws the image representing a checkpoint.
void drawMazeWall (ALLEGRO_BITMAP *canvas)
 Draws the image representing a solid part of the maze.
void drawMazeFloor (ALLEGRO_BITMAP *canvas)
 Draws the image representing a non-solid part of the maze.
void drawSmoke (ALLEGRO_BITMAP *canvas)
 Draws the image representing a smokescreen.
void drawCrashedCar (ALLEGRO_BITMAP *canvas)
 Draws the popup that appears when a car crashes.
void drawClaimedCheckpoint (ALLEGRO_BITMAP *canvas)
 Draws the popup that appears when a checkpoint is collected.

+Private Attributes

AllegroDrawingInit _drawingInstalls
 Ensures that Allegro is initialized while an object of this class exists.
ALLEGRO_FONT * _bitmapFont
 Font used for writing text on bitmaps.
map< Image, ALLEGRO_BITMAP * > _bitmaps
 map containing pairs of Images (the enumerated type) and the actual images.
unsigned int _blockWidth
 The width of a square image in the store.
+

Detailed Description

+

Class for accessing images in ALLEGRO_BITMAP format and low level drawing.

+

The store ensures that only one copy of identical images are created. This is done through a map, that caches the images that have already been requested. If an uncached image is requested, it is added to the cache before being returned. The store provides an enumerated type, Image, for other classes to reference which image should represent the object on the screen.

+

All images are square, to allow easy rotation and placement on the screen.

+
Author:
Justin Wernick
+
+David Schneider
+ +

Definition at line 30 of file BitmapStore.h.

+

Member Enumeration Documentation

+ +
+
+ + + + +
enum BitmapStore::Image
+
+
+ +

Type used to define which image should be returned.

+
Enumerator:
+ + + + + + + + + +
PLAYER  +
ENEMY  +
ROCK  +
CHECKPOINT  +
MAZE_WALL  +
MAZE_FLOOR  +
SMOKE  +
CRASHED_CAR  +
CLAIMED_CHECKPOINT  +
+
+
+ +

Definition at line 47 of file BitmapStore.h.

+ +
+
+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + + +
BitmapStore::BitmapStore (unsigned int blockWidth)
+
+
+ +

Constructor for creating a BitmapStore with a set image size.

+
Parameters:
+ + +
[in]blockWidthThe width (and height) of an image returned by the store in pixels.
+
+
+ +

Definition at line 3 of file BitmapStore.cpp.

+ +
+
+ +
+
+ + + + + + + +
BitmapStore::~BitmapStore ()
+
+
+ +

Destructor for clearing cache.

+ +

Definition at line 14 of file BitmapStore.cpp.

+ +
+
+ +
+
+ + + + + + + + +
BitmapStore::BitmapStore (const BitmapStoreref) [private]
+
+
+ +

Unimplemented copy constructor, prevents copying of BitmapStore objects.

+

Copying a BitmapStore is unneccesary as there should only be a single BitmapStore object.

+ +
+
+

Member Function Documentation

+ +
+
+ + + + + + + + +
void BitmapStore::drawCheckpoint (ALLEGRO_BITMAP * canvas) [private]
+
+
+ +

Draws the image representing a checkpoint.

+
Parameters:
+ + +
[out]canvasALLEGRO_BITMAP onto which the image is drawn.
+
+
+ +

Definition at line 155 of file BitmapStore.cpp.

+ +
+
+ +
+
+ + + + + + + + +
void BitmapStore::drawClaimedCheckpoint (ALLEGRO_BITMAP * canvas) [private]
+
+
+ +

Draws the popup that appears when a checkpoint is collected.

+
Parameters:
+ + +
[out]canvasALLEGRO_BITMAP onto which the image is drawn.
+
+
+ +

Definition at line 229 of file BitmapStore.cpp.

+ +
+
+ +
+
+ + + + + + + + +
void BitmapStore::drawCrashedCar (ALLEGRO_BITMAP * canvas) [private]
+
+
+ +

Draws the popup that appears when a car crashes.

+
Parameters:
+ + +
[out]canvasALLEGRO_BITMAP onto which the image is drawn.
+
+
+ +

Definition at line 208 of file BitmapStore.cpp.

+ +
+
+ +
+
+ + + + + + + + +
void BitmapStore::drawEnemyCar (ALLEGRO_BITMAP * canvas) [private]
+
+
+ +

Draws the image representing an enemy.

+
Parameters:
+ + +
[out]canvasALLEGRO_BITMAP onto which the image is drawn.
+
+
+ +

Definition at line 105 of file BitmapStore.cpp.

+ +
+
+ +
+
+ + + + + + + + +
void BitmapStore::drawMazeFloor (ALLEGRO_BITMAP * canvas) [private]
+
+
+ +

Draws the image representing a non-solid part of the maze.

+
Parameters:
+ + +
[out]canvasALLEGRO_BITMAP onto which the image is drawn.
+
+
+ +

Definition at line 179 of file BitmapStore.cpp.

+ +
+
+ +
+
+ + + + + + + + +
void BitmapStore::drawMazeWall (ALLEGRO_BITMAP * canvas) [private]
+
+
+ +

Draws the image representing a solid part of the maze.

+
Parameters:
+ + +
[out]canvasALLEGRO_BITMAP onto which the image is drawn.
+
+
+ +

Definition at line 169 of file BitmapStore.cpp.

+ +
+
+ +
+
+ + + + + + + + +
void BitmapStore::drawPlayerCar (ALLEGRO_BITMAP * canvas) [private]
+
+
+ +

Draws the image representing the player.

+
Parameters:
+ + +
[out]canvasALLEGRO_BITMAP onto which the image is drawn.
+
+
+ +

Definition at line 71 of file BitmapStore.cpp.

+ +
+
+ +
+
+ + + + + + + + +
void BitmapStore::drawRock (ALLEGRO_BITMAP * canvas) [private]
+
+
+ +

Draws the image representing a rock.

+
Parameters:
+ + +
[out]canvasALLEGRO_BITMAP onto which the image is drawn.
+
+
+ +

Definition at line 139 of file BitmapStore.cpp.

+ +
+
+ +
+
+ + + + + + + + +
void BitmapStore::drawSmoke (ALLEGRO_BITMAP * canvas) [private]
+
+
+ +

Draws the image representing a smokescreen.

+
Parameters:
+ + +
[out]canvasALLEGRO_BITMAP onto which the image is drawn.
+
+
+ +

Definition at line 189 of file BitmapStore.cpp.

+ +
+
+ +
+
+ + + + + + + + +
ALLEGRO_BITMAP * BitmapStore::getBitmap (Image image)
+
+
+ +

Function to get image for drawing to the screen.

+
Parameters:
+ + +
[in]imageImage to be returned.
+
+
+
Returns:
Requested image in ALLEGRO_BITMAP format.
+ +

Definition at line 25 of file BitmapStore.cpp.

+ +
+
+ +
+
+ + + + + + + + +
BitmapStore& BitmapStore::operator= (const BitmapStorerhs) [private]
+
+
+ +

Unimplemented assignment operator.

+
See also:
BitmapStore(const BitmapStore& ref);
+ +
+
+

Member Data Documentation

+ +
+
+ + + + +
ALLEGRO_FONT* BitmapStore::_bitmapFont [private]
+
+
+ +

Font used for writing text on bitmaps.

+ +

Definition at line 128 of file BitmapStore.h.

+ +
+
+ +
+
+ + + + +
map<Image, ALLEGRO_BITMAP*> BitmapStore::_bitmaps [private]
+
+
+ +

map containing pairs of Images (the enumerated type) and the actual images.

+

Creates a cache for images once they have been drawn.

+ +

Definition at line 135 of file BitmapStore.h.

+ +
+
+ +
+
+ + + + +
unsigned int BitmapStore::_blockWidth [private]
+
+
+ +

The width of a square image in the store.

+ +

Definition at line 137 of file BitmapStore.h.

+ +
+
+ +
+ +
+ +

Ensures that Allegro is initialized while an object of this class exists.

+ +

Definition at line 126 of file BitmapStore.h.

+ +
+
+
The documentation for this class was generated from the following files: +
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/class_car-members.html b/docs/html/class_car-members.html new file mode 100644 index 0000000..dec3d2c --- /dev/null +++ b/docs/html/class_car-members.html @@ -0,0 +1,126 @@ + + + + +Rally X: Member List + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
+
Car Member List
+
+
+This is the complete list of members for Car, including all inherited members. + + + + + + + + + + + + + + + + +
_baseSpeedCar [protected, static]
_destroyedGameObject [protected]
_facingGameObject [protected]
_imageGameObject [protected]
_speedCar [protected]
_xGameObject [protected]
_yGameObject [protected]
Car(double x, double y, BitmapStore::Image image, Maze::Direction facing)Car
destroyed() const GameObject
facing() const GameObject
GameObject(double x, double y, BitmapStore::Image image, Maze::Direction facing=Maze::UP)GameObject
image() const GameObject
move(const Maze &maze)Car [protected]
speed() const Car
x() const GameObject
y() const GameObject
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/class_car.html b/docs/html/class_car.html new file mode 100644 index 0000000..0e1a88d --- /dev/null +++ b/docs/html/class_car.html @@ -0,0 +1,302 @@ + + + + +Rally X: Car Class Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+ +
+
Car Class Reference
+
+
+ +

GameObject that moves through the maze and changes direction. + More...

+ +

#include <Car.h>

+
+Inheritance diagram for Car:
+
+
+ + +GameObject +EnemyCar +PlayerCar + +
+ +

List of all members.

+ + + + + + + + + + + + + + + +

+Public Member Functions

 Car (double x, double y, BitmapStore::Image image, Maze::Direction facing)
 Creates a Car at the given position, with the given image, facing in the given direction.
double speed () const
 Function to access the current speed of the car.

+Protected Member Functions

void move (const Maze &maze)
 Moves the car by its current speed in the direction of its facing.

+Protected Attributes

double _speed
 The current speed that the Car is moving at.

+Static Protected Attributes

static const double _baseSpeed = 0.1
 The speed that a Car moves at in normal conditions.
+

Detailed Description

+

GameObject that moves through the maze and changes direction.

+

Should not be instantiated directly, but rather instantiated through one of the subclasses, PlayerCar or EnemyCar.

+
Author:
Justin Wernick
+
+David Schneider
+ +

Definition at line 20 of file Car.h.

+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Car::Car (double x,
double y,
BitmapStore::Image image,
Maze::Direction facing 
)
+
+
+ +

Creates a Car at the given position, with the given image, facing in the given direction.

+
Parameters:
+ + + + + +
[in]xx coordinate of initial position.
[in]yy coordinate of initial position.
[in]imageBitmap to be drawn on the screen to represent the car.
[in]facingDirection in which the Car is initially facing.
+
+
+ +

Definition at line 3 of file Car.cpp.

+ +
+
+

Member Function Documentation

+ +
+
+ + + + + + + + +
void Car::move (const Mazemaze) [protected]
+
+
+ +

Moves the car by its current speed in the direction of its facing.

+

Only moves along the x or y axis, and snaps to the grid in the other direction. Does not allow movement through solid parts of the maze.

+
Parameters:
+ + +
[in]mazeThe maze in which the Car is moving, confining its movements.
+
+
+ +

Definition at line 14 of file Car.cpp.

+ +
+
+ +
+
+ + + + + + + +
double Car::speed () const
+
+
+ +

Function to access the current speed of the car.

+
Returns:
The current speed of the car, in pixels per update.
+ +

Definition at line 9 of file Car.cpp.

+ +
+
+

Member Data Documentation

+ +
+
+ + + + +
const double Car::_baseSpeed = 0.1 [static, protected]
+
+
+ +

The speed that a Car moves at in normal conditions.

+ +

Definition at line 54 of file Car.h.

+ +
+
+ +
+
+ + + + +
double Car::_speed [protected]
+
+
+ +

The current speed that the Car is moving at.

+ +

Definition at line 53 of file Car.h.

+ +
+
+
The documentation for this class was generated from the following files: +
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/class_car.png b/docs/html/class_car.png new file mode 100644 index 0000000..57ebb58 Binary files /dev/null and b/docs/html/class_car.png differ diff --git a/docs/html/class_checkpoint-members.html b/docs/html/class_checkpoint-members.html new file mode 100644 index 0000000..b358b63 --- /dev/null +++ b/docs/html/class_checkpoint-members.html @@ -0,0 +1,127 @@ + + + + +Rally X: Member List + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
+
Checkpoint Member List
+
+
+This is the complete list of members for Checkpoint, including all inherited members. + + + + + + + + + + + + + + + + + +
_checkpointCountCheckpoint [private, static]
_destroyedGameObject [protected]
_facingGameObject [protected]
_imageGameObject [protected]
_xGameObject [protected]
_yGameObject [protected]
Checkpoint(double x, double y)Checkpoint
Checkpoint(const Checkpoint &ref)Checkpoint
checkpointCount()Checkpoint [static]
collect()Checkpoint
destroyed() const GameObject
facing() const GameObject
GameObject(double x, double y, BitmapStore::Image image, Maze::Direction facing=Maze::UP)GameObject
image() const GameObject
x() const GameObject
y() const GameObject
~Checkpoint()Checkpoint
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/class_checkpoint.html b/docs/html/class_checkpoint.html new file mode 100644 index 0000000..0e3b2dc --- /dev/null +++ b/docs/html/class_checkpoint.html @@ -0,0 +1,301 @@ + + + + +Rally X: Checkpoint Class Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+ +
+
Checkpoint Class Reference
+
+
+ +

GameObject that the player needs to pick up by driving over. + More...

+ +

#include <Checkpoint.h>

+
+Inheritance diagram for Checkpoint:
+
+
+ + +GameObject + +
+ +

List of all members.

+ + + + + + + + + + + + + + + + +

+Public Member Functions

 Checkpoint (double x, double y)
 Creates a checkpoint at the given coordinates.
 Checkpoint (const Checkpoint &ref)
 Copy constuctor, overwritten to include in the counting of Checkpoints.
 ~Checkpoint ()
 Destructor, decreases the number of Checkpoints in existence.
void collect ()
 Function to be called when a PlayerCar collects the Checkpoint.

+Static Public Member Functions

static int checkpointCount ()
 Function for accessing the number of checkpoints that currently exist.

+Static Private Attributes

static int _checkpointCount = 0
 Count of the number of Checkpoints currently in existence.
+

Detailed Description

+

GameObject that the player needs to pick up by driving over.

+

The level is complete when all checkpoints have been collected.

+
Author:
Justin Wernick
+
+David Schneider
+ +

Definition at line 15 of file Checkpoint.h.

+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + +
Checkpoint::Checkpoint (double x,
double y 
)
+
+
+ +

Creates a checkpoint at the given coordinates.

+
Parameters:
+ + + +
[in]xx coordinate of Checkpoint's position.
[in]yy coordinate of Checkpoint's position.
+
+
+ +

Definition at line 5 of file Checkpoint.cpp.

+ +
+
+ +
+
+ + + + + + + + +
Checkpoint::Checkpoint (const Checkpointref)
+
+
+ +

Copy constuctor, overwritten to include in the counting of Checkpoints.

+ +

Definition at line 11 of file Checkpoint.cpp.

+ +
+
+ +
+
+ + + + + + + +
Checkpoint::~Checkpoint ()
+
+
+ +

Destructor, decreases the number of Checkpoints in existence.

+ +

Definition at line 17 of file Checkpoint.cpp.

+ +
+
+

Member Function Documentation

+ +
+
+ + + + + + + +
int Checkpoint::checkpointCount () [static]
+
+
+ +

Function for accessing the number of checkpoints that currently exist.

+
Returns:
The number of checkpoints that currently exist.
+ +

Definition at line 22 of file Checkpoint.cpp.

+ +
+
+ +
+
+ + + + + + + +
void Checkpoint::collect ()
+
+
+ +

Function to be called when a PlayerCar collects the Checkpoint.

+ +

Definition at line 27 of file Checkpoint.cpp.

+ +
+
+

Member Data Documentation

+ +
+
+ + + + +
int Checkpoint::_checkpointCount = 0 [static, private]
+
+
+ +

Count of the number of Checkpoints currently in existence.

+ +

Definition at line 50 of file Checkpoint.h.

+ +
+
+
The documentation for this class was generated from the following files: +
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/class_checkpoint.png b/docs/html/class_checkpoint.png new file mode 100644 index 0000000..c0a2649 Binary files /dev/null and b/docs/html/class_checkpoint.png differ diff --git a/docs/html/class_collision_detector-members.html b/docs/html/class_collision_detector-members.html new file mode 100644 index 0000000..ecbeabb --- /dev/null +++ b/docs/html/class_collision_detector-members.html @@ -0,0 +1,115 @@ + + + + +Rally X: Member List + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
+
CollisionDetector Member List
+
+
+This is the complete list of members for CollisionDetector, including all inherited members. + + + + + +
checkCollisions(list< PlayerCar > &players, list< EnemyCar > &enemies, list< Checkpoint > &checkpoints, list< Rock > &rocks, list< Smokescreen > &smokescreens)CollisionDetector
collision(PlayerCar &player, Checkpoint &checkpoint)CollisionDetector [private]
collision(PlayerCar &player, EnemyCar &enemy)CollisionDetector [private]
collision(PlayerCar &player, Rock &rock)CollisionDetector [private]
collision(EnemyCar &enemy, Smokescreen &smokescreen)CollisionDetector [private]
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/class_collision_detector.html b/docs/html/class_collision_detector.html new file mode 100644 index 0000000..40a06d5 --- /dev/null +++ b/docs/html/class_collision_detector.html @@ -0,0 +1,360 @@ + + + + +Rally X: CollisionDetector Class Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+ +
+
CollisionDetector Class Reference
+
+
+ +

Object for handling collisions between GameObjects. + More...

+ +

#include <CollisionDetector.h>

+ +

List of all members.

+ + + + + + + + + + + + + +

+Public Member Functions

void checkCollisions (list< PlayerCar > &players, list< EnemyCar > &enemies, list< Checkpoint > &checkpoints, list< Rock > &rocks, list< Smokescreen > &smokescreens)
 Checks for collisions between all relevant pairs of objects, and calls the relevant collision function if one is found.

+Private Member Functions

void collision (PlayerCar &player, Checkpoint &checkpoint)
 Collision between a PlayerCar and a Checkpoint.
void collision (PlayerCar &player, EnemyCar &enemy)
 Collision between a PlayerCar and an EnemyCar.
void collision (PlayerCar &player, Rock &rock)
 Collision between a PlayerCar and a Rock.
void collision (EnemyCar &enemy, Smokescreen &smokescreen)
 Collision between an EnemyCar and a Smokescreen.
+

Detailed Description

+

Object for handling collisions between GameObjects.

+

Collisions between all relevant objects are checked and the appropriate methods on the GameObjects are called when a collision occurs.

+
Author:
Justin Wernick
+
+David Schneider
+ +

Definition at line 22 of file CollisionDetector.h.

+

Member Function Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void CollisionDetector::checkCollisions (list< PlayerCar > & players,
list< EnemyCar > & enemies,
list< Checkpoint > & checkpoints,
list< Rock > & rocks,
list< Smokescreen > & smokescreens 
)
+
+
+ +

Checks for collisions between all relevant pairs of objects, and calls the relevant collision function if one is found.

+

A collision occurs if the distance between two object's x values is less than 1, and the distance between their y values is also less than 1.

+
Parameters:
+ + + + + + +
[in,out]playersList of PlayerCars, that can collide with EnemieCars, Checkpoints, or Rocks.
[in,out]enemiesList of EnemyCars, that can collide with PlayerCars, or Smokescreens.
[in,out]checkpointsList of Checkpoints, that can collide with PlayerCars.
[in,out]rocksList of Rocks, that can collide with PlayerCars.
[in,out]smokescreensList of Smokescreens, that can collide with EnemyCars.
+
+
+ +

Definition at line 3 of file CollisionDetector.cpp.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void CollisionDetector::collision (PlayerCarplayer,
Checkpointcheckpoint 
) [private]
+
+
+ +

Collision between a PlayerCar and a Checkpoint.

+
Parameters:
+ + + +
[in,out]playerPlayerCar involved in the collision.
[in,out]checkpointCheckpoint involved in the collision.
+
+
+ +

Definition at line 44 of file CollisionDetector.cpp.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void CollisionDetector::collision (PlayerCarplayer,
EnemyCarenemy 
) [private]
+
+
+ +

Collision between a PlayerCar and an EnemyCar.

+
Parameters:
+ + + +
[in,out]playerPlayerCar involved in the collision.
[in,out]enemyEnemyCar involved in the collision.
+
+
+ +

Definition at line 55 of file CollisionDetector.cpp.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void CollisionDetector::collision (PlayerCarplayer,
Rockrock 
) [private]
+
+
+ +

Collision between a PlayerCar and a Rock.

+
Parameters:
+ + + +
[in,out]playerPlayerCar involved in the collision.
[in,out]rockRock involved in the collision.
+
+
+ +

Definition at line 50 of file CollisionDetector.cpp.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void CollisionDetector::collision (EnemyCarenemy,
Smokescreensmokescreen 
) [private]
+
+
+ +

Collision between an EnemyCar and a Smokescreen.

+
Parameters:
+ + + +
[in,out]enemyEnemyCar involved in the collision.
[in,out]smokescreenSmokescreen involved in the collision.
+
+
+ +

Definition at line 61 of file CollisionDetector.cpp.

+ +
+
+
The documentation for this class was generated from the following files: +
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/class_colour_store-members.html b/docs/html/class_colour_store-members.html new file mode 100644 index 0000000..34d67d4 --- /dev/null +++ b/docs/html/class_colour_store-members.html @@ -0,0 +1,117 @@ + + + + +Rally X: Member List + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
+
ColourStore Member List
+
+
+This is the complete list of members for ColourStore, including all inherited members. + + + + + + + +
_coloursColourStore [private]
_transparentColourStore [private]
ColourStore()ColourStore
ColourStore(const ColourStore &ref)ColourStore [private]
getColour(BitmapStore::Image image)ColourStore
operator=(const ColourStore &rhs)ColourStore [private]
populateColours()ColourStore [private]
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/class_colour_store.html b/docs/html/class_colour_store.html new file mode 100644 index 0000000..d7af6da --- /dev/null +++ b/docs/html/class_colour_store.html @@ -0,0 +1,297 @@ + + + + +Rally X: ColourStore Class Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+ +
+
ColourStore Class Reference
+
+
+ +

Class for mapping BitmapStore images to colours for use in the minimap. + More...

+ +

#include <ColourStore.h>

+ +

List of all members.

+ + + + + + + + + + + + + + + + + +

+Public Member Functions

 ColourStore ()
 Creates the ColourStore object and initialises all of the colours.
ALLEGRO_COLOR getColour (BitmapStore::Image image)
 Returns the colour associated with a given image.

+Private Member Functions

 ColourStore (const ColourStore &ref)
 Unimplemented copy constructor, prevents copying of ColourStore objects.
ColourStoreoperator= (const ColourStore &rhs)
 Unimplemented assignment operator.
void populateColours ()
 Initialises all of the relevant colours.

+Private Attributes

map< BitmapStore::Image,
+ALLEGRO_COLOR > 
_colours
ALLEGRO_COLOR _transparent
 Initialised to have an alpha of 0, and returned when the colour of an unlisted image is requested.
+

Detailed Description

+

Class for mapping BitmapStore images to colours for use in the minimap.

+
Author:
Justin Wernick
+
+David Schneider
+ +

Definition at line 14 of file ColourStore.h.

+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + +
ColourStore::ColourStore ()
+
+
+ +

Creates the ColourStore object and initialises all of the colours.

+ +

Definition at line 3 of file ColourStore.cpp.

+ +
+
+ +
+
+ + + + + + + + +
ColourStore::ColourStore (const ColourStoreref) [private]
+
+
+ +

Unimplemented copy constructor, prevents copying of ColourStore objects.

+

Copying a ColourStore is unneccesary as there should only be a single ColourStore object.

+ +
+
+

Member Function Documentation

+ +
+
+ + + + + + + + +
ALLEGRO_COLOR ColourStore::getColour (BitmapStore::Image image)
+
+
+ +

Returns the colour associated with a given image.

+

If no colour makes sense for the image, then when it is requested a colour with an alpha of 0 (completely transparent) is returned.

+
Parameters:
+ + +
[in]imageThe BitmapStore image to be associated with a colour.
+
+
+
Returns:
The requested colour.
+ +

Definition at line 18 of file ColourStore.cpp.

+ +
+
+ +
+
+ + + + + + + + +
ColourStore& ColourStore::operator= (const ColourStorerhs) [private]
+
+
+ +

Unimplemented assignment operator.

+
See also:
ColourStore(const ColourStore& ref);
+ +
+
+ +
+
+ + + + + + + +
void ColourStore::populateColours () [private]
+
+
+ +

Initialises all of the relevant colours.

+ +

Definition at line 8 of file ColourStore.cpp.

+ +
+
+

Member Data Documentation

+ +
+
+ + + + +
map<BitmapStore::Image, ALLEGRO_COLOR> ColourStore::_colours [private]
+
+
+ +

Definition at line 47 of file ColourStore.h.

+ +
+
+ +
+
+ + + + +
ALLEGRO_COLOR ColourStore::_transparent [private]
+
+
+ +

Initialised to have an alpha of 0, and returned when the colour of an unlisted image is requested.

+ +

Definition at line 52 of file ColourStore.h.

+ +
+
+
The documentation for this class was generated from the following files: +
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/class_config-members.html b/docs/html/class_config-members.html new file mode 100644 index 0000000..26133a8 --- /dev/null +++ b/docs/html/class_config-members.html @@ -0,0 +1,130 @@ + + + + +Rally X: Member List + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
+
Config Member List
+
+
+This is the complete list of members for Config, including all inherited members. + + + + + + + + + + + + + + + + + + + + +
_fullscreenConfig [private]
_screenHeightConfig [private]
_screenWidthConfig [private]
Config(const string &filename)Config
extractValue(const map< string, string > &readValues, map< string, string > &unfoundValues, const string &key, const string &defaultValue)Config [private]
fillValues(const map< string, string > &readValues, map< string, string > &unfoundValues)Config [private]
fullscreen() const Config
FULLSCREEN_DEFAULTConfig [private, static]
FULLSCREEN_KEYConfig [private, static]
readFile(ifstream &file, map< string, string > &map)Config [private]
SCREEN_HEIGHT_DEFAULTConfig [private, static]
SCREEN_HEIGHT_KEYConfig [private, static]
SCREEN_WIDTH_DEFAULTConfig [private, static]
SCREEN_WIDTH_KEYConfig [private, static]
screenHeight() const Config
screenWidth() const Config
setFullscreen(const string &fullscreenStr)Config [private]
setScreenHeight(const string &screenHeightStr)Config [private]
setScreenWidth(const string &screenWidthStr)Config [private]
writeUnfoundValues(ofstream &file, const map< string, string > &unfoundValues)Config [private]
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/class_config.html b/docs/html/class_config.html new file mode 100644 index 0000000..46121fe --- /dev/null +++ b/docs/html/class_config.html @@ -0,0 +1,681 @@ + + + + +Rally X: Config Class Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+ +
+
Config Class Reference
+
+
+ +

Object for handling user settings loaded from a file. + More...

+ +

#include <Config.h>

+ +

List of all members.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

 Config (const string &filename)
 Constructs a Config object from a file with the given path.
unsigned int screenWidth () const
 Function for accessing the screen width setting in pixels.
unsigned int screenHeight () const
 Function for accessing the screen height setting in pixels.
bool fullscreen () const
 Function for accessing whether the game should be displayed in fullscreen or windowed mode.

+Private Member Functions

void readFile (ifstream &file, map< string, string > &map)
 Reads all of the settings defined in a file into a map.
void fillValues (const map< string, string > &readValues, map< string, string > &unfoundValues)
 Initialises the Config option's parameters to those in the readValues map.
string extractValue (const map< string, string > &readValues, map< string, string > &unfoundValues, const string &key, const string &defaultValue)
 Helper function for fillValues. Finds the value for a single key.
void writeUnfoundValues (ofstream &file, const map< string, string > &unfoundValues)
 Writes settings that were not found in the file to the file with default values.
void setScreenWidth (const string &screenWidthStr)
 Initializes the screen width in pixels from a given string.
void setScreenHeight (const string &screenHeightStr)
 Initializes the screen height in pixels from a given string.
void setFullscreen (const string &fullscreenStr)
 Initializes the fullscreen setting from a given string.

+Private Attributes

unsigned int _screenWidth
 The desired width of the screen in pixels.
unsigned int _screenHeight
 The desired height of the screen in pixels.
bool _fullscreen
 The desired fullscreen or windowed setting.

+Static Private Attributes

static const string SCREEN_WIDTH_KEY
 The key for the screen width setting, initialized to "screen_width".
static const string SCREEN_HEIGHT_KEY
 The key for the screen height setting, initialized to "screen_height".
static const string FULLSCREEN_KEY
 The key for the fullscreen setting, initialized to "fullscreen".
static const string SCREEN_WIDTH_DEFAULT
 The default value for the screen width setting, initialized to 800.
static const string SCREEN_HEIGHT_DEFAULT
 The default value for the screen height setting, initialized to 600.
static const string FULLSCREEN_DEFAULT
 The default value for the fullscreen setting, initialized to false.
+

Detailed Description

+

Object for handling user settings loaded from a file.

+

These settings are currently all related to the screen (resolution and windowed or fullscreen). If custom controls are implemented in a later release, they will be loaded here. If a setting exists but is not found in the config file, it is set to a default value and written to the file.

+
Author:
Justin Wernick
+
+David Schneider
+ +

Definition at line 20 of file Config.h.

+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + + +
Config::Config (const string & filename)
+
+
+ +

Constructs a Config object from a file with the given path.

+

Opens the file and reads all of the settings in the file. The read settings are bound to the settings that have keys defined in the class. And settings missing from the file are set to default values, and the default values are written to the file.

+
Parameters:
+ + +
[in]filenameThe path of the file in which the settings are stored.
+
+
+ +

Definition at line 12 of file Config.cpp.

+ +
+
+

Member Function Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
string Config::extractValue (const map< string, string > & readValues,
map< string, string > & unfoundValues,
const string & key,
const string & defaultValue 
) [private]
+
+
+ +

Helper function for fillValues. Finds the value for a single key.

+

If the given key does not appear, it is added to the unfoundValues map with the given default

+
Parameters:
+ + + + + +
[in]readValuesA map containing all of the settings read in from a config file.
[out]unfoundValuesA map that is populated with and settings not found in readValues.
[in]keyThe key of the setting to be found in readValues.
[in]defaultValueThe value to return and add to unfoundValues if the setting is not found in readValues.
+
+
+
Returns:
The value corresponding to the requested key.
+ +

Definition at line 72 of file Config.cpp.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void Config::fillValues (const map< string, string > & readValues,
map< string, string > & unfoundValues 
) [private]
+
+
+ +

Initialises the Config option's parameters to those in the readValues map.

+

Parameters with a key that does not appear in readValues are initialised to a default value. The default value, and its key, are then added to the unfoundValues map.

+
Parameters:
+ + + +
[in]readValuesA map containing all of the settings read in from a config file.
[out]unfoundValuesA map that is populated with and settings not found in readValues.
+
+
+ +

Definition at line 65 of file Config.cpp.

+ +
+
+ +
+
+ + + + + + + +
bool Config::fullscreen () const
+
+
+ +

Function for accessing whether the game should be displayed in fullscreen or windowed mode.

+
Returns:
The desired fullscreen setting. A result of true means fullscreen mode, while a result of false means windowed mode.
+ +

Definition at line 40 of file Config.cpp.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void Config::readFile (ifstream & file,
map< string, string > & map 
) [private]
+
+
+ +

Reads all of the settings defined in a file into a map.

+

Reads each line that is in the format "key=value" in a file into a map. Lines that do not contain a '=' are ignored.

+
Parameters:
+ + + +
[in]fileAn opened filestream object at the beginning of the file to be read. After the function call, file will be at the end of the file.
[out]mapThe map that is populated with settings.
+
+
+ +

Definition at line 45 of file Config.cpp.

+ +
+
+ +
+
+ + + + + + + +
unsigned int Config::screenHeight () const
+
+
+ +

Function for accessing the screen height setting in pixels.

+
Returns:
The desired height of the screen in pixels.
+ +

Definition at line 36 of file Config.cpp.

+ +
+
+ +
+
+ + + + + + + +
unsigned int Config::screenWidth () const
+
+
+ +

Function for accessing the screen width setting in pixels.

+
Returns:
The desired width of the screen in pixels.
+ +

Definition at line 32 of file Config.cpp.

+ +
+
+ +
+
+ + + + + + + + +
void Config::setFullscreen (const string & fullscreenStr) [private]
+
+
+ +

Initializes the fullscreen setting from a given string.

+
Parameters:
+ + +
[in]fullscreenStrA string representing whether the screen should be in fullscreen mode ("true") or windowed mode (anything else).
+
+
+ +

Definition at line 102 of file Config.cpp.

+ +
+
+ +
+
+ + + + + + + + +
void Config::setScreenHeight (const string & screenHeightStr) [private]
+
+
+ +

Initializes the screen height in pixels from a given string.

+
Parameters:
+ + +
[in]screenHeightStrA string representing the desired screen height, read from a file.
+
+
+ +

Definition at line 98 of file Config.cpp.

+ +
+
+ +
+
+ + + + + + + + +
void Config::setScreenWidth (const string & screenWidthStr) [private]
+
+
+ +

Initializes the screen width in pixels from a given string.

+
Parameters:
+ + +
[in]screenWidthStrA string representing the desired screen width, read from a file.
+
+
+ +

Definition at line 94 of file Config.cpp.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void Config::writeUnfoundValues (ofstream & file,
const map< string, string > & unfoundValues 
) [private]
+
+
+ +

Writes settings that were not found in the file to the file with default values.

+
Parameters:
+ + + +
[in]fileThe opened filestream to which the key=value pairs are written.
[in]unfoundValuesThe map of key value pairs to be written to the file.
+
+
+ +

Definition at line 86 of file Config.cpp.

+ +
+
+

Member Data Documentation

+ +
+
+ + + + +
bool Config::_fullscreen [private]
+
+
+ +

The desired fullscreen or windowed setting.

+ +

Definition at line 125 of file Config.h.

+ +
+
+ +
+
+ + + + +
unsigned int Config::_screenHeight [private]
+
+
+ +

The desired height of the screen in pixels.

+ +

Definition at line 124 of file Config.h.

+ +
+
+ +
+
+ + + + +
unsigned int Config::_screenWidth [private]
+
+
+ +

The desired width of the screen in pixels.

+ +

Definition at line 123 of file Config.h.

+ +
+
+ +
+
+ + + + +
const string Config::FULLSCREEN_DEFAULT [static, private]
+
+
+ +

The default value for the fullscreen setting, initialized to false.

+ +

Definition at line 133 of file Config.h.

+ +
+
+ +
+
+ + + + +
const string Config::FULLSCREEN_KEY [static, private]
+
+
+ +

The key for the fullscreen setting, initialized to "fullscreen".

+ +

Definition at line 129 of file Config.h.

+ +
+
+ +
+
+ + + + +
const string Config::SCREEN_HEIGHT_DEFAULT [static, private]
+
+
+ +

The default value for the screen height setting, initialized to 600.

+ +

Definition at line 132 of file Config.h.

+ +
+
+ +
+
+ + + + +
const string Config::SCREEN_HEIGHT_KEY [static, private]
+
+
+ +

The key for the screen height setting, initialized to "screen_height".

+ +

Definition at line 128 of file Config.h.

+ +
+
+ +
+
+ + + + +
const string Config::SCREEN_WIDTH_DEFAULT [static, private]
+
+
+ +

The default value for the screen width setting, initialized to 800.

+ +

Definition at line 131 of file Config.h.

+ +
+
+ +
+
+ + + + +
const string Config::SCREEN_WIDTH_KEY [static, private]
+
+
+ +

The key for the screen width setting, initialized to "screen_width".

+ +

Definition at line 127 of file Config.h.

+ +
+
+
The documentation for this class was generated from the following files: +
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/class_destroyed_object_popup-members.html b/docs/html/class_destroyed_object_popup-members.html new file mode 100644 index 0000000..a8d444e --- /dev/null +++ b/docs/html/class_destroyed_object_popup-members.html @@ -0,0 +1,125 @@ + + + + +Rally X: Member List + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
+
DestroyedObjectPopup Member List
+
+
+This is the complete list of members for DestroyedObjectPopup, including all inherited members. + + + + + + + + + + + + + + + +
_destroyedGameObject [protected]
_facingGameObject [protected]
_imageGameObject [protected]
_xGameObject [protected]
_yGameObject [protected]
destroyed() const GameObject
DestroyedObjectPopup(double x, double y, BitmapStore::Image image)DestroyedObjectPopup
facing() const GameObject
GameObject(double x, double y, BitmapStore::Image image, Maze::Direction facing=Maze::UP)GameObject
image() const GameObject
LimitedTimeObject(double x, double y, BitmapStore::Image image, int time)LimitedTimeObject
POPUP_TIMEDestroyedObjectPopup [private, static]
update()LimitedTimeObject
x() const GameObject
y() const GameObject
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/class_destroyed_object_popup.html b/docs/html/class_destroyed_object_popup.html new file mode 100644 index 0000000..6163af3 --- /dev/null +++ b/docs/html/class_destroyed_object_popup.html @@ -0,0 +1,215 @@ + + + + +Rally X: DestroyedObjectPopup Class Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+ +
+
DestroyedObjectPopup Class Reference
+
+
+ +

Object that appears on the screen for a short time when another object has been destroyed. + More...

+ +

#include <DestroyedObjectPopup.h>

+
+Inheritance diagram for DestroyedObjectPopup:
+
+
+ + +LimitedTimeObject +GameObject + +
+ +

List of all members.

+ + + + + + + +

+Public Member Functions

 DestroyedObjectPopup (double x, double y, BitmapStore::Image image)
 Creates the popup at the given location, with the given image.

+Static Private Attributes

static const int POPUP_TIME = 30
 The number of frames that the DestroyedObjectPopup exists before it is destroyed. 1 second at FPS=30.
+

Detailed Description

+

Object that appears on the screen for a short time when another object has been destroyed.

+

Used to give extra visual feedback when a checkpoint has been collected or a Car crashes.

+
Author:
Justin Wernick
+
+David Schneider
+ +

Definition at line 15 of file DestroyedObjectPopup.h.

+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
DestroyedObjectPopup::DestroyedObjectPopup (double x,
double y,
BitmapStore::Image image 
)
+
+
+ +

Creates the popup at the given location, with the given image.

+
Parameters:
+ + + + +
[in]xThe x coordinate of the object's position.
[in]yThe y coordinate of the object's position.
[in]imageThe bitmap to be shown until the popup disappears.
+
+
+ +

Definition at line 3 of file DestroyedObjectPopup.cpp.

+ +
+
+

Member Data Documentation

+ +
+
+ + + + +
const int DestroyedObjectPopup::POPUP_TIME = 30 [static, private]
+
+
+ +

The number of frames that the DestroyedObjectPopup exists before it is destroyed. 1 second at FPS=30.

+ +

Definition at line 30 of file DestroyedObjectPopup.h.

+ +
+
+
The documentation for this class was generated from the following files: +
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/class_destroyed_object_popup.png b/docs/html/class_destroyed_object_popup.png new file mode 100644 index 0000000..72fc1c4 Binary files /dev/null and b/docs/html/class_destroyed_object_popup.png differ diff --git a/docs/html/class_enemy_car-members.html b/docs/html/class_enemy_car-members.html new file mode 100644 index 0000000..fef1e9e --- /dev/null +++ b/docs/html/class_enemy_car-members.html @@ -0,0 +1,138 @@ + + + + +Rally X: Member List + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
+
EnemyCar Member List
+
+
+This is the complete list of members for EnemyCar, including all inherited members. + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
_baseSpeedCar [protected, static]
_destroyedGameObject [protected]
_facingGameObject [protected]
_imageGameObject [protected]
_speedCar [protected]
_stateEnemyCar [private]
_targetXEnemyCar [private]
_targetYEnemyCar [private]
_xGameObject [protected]
_yGameObject [protected]
blind()EnemyCar
BLINDED enum valueEnemyCar [private]
Car(double x, double y, BitmapStore::Image image, Maze::Direction facing)Car
CHASING enum valueEnemyCar [private]
checkFacing(const Maze &maze, double chasingX, double chasingY, const list< Rock > &rocks)EnemyCar [private]
crash()EnemyCar
destroyed() const GameObject
EnemyCar(double x, double y)EnemyCar
facing() const GameObject
GameObject(double x, double y, BitmapStore::Image image, Maze::Direction facing=Maze::UP)GameObject
image() const GameObject
move(const Maze &maze)Car [protected]
rockAtLocation(double x, double y, const list< Rock > &rocks)EnemyCar [private]
speed() const Car
States enum nameEnemyCar [private]
update(const Maze &maze, const list< PlayerCar > &players, const list< Rock > &rocks)EnemyCar
x() const GameObject
y() const GameObject
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/class_enemy_car.html b/docs/html/class_enemy_car.html new file mode 100644 index 0000000..b6720d9 --- /dev/null +++ b/docs/html/class_enemy_car.html @@ -0,0 +1,480 @@ + + + + +Rally X: EnemyCar Class Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+ +
+
EnemyCar Class Reference
+
+
+ +

GameObject that chases the player around the maze. + More...

+ +

#include <EnemyCar.h>

+
+Inheritance diagram for EnemyCar:
+
+
+ + +Car +GameObject + +
+ +

List of all members.

+ + + + + + + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

 EnemyCar (double x, double y)
 Creates an EnemyCar at the given coordinates.
void update (const Maze &maze, const list< PlayerCar > &players, const list< Rock > &rocks)
 Processes one frame's worth of activity for the object, called every frame.
void crash ()
 Function that is called when an EnemyCar crashes into a PlayerCar.
void blind ()
 Function that is called when an EnemyCar drives into a Smokescreen.

+Private Types

enum  States { BLINDED, +CHASING + }
 States that define how the EnemyCar's AI should behave. More...

+Private Member Functions

void checkFacing (const Maze &maze, double chasingX, double chasingY, const list< Rock > &rocks)
 Updates the direction that the EnemyCar is facing, if neccesary.
bool rockAtLocation (double x, double y, const list< Rock > &rocks)
 Iterates through a list of Rocks and determines if moving to a given position would result in a collision.

+Private Attributes

States _state
 The state that the object is currently in.
double _targetX
 The x coordinate that the EnemyCar is driving towards.
double _targetY
 The y coordinate that the EnemyCar is driving towards.
+

Detailed Description

+

GameObject that chases the player around the maze.

+

Attempts to collide with the player, causing the player to lose.

+
Author:
Justin Wernick
+
+David Schneider
+ +

Definition at line 21 of file EnemyCar.h.

+

Member Enumeration Documentation

+ +
+
+ + + + +
enum EnemyCar::States [private]
+
+
+ +

States that define how the EnemyCar's AI should behave.

+

This would need to be expanded to include more states in order to make the enemies appear smarter.

+
Enumerator:
+ + +
BLINDED  +

The EnemyCar can not see, and so does not move.

+
CHASING  +

The EnemyCar tries to drive to the block that the player is currently on.

+
+
+
+ +

Definition at line 61 of file EnemyCar.h.

+ +
+
+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + +
EnemyCar::EnemyCar (double x,
double y 
)
+
+
+ +

Creates an EnemyCar at the given coordinates.

+
Parameters:
+ + + +
[in]xThe x coordinate of the EnemyCar's initial position.
[in]yThe y coordinate of the EnemyCar's initial position.
+
+
+ +

Definition at line 3 of file EnemyCar.cpp.

+ +
+
+

Member Function Documentation

+ +
+
+ + + + + + + +
void EnemyCar::blind ()
+
+
+ +

Function that is called when an EnemyCar drives into a Smokescreen.

+ +

Definition at line 100 of file EnemyCar.cpp.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void EnemyCar::checkFacing (const Mazemaze,
double chasingX,
double chasingY,
const list< Rock > & rocks 
) [private]
+
+
+ +

Updates the direction that the EnemyCar is facing, if neccesary.

+

The facing is only changed once the current _targetX and _targetY are reached. After that, a facing is chosen that points into an empty block (no maze walls or rocks) that is closest to the chasing x and y using a straight line. This results in the enemy not always taking the shortest route, but it makes it possible to escape enemies. _targetX and _targetY are updated to one block in the new facing direction. The enemy may only turn around and head backwards if there is no other options, so once the enemy starts driving down narrow a path it will continue to the end of the path.

+
Parameters:
+ + + + + +
[in]mazeThe maze that confines the EnemyCar's movements.
[in]chasingXThe x coordinate that the EnemyCar is ultimately trying to reach.
[in]chasingYThe y coordinate that the EnemyCar is ultimately trying to reach.
[in]rocksThe Rocks that the EnemyCar needs to avoid.
+
+
+ +

Definition at line 26 of file EnemyCar.cpp.

+ +
+
+ +
+
+ + + + + + + +
void EnemyCar::crash ()
+
+
+ +

Function that is called when an EnemyCar crashes into a PlayerCar.

+ +

Definition at line 95 of file EnemyCar.cpp.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
bool EnemyCar::rockAtLocation (double x,
double y,
const list< Rock > & rocks 
) [private]
+
+
+ +

Iterates through a list of Rocks and determines if moving to a given position would result in a collision.

+
Parameters:
+ + + + +
[in]xThe potential new x coordinate.
[in]yThe potential new y coordinate.
[in]rocksThe Rocks that are checked for a collision at x and y.
+
+
+ +

Definition at line 86 of file EnemyCar.cpp.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
void EnemyCar::update (const Mazemaze,
const list< PlayerCar > & players,
const list< Rock > & rocks 
)
+
+
+ +

Processes one frame's worth of activity for the object, called every frame.

+

Primarily adjusts the facing if neccesary and then moves using the inhereted move function.

+
Parameters:
+ + + + +
mazeThe maze that confines the EnemyCar's movements.
playersThe list of PlayerCars that the EnemyCar can chase.
rocksThe list of Rocks that need to be avoided.
+
+
+ +

Definition at line 11 of file EnemyCar.cpp.

+ +
+
+

Member Data Documentation

+ +
+
+ + + + +
States EnemyCar::_state [private]
+
+
+ +

The state that the object is currently in.

+ +

Definition at line 66 of file EnemyCar.h.

+ +
+
+ +
+
+ + + + +
double EnemyCar::_targetX [private]
+
+
+ +

The x coordinate that the EnemyCar is driving towards.

+ +

Definition at line 67 of file EnemyCar.h.

+ +
+
+ +
+
+ + + + +
double EnemyCar::_targetY [private]
+
+
+ +

The y coordinate that the EnemyCar is driving towards.

+ +

Definition at line 68 of file EnemyCar.h.

+ +
+
+
The documentation for this class was generated from the following files: +
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/class_enemy_car.png b/docs/html/class_enemy_car.png new file mode 100644 index 0000000..c72ad64 Binary files /dev/null and b/docs/html/class_enemy_car.png differ diff --git a/docs/html/class_file_open_error.html b/docs/html/class_file_open_error.html new file mode 100644 index 0000000..c06baea --- /dev/null +++ b/docs/html/class_file_open_error.html @@ -0,0 +1,125 @@ + + + + +Rally X: FileOpenError Class Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
+
FileOpenError Class Reference
+
+
+ +

An exception that is thrown if the file selected for opening does not exist. + More...

+ +

#include <LevelReader.h>

+

Detailed Description

+

An exception that is thrown if the file selected for opening does not exist.

+

This should never be thrown, since the Allegro native file dialog is being used to select this file, and it only allows one to select existing files.

+
Author:
Justin Wernick
+
+David Schneider
+ +

Definition at line 27 of file LevelReader.h.

+

The documentation for this class was generated from the following file: +
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/class_game-members.html b/docs/html/class_game-members.html new file mode 100644 index 0000000..0187a7b --- /dev/null +++ b/docs/html/class_game-members.html @@ -0,0 +1,134 @@ + + + + +Rally X: Member List + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
+
Game Member List
+
+
+This is the complete list of members for Game, including all inherited members. + + + + + + + + + + + + + + + + + + + + + + + + +
_allegroGame [private]
_checkpointsGame [private]
_collisionDetectorGame [private]
_configGame [private]
_enemiesGame [private]
_mazeGame [private]
_playersGame [private]
_popupsGame [private]
_rocksGame [private]
_screenGame [private]
_smokescreensGame [private]
_timerGame [private]
_timerEventsGame [private]
cleanup()Game [private]
clearLists()Game [private]
FPSGame [static]
Game()Game
Game(const Game &ref)Game [private]
initLevel(const string &levelFile)Game [private]
operator=(const Game &rhs)Game [private]
runloop()Game [private]
start()Game
update()Game [private]
~Game()Game
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/class_game.html b/docs/html/class_game.html new file mode 100644 index 0000000..f56b7df --- /dev/null +++ b/docs/html/class_game.html @@ -0,0 +1,643 @@ + + + + +Rally X: Game Class Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+ +
+
Game Class Reference
+
+
+ +

The object that controls the flow of the game, and the launch point of the game. + More...

+ +

#include <Game.h>

+ +

List of all members.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

 Game ()
 Constructor, that creates the relevant Allegro entities.
 ~Game ()
 Constructor, that destroys the relevant Allegro entities.
void start ()
 Entry point for the program. This should be called from main.

+Static Public Attributes

static const unsigned int FPS = 30
 Frames per second, the number of times the gameloop is run every second.

+Private Member Functions

 Game (const Game &ref)
 Unimplemented copy constructor, prevents copying of Game objects.
Gameoperator= (const Game &rhs)
 Unimplemented assignment operator.
void initLevel (const string &levelFile)
 Initialises all of the GameObject lists using a file.
void runloop ()
 Main part of the game, performs the actions in each frame FPS times per second until the game is over.
void update ()
 Calls the update method on each of the GameObjects in the game.
void cleanup ()
 Removes any GameObjects that have been destroyed from their lists.
void clearLists ()
 Destroys all GameObjects in the game, resetting the lists for a new level to be loaded.

+Private Attributes

AllegroInit _allegro
 Handles dependencies on Allegro being installed.
Config _config
 Loads configuration from file on construction, used to set resolution of screen.
Screen _screen
 Handles all drawing operations.
ALLEGRO_TIMER * _timer
 Creates FPS events per second, that are put into _timerEvents.
ALLEGRO_EVENT_QUEUE * _timerEvents
 Catches events from _timer, used to regulate speed of runloop.
Maze _maze
 The environment that confines the movements of GameObjects, specifically Cars.
list< PlayerCar_players
 Typically a single PlayerCar, controlled by the person playing the game.
list< EnemyCar_enemies
 List of all EnemyCars chasing the player.
list< Checkpoint_checkpoints
 List of checkpoints that the player needs to collect.
list< Rock_rocks
 List of rocks that the player and EnemyCars need to avoid.
list< Smokescreen_smokescreens
 List of Smokescreen objects that are currently able to delay EnemyCars.
list< DestroyedObjectPopup_popups
 List of purely visual DestroyedObjectPopups that need to be drawn.
CollisionDetector _collisionDetector
 Object that checks for collisions each frame.
+

Detailed Description

+

The object that controls the flow of the game, and the launch point of the game.

+

Game contains the various components, including the screen, the maze, and all of the objects in the maze. The timing of the gameloop also falls under Game's control. Essencially, Game is the central point that everything connects to.

+
Author:
Justin Wernick
+
+David Schneider
+ +

Definition at line 36 of file Game.h.

+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + +
Game::Game ()
+
+
+ +

Constructor, that creates the relevant Allegro entities.

+ +

Definition at line 3 of file Game.cpp.

+ +
+
+ +
+
+ + + + + + + +
Game::~Game ()
+
+
+ +

Constructor, that destroys the relevant Allegro entities.

+ +

Definition at line 12 of file Game.cpp.

+ +
+
+ +
+
+ + + + + + + + +
Game::Game (const Gameref) [private]
+
+
+ +

Unimplemented copy constructor, prevents copying of Game objects.

+

Copying a Game is unneccesary as there should only be a single Game object.

+ +
+
+

Member Function Documentation

+ +
+
+ + + + + + + +
void Game::cleanup () [private]
+
+
+ +

Removes any GameObjects that have been destroyed from their lists.

+ +

Definition at line 104 of file Game.cpp.

+ +
+
+ +
+
+ + + + + + + +
void Game::clearLists () [private]
+
+
+ +

Destroys all GameObjects in the game, resetting the lists for a new level to be loaded.

+

This should always be called before a new level is loaded.

+ +

Definition at line 177 of file Game.cpp.

+ +
+
+ +
+
+ + + + + + + + +
void Game::initLevel (const string & levelFile) [private]
+
+
+ +

Initialises all of the GameObject lists using a file.

+
Parameters:
+ + +
[in]levelFileThe path of the file that contains the level layout.
+
+
+ +

Definition at line 32 of file Game.cpp.

+ +
+
+ +
+
+ + + + + + + + +
Game& Game::operator= (const Gamerhs) [private]
+
+
+ +

Unimplemented assignment operator.

+
See also:
Game::Game(const Game& ref)
+ +
+
+ +
+
+ + + + + + + +
void Game::runloop () [private]
+
+
+ +

Main part of the game, performs the actions in each frame FPS times per second until the game is over.

+

Each frame runs the update methods of each of the GameObjects in the lists. The CollisionDetector then checks for collisions between objects. Any GameObjects that have been destroyed are then removed from their lists. Finally, the Screen is called to draw all of the GameObjects that still exist in their new positions.

+

Before the next iteration begins, a check is done for the victory and loss conditions. The loop is ended if either of these are met, or if the player has quit the game.

+ +

Definition at line 39 of file Game.cpp.

+ +
+
+ +
+
+ + + + + + + +
void Game::start ()
+
+
+ +

Entry point for the program. This should be called from main.

+ +

Definition at line 19 of file Game.cpp.

+ +
+
+ +
+
+ + + + + + + +
void Game::update () [private]
+
+
+ +

Calls the update method on each of the GameObjects in the game.

+ +

Definition at line 82 of file Game.cpp.

+ +
+
+

Member Data Documentation

+ +
+
+ + + + +
AllegroInit Game::_allegro [private]
+
+
+ +

Handles dependencies on Allegro being installed.

+ +

Definition at line 106 of file Game.h.

+ +
+
+ +
+
+ + + + +
list<Checkpoint> Game::_checkpoints [private]
+
+
+ +

List of checkpoints that the player needs to collect.

+ +

Definition at line 127 of file Game.h.

+ +
+
+ +
+ +
+ +

Object that checks for collisions each frame.

+ +

Definition at line 132 of file Game.h.

+ +
+
+ +
+
+ + + + +
Config Game::_config [private]
+
+
+ +

Loads configuration from file on construction, used to set resolution of screen.

+ +

Definition at line 108 of file Game.h.

+ +
+
+ +
+
+ + + + +
list<EnemyCar> Game::_enemies [private]
+
+
+ +

List of all EnemyCars chasing the player.

+ +

Definition at line 126 of file Game.h.

+ +
+
+ +
+
+ + + + +
Maze Game::_maze [private]
+
+
+ +

The environment that confines the movements of GameObjects, specifically Cars.

+ +

Definition at line 113 of file Game.h.

+ +
+
+ +
+
+ + + + +
list<PlayerCar> Game::_players [private]
+
+
+ +

Typically a single PlayerCar, controlled by the person playing the game.

+

A list was used for _players to allow the Game object to be constructed without needing to initialise a meaningless PlayerCar object. This also allows the PlayerCar to be destroyed by Rocks or EnemyCars. An added benefit is that it adds the ease of extending the game to allow multiple players. To add multiplayer, the KeyboardHandler would need to be modified to allow different sets of input keys, and the Screen would need to be modified to keep all players visible, but the Game class would be able to remain largely unchanged.

+ +

Definition at line 124 of file Game.h.

+ +
+
+ +
+
+ + + + +
list<DestroyedObjectPopup> Game::_popups [private]
+
+
+ +

List of purely visual DestroyedObjectPopups that need to be drawn.

+ +

Definition at line 130 of file Game.h.

+ +
+
+ +
+
+ + + + +
list<Rock> Game::_rocks [private]
+
+
+ +

List of rocks that the player and EnemyCars need to avoid.

+ +

Definition at line 128 of file Game.h.

+ +
+
+ +
+
+ + + + +
Screen Game::_screen [private]
+
+
+ +

Handles all drawing operations.

+ +

Definition at line 109 of file Game.h.

+ +
+
+ +
+
+ + + + +
list<Smokescreen> Game::_smokescreens [private]
+
+
+ +

List of Smokescreen objects that are currently able to delay EnemyCars.

+ +

Definition at line 129 of file Game.h.

+ +
+
+ +
+
+ + + + +
ALLEGRO_TIMER* Game::_timer [private]
+
+
+ +

Creates FPS events per second, that are put into _timerEvents.

+ +

Definition at line 110 of file Game.h.

+ +
+
+ +
+
+ + + + +
ALLEGRO_EVENT_QUEUE* Game::_timerEvents [private]
+
+
+ +

Catches events from _timer, used to regulate speed of runloop.

+ +

Definition at line 111 of file Game.h.

+ +
+
+ +
+
+ + + + +
const unsigned int Game::FPS = 30 [static]
+
+
+ +

Frames per second, the number of times the gameloop is run every second.

+ +

Definition at line 39 of file Game.h.

+ +
+
+
The documentation for this class was generated from the following files: +
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/class_game_object-members.html b/docs/html/class_game_object-members.html new file mode 100644 index 0000000..33da245 --- /dev/null +++ b/docs/html/class_game_object-members.html @@ -0,0 +1,121 @@ + + + + +Rally X: Member List + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
+
GameObject Member List
+
+
+This is the complete list of members for GameObject, including all inherited members. + + + + + + + + + + + +
_destroyedGameObject [protected]
_facingGameObject [protected]
_imageGameObject [protected]
_xGameObject [protected]
_yGameObject [protected]
destroyed() const GameObject
facing() const GameObject
GameObject(double x, double y, BitmapStore::Image image, Maze::Direction facing=Maze::UP)GameObject
image() const GameObject
x() const GameObject
y() const GameObject
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/class_game_object.html b/docs/html/class_game_object.html new file mode 100644 index 0000000..2b41b1a --- /dev/null +++ b/docs/html/class_game_object.html @@ -0,0 +1,421 @@ + + + + +Rally X: GameObject Class Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+ +
+
GameObject Class Reference
+
+
+ +

Parent class for objects that are placed in the maze. + More...

+ +

#include <GameObject.h>

+
+Inheritance diagram for GameObject:
+
+
+ + +Car +Checkpoint +LimitedTimeObject +Rock +EnemyCar +PlayerCar +DestroyedObjectPopup +Smokescreen + +
+ +

List of all members.

+ + + + + + + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

 GameObject (double x, double y, BitmapStore::Image image, Maze::Direction facing=Maze::UP)
 Creates a GameObject with the given parameters.
double x () const
 Provides access to the x coordinate of the object.
double y () const
 Provides access to the y coordinate of the object.
bool destroyed () const
 Checks if an object has been marked for destruction, for example through a collision.
BitmapStore::Image image () const
 Provides access to the image that should be drawn to represent the object.
Maze::Direction facing () const
 Provides access to the direction that the object is facing.

+Protected Attributes

double _x
 The x coordinate of the object's position.
double _y
 The y coordinate of the object's position.
bool _destroyed
 True if the object has been marked for destruction.
BitmapStore::Image _image
 The bitmap that should be drawn on the screen to represent the object.
Maze::Direction _facing
 The direction in which the object is facing, up, down, left, or right.
+

Detailed Description

+

Parent class for objects that are placed in the maze.

+

These objects are one maze block big. The image in the bitmap store will be drawn on the screen every frame at the Screen class's discression, being rotated to face in the 'facing' direction. Coordinates are given in terms of the Maze class's coordinate system. For example, increasing the x coordinate of an object by 1 will move it one maze block to the right. The number of pixels that this corresponds to is handled by the Screen class.

+

When an object is in a situation that it should be destroyed, it is marked for destruction. It is then the responsibility of the Game class to actually destroy it.

+
Author:
Justin Wernick
+
+David Schneider
+ +

Definition at line 23 of file GameObject.h.

+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
GameObject::GameObject (double x,
double y,
BitmapStore::Image image,
Maze::Direction facing = Maze::UP 
)
+
+
+ +

Creates a GameObject with the given parameters.

+
Parameters:
+ + + + + +
[in]xThe x coordinate of the new object.
[in]yThe y coordinate of the new object.
[in]imageThe image that is drawn to represent the object.
[in]facingThe direction that the object is facing. If the object has no direction, such as with Checkpoint or Rock, the default value of Maze::UP should be used.
+
+
+ +

Definition at line 3 of file GameObject.cpp.

+ +
+
+

Member Function Documentation

+ +
+
+ + + + + + + +
bool GameObject::destroyed () const
+
+
+ +

Checks if an object has been marked for destruction, for example through a collision.

+
Returns:
True is the object has been marked for destruction, false otherwise.
+ +

Definition at line 16 of file GameObject.cpp.

+ +
+
+ +
+
+ + + + + + + +
Maze::Direction GameObject::facing () const
+
+
+ +

Provides access to the direction that the object is facing.

+
Returns:
A direction, corresponding to the rotation that should be done to the drawn image and, in the case of Cars, the direction that they move forward.
+ +

Definition at line 24 of file GameObject.cpp.

+ +
+
+ +
+
+ + + + + + + +
BitmapStore::Image GameObject::image () const
+
+
+ +

Provides access to the image that should be drawn to represent the object.

+
Returns:
An image, corresponding to an enumerated type that can be converted into a bitmap by the BitmapStore class.
+ +

Definition at line 20 of file GameObject.cpp.

+ +
+
+ +
+
+ + + + + + + +
double GameObject::x () const
+
+
+ +

Provides access to the x coordinate of the object.

+
Returns:
The x coordinate of the object, in maze blocks, where 0 is the far left column of the maze.
+ +

Definition at line 8 of file GameObject.cpp.

+ +
+
+ +
+
+ + + + + + + +
double GameObject::y () const
+
+
+ +

Provides access to the y coordinate of the object.

+
Returns:
The y coordinate of the object, in maze blocks, where 0 is the top row of the maze.
+ +

Definition at line 12 of file GameObject.cpp.

+ +
+
+

Member Data Documentation

+ +
+
+ + + + +
bool GameObject::_destroyed [protected]
+
+
+ +

True if the object has been marked for destruction.

+ +

Definition at line 77 of file GameObject.h.

+ +
+
+ +
+
+ + + + +
Maze::Direction GameObject::_facing [protected]
+
+
+ +

The direction in which the object is facing, up, down, left, or right.

+ +

Definition at line 79 of file GameObject.h.

+ +
+
+ +
+
+ + + + +
BitmapStore::Image GameObject::_image [protected]
+
+
+ +

The bitmap that should be drawn on the screen to represent the object.

+ +

Definition at line 78 of file GameObject.h.

+ +
+
+ +
+
+ + + + +
double GameObject::_x [protected]
+
+
+ +

The x coordinate of the object's position.

+ +

Definition at line 75 of file GameObject.h.

+ +
+
+ +
+
+ + + + +
double GameObject::_y [protected]
+
+
+ +

The y coordinate of the object's position.

+ +

Definition at line 76 of file GameObject.h.

+ +
+
+
The documentation for this class was generated from the following files: +
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/class_game_object.png b/docs/html/class_game_object.png new file mode 100644 index 0000000..c17661d Binary files /dev/null and b/docs/html/class_game_object.png differ diff --git a/docs/html/class_game_panel-members.html b/docs/html/class_game_panel-members.html new file mode 100644 index 0000000..8256ceb --- /dev/null +++ b/docs/html/class_game_panel-members.html @@ -0,0 +1,131 @@ + + + + +Rally X: Member List + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
+
GamePanel Member List
+
+
+This is the complete list of members for GamePanel, including all inherited members. + + + + + + + + + + + + + + + + + + + + + +
_allegroGamePanel [private]
_backScreenPanel [protected]
_bitmapStoreGamePanel [private]
_heightScreenPanel [protected]
_mazeblockWidthGamePanel [private]
_offsetXGamePanel [private]
_offsetYGamePanel [private]
_widthScreenPanel [protected]
BLANKScreenPanel [protected, static]
BLOCKS_PER_ROWGamePanel [private, static]
draw(const Maze &maze, const list< PlayerCar > &players, const list< EnemyCar > &enemies, const list< Checkpoint > &checkpoints, const list< Rock > &rocks, const list< Smokescreen > &smokescreens, const list< DestroyedObjectPopup > &popups)GamePanel [virtual]
draw(const Maze &maze)GamePanel [private]
draw(const GameObject &object)GamePanel [private]
flip()ScreenPanel [virtual]
GamePanel(ALLEGRO_BITMAP *back, ALLEGRO_BITMAP *front, int x, int y, int width, int height)GamePanel
GamePanel(const GamePanel &ref)GamePanel [private]
getPanelX(const double &x) const GamePanel [private]
getPanelY(const double &y) const GamePanel [private]
operator=(const GamePanel &rhs)GamePanel [private]
ScreenPanel(ALLEGRO_BITMAP *back, ALLEGRO_BITMAP *front, int x, int y, int width, int height)ScreenPanel
~ScreenPanel()ScreenPanel [virtual]
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/class_game_panel.html b/docs/html/class_game_panel.html new file mode 100644 index 0000000..ec424e9 --- /dev/null +++ b/docs/html/class_game_panel.html @@ -0,0 +1,580 @@ + + + + +Rally X: GamePanel Class Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+ +
+
GamePanel Class Reference
+
+
+ +

ScreenPanel to be drawn on the screen to draw the area where the game takes place. + More...

+ +

#include <GamePanel.h>

+
+Inheritance diagram for GamePanel:
+
+
+ + +ScreenPanel + +
+ +

List of all members.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

 GamePanel (ALLEGRO_BITMAP *back, ALLEGRO_BITMAP *front, int x, int y, int width, int height)
 Creates a GamePanel from the given back and front buffers.
virtual void draw (const Maze &maze, const list< PlayerCar > &players, const list< EnemyCar > &enemies, const list< Checkpoint > &checkpoints, const list< Rock > &rocks, const list< Smokescreen > &smokescreens, const list< DestroyedObjectPopup > &popups)
 Draws the given objects on the screen.

+Private Member Functions

 GamePanel (const GamePanel &ref)
 Copy constructor not implemented, ScreenPanels should not be copied.
GamePaneloperator= (const GamePanel &rhs)
 Assignment operator not implemented, ScreenPanels should not be copied.
float getPanelX (const double &x) const
 Converts an x game coordinate value to its equivalent in pixels.
float getPanelY (const double &y) const
 Converts a y game coordinate value to its equivalent in pixels.
void draw (const Maze &maze)
 Draws a Maze on the screen.
void draw (const GameObject &object)
 Draws a single GameObject on the screen.

+Private Attributes

unsigned int _mazeblockWidth
 The width of one (square) Maze block on the screen, in pixels.
float _offsetX
 The amount that drawing should be offset to the right, recalculated every frame.
float _offsetY
 The amount that drawing should be offset downwards, recalculated every frame.
BitmapStore _bitmapStore
 Used to cache ALLEGRO_BITMAPs, so that they only need to be drawn once.
AllegroInit _allegro
 Handles dependencies on Allegro.

+Static Private Attributes

static const int BLOCKS_PER_ROW = 15
 The number of Maze blocks in one row shown on the panel at a time. Used to determine the scale.
+

Detailed Description

+

ScreenPanel to be drawn on the screen to draw the area where the game takes place.

+

This includes the scrolling maze and all of the GameObjects.

+
Author:
Justin Wernick
+
+David Schneider
+ +

Definition at line 23 of file GamePanel.h.

+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
GamePanel::GamePanel (ALLEGRO_BITMAP * back,
ALLEGRO_BITMAP * front,
int x,
int y,
int width,
int height 
)
+
+
+ +

Creates a GamePanel from the given back and front buffers.

+

The sub-bitmaps that GamePanel uses are created from a rectangular region on back and front that has its top left corner at the coordinate x,y, is width long in the x direction, and height long in the y direction.

+
Parameters:
+ + + + + + + +
[in]backThe current back buffer of the display being sub-bitmapped.
[in]frontThe current front buffer (image currently being displayed) of the display being sub-bitmapped.
[in]xThe x coordinate of the left side of the sub-bitmap in pixels.
[in]yThe x coordinate of the top of the sub-bitmap in pixels.
[in]widthThe length in the x direction of the new sub-bitmap in pixels.
[in]heightThe length in the y direction of the new sub-bitmap in pixels.
+
+
+ +

Definition at line 3 of file GamePanel.cpp.

+ +
+
+ +
+
+ + + + + + + + +
GamePanel::GamePanel (const GamePanelref) [private]
+
+
+ +

Copy constructor not implemented, ScreenPanels should not be copied.

+ +
+
+

Member Function Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void GamePanel::draw (const Mazemaze,
const list< PlayerCar > & players,
const list< EnemyCar > & enemies,
const list< Checkpoint > & checkpoints,
const list< Rock > & rocks,
const list< Smokescreen > & smokescreens,
const list< DestroyedObjectPopup > & popups 
) [virtual]
+
+
+ +

Draws the given objects on the screen.

+

The drawing is offset so that the first entry in players is in the middle of the panel. However, the offset will never be such that the drawing area will be outside of the maze.

+
Parameters:
+ + + + + + + + +
[in]mazeThe Maze that all of the objects are in.
[in]playersThe list of PlayerCars to be drawn.
[in]enemiesThe list of EnemyCars to be drawn.
[in]checkpointsThe list of Checkpoints to be drawn.
[in]rocksThe list of Rocks to be drawn.
[in]smokescreensThe list of Smokescreens to be drawn.
[in]popupsThe list of DestroyedObjectPopups to be drawn.
+
+
+ +

Implements ScreenPanel.

+ +

Definition at line 12 of file GamePanel.cpp.

+ +
+
+ +
+
+ + + + + + + + +
void GamePanel::draw (const Mazemaze) [private]
+
+
+ +

Draws a Maze on the screen.

+

Bitmaps used to represent solid and non-solid parts of the Maze are stored in the BitmapStore.

+
Parameters:
+ + +
[in]mazeThe Maze to be drawn.
+
+
+ +

Definition at line 63 of file GamePanel.cpp.

+ +
+
+ +
+
+ + + + + + + + +
void GamePanel::draw (const GameObjectobject) [private]
+
+
+ +

Draws a single GameObject on the screen.

+

The bitmap to be drawn is retrieved from the BitmapStore using the GameObject's image.

+
Parameters:
+ + +
[in]objectThe GameObject to be drawn.
+
+
+ +

Definition at line 92 of file GamePanel.cpp.

+ +
+
+ +
+
+ + + + + + + + +
float GamePanel::getPanelX (const double & x) const [private]
+
+
+ +

Converts an x game coordinate value to its equivalent in pixels.

+

Converting to the pixel coordinates happens for every object every frame. To increase performance, the parameters are passed in by constant reference instead of by value.

+
Parameters:
+ + +
[in]xThe game coordinate to be converted into pixels.
+
+
+ +

Definition at line 126 of file GamePanel.cpp.

+ +
+
+ +
+
+ + + + + + + + +
float GamePanel::getPanelY (const double & y) const [private]
+
+
+ +

Converts a y game coordinate value to its equivalent in pixels.

+

Converting to the pixel coordinates happens for every object every frame. To increase performance, the parameters are passed in by constant reference instead of by value.

+
Parameters:
+ + +
[in]yThe game coordinate to be converted into pixels.
+
+
+ +

Definition at line 130 of file GamePanel.cpp.

+ +
+
+ +
+
+ + + + + + + + +
GamePanel& GamePanel::operator= (const GamePanelrhs) [private]
+
+
+ +

Assignment operator not implemented, ScreenPanels should not be copied.

+ +
+
+

Member Data Documentation

+ +
+
+ + + + +
AllegroInit GamePanel::_allegro [private]
+
+
+ +

Handles dependencies on Allegro.

+ +

Reimplemented from ScreenPanel.

+ +

Definition at line 114 of file GamePanel.h.

+ +
+
+ +
+
+ + + + +
BitmapStore GamePanel::_bitmapStore [private]
+
+
+ +

Used to cache ALLEGRO_BITMAPs, so that they only need to be drawn once.

+ +

Definition at line 112 of file GamePanel.h.

+ +
+
+ +
+
+ + + + +
unsigned int GamePanel::_mazeblockWidth [private]
+
+
+ +

The width of one (square) Maze block on the screen, in pixels.

+ +

Definition at line 107 of file GamePanel.h.

+ +
+
+ +
+
+ + + + +
float GamePanel::_offsetX [private]
+
+
+ +

The amount that drawing should be offset to the right, recalculated every frame.

+ +

Definition at line 109 of file GamePanel.h.

+ +
+
+ +
+
+ + + + +
float GamePanel::_offsetY [private]
+
+
+ +

The amount that drawing should be offset downwards, recalculated every frame.

+ +

Definition at line 110 of file GamePanel.h.

+ +
+
+ +
+
+ + + + +
const int GamePanel::BLOCKS_PER_ROW = 15 [static, private]
+
+
+ +

The number of Maze blocks in one row shown on the panel at a time. Used to determine the scale.

+ +

Definition at line 105 of file GamePanel.h.

+ +
+
+
The documentation for this class was generated from the following files: +
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/class_game_panel.png b/docs/html/class_game_panel.png new file mode 100644 index 0000000..8d7408e Binary files /dev/null and b/docs/html/class_game_panel.png differ diff --git a/docs/html/class_info_panel-members.html b/docs/html/class_info_panel-members.html new file mode 100644 index 0000000..6a782a6 --- /dev/null +++ b/docs/html/class_info_panel-members.html @@ -0,0 +1,137 @@ + + + + +Rally X: Member List + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
+
InfoPanel Member List
+
+
+This is the complete list of members for InfoPanel, including all inherited members. + + + + + + + + + + + + + + + + + + + + + + + + + + + +
_backScreenPanel [protected]
_checkpointHeadingYInfoPanel [private]
_checkpointValueYInfoPanel [private]
_colourStoreInfoPanel [private]
_drawingInfoPanel [private]
_heightScreenPanel [protected]
_miniMazeblockWidthInfoPanel [private]
_miniMazeHeightInfoPanel [private]
_miniMazeYInfoPanel [private]
_panelFontInfoPanel [private]
_petrolGuageHeightInfoPanel [private]
_petrolGuageYInfoPanel [private]
_petrolHeadingYInfoPanel [private]
_widthScreenPanel [protected]
BLANKScreenPanel [protected, static]
draw(const Maze &maze, const list< PlayerCar > &players, const list< EnemyCar > &enemies, const list< Checkpoint > &checkpoints, const list< Rock > &rocks, const list< Smokescreen > &smokescreens, const list< DestroyedObjectPopup > &popups)InfoPanel [virtual]
draw(const Maze &maze)InfoPanel [private]
draw(const GameObject &object)InfoPanel [private]
flip()ScreenPanel [virtual]
getPanelX(const double &x) const InfoPanel [private]
getPanelY(const double &y) const InfoPanel [private]
InfoPanel(ALLEGRO_BITMAP *back, ALLEGRO_BITMAP *front, int x, int y, int width, int height)InfoPanel
InfoPanel(const InfoPanel &ref)InfoPanel [private]
operator=(const InfoPanel &rhs)InfoPanel [private]
ScreenPanel(ALLEGRO_BITMAP *back, ALLEGRO_BITMAP *front, int x, int y, int width, int height)ScreenPanel
~InfoPanel()InfoPanel
~ScreenPanel()ScreenPanel [virtual]
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/class_info_panel.html b/docs/html/class_info_panel.html new file mode 100644 index 0000000..c01e1ad --- /dev/null +++ b/docs/html/class_info_panel.html @@ -0,0 +1,695 @@ + + + + +Rally X: InfoPanel Class Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+ +
+
InfoPanel Class Reference
+
+
+ +

ScreenPanel to be drawn on the screen to give the player information. + More...

+ +

#include <InfoPanel.h>

+
+Inheritance diagram for InfoPanel:
+
+
+ + +ScreenPanel + +
+ +

List of all members.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

 InfoPanel (ALLEGRO_BITMAP *back, ALLEGRO_BITMAP *front, int x, int y, int width, int height)
 Creates an InfoPanel from the given back and front buffers.
 ~InfoPanel ()
 Destructor that ensured that the font created is destroyed.
virtual void draw (const Maze &maze, const list< PlayerCar > &players, const list< EnemyCar > &enemies, const list< Checkpoint > &checkpoints, const list< Rock > &rocks, const list< Smokescreen > &smokescreens, const list< DestroyedObjectPopup > &popups)
 Draws the InfoPanel using the given objects.

+Private Member Functions

 InfoPanel (const InfoPanel &ref)
 Copy constructor not implemented, ScreenPanels should not be copied.
InfoPaneloperator= (const InfoPanel &rhs)
 Assignment operator not implemented, ScreenPanels should not be copied.
float getPanelX (const double &x) const
 Converts an x game coordinate value to its equivalent in pixels.
float getPanelY (const double &y) const
 Converts a y game coordinate value to its equivalent in pixels.
void draw (const Maze &maze)
 Draws a Maze on the panel.
void draw (const GameObject &object)
 Draws a single GameObject on the panel.

+Private Attributes

AllegroDrawingInit _drawing
 Handles dependencies on Allegro's primitive drawing functions.
ColourStore _colourStore
 Caches colours for drawing.
float _petrolHeadingY
 The y coordinate of the heading for the petrol guage.
float _petrolGuageY
 The y coordinate of top of the petrol guage.
float _petrolGuageHeight
 The height of the rectangle that is the petrol guage.
float _checkpointHeadingY
 The y coordinate of the heading for the number of remaining checkpoints.
float _checkpointValueY
 The y coordinate of the text stating the number of remaining checkpoints.
float _miniMazeY
 The y coordinate of the top of the Maze.
float _miniMazeHeight
 The height of the Maze.
float _miniMazeblockWidth
 The width of each Maze block being drawn.
ALLEGRO_FONT * _panelFont
 The font being used to write the headings and number of checkpoints remaining.
+

Detailed Description

+

ScreenPanel to be drawn on the screen to give the player information.

+

This includes the minimap, a scaled down version of the entire maze that does not scroll, with icons to represent the PlayerCar, EnemyCars, and Checkpoints. Text is drawn to show the player the number of Checkpoints that needed to be collected for victory, and a rectangle is drawn representing the amount of petrol that the PlayerCar has left.

+
Author:
Justin Wernick
+
+David Schneider
+ +

Definition at line 30 of file InfoPanel.h.

+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
InfoPanel::InfoPanel (ALLEGRO_BITMAP * back,
ALLEGRO_BITMAP * front,
int x,
int y,
int width,
int height 
)
+
+
+ +

Creates an InfoPanel from the given back and front buffers.

+

The sub-bitmaps that InfoPanel uses are created from a rectangular region on back and front that has its top left corner at the coordinate x,y, is width long in the x direction, and height long in the y direction.

+
Parameters:
+ + + + + + + +
[in]backThe current back buffer of the display being sub-bitmapped.
[in]frontThe current front buffer (image currently being displayed) of the display being sub-bitmapped.
[in]xThe x coordinate of the left side of the sub-bitmap in pixels.
[in]yThe x coordinate of the top of the sub-bitmap in pixels.
[in]widthThe length in the x direction of the new sub-bitmap in pixels.
[in]heightThe length in the y direction of the new sub-bitmap in pixels.
+
+
+ +

Definition at line 3 of file InfoPanel.cpp.

+ +
+
+ +
+
+ + + + + + + +
InfoPanel::~InfoPanel ()
+
+
+ +

Destructor that ensured that the font created is destroyed.

+

The memory for the sub-bitmaps are handled by the parent class, ScreenPanel.

+ +

Definition at line 22 of file InfoPanel.cpp.

+ +
+
+ +
+
+ + + + + + + + +
InfoPanel::InfoPanel (const InfoPanelref) [private]
+
+
+ +

Copy constructor not implemented, ScreenPanels should not be copied.

+ +
+
+

Member Function Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void InfoPanel::draw (const Mazemaze,
const list< PlayerCar > & players,
const list< EnemyCar > & enemies,
const list< Checkpoint > & checkpoints,
const list< Rock > & rocks,
const list< Smokescreen > & smokescreens,
const list< DestroyedObjectPopup > & popups 
) [virtual]
+
+
+ +

Draws the InfoPanel using the given objects.

+

Not all of the provided objects are needed for the drawing process, but they are included to give the most general drawing case. This is to support polymorphism, where the InfoPanel can be told to draw its sub-bitmap in the same manner as any other ScreenPanel.

+

The scale of the minimap is determined at the beginning of each frame, so that it will always fit even if the maze is larger than on the last frame.

+
Parameters:
+ + + + + + + + +
[in]mazeThe Maze that all of the objects are in.
[in]playersThe list of PlayerCars to be drawn.
[in]enemiesThe list of EnemyCars to be drawn.
[in]checkpointsThe list of Checkpoints to be drawn.
[in]rocksRocks are not actually drawn.
[in]smokescreensSmokescreens are not actually drawn.
[in]popupsDestroyedObjectPopups are not actually drawn.
+
+
+ +

Implements ScreenPanel.

+ +

Definition at line 27 of file InfoPanel.cpp.

+ +
+
+ +
+
+ + + + + + + + +
void InfoPanel::draw (const Mazemaze) [private]
+
+
+ +

Draws a Maze on the panel.

+

The Maze is constructed of coloured squares. The colour of the squares is retrieved from the ColourStore.

+

Unlike in the GamePanel, the entire Maze is drawn.

+
Parameters:
+ + +
[in]mazeThe Maze to be drawn.
+
+
+ +

Definition at line 71 of file InfoPanel.cpp.

+ +
+
+ +
+
+ + + + + + + + +
void InfoPanel::draw (const GameObjectobject) [private]
+
+
+ +

Draws a single GameObject on the panel.

+

The GameObject is represented by a coloured circle in the Maze. The colour is based on the GameObject's image and is retrieved from the ColourStore.

+
Parameters:
+ + +
[in]objectThe GameObject to be drawn.
+
+
+ +

Definition at line 96 of file InfoPanel.cpp.

+ +
+
+ +
+
+ + + + + + + + +
float InfoPanel::getPanelX (const double & x) const [private]
+
+
+ +

Converts an x game coordinate value to its equivalent in pixels.

+

Converting to the pixel coordinates happens for every object every frame. To increase performance, the parameters are passed in by constant reference instead of by value.

+
Parameters:
+ + +
[in]xThe game coordinate to be converted into pixels.
+
+
+ +

Definition at line 104 of file InfoPanel.cpp.

+ +
+
+ +
+
+ + + + + + + + +
float InfoPanel::getPanelY (const double & y) const [private]
+
+
+ +

Converts a y game coordinate value to its equivalent in pixels.

+

Converting to the pixel coordinates happens for every object every frame. To increase performance, the parameters are passed in by constant reference instead of by value.

+
Parameters:
+ + +
[in]yThe game coordinate to be converted into pixels.
+
+
+ +

Definition at line 108 of file InfoPanel.cpp.

+ +
+
+ +
+
+ + + + + + + + +
InfoPanel& InfoPanel::operator= (const InfoPanelrhs) [private]
+
+
+ +

Assignment operator not implemented, ScreenPanels should not be copied.

+ +
+
+

Member Data Documentation

+ +
+
+ + + + +
float InfoPanel::_checkpointHeadingY [private]
+
+
+ +

The y coordinate of the heading for the number of remaining checkpoints.

+ +

Definition at line 131 of file InfoPanel.h.

+ +
+
+ +
+
+ + + + +
float InfoPanel::_checkpointValueY [private]
+
+
+ +

The y coordinate of the text stating the number of remaining checkpoints.

+ +

Definition at line 132 of file InfoPanel.h.

+ +
+
+ +
+
+ + + + +
ColourStore InfoPanel::_colourStore [private]
+
+
+ +

Caches colours for drawing.

+ +

Definition at line 126 of file InfoPanel.h.

+ +
+
+ +
+ +
+ +

Handles dependencies on Allegro's primitive drawing functions.

+ +

Definition at line 125 of file InfoPanel.h.

+ +
+
+ +
+
+ + + + +
float InfoPanel::_miniMazeblockWidth [private]
+
+
+ +

The width of each Maze block being drawn.

+ +

Definition at line 135 of file InfoPanel.h.

+ +
+
+ +
+
+ + + + +
float InfoPanel::_miniMazeHeight [private]
+
+
+ +

The height of the Maze.

+ +

Definition at line 134 of file InfoPanel.h.

+ +
+
+ +
+
+ + + + +
float InfoPanel::_miniMazeY [private]
+
+
+ +

The y coordinate of the top of the Maze.

+ +

Definition at line 133 of file InfoPanel.h.

+ +
+
+ +
+
+ + + + +
ALLEGRO_FONT* InfoPanel::_panelFont [private]
+
+
+ +

The font being used to write the headings and number of checkpoints remaining.

+ +

Definition at line 137 of file InfoPanel.h.

+ +
+
+ +
+
+ + + + +
float InfoPanel::_petrolGuageHeight [private]
+
+
+ +

The height of the rectangle that is the petrol guage.

+ +

Definition at line 130 of file InfoPanel.h.

+ +
+
+ +
+
+ + + + +
float InfoPanel::_petrolGuageY [private]
+
+
+ +

The y coordinate of top of the petrol guage.

+ +

Definition at line 129 of file InfoPanel.h.

+ +
+
+ +
+
+ + + + +
float InfoPanel::_petrolHeadingY [private]
+
+
+ +

The y coordinate of the heading for the petrol guage.

+ +

Definition at line 128 of file InfoPanel.h.

+ +
+
+
The documentation for this class was generated from the following files: +
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/class_info_panel.png b/docs/html/class_info_panel.png new file mode 100644 index 0000000..3a03eb5 Binary files /dev/null and b/docs/html/class_info_panel.png differ diff --git a/docs/html/class_install_failure.html b/docs/html/class_install_failure.html new file mode 100644 index 0000000..b858839 --- /dev/null +++ b/docs/html/class_install_failure.html @@ -0,0 +1,124 @@ + + + + +Rally X: InstallFailure Class Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
+
InstallFailure Class Reference
+
+
+ +

Exception to be thrown if any component of Allegro fails to install at runtime. + More...

+ +

#include <AllegroWrappers.h>

+

Detailed Description

+

Exception to be thrown if any component of Allegro fails to install at runtime.

+
Author:
Justin Wernick
+
+David Schneider
+ +

Definition at line 15 of file AllegroWrappers.h.

+

The documentation for this class was generated from the following file: +
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/class_keyboard_handler-members.html b/docs/html/class_keyboard_handler-members.html new file mode 100644 index 0000000..e299895 --- /dev/null +++ b/docs/html/class_keyboard_handler-members.html @@ -0,0 +1,130 @@ + + + + +Rally X: Member List + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
+
KeyboardHandler Member List
+
+
+This is the complete list of members for KeyboardHandler, including all inherited members. + + + + + + + + + + + + + + + + + + + + +
_downKeyboardHandler [private]
_keyboardKeyboardHandler [private]
_keyboardEventsKeyboardHandler [private]
_leftKeyboardHandler [private]
_previousFacingKeyboardHandler [private]
_rightKeyboardHandler [private]
_smokescreenKeyboardHandler [private]
_upKeyboardHandler [private]
DOWN_KEYKeyboardHandler [private, static]
getFacing()KeyboardHandler
getSmokescreen()KeyboardHandler
KeyboardHandler(Maze::Direction currentFacing)KeyboardHandler
KeyboardHandler(const KeyboardHandler &ref)KeyboardHandler
LEFT_KEYKeyboardHandler [private, static]
operator=(const KeyboardHandler &rhs)KeyboardHandler
RIGHT_KEYKeyboardHandler [private, static]
SMOKESCREEN_KEYKeyboardHandler [private, static]
UP_KEYKeyboardHandler [private, static]
updateFlags()KeyboardHandler [private]
~KeyboardHandler()KeyboardHandler
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/class_keyboard_handler.html b/docs/html/class_keyboard_handler.html new file mode 100644 index 0000000..97b0817 --- /dev/null +++ b/docs/html/class_keyboard_handler.html @@ -0,0 +1,559 @@ + + + + +Rally X: KeyboardHandler Class Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+ +
+
KeyboardHandler Class Reference
+
+
+ +

Class for handling keyboard related game inputs from the player. + More...

+ +

#include <KeyboardHandler.h>

+ +

List of all members.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

 KeyboardHandler (Maze::Direction currentFacing)
 Creates a KeyboardHandler with a given initial state.
 KeyboardHandler (const KeyboardHandler &ref)
 Copy constructor that ensures that a copy of a KeyboardHandler will have its own event queue.
KeyboardHandleroperator= (const KeyboardHandler &rhs)
 Assignment operator that ensures that an assigned KeyboardHandler will have its own event queue.
 ~KeyboardHandler ()
 Cleans up the keyboard event queue.
Maze::Direction getFacing ()
 Gives the last direction that the player entered on the keyboard.
bool getSmokescreen ()
 Gives whether or not the key for creating a Smokescreen is currently pressed.

+Private Member Functions

void updateFlags ()
 Processes all pending keyboard inputs, and updates flags as appropriate.

+Private Attributes

AllegroKeyboardInit _keyboard
 Ensures that dependencies on the Allegro keyboard library are installed.
bool _up
 True if the up arrow key is depressed.
bool _down
 True if the down arrow key is depressed.
bool _left
 True if the left arrow key is depressed.
bool _right
 True if the right arrow key is depressed.
bool _smokescreen
 True if the smokescreen key is depressed.
Maze::Direction _previousFacing
 The direction that was returned on the last call of getFacing.
ALLEGRO_EVENT_QUEUE * _keyboardEvents
 Queue for all keyboard events.

+Static Private Attributes

static const int UP_KEY = ALLEGRO_KEY_UP
 Key that must be pressed to turn up.
static const int DOWN_KEY = ALLEGRO_KEY_DOWN
 Key that must be pressed to turn down.
static const int LEFT_KEY = ALLEGRO_KEY_LEFT
 Key that must be pressed to turn left.
static const int RIGHT_KEY = ALLEGRO_KEY_RIGHT
 Key that must be pressed to turn right.
static const int SMOKESCREEN_KEY = ALLEGRO_KEY_SPACE
 Key that must be pressed to create a smokescreen.
+

Detailed Description

+

Class for handling keyboard related game inputs from the player.

+

Written with controlling a PlayerCar in mind. The handler keeps track of the last direction pushed and responds to requests from the PlayerCar for which direction it should face next, and whether the player is pressing the Smokescreen button.

+
Author:
Justin Wernick
+
+David Schneider
+ +

Definition at line 19 of file KeyboardHandler.h.

+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + + +
KeyboardHandler::KeyboardHandler (Maze::Direction currentFacing)
+
+
+ +

Creates a KeyboardHandler with a given initial state.

+
Parameters:
+ + +
[in]currentFacingThe initial value for the previous facing of the object being controlled.
+
+
+ +

Definition at line 3 of file KeyboardHandler.cpp.

+ +
+
+ +
+
+ + + + + + + + +
KeyboardHandler::KeyboardHandler (const KeyboardHandlerref)
+
+
+ +

Copy constructor that ensures that a copy of a KeyboardHandler will have its own event queue.

+ +

Definition at line 15 of file KeyboardHandler.cpp.

+ +
+
+ +
+
+ + + + + + + +
KeyboardHandler::~KeyboardHandler ()
+
+
+ +

Cleans up the keyboard event queue.

+ +

Definition at line 44 of file KeyboardHandler.cpp.

+ +
+
+

Member Function Documentation

+ +
+
+ + + + + + + +
Maze::Direction KeyboardHandler::getFacing ()
+
+
+ +

Gives the last direction that the player entered on the keyboard.

+

All pending keyboard events are processed, then a key out of those currently depressed is returned. The precendence for keys held down (up, down, left, then right) is arbitrary, since the player should not be holding down more than one arrow key at a time. If no keys are currently depressed, the value returned on the last call is returned again.

+
Returns:
The direction that the player has chosen through pressing arrow keys.
+ +

Definition at line 99 of file KeyboardHandler.cpp.

+ +
+
+ +
+
+ + + + + + + +
bool KeyboardHandler::getSmokescreen ()
+
+
+ +

Gives whether or not the key for creating a Smokescreen is currently pressed.

+
Returns:
True if a Smokescreen should be created.
+ +

Definition at line 111 of file KeyboardHandler.cpp.

+ +
+
+ +
+
+ + + + + + + + +
KeyboardHandler & KeyboardHandler::operator= (const KeyboardHandlerrhs)
+
+
+ +

Assignment operator that ensures that an assigned KeyboardHandler will have its own event queue.

+ +

Definition at line 27 of file KeyboardHandler.cpp.

+ +
+
+ +
+
+ + + + + + + +
void KeyboardHandler::updateFlags () [private]
+
+
+ +

Processes all pending keyboard inputs, and updates flags as appropriate.

+ +

Definition at line 49 of file KeyboardHandler.cpp.

+ +
+
+

Member Data Documentation

+ +
+
+ + + + +
bool KeyboardHandler::_down [private]
+
+
+ +

True if the down arrow key is depressed.

+ +

Definition at line 69 of file KeyboardHandler.h.

+ +
+
+ +
+ +
+ +

Ensures that dependencies on the Allegro keyboard library are installed.

+ +

Definition at line 61 of file KeyboardHandler.h.

+ +
+
+ +
+
+ + + + +
ALLEGRO_EVENT_QUEUE* KeyboardHandler::_keyboardEvents [private]
+
+
+ +

Queue for all keyboard events.

+ +

Definition at line 74 of file KeyboardHandler.h.

+ +
+
+ +
+
+ + + + +
bool KeyboardHandler::_left [private]
+
+
+ +

True if the left arrow key is depressed.

+ +

Definition at line 70 of file KeyboardHandler.h.

+ +
+
+ +
+ +
+ +

The direction that was returned on the last call of getFacing.

+ +

Definition at line 73 of file KeyboardHandler.h.

+ +
+
+ +
+
+ + + + +
bool KeyboardHandler::_right [private]
+
+
+ +

True if the right arrow key is depressed.

+ +

Definition at line 71 of file KeyboardHandler.h.

+ +
+
+ +
+
+ + + + +
bool KeyboardHandler::_smokescreen [private]
+
+
+ +

True if the smokescreen key is depressed.

+ +

Definition at line 72 of file KeyboardHandler.h.

+ +
+
+ +
+
+ + + + +
bool KeyboardHandler::_up [private]
+
+
+ +

True if the up arrow key is depressed.

+ +

Definition at line 68 of file KeyboardHandler.h.

+ +
+
+ +
+
+ + + + +
const int KeyboardHandler::DOWN_KEY = ALLEGRO_KEY_DOWN [static, private]
+
+
+ +

Key that must be pressed to turn down.

+ +

Definition at line 77 of file KeyboardHandler.h.

+ +
+
+ +
+
+ + + + +
const int KeyboardHandler::LEFT_KEY = ALLEGRO_KEY_LEFT [static, private]
+
+
+ +

Key that must be pressed to turn left.

+ +

Definition at line 78 of file KeyboardHandler.h.

+ +
+
+ +
+
+ + + + +
const int KeyboardHandler::RIGHT_KEY = ALLEGRO_KEY_RIGHT [static, private]
+
+
+ +

Key that must be pressed to turn right.

+ +

Definition at line 79 of file KeyboardHandler.h.

+ +
+
+ +
+
+ + + + +
const int KeyboardHandler::SMOKESCREEN_KEY = ALLEGRO_KEY_SPACE [static, private]
+
+
+ +

Key that must be pressed to create a smokescreen.

+ +

Definition at line 80 of file KeyboardHandler.h.

+ +
+
+ +
+
+ + + + +
const int KeyboardHandler::UP_KEY = ALLEGRO_KEY_UP [static, private]
+
+
+ +

Key that must be pressed to turn up.

+ +

Definition at line 76 of file KeyboardHandler.h.

+ +
+
+
The documentation for this class was generated from the following files: +
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/class_level_reader-members.html b/docs/html/class_level_reader-members.html new file mode 100644 index 0000000..d53251c --- /dev/null +++ b/docs/html/class_level_reader-members.html @@ -0,0 +1,118 @@ + + + + +Rally X: Member List + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
+
LevelReader Member List
+
+
+This is the complete list of members for LevelReader, including all inherited members. + + + + + + + + +
_filenameLevelReader [private]
CHECKPOINT_CHARLevelReader [private, static]
ENEMY_CHARLevelReader [private, static]
LevelReader(string filename)LevelReader
PLAYER_CHARLevelReader [private, static]
readLevel(Maze &maze, list< PlayerCar > &players, list< EnemyCar > &enemies, list< Checkpoint > &checkpoints, list< Rock > &rocks)LevelReader
ROCK_CHARLevelReader [private, static]
WALL_CHARLevelReader [private, static]
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/class_level_reader.html b/docs/html/class_level_reader.html new file mode 100644 index 0000000..07bc827 --- /dev/null +++ b/docs/html/class_level_reader.html @@ -0,0 +1,347 @@ + + + + +Rally X: LevelReader Class Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+ +
+
LevelReader Class Reference
+
+
+ +

Reads the game objects from a text file and calls relevant constructors. + More...

+ +

#include <LevelReader.h>

+ +

List of all members.

+ + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

 LevelReader (string filename)
 Constructor that stores the path of the file containing the level to be read with the readLevel function.
void readLevel (Maze &maze, list< PlayerCar > &players, list< EnemyCar > &enemies, list< Checkpoint > &checkpoints, list< Rock > &rocks)
 Function to read the chosen file into the data structures used in the game.

+Private Attributes

string _filename
 Path of the file containing the level.

+Static Private Attributes

static const char PLAYER_CHAR = '@'
 Character represented a PlayerCar in the level file.
static const char ENEMY_CHAR = 'X'
 Character represented an EnemyCar in the level file.
static const char CHECKPOINT_CHAR = 'P'
 Character represented a Checkpoint in the level file.
static const char ROCK_CHAR = 'O'
 Character represented a Rock in the level file.
static const char WALL_CHAR = '#'
 Character represented a solid part of the maze in the level file.
+

Detailed Description

+

Reads the game objects from a text file and calls relevant constructors.

+
Author:
Justin Wernick
+
+David Schneider
+ +

Definition at line 35 of file LevelReader.h.

+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + + +
LevelReader::LevelReader (string filename)
+
+
+ +

Constructor that stores the path of the file containing the level to be read with the readLevel function.

+
Parameters:
+ + +
[in]filenameThe path of the file containing the level.
+
+
+ +

Definition at line 3 of file LevelReader.cpp.

+ +
+
+

Member Function Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void LevelReader::readLevel (Mazemaze,
list< PlayerCar > & players,
list< EnemyCar > & enemies,
list< Checkpoint > & checkpoints,
list< Rock > & rocks 
)
+
+
+ +

Function to read the chosen file into the data structures used in the game.

+

Each character in the file is iterated through, and added to the appropriate data structure if it matches one of the defined constants. Lists should be cleared prior to calling this function.

+
Parameters:
+ + + + + + +
[out]mazeObject representing the walls, populated with a vector of x,y pairs.
[out]playersList representing the player(s) in the game.
[out]enemiesList representing the enemies in the game.
[out]checkpointsList representing the checkpoints in the game.
[out]rocksList representing the rocks in the game.
+
+
+ +

Definition at line 7 of file LevelReader.cpp.

+ +
+
+

Member Data Documentation

+ +
+
+ + + + +
string LevelReader::_filename [private]
+
+
+ +

Path of the file containing the level.

+ +

Definition at line 68 of file LevelReader.h.

+ +
+
+ +
+
+ + + + +
const char LevelReader::CHECKPOINT_CHAR = 'P' [static, private]
+
+
+ +

Character represented a Checkpoint in the level file.

+ +

Definition at line 64 of file LevelReader.h.

+ +
+
+ +
+
+ + + + +
const char LevelReader::ENEMY_CHAR = 'X' [static, private]
+
+
+ +

Character represented an EnemyCar in the level file.

+ +

Definition at line 63 of file LevelReader.h.

+ +
+
+ +
+
+ + + + +
const char LevelReader::PLAYER_CHAR = '@' [static, private]
+
+
+ +

Character represented a PlayerCar in the level file.

+ +

Definition at line 62 of file LevelReader.h.

+ +
+
+ +
+
+ + + + +
const char LevelReader::ROCK_CHAR = 'O' [static, private]
+
+
+ +

Character represented a Rock in the level file.

+ +

Definition at line 65 of file LevelReader.h.

+ +
+
+ +
+
+ + + + +
const char LevelReader::WALL_CHAR = '#' [static, private]
+
+
+ +

Character represented a solid part of the maze in the level file.

+ +

Definition at line 66 of file LevelReader.h.

+ +
+
+
The documentation for this class was generated from the following files: +
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/class_limited_time_object-members.html b/docs/html/class_limited_time_object-members.html new file mode 100644 index 0000000..4461dce --- /dev/null +++ b/docs/html/class_limited_time_object-members.html @@ -0,0 +1,124 @@ + + + + +Rally X: Member List + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
+
LimitedTimeObject Member List
+
+
+This is the complete list of members for LimitedTimeObject, including all inherited members. + + + + + + + + + + + + + + +
_destroyedGameObject [protected]
_facingGameObject [protected]
_imageGameObject [protected]
_remainingTimeLimitedTimeObject [private]
_xGameObject [protected]
_yGameObject [protected]
destroyed() const GameObject
facing() const GameObject
GameObject(double x, double y, BitmapStore::Image image, Maze::Direction facing=Maze::UP)GameObject
image() const GameObject
LimitedTimeObject(double x, double y, BitmapStore::Image image, int time)LimitedTimeObject
update()LimitedTimeObject
x() const GameObject
y() const GameObject
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/class_limited_time_object.html b/docs/html/class_limited_time_object.html new file mode 100644 index 0000000..7c34b4b --- /dev/null +++ b/docs/html/class_limited_time_object.html @@ -0,0 +1,247 @@ + + + + +Rally X: LimitedTimeObject Class Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+ +
+
LimitedTimeObject Class Reference
+
+
+ +

Parent class for GameObjects that are created, exist for a given time, and are then destroyed. + More...

+ +

#include <LimitedTimeObject.h>

+
+Inheritance diagram for LimitedTimeObject:
+
+
+ + +GameObject +DestroyedObjectPopup +Smokescreen + +
+ +

List of all members.

+ + + + + + + + + +

+Public Member Functions

 LimitedTimeObject (double x, double y, BitmapStore::Image image, int time)
 Creates a LimitedTimeObject with the given parameters.
void update ()
 Function that should be run on every iteration of the gameloop.

+Private Attributes

int _remainingTime
 The number of times that update still needs to be run before the object is marked for destruction.
+

Detailed Description

+

Parent class for GameObjects that are created, exist for a given time, and are then destroyed.

+
Author:
Justin Wernick
+
+David Schneider
+ +

Definition at line 14 of file LimitedTimeObject.h.

+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
LimitedTimeObject::LimitedTimeObject (double x,
double y,
BitmapStore::Image image,
int time 
)
+
+
+ +

Creates a LimitedTimeObject with the given parameters.

+
Parameters:
+ + + + + +
[in]xThe x coordinate of the new object.
[in]yThe y coordinate of the new object.
[in]imageThe image that is drawn to represent the object.
[in]timeThe number of times that the update function is run before the object is destroyed.
+
+
+ +

Definition at line 3 of file LimitedTimeObject.cpp.

+ +
+
+

Member Function Documentation

+ +
+
+ + + + + + + +
void LimitedTimeObject::update ()
+
+
+ +

Function that should be run on every iteration of the gameloop.

+

The time remaining is decremented, and the object is marked for destruction when it reaches zero.

+ +

Definition at line 9 of file LimitedTimeObject.cpp.

+ +
+
+

Member Data Documentation

+ +
+
+ + + + +
int LimitedTimeObject::_remainingTime [private]
+
+
+ +

The number of times that update still needs to be run before the object is marked for destruction.

+

For example, if the remaining time is 1, then the object is marked on the next update.

+ +

Definition at line 42 of file LimitedTimeObject.h.

+ +
+
+
The documentation for this class was generated from the following files: +
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/class_limited_time_object.png b/docs/html/class_limited_time_object.png new file mode 100644 index 0000000..e3d5438 Binary files /dev/null and b/docs/html/class_limited_time_object.png differ diff --git a/docs/html/class_maze-members.html b/docs/html/class_maze-members.html new file mode 100644 index 0000000..dfae67a --- /dev/null +++ b/docs/html/class_maze-members.html @@ -0,0 +1,125 @@ + + + + +Rally X: Member List + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
+
Maze Member List
+
+
+This is the complete list of members for Maze, including all inherited members. + + + + + + + + + + + + + + + +
_heightMaze [private]
_wallLocationsMaze [private]
_widthMaze [private]
backwards(Direction forwards)Maze [static]
BoolGrid typedefMaze [private]
Direction enum nameMaze
DOWN enum valueMaze
generateMaze(const vector< pair< int, int > > &walls, int maxObjectX=0, int maxObjectY=0)Maze
getSolid(const int &x, const int &y) const Maze
height() const Maze
LEFT enum valueMaze
Maze()Maze
RIGHT enum valueMaze
UP enum valueMaze
width() const Maze
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/class_maze.html b/docs/html/class_maze.html new file mode 100644 index 0000000..873efac --- /dev/null +++ b/docs/html/class_maze.html @@ -0,0 +1,450 @@ + + + + +Rally X: Maze Class Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+ +
+
Maze Class Reference
+
+
+ +

A rectangular 2D boolean array, representing where cars can drive and where they cannot. + More...

+ +

#include <Maze.h>

+ +

List of all members.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Public Types

enum  Direction { UP, +DOWN, +LEFT, +RIGHT + }
 Defines the directions in which movement can happen in the maze. More...

+Public Member Functions

 Maze ()
 Creates an empty Maze with width and height of zero.
void generateMaze (const vector< pair< int, int > > &walls, int maxObjectX=0, int maxObjectY=0)
 Generates a new Maze from the vector of wall coordinates.
bool getSolid (const int &x, const int &y) const
 Checks if a given position contains a wall or not.
int width () const
 Provides access to the width of the Maze object.
int height () const
 Provides access to the height of the Maze object.

+Static Public Member Functions

static Direction backwards (Direction forwards)
 Inverts a given direction, to give the value to face in the opposite direction.

+Private Types

typedef vector< vector< bool > > BoolGrid
 Provides an easier to read pseudonym for a 2 dimensional boolean vector.

+Private Attributes

BoolGrid _wallLocations
 The 2 dimensional vector that stores the locations of walls.
int _width
 The number of blocks in each row.
int _height
 The number of blocks in each column.
+

Detailed Description

+

A rectangular 2D boolean array, representing where cars can drive and where they cannot.

+
Author:
Justin Wernick
+
+David Schneider
+ +

Definition at line 14 of file Maze.h.

+

Member Typedef Documentation

+ +
+
+ + + + +
typedef vector<vector<bool> > Maze::BoolGrid [private]
+
+
+ +

Provides an easier to read pseudonym for a 2 dimensional boolean vector.

+ +

Definition at line 85 of file Maze.h.

+ +
+
+

Member Enumeration Documentation

+ +
+
+ + + + +
enum Maze::Direction
+
+
+ +

Defines the directions in which movement can happen in the maze.

+
Enumerator:
+ + + + +
UP  +
DOWN  +
LEFT  +
RIGHT  +
+
+
+ +

Definition at line 20 of file Maze.h.

+ +
+
+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + +
Maze::Maze ()
+
+
+ +

Creates an empty Maze with width and height of zero.

+ +

Definition at line 3 of file Maze.cpp.

+ +
+
+

Member Function Documentation

+ +
+
+ + + + + + + + +
Maze::Direction Maze::backwards (Direction forwards) [static]
+
+
+ +

Inverts a given direction, to give the value to face in the opposite direction.

+
Parameters:
+ + +
[in]forwardsThe direction to be inverted.
+
+
+
Returns:
The inverse of the given direction.
+ +

Definition at line 57 of file Maze.cpp.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
void Maze::generateMaze (const vector< pair< int, int > > & walls,
int maxObjectX = 0,
int maxObjectY = 0 
)
+
+
+ +

Generates a new Maze from the vector of wall coordinates.

+

The size of the Maze is chosen to just fit all of the walls. If objects exist outside of the walls, the x of the rightmost object and the y of the bottommost object can be passed in to make the Maze at least reach those coordinates.

+
Parameters:
+ + + + +
[in]wallsA vector of x,y coordinate pairs representing the locations of each wall block.
[in]maxObjectXThe minimum x value that the Maze must be able to index.
[in]maxObjectYThe minimum y value that the Maze must be able to index.
+
+
+ +

Definition at line 9 of file Maze.cpp.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
bool Maze::getSolid (const int & x,
const int & y 
) const
+
+
+ +

Checks if a given position contains a wall or not.

+

This function is one of the most called as it is called for each block drawing the Maze on the Screen, by any Car checking if it can move, and by the EnemyCar to choose a viable direction to face. As such, it has been optimised by passing the parameters by constant reference, even though they are primitives. Further, the vector class's bounds checking is bypassed, with bounds checking performed manually with the assumption that the 2D vector is rectangular, to increase performance. Neither of these changes impare readability.

+
Parameters:
+ + + +
[in]xThe x coordinate being queried.
[in]yThe y coordinate being queried.
+
+
+
Returns:
True if the location contains a wall. Also returns true if the coordinate is outside of the Maze.
+ +

Definition at line 40 of file Maze.cpp.

+ +
+
+ +
+
+ + + + + + + +
int Maze::height () const
+
+
+ +

Provides access to the height of the Maze object.

+
Returns:
The amount of blocks in each column of the maze.
+ +

Definition at line 52 of file Maze.cpp.

+ +
+
+ +
+
+ + + + + + + +
int Maze::width () const
+
+
+ +

Provides access to the width of the Maze object.

+
Returns:
The amount of blocks in each row of the maze.
+ +

Definition at line 48 of file Maze.cpp.

+ +
+
+

Member Data Documentation

+ +
+
+ + + + +
int Maze::_height [private]
+
+
+ +

The number of blocks in each column.

+ +

Definition at line 97 of file Maze.h.

+ +
+
+ +
+
+ + + + +
BoolGrid Maze::_wallLocations [private]
+
+
+ +

The 2 dimensional vector that stores the locations of walls.

+

The outer vector is columns, indexed with the x coordinate, and the inner vectors are the vertical positions in the column, indexed with the y coordinate. This results in a vector that is acced with _wallLocations.at(x).at(y).

+ +

Definition at line 94 of file Maze.h.

+ +
+
+ +
+
+ + + + +
int Maze::_width [private]
+
+
+ +

The number of blocks in each row.

+ +

Definition at line 96 of file Maze.h.

+ +
+
+
The documentation for this class was generated from the following files: +
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/class_maze_math-members.html b/docs/html/class_maze_math-members.html new file mode 100644 index 0000000..0916c33 --- /dev/null +++ b/docs/html/class_maze_math-members.html @@ -0,0 +1,115 @@ + + + + +Rally X: Member List + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
+
MazeMath Member List
+
+
+This is the complete list of members for MazeMath, including all inherited members. + + + + + +
distance(double x1, double y1, double x2, double y2)MazeMath [static]
MazeMath()MazeMath [private]
MazeMath(const MazeMath &ref)MazeMath [private]
operator=(const MazeMath &rhs)MazeMath [private]
round(double value)MazeMath [static]
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/class_maze_math.html b/docs/html/class_maze_math.html new file mode 100644 index 0000000..1f53f7f --- /dev/null +++ b/docs/html/class_maze_math.html @@ -0,0 +1,288 @@ + + + + +Rally X: MazeMath Class Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+ +
+
MazeMath Class Reference
+
+
+ +

Class of static methods for common math functions that occur in the 2D maze setting. + More...

+ +

#include <MazeMath.h>

+ +

List of all members.

+ + + + + + + + + + + + + +

+Static Public Member Functions

static double round (double value)
 Rounds a value to the nearest integer.
static double distance (double x1, double y1, double x2, double y2)
 Finds the straight line distance between two points on a 2D plane.

+Private Member Functions

 MazeMath ()
 Unimplemented constructor.
 MazeMath (const MazeMath &ref)
 Unimplemented copy constructor.
MazeMathoperator= (const MazeMath &rhs)
 Unimplemented assignment operator.
+

Detailed Description

+

Class of static methods for common math functions that occur in the 2D maze setting.

+
Author:
Justin Wernick
+
+David Schneider
+ +

Definition at line 12 of file MazeMath.h.

+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + +
MazeMath::MazeMath () [private]
+
+
+ +

Unimplemented constructor.

+

being a grouping of static functions, construction and destruction of MazeMath objects is unneccesary.

+ +
+
+ +
+
+ + + + + + + + +
MazeMath::MazeMath (const MazeMathref) [private]
+
+
+ +

Unimplemented copy constructor.

+ +
+
+

Member Function Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
double MazeMath::distance (double x1,
double y1,
double x2,
double y2 
) [static]
+
+
+ +

Finds the straight line distance between two points on a 2D plane.

+

Implemented using Pythagoras' Theorem.

+
Parameters:
+ + + + + +
[in]x1The x coordinate of the first point.
[in]y1The y coordinate of the first point.
[in]x2The x coordinate of the second point.
[in]y2The y coordinate of the second point.
+
+
+
Returns:
The distance between the two given points.
+ +

Definition at line 15 of file MazeMath.cpp.

+ +
+
+ +
+
+ + + + + + + + +
MazeMath& MazeMath::operator= (const MazeMathrhs) [private]
+
+
+ +

Unimplemented assignment operator.

+ +
+
+ +
+
+ + + + + + + + +
double MazeMath::round (double value) [static]
+
+
+ +

Rounds a value to the nearest integer.

+

Values with a decimal fraction less than 0.5 are floored, while values with a decimal fraction greater than or eqaul to 0.5 are ceiled.

+
Parameters:
+ + +
[in]valueThe number to be rounded off.
+
+
+
Returns:
The rounded off version of the given value.
+ +

Definition at line 3 of file MazeMath.cpp.

+ +
+
+
The documentation for this class was generated from the following files: +
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/class_player_car-members.html b/docs/html/class_player_car-members.html new file mode 100644 index 0000000..c7fa29a --- /dev/null +++ b/docs/html/class_player_car-members.html @@ -0,0 +1,137 @@ + + + + +Rally X: Member List + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
+
PlayerCar Member List
+
+
+This is the complete list of members for PlayerCar, including all inherited members. + + + + + + + + + + + + + + + + + + + + + + + + + + + +
_baseSpeedCar [protected, static]
_destroyedGameObject [protected]
_facingGameObject [protected]
_imageGameObject [protected]
_inputPlayerCar [private]
_petrolPlayerCar [private]
_speedCar [protected]
_xGameObject [protected]
_yGameObject [protected]
Car(double x, double y, BitmapStore::Image image, Maze::Direction facing)Car
crash()PlayerCar
destroyed() const GameObject
facing() const GameObject
GameObject(double x, double y, BitmapStore::Image image, Maze::Direction facing=Maze::UP)GameObject
gotCheckpoint()PlayerCar
image() const GameObject
makeSmoke(list< Smokescreen > &currentSmoke)PlayerCar
move(const Maze &maze)Car [protected]
petrol() const PlayerCar
PETROL_FROM_CHECKPOINTPlayerCar [private, static]
PETROL_USE_RATEPlayerCar [private, static]
PETROL_USE_SMOKESCREENPlayerCar [private, static]
PlayerCar(double x, double y, Maze::Direction facing=Maze::UP)PlayerCar
speed() const Car
update(const Maze &maze, list< Smokescreen > &currentSmoke)PlayerCar
x() const GameObject
y() const GameObject
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/class_player_car.html b/docs/html/class_player_car.html new file mode 100644 index 0000000..09bf834 --- /dev/null +++ b/docs/html/class_player_car.html @@ -0,0 +1,435 @@ + + + + +Rally X: PlayerCar Class Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+ +
+
PlayerCar Class Reference
+
+
+ +

A GameObject that is controlled by the player. + More...

+ +

#include <PlayerCar.h>

+
+Inheritance diagram for PlayerCar:
+
+
+ + +Car +GameObject + +
+ +

List of all members.

+ + + + + + + + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

 PlayerCar (double x, double y, Maze::Direction facing=Maze::UP)
 Creates a PlayerCar at the given location facing in the given direction.
void update (const Maze &maze, list< Smokescreen > &currentSmoke)
 Processes one frame's worth of activity for the object, called every frame.
void makeSmoke (list< Smokescreen > &currentSmoke)
 Creates a Smokescreen one block behind the player if the action is viable.
void gotCheckpoint ()
 Function that is called when the PlayerCar collides with a Checkpoint.
void crash ()
 Function that is called when the PlayerCar collides with an EnemyCar.
double petrol () const
 Function to allow access to the amount of petrol that the PlayerCar still has.

+Private Attributes

KeyboardHandler _input
 Object that handles all interaction with the player.
double _petrol
 The amount of petrol that the PlayerCar still has.

+Static Private Attributes

static const double PETROL_USE_RATE = 0.0007
 The amount of petrol used every frame.
static const double PETROL_USE_SMOKESCREEN = 0.05
 The amount of petrol used to create a Smokescreen.
static const double PETROL_FROM_CHECKPOINT = 0.2
 The amount of petrol gained from collecting a Checkpoint.
+

Detailed Description

+

A GameObject that is controlled by the player.

+

Contains a KeyboardHandler to accept user input.

+
Author:
Justin Wernick
+
+David Schneider
+ +

Definition at line 23 of file PlayerCar.h.

+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
PlayerCar::PlayerCar (double x,
double y,
Maze::Direction facing = Maze::UP 
)
+
+
+ +

Creates a PlayerCar at the given location facing in the given direction.

+

In the current form of the level files, there is no way to distinguish the direction that the player is facing, so the default of UP is used. However, the ability to pass in a facing is useful in the unit tests.

+
Parameters:
+ + + + +
[in]xThe x coordinate of the object's initial position.
[in]yThe y coordinate of the object's initial position.
[in]facingThe direction that the object is initially facing.
+
+
+ +

Definition at line 3 of file PlayerCar.cpp.

+ +
+
+

Member Function Documentation

+ +
+
+ + + + + + + +
void PlayerCar::crash ()
+
+
+ +

Function that is called when the PlayerCar collides with an EnemyCar.

+ +

Definition at line 73 of file PlayerCar.cpp.

+ +
+
+ +
+
+ + + + + + + +
void PlayerCar::gotCheckpoint ()
+
+
+ +

Function that is called when the PlayerCar collides with a Checkpoint.

+

Increases the amount of petrol by PETROL_FROM_CHECKPOINT.

+ +

Definition at line 78 of file PlayerCar.cpp.

+ +
+
+ +
+
+ + + + + + + + +
void PlayerCar::makeSmoke (list< Smokescreen > & currentSmoke)
+
+
+ +

Creates a Smokescreen one block behind the player if the action is viable.

+

The action is viable if the object has more than PETROL_USE_SMOKESCREEN petrol. Further, the position must not overlap with existing Smokescreens. This allows the player to hold down the Smokescreen button without creating a new Smokescreen every frame. Creating a Smokescreen decreases the petrol by PETROL_USE_SMOKESCREEN.

+
Parameters:
+ + +
[in,out]currentSmokeThe list of Smokescreens being drawn, that the new Smokescreens will be added to the back of.
+
+
+ +

Definition at line 28 of file PlayerCar.cpp.

+ +
+
+ +
+
+ + + + + + + +
double PlayerCar::petrol () const
+
+
+ +

Function to allow access to the amount of petrol that the PlayerCar still has.

+ +

Definition at line 84 of file PlayerCar.cpp.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void PlayerCar::update (const Mazemaze,
list< Smokescreen > & currentSmoke 
)
+
+
+ +

Processes one frame's worth of activity for the object, called every frame.

+

The Keyboard handler is called for the user's input. Based on this, the direction can be changed, and a Smokescreen can be created and added to the list of already existing Smokescreens. The PlayerCar is then moved. Petrol is decreased by PETROL_USE_RATE on every update.

+
Parameters:
+ + + +
[in]mazeThe Maze that confines the PlayerCar's movement.
[in,out]currentSmokeThe list of Smokescreens being drawn, that the new Smokescreens will be added to the back of.
+
+
+ +

Definition at line 10 of file PlayerCar.cpp.

+ +
+
+

Member Data Documentation

+ +
+
+ + + + +
KeyboardHandler PlayerCar::_input [private]
+
+
+ +

Object that handles all interaction with the player.

+ +

Definition at line 84 of file PlayerCar.h.

+ +
+
+ +
+
+ + + + +
double PlayerCar::_petrol [private]
+
+
+ +

The amount of petrol that the PlayerCar still has.

+

Measured as a fraction, with 1 being a full tank and 0 being empty. When the petrol reaches 0, it is kept at zero and the PlayerCar's speed is halved.

+ +

Definition at line 92 of file PlayerCar.h.

+ +
+
+ +
+
+ + + + +
const double PlayerCar::PETROL_FROM_CHECKPOINT = 0.2 [static, private]
+
+
+ +

The amount of petrol gained from collecting a Checkpoint.

+ +

Definition at line 96 of file PlayerCar.h.

+ +
+
+ +
+
+ + + + +
const double PlayerCar::PETROL_USE_RATE = 0.0007 [static, private]
+
+
+ +

The amount of petrol used every frame.

+ +

Definition at line 94 of file PlayerCar.h.

+ +
+
+ +
+
+ + + + +
const double PlayerCar::PETROL_USE_SMOKESCREEN = 0.05 [static, private]
+
+
+ +

The amount of petrol used to create a Smokescreen.

+ +

Definition at line 95 of file PlayerCar.h.

+ +
+
+
The documentation for this class was generated from the following files: +
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/class_player_car.png b/docs/html/class_player_car.png new file mode 100644 index 0000000..83a5c68 Binary files /dev/null and b/docs/html/class_player_car.png differ diff --git a/docs/html/class_rock-members.html b/docs/html/class_rock-members.html new file mode 100644 index 0000000..1dcae3a --- /dev/null +++ b/docs/html/class_rock-members.html @@ -0,0 +1,122 @@ + + + + +Rally X: Member List + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
+
Rock Member List
+
+
+This is the complete list of members for Rock, including all inherited members. + + + + + + + + + + + + +
_destroyedGameObject [protected]
_facingGameObject [protected]
_imageGameObject [protected]
_xGameObject [protected]
_yGameObject [protected]
destroyed() const GameObject
facing() const GameObject
GameObject(double x, double y, BitmapStore::Image image, Maze::Direction facing=Maze::UP)GameObject
image() const GameObject
Rock(double x, double y)Rock
x() const GameObject
y() const GameObject
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/class_rock.html b/docs/html/class_rock.html new file mode 100644 index 0000000..0c6f5f1 --- /dev/null +++ b/docs/html/class_rock.html @@ -0,0 +1,184 @@ + + + + +Rally X: Rock Class Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+ +
+
Rock Class Reference
+
+
+ +

A game object that acts as an obstacle to the player. + More...

+ +

#include <Rock.h>

+
+Inheritance diagram for Rock:
+
+
+ + +GameObject + +
+ +

List of all members.

+ + + + +

+Public Member Functions

 Rock (double x, double y)
 Creates a Rock at the given coordinates.
+

Detailed Description

+

A game object that acts as an obstacle to the player.

+

Does nothing actively.

+
Author:
Justin Wernick
+
+David Schneider
+ +

Definition at line 15 of file Rock.h.

+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + +
Rock::Rock (double x,
double y 
)
+
+
+ +

Creates a Rock at the given coordinates.

+
Parameters:
+ + + +
[in]xThe x coordinate of the Rock's position.
[in]yThe y coordinate of the Rock's position.
+
+
+ +

Definition at line 3 of file Rock.cpp.

+ +
+
+
The documentation for this class was generated from the following files: +
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/class_rock.png b/docs/html/class_rock.png new file mode 100644 index 0000000..c550ff4 Binary files /dev/null and b/docs/html/class_rock.png differ diff --git a/docs/html/class_screen-members.html b/docs/html/class_screen-members.html new file mode 100644 index 0000000..6797c75 --- /dev/null +++ b/docs/html/class_screen-members.html @@ -0,0 +1,133 @@ + + + + +Rally X: Member List + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
+
Screen Member List
+
+
+This is the complete list of members for Screen, including all inherited members. + + + + + + + + + + + + + + + + + + + + + + + +
_allegroScreen [private]
_displayScreen [private]
_drawingScreen [private]
_exitClickedScreen [private]
_fontScreen [private]
_gameAreaWidthScreen [private]
_infoPanelWidthScreen [private]
_keyboardScreen [private]
_panelsScreen [private]
_screenHeightScreen [private]
_screenWidthScreen [private]
_windowEventsScreen [private]
draw(const Maze &maze, const list< PlayerCar > &players, const list< EnemyCar > &enemies, const list< Checkpoint > &checkpoints, const list< Rock > &rocks, const list< Smokescreen > &smokescreens, const list< DestroyedObjectPopup > &popups)Screen
drawLoss()Screen
drawWin()Screen
exitClicked()Screen
flip()Screen [private]
getLevel()Screen
operator=(const Screen &rhs)Screen [private]
resolutionSupported()Screen [private]
Screen(unsigned int screenWidth, unsigned int screenHeight, bool fullscreen)Screen
Screen(const Screen &ref)Screen [private]
~Screen()Screen
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/class_screen.html b/docs/html/class_screen.html new file mode 100644 index 0000000..581ce34 --- /dev/null +++ b/docs/html/class_screen.html @@ -0,0 +1,699 @@ + + + + +Rally X: Screen Class Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+ +
+
Screen Class Reference
+
+
+ +

Class for creating a window on the screen. + More...

+ +

#include <Screen.h>

+ +

List of all members.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

 Screen (unsigned int screenWidth, unsigned int screenHeight, bool fullscreen)
 Creates a Screen with the given width and height in pixels, and the given fullscreen setting.
 ~Screen ()
 Destructor to ensure that the display and any ScreenPanels are destroyed properly.
string getLevel ()
 Presents the player with a file dialog, requesting a level file to be selected.
void draw (const Maze &maze, const list< PlayerCar > &players, const list< EnemyCar > &enemies, const list< Checkpoint > &checkpoints, const list< Rock > &rocks, const list< Smokescreen > &smokescreens, const list< DestroyedObjectPopup > &popups)
 Draws the given objects on the screen.
bool exitClicked ()
 Function to find if the player has chosen to exit the game.
void drawWin ()
 Draws a splash screen when the level has been won.
void drawLoss ()
 Draws a splash screen when the level has been lost.

+Private Member Functions

 Screen (const Screen &ref)
 Unimplemented copy constructor, prevents copying of Screen objects.
Screenoperator= (const Screen &rhs)
 Unimplemented assignment operator.
void flip ()
 Flips the display's buffers, as well as those for all of the ScreenPanels.
bool resolutionSupported ()
 Checks the current resolution (_screenWidth and _screenHeight) against the screen's supported resolutions.

+Private Attributes

AllegroInit _allegro
 Ensures that Allegro has been installed, for event queues and creating the display.
AllegroKeyboardInit _keyboard
 Ensures that the keyboard has been installed, for checking for the ESC key.
AllegroDrawingInit _drawing
 Ensures that drawing operations have been installed, for drawing splash screens.
bool _exitClicked
 Set to true when the user chooses to quit the game.
unsigned int _screenWidth
 Horizontal number of pixels per row on the screen.
unsigned int _screenHeight
 Vertical number of pixels per column on the screen.
unsigned int _gameAreaWidth
 Width of the GamePanel created.
unsigned int _infoPanelWidth
 Width of the InfoPanel created. The InfoPanel is placed directly to the right of the GamePanel.
ALLEGRO_DISPLAY * _display
 The window created on the player's monitor to see the game.
ALLEGRO_EVENT_QUEUE * _windowEvents
 Events caught by the screen, checked for an exit command.
ALLEGRO_FONT * _font
 Font used in drawing splash screens.
vector< ScreenPanel * > _panels
 Polymorphic container used to encapsulate the different types of drawing to the screen.
+

Detailed Description

+

Class for creating a window on the screen.

+

Anything involving drawing on the screen is the responsibility of this class. Most of these responsibilities are outsourced through creating ScreenPanels with more specialised tasks, such as drawing specifically the area where the gameplay takes place (GamePanel) or the providing the player with information (InfoPanel).

+
Author:
Justin Wernick
+
+David Schneider
+ +

Definition at line 44 of file Screen.h.

+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
Screen::Screen (unsigned int screenWidth,
unsigned int screenHeight,
bool fullscreen 
)
+
+
+ +

Creates a Screen with the given width and height in pixels, and the given fullscreen setting.

+
Parameters:
+ + + + +
[in]screenWidthThe width of the display that will be created in pixels.
[in]screenHeightThe height of the display that will be created in pixels.
[in]fullscreenTrue if the game should be in fullscreen mode. False otherwise.
+
+
+ +

Definition at line 3 of file Screen.cpp.

+ +
+
+ +
+
+ + + + + + + +
Screen::~Screen ()
+
+
+ +

Destructor to ensure that the display and any ScreenPanels are destroyed properly.

+ +

Definition at line 52 of file Screen.cpp.

+ +
+
+ +
+
+ + + + + + + + +
Screen::Screen (const Screenref) [private]
+
+
+ +

Unimplemented copy constructor, prevents copying of Screen objects.

+

Copying a Screen is unneccesary as there should only be a single Screen object.

+ +
+
+

Member Function Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void Screen::draw (const Mazemaze,
const list< PlayerCar > & players,
const list< EnemyCar > & enemies,
const list< Checkpoint > & checkpoints,
const list< Rock > & rocks,
const list< Smokescreen > & smokescreens,
const list< DestroyedObjectPopup > & popups 
)
+
+
+ +

Draws the given objects on the screen.

+

The objects are passed to each of the ScreenPanels in turn, and then the buffers are flipped.

+
Parameters:
+ + + + + + + + +
[in]mazeThe Maze that all of the objects are in.
[in]playersThe list of PlayerCars to be drawn.
[in]enemiesThe list of EnemyCars to be drawn.
[in]checkpointsThe list of Checkpoints to be drawn.
[in]rocksThe list of Rocks to be drawn.
[in]smokescreensThe list of Smokescreens to be drawn.
[in]popupsThe list of DestroyedObjectPopups to be drawn.
+
+
+ +

Definition at line 83 of file Screen.cpp.

+ +
+
+ +
+
+ + + + + + + +
void Screen::drawLoss ()
+
+
+ +

Draws a splash screen when the level has been lost.

+ +

Definition at line 114 of file Screen.cpp.

+ +
+
+ +
+
+ + + + + + + +
void Screen::drawWin ()
+
+
+ +

Draws a splash screen when the level has been won.

+ +

Definition at line 101 of file Screen.cpp.

+ +
+
+ +
+
+ + + + + + + +
bool Screen::exitClicked ()
+
+
+ +

Function to find if the player has chosen to exit the game.

+

The game can be exited by clicking the x in the corner of the window, pressing the ESC key during the game, or by clicking 'cancel' on the file selection dialog.

+
Returns:
True if the game should be quit.
+ +

Definition at line 127 of file Screen.cpp.

+ +
+
+ +
+
+ + + + + + + +
void Screen::flip () [private]
+
+
+ +

Flips the display's buffers, as well as those for all of the ScreenPanels.

+ +

Definition at line 92 of file Screen.cpp.

+ +
+
+ +
+
+ + + + + + + +
string Screen::getLevel ()
+
+
+ +

Presents the player with a file dialog, requesting a level file to be selected.

+

If the cancel button is clicked, and empty string is returned and exitClicked() will return true on its next call.

+
Returns:
The path of the level file, or an empty string if no file was selected.
+ +

Definition at line 65 of file Screen.cpp.

+ +
+
+ +
+
+ + + + + + + + +
Screen& Screen::operator= (const Screenrhs) [private]
+
+
+ +

Unimplemented assignment operator.

+
See also:
Screen(const Screen& ref)
+ +
+
+ +
+
+ + + + + + + +
bool Screen::resolutionSupported () [private]
+
+
+ +

Checks the current resolution (_screenWidth and _screenHeight) against the screen's supported resolutions.

+

Used to test if a fullscreen mode selection will launch without issue.

+
Returns:
True if the current resolution is supported.
+ +

Definition at line 145 of file Screen.cpp.

+ +
+
+

Member Data Documentation

+ +
+
+ + + + +
AllegroInit Screen::_allegro [private]
+
+
+ +

Ensures that Allegro has been installed, for event queues and creating the display.

+ +

Definition at line 134 of file Screen.h.

+ +
+
+ +
+
+ + + + +
ALLEGRO_DISPLAY* Screen::_display [private]
+
+
+ +

The window created on the player's monitor to see the game.

+ +

Definition at line 146 of file Screen.h.

+ +
+
+ +
+
+ + + + +
AllegroDrawingInit Screen::_drawing [private]
+
+
+ +

Ensures that drawing operations have been installed, for drawing splash screens.

+ +

Definition at line 136 of file Screen.h.

+ +
+
+ +
+
+ + + + +
bool Screen::_exitClicked [private]
+
+
+ +

Set to true when the user chooses to quit the game.

+ +

Definition at line 138 of file Screen.h.

+ +
+
+ +
+
+ + + + +
ALLEGRO_FONT* Screen::_font [private]
+
+
+ +

Font used in drawing splash screens.

+ +

Definition at line 148 of file Screen.h.

+ +
+
+ +
+
+ + + + +
unsigned int Screen::_gameAreaWidth [private]
+
+
+ +

Width of the GamePanel created.

+ +

Definition at line 143 of file Screen.h.

+ +
+
+ +
+
+ + + + +
unsigned int Screen::_infoPanelWidth [private]
+
+
+ +

Width of the InfoPanel created. The InfoPanel is placed directly to the right of the GamePanel.

+ +

Definition at line 144 of file Screen.h.

+ +
+
+ +
+
+ + + + +
AllegroKeyboardInit Screen::_keyboard [private]
+
+
+ +

Ensures that the keyboard has been installed, for checking for the ESC key.

+ +

Definition at line 135 of file Screen.h.

+ +
+
+ +
+
+ + + + +
vector<ScreenPanel*> Screen::_panels [private]
+
+
+ +

Polymorphic container used to encapsulate the different types of drawing to the screen.

+

Since the memory of the ScreenPanels in the vector is allocated dynamically, it must be deallocated in the destructor.

+ +

Definition at line 156 of file Screen.h.

+ +
+
+ +
+
+ + + + +
unsigned int Screen::_screenHeight [private]
+
+
+ +

Vertical number of pixels per column on the screen.

+ +

Definition at line 141 of file Screen.h.

+ +
+
+ +
+
+ + + + +
unsigned int Screen::_screenWidth [private]
+
+
+ +

Horizontal number of pixels per row on the screen.

+ +

Definition at line 140 of file Screen.h.

+ +
+
+ +
+
+ + + + +
ALLEGRO_EVENT_QUEUE* Screen::_windowEvents [private]
+
+
+ +

Events caught by the screen, checked for an exit command.

+ +

Definition at line 147 of file Screen.h.

+ +
+
+
The documentation for this class was generated from the following files: +
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/class_screen_panel-members.html b/docs/html/class_screen_panel-members.html new file mode 100644 index 0000000..2ffc48b --- /dev/null +++ b/docs/html/class_screen_panel-members.html @@ -0,0 +1,122 @@ + + + + +Rally X: Member List + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
+
ScreenPanel Member List
+
+
+This is the complete list of members for ScreenPanel, including all inherited members. + + + + + + + + + + + + +
_allegroScreenPanel [private]
_backScreenPanel [protected]
_frontScreenPanel [private]
_heightScreenPanel [protected]
_widthScreenPanel [protected]
BLANKScreenPanel [protected, static]
draw(const Maze &maze, const list< PlayerCar > &players, const list< EnemyCar > &enemies, const list< Checkpoint > &checkpoints, const list< Rock > &rocks, const list< Smokescreen > &smokescreens, const list< DestroyedObjectPopup > &popups)=0ScreenPanel [pure virtual]
flip()ScreenPanel [virtual]
operator=(const ScreenPanel &rhs)ScreenPanel [private]
ScreenPanel(ALLEGRO_BITMAP *back, ALLEGRO_BITMAP *front, int x, int y, int width, int height)ScreenPanel
ScreenPanel(const ScreenPanel &ref)ScreenPanel [private]
~ScreenPanel()ScreenPanel [virtual]
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/class_screen_panel.html b/docs/html/class_screen_panel.html new file mode 100644 index 0000000..cc72a9f --- /dev/null +++ b/docs/html/class_screen_panel.html @@ -0,0 +1,508 @@ + + + + +Rally X: ScreenPanel Class Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+ +
+
ScreenPanel Class Reference
+
+
+ +

Parent class for panels that are drawn on the screen. + More...

+ +

#include <ScreenPanel.h>

+
+Inheritance diagram for ScreenPanel:
+
+
+ + +GamePanel +InfoPanel + +
+ +

List of all members.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

 ScreenPanel (ALLEGRO_BITMAP *back, ALLEGRO_BITMAP *front, int x, int y, int width, int height)
 Creates a ScreenPanel from the given back and front buffers.
virtual ~ScreenPanel ()
 Destructor to ensure that sub-bitmap memory is deallocated.
virtual void draw (const Maze &maze, const list< PlayerCar > &players, const list< EnemyCar > &enemies, const list< Checkpoint > &checkpoints, const list< Rock > &rocks, const list< Smokescreen > &smokescreens, const list< DestroyedObjectPopup > &popups)=0
 Pure virtual method for drawing a collection of objects onto the panel.
virtual void flip ()
 Swaps the front and back buffers.

+Protected Attributes

ALLEGRO_BITMAP * _back
 The back buffer. Only the back buffer can be drawn to.
int _width
 The width of the sub-bitmaps being drawn to in pixels.
int _height
 The height of the sub-bitmaps being drawn to in pixels.

+Static Protected Attributes

static const ALLEGRO_COLOR BLANK = al_map_rgb(0,0,0)
 Colour used to clear the screen at the beginning of drawing operations.

+Private Member Functions

 ScreenPanel (const ScreenPanel &ref)
 Copy constructor not implemented, ScreenPanels should not be copied.
ScreenPaneloperator= (const ScreenPanel &rhs)
 Assignment operator not implemented, ScreenPanels should not be copied.

+Private Attributes

AllegroInit _allegro
 Handles dependencies on Allegro being initialised.
ALLEGRO_BITMAP * _front
 The front buffer, that is currently being shown on the screen.
+

Detailed Description

+

Parent class for panels that are drawn on the screen.

+

Panels are given a sub-bitmap of the Screen bitmap, which they draw their panel specific outputs on. The ScreenPanel class is subclassed to give specific drawing functions, like drawing the Maze and GameObjects on the screen.

+

When the object is created, the back bitmap and front bitmap should correspond to the back and front buffers of the display respectively. This should be kept in sync by calling flip every time the display is flipped.

+
Author:
Justin Wernick
+
+David Schneider
+ +

Definition at line 29 of file ScreenPanel.h.

+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ScreenPanel::ScreenPanel (ALLEGRO_BITMAP * back,
ALLEGRO_BITMAP * front,
int x,
int y,
int width,
int height 
)
+
+
+ +

Creates a ScreenPanel from the given back and front buffers.

+

The sub-bitmaps that ScreenPanel uses are created from a rectangular region on back and front that has its top left corner at the coordinate x,y, is width long in the x direction, and height long in the y direction.

+
Parameters:
+ + + + + + + +
[in]backThe current back buffer of the display being sub-bitmapped.
[in]frontThe current front buffer (image currently being displayed) of the display being sub-bitmapped.
[in]xThe x coordinate of the left side of the sub-bitmap in pixels.
[in]yThe x coordinate of the top of the sub-bitmap in pixels.
[in]widthThe length in the x direction of the new sub-bitmap in pixels.
[in]heightThe length in the y direction of the new sub-bitmap in pixels.
+
+
+ +

Definition at line 5 of file ScreenPanel.cpp.

+ +
+
+ +
+
+ + + + + + + +
ScreenPanel::~ScreenPanel () [virtual]
+
+
+ +

Destructor to ensure that sub-bitmap memory is deallocated.

+ +

Definition at line 13 of file ScreenPanel.cpp.

+ +
+
+ +
+
+ + + + + + + + +
ScreenPanel::ScreenPanel (const ScreenPanelref) [private]
+
+
+ +

Copy constructor not implemented, ScreenPanels should not be copied.

+ +
+
+

Member Function Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
virtual void ScreenPanel::draw (const Mazemaze,
const list< PlayerCar > & players,
const list< EnemyCar > & enemies,
const list< Checkpoint > & checkpoints,
const list< Rock > & rocks,
const list< Smokescreen > & smokescreens,
const list< DestroyedObjectPopup > & popups 
) [pure virtual]
+
+
+ +

Pure virtual method for drawing a collection of objects onto the panel.

+

Implementations do not need to draw all of the objects if it is not neccesary for the type of panel, but the interface accepts all of them to be general.

+
Parameters:
+ + + + + + + + +
[in]mazeThe Maze that all of the objects are in.
[in]playersThe list of PlayerCars to be drawn.
[in]enemiesThe list of EnemyCars to be drawn.
[in]checkpointsThe list of Checkpoints to be drawn.
[in]rocksThe list of Rocks to be drawn.
[in]smokescreensThe list of Smokescreens to be drawn.
[in]popupsThe list of DestroyedObjectPopups to be drawn.
+
+
+ +

Implemented in InfoPanel, and GamePanel.

+ +
+
+ +
+
+ + + + + + + +
void ScreenPanel::flip () [virtual]
+
+
+ +

Swaps the front and back buffers.

+

This function should be called every time the display is flipped.

+ +

Definition at line 19 of file ScreenPanel.cpp.

+ +
+
+ +
+
+ + + + + + + + +
ScreenPanel& ScreenPanel::operator= (const ScreenPanelrhs) [private]
+
+
+ +

Assignment operator not implemented, ScreenPanels should not be copied.

+ +
+
+

Member Data Documentation

+ +
+
+ + + + +
AllegroInit ScreenPanel::_allegro [private]
+
+
+ +

Handles dependencies on Allegro being initialised.

+ +

Reimplemented in GamePanel.

+ +

Definition at line 93 of file ScreenPanel.h.

+ +
+
+ +
+
+ + + + +
ALLEGRO_BITMAP* ScreenPanel::_back [protected]
+
+
+ +

The back buffer. Only the back buffer can be drawn to.

+ +

Definition at line 79 of file ScreenPanel.h.

+ +
+
+ +
+
+ + + + +
ALLEGRO_BITMAP* ScreenPanel::_front [private]
+
+
+ +

The front buffer, that is currently being shown on the screen.

+ +

Definition at line 95 of file ScreenPanel.h.

+ +
+
+ +
+
+ + + + +
int ScreenPanel::_height [protected]
+
+
+ +

The height of the sub-bitmaps being drawn to in pixels.

+ +

Definition at line 82 of file ScreenPanel.h.

+ +
+
+ +
+
+ + + + +
int ScreenPanel::_width [protected]
+
+
+ +

The width of the sub-bitmaps being drawn to in pixels.

+ +

Definition at line 81 of file ScreenPanel.h.

+ +
+
+ +
+
+ + + + +
const ALLEGRO_COLOR ScreenPanel::BLANK = al_map_rgb(0,0,0) [static, protected]
+
+
+ +

Colour used to clear the screen at the beginning of drawing operations.

+ +

Definition at line 77 of file ScreenPanel.h.

+ +
+
+
The documentation for this class was generated from the following files: +
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/class_screen_panel.png b/docs/html/class_screen_panel.png new file mode 100644 index 0000000..75173be Binary files /dev/null and b/docs/html/class_screen_panel.png differ diff --git a/docs/html/class_smokescreen-members.html b/docs/html/class_smokescreen-members.html new file mode 100644 index 0000000..7217351 --- /dev/null +++ b/docs/html/class_smokescreen-members.html @@ -0,0 +1,125 @@ + + + + +Rally X: Member List + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
+
Smokescreen Member List
+
+
+This is the complete list of members for Smokescreen, including all inherited members. + + + + + + + + + + + + + + + +
_destroyedGameObject [protected]
_facingGameObject [protected]
_imageGameObject [protected]
_xGameObject [protected]
_yGameObject [protected]
destroyed() const GameObject
facing() const GameObject
GameObject(double x, double y, BitmapStore::Image image, Maze::Direction facing=Maze::UP)GameObject
image() const GameObject
LimitedTimeObject(double x, double y, BitmapStore::Image image, int time)LimitedTimeObject
SMOKE_TIMESmokescreen [private, static]
Smokescreen(double x, double y)Smokescreen
update()LimitedTimeObject
x() const GameObject
y() const GameObject
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/class_smokescreen.html b/docs/html/class_smokescreen.html new file mode 100644 index 0000000..f8ff14a --- /dev/null +++ b/docs/html/class_smokescreen.html @@ -0,0 +1,208 @@ + + + + +Rally X: Smokescreen Class Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+ +
+
Smokescreen Class Reference
+
+
+ +

GameObject that causes the EnemyCar to be delayed if they crash into it. + More...

+ +

#include <Smokescreen.h>

+
+Inheritance diagram for Smokescreen:
+
+
+ + +LimitedTimeObject +GameObject + +
+ +

List of all members.

+ + + + + + + +

+Public Member Functions

 Smokescreen (double x, double y)
 Creates a Smokescreen at the given location.

+Static Private Attributes

static const int SMOKE_TIME = 60
 The number of frames that the Smokescreen exists before it is destroyed. 2 second at FPS=30.
+

Detailed Description

+

GameObject that causes the EnemyCar to be delayed if they crash into it.

+

After a short time, the SmokeScreen dissipates.

+
Author:
Justin Wernick
+
+David Schneider
+ +

Definition at line 15 of file Smokescreen.h.

+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + +
Smokescreen::Smokescreen (double x,
double y 
)
+
+
+ +

Creates a Smokescreen at the given location.

+
Parameters:
+ + + +
[in]xThe x coordinate of the object's position.
[in]yThe y coordinate of the object's position.
+
+
+ +

Definition at line 3 of file Smokescreen.cpp.

+ +
+
+

Member Data Documentation

+ +
+
+ + + + +
const int Smokescreen::SMOKE_TIME = 60 [static, private]
+
+
+ +

The number of frames that the Smokescreen exists before it is destroyed. 2 second at FPS=30.

+ +

Definition at line 28 of file Smokescreen.h.

+ +
+
+
The documentation for this class was generated from the following files: +
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/class_smokescreen.png b/docs/html/class_smokescreen.png new file mode 100644 index 0000000..c097b4d Binary files /dev/null and b/docs/html/class_smokescreen.png differ diff --git a/docs/html/classes.html b/docs/html/classes.html new file mode 100644 index 0000000..360b072 --- /dev/null +++ b/docs/html/classes.html @@ -0,0 +1,142 @@ + + + + +Rally X: Class Index + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
+
Class Index
+
+
+
A | B | C | D | E | F | G | I | K | L | M | P | R | S
+ + + + + + + + + + + + + + + + +
  A  
+
Checkpoint   
  G  
+
  L  
+
  S  
+
CollisionDetector   
AllegroDrawingInit   ColourStore   Game   LevelReader   Screen   
AllegroInit   Config   GameObject   LimitedTimeObject   ScreenPanel   
AllegroKeyboardInit   
  D  
+
GamePanel   
  M  
+
Smokescreen   
  B  
+
  I  
+
DestroyedObjectPopup   Maze   
BadResolution   
  E  
+
InfoPanel   MazeMath   
BitmapStore   InstallFailure   
  P  
+
  C  
+
EnemyCar   
  K  
+
  F  
+
PlayerCar   
Car   KeyboardHandler   
  R  
+
FileOpenError   
Rock   
+
A | B | C | D | E | F | G | I | K | L | M | P | R | S
+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/closed.png b/docs/html/closed.png new file mode 100644 index 0000000..b7d4bd9 Binary files /dev/null and b/docs/html/closed.png differ diff --git a/docs/html/data_tests_8cpp.html b/docs/html/data_tests_8cpp.html new file mode 100644 index 0000000..2aba791 --- /dev/null +++ b/docs/html/data_tests_8cpp.html @@ -0,0 +1,305 @@ + + + + +Rally X: tests/dataTests.cpp File Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+ +
+
tests/dataTests.cpp File Reference
+
+
+ +

Unit tests for the data layer of a Rally-X game. +More...

+
#include <cstdio>
+#include <fstream>
+#include <gtest/gtest.h>
+#include "../source/data/Config.h"
+#include "../source/data/LevelReader.h"
+#include "../source/logic/PlayerCar.h"
+#include "../source/logic/EnemyCar.h"
+#include "../source/logic/Checkpoint.h"
+#include "../source/logic/Rock.h"
+#include "../source/logic/Smokescreen.h"
+#include "../source/logic/Maze.h"
+
+

Go to the source code of this file.

+ + + + + + + + + + + + +

+Functions

 TEST (Config, readsSettingsCorrectly)
 Tests that a normal complete config file can be read.
 TEST (Config, createsFileIfNeeded)
 Tests that, if the config file does not exist, it is created with default values.
 TEST (Config, incompleteFileFilled)
 Tests that an incomplete config file is loaded, with defaults for the missing values.
 TEST (LevelReader, readsFileInfoObjects)
 Tests that a level can be loaded correctly from a file.
 TEST (LevelReader, throwsExceptionOnBadFilename)
 Tests that an exception is throws if the selected file does not exist.
+

Detailed Description

+

Unit tests for the data layer of a Rally-X game.

+

The functionality of each class in the data layer was tested.

+

The Config class was tested in terms of its ability to read an existing config file, as well as its ability to create a new file with default values, or fill missing parameters with default values.

+

The LevelReader class was tested in the normal case, where a correct level file is given, and in the case where a file that does not exist is given.

+
Author:
Justin Wernick
+
+David Schneider
+ +

Definition in file dataTests.cpp.

+

Function Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + +
TEST (Config ,
readsSettingsCorrectly  
)
+
+
+ +

Tests that a normal complete config file can be read.

+ +

Definition at line 35 of file dataTests.cpp.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
TEST (Config ,
createsFileIfNeeded  
)
+
+
+ +

Tests that, if the config file does not exist, it is created with default values.

+ +

Definition at line 58 of file dataTests.cpp.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
TEST (Config ,
incompleteFileFilled  
)
+
+
+ +

Tests that an incomplete config file is loaded, with defaults for the missing values.

+ +

Definition at line 78 of file dataTests.cpp.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
TEST (LevelReader ,
readsFileInfoObjects  
)
+
+
+ +

Tests that a level can be loaded correctly from a file.

+ +

Definition at line 99 of file dataTests.cpp.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
TEST (LevelReader ,
throwsExceptionOnBadFilename  
)
+
+
+ +

Tests that an exception is throws if the selected file does not exist.

+ +

Definition at line 174 of file dataTests.cpp.

+ +
+
+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/data_tests_8cpp_source.html b/docs/html/data_tests_8cpp_source.html new file mode 100644 index 0000000..163697e --- /dev/null +++ b/docs/html/data_tests_8cpp_source.html @@ -0,0 +1,261 @@ + + + + +Rally X: tests/dataTests.cpp Source File + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
tests/dataTests.cpp
+
+
+Go to the documentation of this file.
00001 
+00017 #include <cstdio>
+00018 #include <fstream>
+00019 using namespace std;
+00020 
+00021 #include <gtest/gtest.h>
+00022 
+00023 #include "../source/data/Config.h"
+00024 #include "../source/data/LevelReader.h"
+00025 #include "../source/logic/PlayerCar.h"
+00026 #include "../source/logic/EnemyCar.h"
+00027 #include "../source/logic/Checkpoint.h"
+00028 #include "../source/logic/Rock.h"
+00029 #include "../source/logic/Smokescreen.h"
+00030 #include "../source/logic/Maze.h"
+00031 
+00035 TEST(Config, readsSettingsCorrectly)
+00036 {
+00037     string testFilepath = "testConfig.txt";
+00038     ofstream testFile(testFilepath.c_str());
+00039 
+00040     testFile << "screen_width=123" << endl;
+00041     testFile << "screen_height=345" << endl;
+00042     testFile << "fullscreen=true" << endl;
+00043 
+00044     testFile.close();
+00045 
+00046     Config testConfig(testFilepath);
+00047 
+00048     EXPECT_EQ((unsigned)(123), testConfig.screenWidth());
+00049     EXPECT_EQ((unsigned)(345), testConfig.screenHeight());
+00050     EXPECT_TRUE(testConfig.fullscreen());
+00051 
+00052     remove(testFilepath.c_str());
+00053 }
+00054 
+00058 TEST(Config, createsFileIfNeeded)
+00059 {
+00060     string testFilepath = "testConfig.txt";
+00061     Config testConfig(testFilepath);
+00062 
+00063     ifstream testFile(testFilepath.c_str());
+00064     EXPECT_TRUE(testFile);
+00065     testFile.close();
+00066 
+00067     //test for default values
+00068     EXPECT_EQ((unsigned)(800), testConfig.screenWidth());
+00069     EXPECT_EQ((unsigned)(600), testConfig.screenHeight());
+00070     EXPECT_FALSE(testConfig.fullscreen());
+00071 
+00072     remove(testFilepath.c_str());
+00073 }
+00074 
+00078 TEST(Config, incompleteFileFilled)
+00079 {
+00080     string testFilepath = "testConfig.txt";
+00081     ofstream testFile(testFilepath.c_str());
+00082 
+00083     testFile << "screen_height=345" << endl;
+00084 
+00085     testFile.close();
+00086 
+00087     Config testConfig(testFilepath);
+00088 
+00089     EXPECT_EQ((unsigned)(800), testConfig.screenWidth());
+00090     EXPECT_EQ((unsigned)(345), testConfig.screenHeight());
+00091     EXPECT_FALSE(testConfig.fullscreen());
+00092 
+00093     remove(testFilepath.c_str());
+00094 }
+00095 
+00099 TEST(LevelReader, readsFileInfoObjects)
+00100 {
+00101     string testFilepath = "testMaze.lvl";
+00102     ofstream testFile(testFilepath.c_str());
+00103 
+00104     testFile << " P X  " << endl;
+00105     testFile << "      " << endl;
+00106     testFile << "   @  " << endl;
+00107     testFile << "     X" << endl;
+00108     testFile << "##    " << endl;
+00109     testFile << "   P  " << endl;
+00110     testFile << "  O   " << endl;
+00111 
+00112     testFile.close();
+00113 
+00114     LevelReader testReader(testFilepath);
+00115     Maze maze;
+00116     list<PlayerCar> players;
+00117     list<EnemyCar> enemies;
+00118     list<Checkpoint> checkpoints;
+00119     list<Rock> rocks;
+00120     testReader.readLevel(maze, players, enemies, checkpoints, rocks);
+00121 
+00122     list<PlayerCar> expectedPlayers;
+00123     list<EnemyCar> expectedEnemies;
+00124     list<Checkpoint> expectedCheckpoints;
+00125     list<Rock> expectedRocks;
+00126 
+00127     expectedPlayers.push_back(PlayerCar(3,2));
+00128     expectedEnemies.push_back(EnemyCar(3,0));
+00129     expectedEnemies.push_back(EnemyCar(5,3));
+00130     expectedCheckpoints.push_back(Checkpoint(2,0));
+00131     expectedCheckpoints.push_back(Checkpoint(3,5));
+00132     expectedRocks.push_back(Rock(2,6));
+00133 
+00134     //eqality operator was not implemented for the GameObject class or its subclasses
+00135     //because it would not be meaningful. Two objects with the same position, type, and facing
+00136     //are still two different objects.
+00137     //iterators were used because the list type does not have an 'at' function.
+00138     list<PlayerCar>::const_iterator playIter = players.begin();
+00139     EXPECT_FLOAT_EQ(playIter->x(), 3);
+00140     EXPECT_FLOAT_EQ(playIter->y(), 2);
+00141     ++playIter;
+00142     EXPECT_EQ(playIter, players.end());
+00143 
+00144     list<EnemyCar>::const_iterator enemyIter = enemies.begin();
+00145     EXPECT_FLOAT_EQ(enemyIter->x(), 3);
+00146     EXPECT_FLOAT_EQ(enemyIter->y(), 0);
+00147     ++enemyIter;
+00148     EXPECT_FLOAT_EQ(enemyIter->x(), 5);
+00149     EXPECT_FLOAT_EQ(enemyIter->y(), 3);
+00150     ++enemyIter;
+00151     EXPECT_EQ(enemyIter, enemies.end());
+00152 
+00153     list<Checkpoint>::const_iterator checkIter = checkpoints.begin();
+00154     EXPECT_FLOAT_EQ(checkIter->x(), 1);
+00155     EXPECT_FLOAT_EQ(checkIter->y(), 0);
+00156     ++checkIter;
+00157     EXPECT_FLOAT_EQ(checkIter->x(), 3);
+00158     EXPECT_FLOAT_EQ(checkIter->y(), 5);
+00159     ++checkIter;
+00160     EXPECT_EQ(checkIter, checkpoints.end());
+00161 
+00162     list<Rock>::const_iterator rockIter = rocks.begin();
+00163     EXPECT_FLOAT_EQ(rockIter->x(), 2);
+00164     EXPECT_FLOAT_EQ(rockIter->y(), 6);
+00165     ++rockIter;
+00166     EXPECT_EQ(rockIter, rocks.end());
+00167 
+00168     remove(testFilepath.c_str());
+00169 }
+00170 
+00174 TEST(LevelReader, throwsExceptionOnBadFilename)
+00175 {
+00176     string testFilepath = "testLevel.lvl";
+00177     LevelReader testReader(testFilepath);
+00178     Maze maze;
+00179     list<PlayerCar> players;
+00180     list<EnemyCar> enemies;
+00181     list<Checkpoint> checkpoints;
+00182     list<Rock> rocks;
+00183     EXPECT_ANY_THROW(testReader.readLevel(maze, players, enemies, checkpoints, rocks));
+00184 }
+
+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/doxygen.css b/docs/html/doxygen.css new file mode 100644 index 0000000..22c7b5c --- /dev/null +++ b/docs/html/doxygen.css @@ -0,0 +1,946 @@ +/* The standard CSS for doxygen */ + +body, table, div, p, dl { + font-family: Lucida Grande, Verdana, Geneva, Arial, sans-serif; + font-size: 12px; +} + +/* @group Heading Levels */ + +h1 { + font-size: 150%; +} + +.title { + font-size: 150%; + font-weight: bold; + margin: 10px 2px; +} + +h2 { + font-size: 120%; +} + +h3 { + font-size: 100%; +} + +dt { + font-weight: bold; +} + +div.multicol { + -moz-column-gap: 1em; + -webkit-column-gap: 1em; + -moz-column-count: 3; + -webkit-column-count: 3; +} + +p.startli, p.startdd, p.starttd { + margin-top: 2px; +} + +p.endli { + margin-bottom: 0px; +} + +p.enddd { + margin-bottom: 4px; +} + +p.endtd { + margin-bottom: 2px; +} + +/* @end */ + +caption { + font-weight: bold; +} + +span.legend { + font-size: 70%; + text-align: center; +} + +h3.version { + font-size: 90%; + text-align: center; +} + +div.qindex, div.navtab{ + background-color: #EBEFF6; + border: 1px solid #A3B4D7; + text-align: center; +} + +div.qindex, div.navpath { + width: 100%; + line-height: 140%; +} + +div.navtab { + margin-right: 15px; +} + +/* @group Link Styling */ + +a { + color: #3D578C; + font-weight: normal; + text-decoration: none; +} + +.contents a:visited { + color: #4665A2; +} + +a:hover { + text-decoration: underline; +} + +a.qindex { + font-weight: bold; +} + +a.qindexHL { + font-weight: bold; + background-color: #9CAFD4; + color: #ffffff; + border: 1px double #869DCA; +} + +.contents a.qindexHL:visited { + color: #ffffff; +} + +a.el { + font-weight: bold; +} + +a.elRef { +} + +a.code { + color: #4665A2; +} + +a.codeRef { + color: #4665A2; +} + +/* @end */ + +dl.el { + margin-left: -1cm; +} + +.fragment { + font-family: monospace, fixed; + font-size: 105%; +} + +pre.fragment { + border: 1px solid #C4CFE5; + background-color: #FBFCFD; + padding: 4px 6px; + margin: 4px 8px 4px 2px; + overflow: auto; + word-wrap: break-word; + font-size: 9pt; + line-height: 125%; +} + +div.ah { + background-color: black; + font-weight: bold; + color: #ffffff; + margin-bottom: 3px; + margin-top: 3px; + padding: 0.2em; + border: solid thin #333; + border-radius: 0.5em; + -webkit-border-radius: .5em; + -moz-border-radius: .5em; + box-shadow: 2px 2px 3px #999; + -webkit-box-shadow: 2px 2px 3px #999; + -moz-box-shadow: rgba(0, 0, 0, 0.15) 2px 2px 2px; + background-image: -webkit-gradient(linear, left top, left bottom, from(#eee), to(#000),color-stop(0.3, #444)); + background-image: -moz-linear-gradient(center top, #eee 0%, #444 40%, #000); +} + +div.groupHeader { + margin-left: 16px; + margin-top: 12px; + font-weight: bold; +} + +div.groupText { + margin-left: 16px; + font-style: italic; +} + +body { + background-color: white; + color: black; + margin: 0; +} + +div.contents { + margin-top: 10px; + margin-left: 8px; + margin-right: 8px; +} + +td.indexkey { + background-color: #EBEFF6; + font-weight: bold; + border: 1px solid #C4CFE5; + margin: 2px 0px 2px 0; + padding: 2px 10px; +} + +td.indexvalue { + background-color: #EBEFF6; + border: 1px solid #C4CFE5; + padding: 2px 10px; + margin: 2px 0px; +} + +tr.memlist { + background-color: #EEF1F7; +} + +p.formulaDsp { + text-align: center; +} + +img.formulaDsp { + +} + +img.formulaInl { + vertical-align: middle; +} + +div.center { + text-align: center; + margin-top: 0px; + margin-bottom: 0px; + padding: 0px; +} + +div.center img { + border: 0px; +} + +address.footer { + text-align: right; + padding-right: 12px; +} + +img.footer { + border: 0px; + vertical-align: middle; +} + +/* @group Code Colorization */ + +span.keyword { + color: #008000 +} + +span.keywordtype { + color: #604020 +} + +span.keywordflow { + color: #e08000 +} + +span.comment { + color: #800000 +} + +span.preprocessor { + color: #806020 +} + +span.stringliteral { + color: #002080 +} + +span.charliteral { + color: #008080 +} + +span.vhdldigit { + color: #ff00ff +} + +span.vhdlchar { + color: #000000 +} + +span.vhdlkeyword { + color: #700070 +} + +span.vhdllogic { + color: #ff0000 +} + +/* @end */ + +/* +.search { + color: #003399; + font-weight: bold; +} + +form.search { + margin-bottom: 0px; + margin-top: 0px; +} + +input.search { + font-size: 75%; + color: #000080; + font-weight: normal; + background-color: #e8eef2; +} +*/ + +td.tiny { + font-size: 75%; +} + +.dirtab { + padding: 4px; + border-collapse: collapse; + border: 1px solid #A3B4D7; +} + +th.dirtab { + background: #EBEFF6; + font-weight: bold; +} + +hr { + height: 0px; + border: none; + border-top: 1px solid #4A6AAA; +} + +hr.footer { + height: 1px; +} + +/* @group Member Descriptions */ + +table.memberdecls { + border-spacing: 0px; + padding: 0px; +} + +.mdescLeft, .mdescRight, +.memItemLeft, .memItemRight, +.memTemplItemLeft, .memTemplItemRight, .memTemplParams { + background-color: #F9FAFC; + border: none; + margin: 4px; + padding: 1px 0 0 8px; +} + +.mdescLeft, .mdescRight { + padding: 0px 8px 4px 8px; + color: #555; +} + +.memItemLeft, .memItemRight, .memTemplParams { + border-top: 1px solid #C4CFE5; +} + +.memItemLeft, .memTemplItemLeft { + white-space: nowrap; +} + +.memItemRight { + width: 100%; +} + +.memTemplParams { + color: #4665A2; + white-space: nowrap; +} + +/* @end */ + +/* @group Member Details */ + +/* Styles for detailed member documentation */ + +.memtemplate { + font-size: 80%; + color: #4665A2; + font-weight: normal; + margin-left: 9px; +} + +.memnav { + background-color: #EBEFF6; + border: 1px solid #A3B4D7; + text-align: center; + margin: 2px; + margin-right: 15px; + padding: 2px; +} + +.mempage { + width: 100%; +} + +.memitem { + padding: 0; + margin-bottom: 10px; + margin-right: 5px; +} + +.memname { + white-space: nowrap; + font-weight: bold; + margin-left: 6px; +} + +.memproto, dl.reflist dt { + border-top: 1px solid #A8B8D9; + border-left: 1px solid #A8B8D9; + border-right: 1px solid #A8B8D9; + padding: 6px 0px 6px 0px; + color: #253555; + font-weight: bold; + text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9); + /* opera specific markup */ + box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); + border-top-right-radius: 8px; + border-top-left-radius: 8px; + /* firefox specific markup */ + -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px; + -moz-border-radius-topright: 8px; + -moz-border-radius-topleft: 8px; + /* webkit specific markup */ + -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); + -webkit-border-top-right-radius: 8px; + -webkit-border-top-left-radius: 8px; + background-image:url('nav_f.png'); + background-repeat:repeat-x; + background-color: #E2E8F2; + +} + +.memdoc, dl.reflist dd { + border-bottom: 1px solid #A8B8D9; + border-left: 1px solid #A8B8D9; + border-right: 1px solid #A8B8D9; + padding: 2px 5px; + background-color: #FBFCFD; + border-top-width: 0; + /* opera specific markup */ + border-bottom-left-radius: 8px; + border-bottom-right-radius: 8px; + box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); + /* firefox specific markup */ + -moz-border-radius-bottomleft: 8px; + -moz-border-radius-bottomright: 8px; + -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px; + background-image: -moz-linear-gradient(center top, #FFFFFF 0%, #FFFFFF 60%, #F7F8FB 95%, #EEF1F7); + /* webkit specific markup */ + -webkit-border-bottom-left-radius: 8px; + -webkit-border-bottom-right-radius: 8px; + -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); + background-image: -webkit-gradient(linear,center top,center bottom,from(#FFFFFF), color-stop(0.6,#FFFFFF), color-stop(0.60,#FFFFFF), color-stop(0.95,#F7F8FB), to(#EEF1F7)); +} + +dl.reflist dt { + padding: 5px; +} + +dl.reflist dd { + margin: 0px 0px 10px 0px; + padding: 5px; +} + +.paramkey { + text-align: right; +} + +.paramtype { + white-space: nowrap; +} + +.paramname { + color: #602020; + white-space: nowrap; +} +.paramname em { + font-style: normal; +} + +.params, .retval, .exception, .tparams { + border-spacing: 6px 2px; +} + +.params .paramname, .retval .paramname { + font-weight: bold; + vertical-align: top; +} + +.params .paramtype { + font-style: italic; + vertical-align: top; +} + +.params .paramdir { + font-family: "courier new",courier,monospace; + vertical-align: top; +} + + + + +/* @end */ + +/* @group Directory (tree) */ + +/* for the tree view */ + +.ftvtree { + font-family: sans-serif; + margin: 0px; +} + +/* these are for tree view when used as main index */ + +.directory { + font-size: 9pt; + font-weight: bold; + margin: 5px; +} + +.directory h3 { + margin: 0px; + margin-top: 1em; + font-size: 11pt; +} + +/* +The following two styles can be used to replace the root node title +with an image of your choice. Simply uncomment the next two styles, +specify the name of your image and be sure to set 'height' to the +proper pixel height of your image. +*/ + +/* +.directory h3.swap { + height: 61px; + background-repeat: no-repeat; + background-image: url("yourimage.gif"); +} +.directory h3.swap span { + display: none; +} +*/ + +.directory > h3 { + margin-top: 0; +} + +.directory p { + margin: 0px; + white-space: nowrap; +} + +.directory div { + display: none; + margin: 0px; +} + +.directory img { + vertical-align: -30%; +} + +/* these are for tree view when not used as main index */ + +.directory-alt { + font-size: 100%; + font-weight: bold; +} + +.directory-alt h3 { + margin: 0px; + margin-top: 1em; + font-size: 11pt; +} + +.directory-alt > h3 { + margin-top: 0; +} + +.directory-alt p { + margin: 0px; + white-space: nowrap; +} + +.directory-alt div { + display: none; + margin: 0px; +} + +.directory-alt img { + vertical-align: -30%; +} + +/* @end */ + +div.dynheader { + margin-top: 8px; +} + +address { + font-style: normal; + color: #2A3D61; +} + +table.doxtable { + border-collapse:collapse; +} + +table.doxtable td, table.doxtable th { + border: 1px solid #2D4068; + padding: 3px 7px 2px; +} + +table.doxtable th { + background-color: #374F7F; + color: #FFFFFF; + font-size: 110%; + padding-bottom: 4px; + padding-top: 5px; + text-align:left; +} + +table.fieldtable { + width: 100%; + margin-bottom: 10px; + border: 1px solid #A8B8D9; + border-spacing: 0px; + -moz-border-radius: 4px; + -webkit-border-radius: 4px; + border-radius: 4px; + -moz-box-shadow: rgba(0, 0, 0, 0.15) 2px 2px 2px; + -webkit-box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.15); + box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.15); +} + +.fieldtable td, .fieldtable th { + padding: 3px 7px 2px; +} + +.fieldtable td.fieldtype, .fieldtable td.fieldname { + white-space: nowrap; + border-right: 1px solid #A8B8D9; + border-bottom: 1px solid #A8B8D9; + vertical-align: top; +} + +.fieldtable td.fielddoc { + border-bottom: 1px solid #A8B8D9; + width: 100%; +} + +.fieldtable tr:last-child td { + border-bottom: none; +} + +.fieldtable th { + background-image:url('nav_f.png'); + background-repeat:repeat-x; + background-color: #E2E8F2; + font-size: 90%; + color: #253555; + padding-bottom: 4px; + padding-top: 5px; + text-align:left; + -moz-border-radius-topleft: 4px; + -moz-border-radius-topright: 4px; + -webkit-border-top-left-radius: 4px; + -webkit-border-top-right-radius: 4px; + border-top-left-radius: 4px; + border-top-right-radius: 4px; + border-bottom: 1px solid #A8B8D9; +} + + +.tabsearch { + top: 0px; + left: 10px; + height: 36px; + background-image: url('tab_b.png'); + z-index: 101; + overflow: hidden; + font-size: 13px; +} + +.navpath ul +{ + font-size: 11px; + background-image:url('tab_b.png'); + background-repeat:repeat-x; + height:30px; + line-height:30px; + color:#8AA0CC; + border:solid 1px #C2CDE4; + overflow:hidden; + margin:0px; + padding:0px; +} + +.navpath li +{ + list-style-type:none; + float:left; + padding-left:10px; + padding-right:15px; + background-image:url('bc_s.png'); + background-repeat:no-repeat; + background-position:right; + color:#364D7C; +} + +.navpath li.navelem a +{ + height:32px; + display:block; + text-decoration: none; + outline: none; +} + +.navpath li.navelem a:hover +{ + color:#6884BD; +} + +.navpath li.footer +{ + list-style-type:none; + float:right; + padding-left:10px; + padding-right:15px; + background-image:none; + background-repeat:no-repeat; + background-position:right; + color:#364D7C; + font-size: 8pt; +} + + +div.summary +{ + float: right; + font-size: 8pt; + padding-right: 5px; + width: 50%; + text-align: right; +} + +div.summary a +{ + white-space: nowrap; +} + +div.ingroups +{ + margin-left: 5px; + font-size: 8pt; + padding-left: 5px; + width: 50%; + text-align: left; +} + +div.ingroups a +{ + white-space: nowrap; +} + +div.header +{ + background-image:url('nav_h.png'); + background-repeat:repeat-x; + background-color: #F9FAFC; + margin: 0px; + border-bottom: 1px solid #C4CFE5; +} + +div.headertitle +{ + padding: 5px 5px 5px 7px; +} + +dl +{ + padding: 0 0 0 10px; +} + +dl.note, dl.warning, dl.attention, dl.pre, dl.post, dl.invariant, dl.deprecated, dl.todo, dl.test, dl.bug +{ + border-left:4px solid; + padding: 0 0 0 6px; +} + +dl.note +{ + border-color: #D0C000; +} + +dl.warning, dl.attention +{ + border-color: #FF0000; +} + +dl.pre, dl.post, dl.invariant +{ + border-color: #00D000; +} + +dl.deprecated +{ + border-color: #505050; +} + +dl.todo +{ + border-color: #00C0E0; +} + +dl.test +{ + border-color: #3030E0; +} + +dl.bug +{ + border-color: #C08050; +} + +#projectlogo +{ + text-align: center; + vertical-align: bottom; + border-collapse: separate; +} + +#projectlogo img +{ + border: 0px none; +} + +#projectname +{ + font: 300% Tahoma, Arial,sans-serif; + margin: 0px; + padding: 2px 0px; +} + +#projectbrief +{ + font: 120% Tahoma, Arial,sans-serif; + margin: 0px; + padding: 0px; +} + +#projectnumber +{ + font: 50% Tahoma, Arial,sans-serif; + margin: 0px; + padding: 0px; +} + +#titlearea +{ + padding: 0px; + margin: 0px; + width: 100%; + border-bottom: 1px solid #5373B4; +} + +.image +{ + text-align: center; +} + +.dotgraph +{ + text-align: center; +} + +.mscgraph +{ + text-align: center; +} + +.caption +{ + font-weight: bold; +} + +div.zoom +{ + border: 1px solid #90A5CE; +} + +dl.citelist { + margin-bottom:50px; +} + +dl.citelist dt { + color:#334975; + float:left; + font-weight:bold; + margin-right:10px; + padding:5px; +} + +dl.citelist dd { + margin:2px 0; + padding:5px 0; +} + +@media print +{ + #top { display: none; } + #side-nav { display: none; } + #nav-path { display: none; } + body { overflow:visible; } + h1, h2, h3, h4, h5, h6 { page-break-after: avoid; } + .summary { display: none; } + .memitem { page-break-inside: avoid; } + #doc-content + { + margin-left:0 !important; + height:auto !important; + width:auto !important; + overflow:inherit; + display:inline; + } + pre.fragment + { + overflow: visible; + text-wrap: unrestricted; + white-space: -moz-pre-wrap; /* Moz */ + white-space: -pre-wrap; /* Opera 4-6 */ + white-space: -o-pre-wrap; /* Opera 7 */ + white-space: pre-wrap; /* CSS3 */ + word-wrap: break-word; /* IE 5.5+ */ + } +} + diff --git a/docs/html/doxygen.png b/docs/html/doxygen.png new file mode 100644 index 0000000..635ed52 Binary files /dev/null and b/docs/html/doxygen.png differ diff --git a/docs/html/files.html b/docs/html/files.html new file mode 100644 index 0000000..c820370 --- /dev/null +++ b/docs/html/files.html @@ -0,0 +1,159 @@ + + + + +Rally X: File List + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
+
File List
+
+
+
Here is a list of all files with brief descriptions:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
source/main.cpp [code]
source/data/Config.cpp [code]
source/data/Config.h [code]
source/data/LevelReader.cpp [code]
source/data/LevelReader.h [code]
source/logic/AllegroWrappers.cpp [code]
source/logic/AllegroWrappers.h [code]
source/logic/Car.cpp [code]
source/logic/Car.h [code]
source/logic/Checkpoint.cpp [code]
source/logic/Checkpoint.h [code]
source/logic/CollisionDetector.cpp [code]
source/logic/CollisionDetector.h [code]
source/logic/DestroyedObjectPopup.cpp [code]
source/logic/DestroyedObjectPopup.h [code]
source/logic/EnemyCar.cpp [code]
source/logic/EnemyCar.h [code]
source/logic/Game.cpp [code]
source/logic/Game.h [code]
source/logic/GameObject.cpp [code]
source/logic/GameObject.h [code]
source/logic/LimitedTimeObject.cpp [code]
source/logic/LimitedTimeObject.h [code]
source/logic/Maze.cpp [code]
source/logic/Maze.h [code]
source/logic/MazeMath.cpp [code]
source/logic/MazeMath.h [code]
source/logic/PlayerCar.cpp [code]
source/logic/PlayerCar.h [code]
source/logic/Rock.cpp [code]
source/logic/Rock.h [code]
source/logic/Smokescreen.cpp [code]
source/logic/Smokescreen.h [code]
source/presentation/BitmapStore.cpp [code]
source/presentation/BitmapStore.h [code]
source/presentation/ColourStore.cpp [code]
source/presentation/ColourStore.h [code]
source/presentation/GamePanel.cpp [code]
source/presentation/GamePanel.h [code]
source/presentation/InfoPanel.cpp [code]
source/presentation/InfoPanel.h [code]
source/presentation/KeyboardHandler.cpp [code]
source/presentation/KeyboardHandler.h [code]
source/presentation/Screen.cpp [code]
source/presentation/Screen.h [code]
source/presentation/ScreenPanel.cpp [code]
source/presentation/ScreenPanel.h [code]
tests/dataTests.cpp [code]Unit tests for the data layer of a Rally-X game
tests/logicTests.cpp [code]Unit tests for the logic layer of a Rally-X game
tests/presentationTests.cpp [code]Unit tests for the presentation layer of a Rally-X game
+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/functions.html b/docs/html/functions.html new file mode 100644 index 0000000..b88cd0a --- /dev/null +++ b/docs/html/functions.html @@ -0,0 +1,377 @@ + + + + +Rally X: Class Members + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + + + +
+
+
Here is a list of all class members with links to the classes they belong to:
+ +

- _ -

+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/functions_0x61.html b/docs/html/functions_0x61.html new file mode 100644 index 0000000..ebe7268 --- /dev/null +++ b/docs/html/functions_0x61.html @@ -0,0 +1,154 @@ + + + + +Rally X: Class Members + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + + + +
+
+
Here is a list of all class members with links to the classes they belong to:
+ +

- a -

+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/functions_0x62.html b/docs/html/functions_0x62.html new file mode 100644 index 0000000..7ec2816 --- /dev/null +++ b/docs/html/functions_0x62.html @@ -0,0 +1,166 @@ + + + + +Rally X: Class Members + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + + + +
+
+
Here is a list of all class members with links to the classes they belong to:
+ +

- b -

+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/functions_0x63.html b/docs/html/functions_0x63.html new file mode 100644 index 0000000..43bd007 --- /dev/null +++ b/docs/html/functions_0x63.html @@ -0,0 +1,197 @@ + + + + +Rally X: Class Members + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + + + +
+
+
Here is a list of all class members with links to the classes they belong to:
+ +

- c -

+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/functions_0x64.html b/docs/html/functions_0x64.html new file mode 100644 index 0000000..b21060a --- /dev/null +++ b/docs/html/functions_0x64.html @@ -0,0 +1,203 @@ + + + + +Rally X: Class Members + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + + + +
+
+
Here is a list of all class members with links to the classes they belong to:
+ +

- d -

+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/functions_0x65.html b/docs/html/functions_0x65.html new file mode 100644 index 0000000..4ac8571 --- /dev/null +++ b/docs/html/functions_0x65.html @@ -0,0 +1,160 @@ + + + + +Rally X: Class Members + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + + + +
+
+
Here is a list of all class members with links to the classes they belong to:
+ +

- e -

+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/functions_0x66.html b/docs/html/functions_0x66.html new file mode 100644 index 0000000..78b4423 --- /dev/null +++ b/docs/html/functions_0x66.html @@ -0,0 +1,167 @@ + + + + +Rally X: Class Members + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + + + +
+
+
Here is a list of all class members with links to the classes they belong to:
+ +

- f -

+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/functions_0x67.html b/docs/html/functions_0x67.html new file mode 100644 index 0000000..c36fa61 --- /dev/null +++ b/docs/html/functions_0x67.html @@ -0,0 +1,186 @@ + + + + +Rally X: Class Members + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + + + +
+
+
Here is a list of all class members with links to the classes they belong to:
+ +

- g -

+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/functions_0x68.html b/docs/html/functions_0x68.html new file mode 100644 index 0000000..c9d2857 --- /dev/null +++ b/docs/html/functions_0x68.html @@ -0,0 +1,148 @@ + + + + +Rally X: Class Members + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + + + +
+
+
Here is a list of all class members with links to the classes they belong to:
+ +

- h -

+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/functions_0x69.html b/docs/html/functions_0x69.html new file mode 100644 index 0000000..178c837 --- /dev/null +++ b/docs/html/functions_0x69.html @@ -0,0 +1,157 @@ + + + + +Rally X: Class Members + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + + + +
+
+
Here is a list of all class members with links to the classes they belong to:
+ +

- i -

+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/functions_0x6b.html b/docs/html/functions_0x6b.html new file mode 100644 index 0000000..5a06e24 --- /dev/null +++ b/docs/html/functions_0x6b.html @@ -0,0 +1,148 @@ + + + + +Rally X: Class Members + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + + + +
+
+
Here is a list of all class members with links to the classes they belong to:
+ +

- k -

+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/functions_0x6c.html b/docs/html/functions_0x6c.html new file mode 100644 index 0000000..56b1122 --- /dev/null +++ b/docs/html/functions_0x6c.html @@ -0,0 +1,157 @@ + + + + +Rally X: Class Members + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + + + +
+
+
Here is a list of all class members with links to the classes they belong to:
+ +

- l -

+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/functions_0x6d.html b/docs/html/functions_0x6d.html new file mode 100644 index 0000000..38b3401 --- /dev/null +++ b/docs/html/functions_0x6d.html @@ -0,0 +1,163 @@ + + + + +Rally X: Class Members + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + + + +
+
+
Here is a list of all class members with links to the classes they belong to:
+ +

- m -

+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/functions_0x6f.html b/docs/html/functions_0x6f.html new file mode 100644 index 0000000..9e4c60e --- /dev/null +++ b/docs/html/functions_0x6f.html @@ -0,0 +1,156 @@ + + + + +Rally X: Class Members + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + + + +
+
+
Here is a list of all class members with links to the classes they belong to:
+ +

- o -

+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/functions_0x70.html b/docs/html/functions_0x70.html new file mode 100644 index 0000000..3adc8ce --- /dev/null +++ b/docs/html/functions_0x70.html @@ -0,0 +1,172 @@ + + + + +Rally X: Class Members + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + + + +
+
+
Here is a list of all class members with links to the classes they belong to:
+ +

- p -

+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/functions_0x72.html b/docs/html/functions_0x72.html new file mode 100644 index 0000000..9bfaa84 --- /dev/null +++ b/docs/html/functions_0x72.html @@ -0,0 +1,178 @@ + + + + +Rally X: Class Members + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + + + +
+
+
Here is a list of all class members with links to the classes they belong to:
+ +

- r -

+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/functions_0x73.html b/docs/html/functions_0x73.html new file mode 100644 index 0000000..f720544 --- /dev/null +++ b/docs/html/functions_0x73.html @@ -0,0 +1,199 @@ + + + + +Rally X: Class Members + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + + + +
+
+
Here is a list of all class members with links to the classes they belong to:
+ +

- s -

+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/functions_0x75.html b/docs/html/functions_0x75.html new file mode 100644 index 0000000..b1ac8f2 --- /dev/null +++ b/docs/html/functions_0x75.html @@ -0,0 +1,160 @@ + + + + +Rally X: Class Members + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + + + +
+
+
Here is a list of all class members with links to the classes they belong to:
+ +

- u -

+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/functions_0x77.html b/docs/html/functions_0x77.html new file mode 100644 index 0000000..0c9a602 --- /dev/null +++ b/docs/html/functions_0x77.html @@ -0,0 +1,154 @@ + + + + +Rally X: Class Members + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + + + +
+
+
Here is a list of all class members with links to the classes they belong to:
+ +

- w -

+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/functions_0x78.html b/docs/html/functions_0x78.html new file mode 100644 index 0000000..2127635 --- /dev/null +++ b/docs/html/functions_0x78.html @@ -0,0 +1,148 @@ + + + + +Rally X: Class Members + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + + + +
+
+
Here is a list of all class members with links to the classes they belong to:
+ +

- x -

+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/functions_0x79.html b/docs/html/functions_0x79.html new file mode 100644 index 0000000..8a74950 --- /dev/null +++ b/docs/html/functions_0x79.html @@ -0,0 +1,148 @@ + + + + +Rally X: Class Members + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + + + +
+
+
Here is a list of all class members with links to the classes they belong to:
+ +

- y -

+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/functions_0x7e.html b/docs/html/functions_0x7e.html new file mode 100644 index 0000000..34e3fa5 --- /dev/null +++ b/docs/html/functions_0x7e.html @@ -0,0 +1,175 @@ + + + + +Rally X: Class Members + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + + + +
+
+
Here is a list of all class members with links to the classes they belong to:
+ +

- ~ -

+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/functions_enum.html b/docs/html/functions_enum.html new file mode 100644 index 0000000..a8354a8 --- /dev/null +++ b/docs/html/functions_enum.html @@ -0,0 +1,126 @@ + + + + +Rally X: Class Members - Enumerations + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + + +
+
+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/functions_eval.html b/docs/html/functions_eval.html new file mode 100644 index 0000000..4e6fca5 --- /dev/null +++ b/docs/html/functions_eval.html @@ -0,0 +1,162 @@ + + + + +Rally X: Class Members - Enumerator + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + + +
+
+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/functions_func.html b/docs/html/functions_func.html new file mode 100644 index 0000000..67bae61 --- /dev/null +++ b/docs/html/functions_func.html @@ -0,0 +1,548 @@ + + + + +Rally X: Class Members - Functions + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + + + +
+
+  + +

- a -

+ + +

- b -

+ + +

- c -

+ + +

- d -

+ + +

- e -

+ + +

- f -

+ + +

- g -

+ + +

- h -

+ + +

- i -

+ + +

- k -

+ + +

- l -

+ + +

- m -

+ + +

- o -

+ + +

- p -

+ + +

- r -

+ + +

- s -

+ + +

- u -

+ + +

- w -

+ + +

- x -

+ + +

- y -

+ + +

- ~ -

+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/functions_type.html b/docs/html/functions_type.html new file mode 100644 index 0000000..149092b --- /dev/null +++ b/docs/html/functions_type.html @@ -0,0 +1,120 @@ + + + + +Rally X: Class Members - Typedefs + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + + +
+
+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/functions_vars.html b/docs/html/functions_vars.html new file mode 100644 index 0000000..2dbe8df --- /dev/null +++ b/docs/html/functions_vars.html @@ -0,0 +1,483 @@ + + + + +Rally X: Class Members - Variables + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + + + +
+
+  + +

- _ -

+ + +

- b -

+ + +

- c -

+ + +

- d -

+ + +

- e -

+ + +

- f -

+ + +

- l -

+ + +

- p -

+ + +

- r -

+ + +

- s -

+ + +

- u -

+ + +

- w -

+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/globals.html b/docs/html/globals.html new file mode 100644 index 0000000..0e0f67e --- /dev/null +++ b/docs/html/globals.html @@ -0,0 +1,132 @@ + + + + +Rally X: File Members + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + + + +
+
+
Here is a list of all file members with links to the files they belong to:
+ +

- m -

+ + +

- t -

+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/globals_func.html b/docs/html/globals_func.html new file mode 100644 index 0000000..6fb96a3 --- /dev/null +++ b/docs/html/globals_func.html @@ -0,0 +1,132 @@ + + + + +Rally X: File Members + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + + + +
+
+  + +

- m -

+ + +

- t -

+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/hierarchy.html b/docs/html/hierarchy.html new file mode 100644 index 0000000..c961c19 --- /dev/null +++ b/docs/html/hierarchy.html @@ -0,0 +1,147 @@ + + + + +Rally X: Class Hierarchy + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
+
Class Hierarchy
+
+
+
This inheritance list is sorted roughly, but not completely, alphabetically:
+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/index.html b/docs/html/index.html new file mode 100644 index 0000000..9e3eb50 --- /dev/null +++ b/docs/html/index.html @@ -0,0 +1,101 @@ + + + + +Rally X: Main Page + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + +
+
+
+
Rally X Documentation
+
+
+
+ +
+ All Classes Files Functions Variables Typedefs Enumerations Enumerator
+ + +
+ +
+ + + + + + + diff --git a/docs/html/installdox b/docs/html/installdox new file mode 100644 index 0000000..edf5bbf --- /dev/null +++ b/docs/html/installdox @@ -0,0 +1,112 @@ +#!/usr/bin/perl + +%subst = ( ); +$quiet = 0; + +while ( @ARGV ) { + $_ = shift @ARGV; + if ( s/^-// ) { + if ( /^l(.*)/ ) { + $v = ($1 eq "") ? shift @ARGV : $1; + ($v =~ /\/$/) || ($v .= "/"); + $_ = $v; + if ( /(.+)\@(.+)/ ) { + if ( exists $subst{$1} ) { + $subst{$1} = $2; + } else { + print STDERR "Unknown tag file $1 given with option -l\n"; + &usage(); + } + } else { + print STDERR "Argument $_ is invalid for option -l\n"; + &usage(); + } + } + elsif ( /^q/ ) { + $quiet = 1; + } + elsif ( /^\?|^h/ ) { + &usage(); + } + else { + print STDERR "Illegal option -$_\n"; + &usage(); + } + } + else { + push (@files, $_ ); + } +} + +foreach $sub (keys %subst) +{ + if ( $subst{$sub} eq "" ) + { + print STDERR "No substitute given for tag file `$sub'\n"; + &usage(); + } + elsif ( ! $quiet && $sub ne "_doc" && $sub ne "_cgi" ) + { + print "Substituting $subst{$sub} for each occurrence of tag file $sub\n"; + } +} + +if ( ! @files ) { + if (opendir(D,".")) { + foreach $file ( readdir(D) ) { + $match = ".html"; + next if ( $file =~ /^\.\.?$/ ); + ($file =~ /$match/) && (push @files, $file); + ($file =~ /\.svg/) && (push @files, $file); + ($file =~ "navtree.js") && (push @files, $file); + } + closedir(D); + } +} + +if ( ! @files ) { + print STDERR "Warning: No input files given and none found!\n"; +} + +foreach $f (@files) +{ + if ( ! $quiet ) { + print "Editing: $f...\n"; + } + $oldf = $f; + $f .= ".bak"; + unless (rename $oldf,$f) { + print STDERR "Error: cannot rename file $oldf\n"; + exit 1; + } + if (open(F,"<$f")) { + unless (open(G,">$oldf")) { + print STDERR "Error: opening file $oldf for writing\n"; + exit 1; + } + if ($oldf ne "tree.js") { + while () { + s/doxygen\=\"([^ \"\:\t\>\<]*)\:([^ \"\t\>\<]*)\" (xlink:href|href|src)=\"\2/doxygen\=\"$1:$subst{$1}\" \3=\"$subst{$1}/g; + print G "$_"; + } + } + else { + while () { + s/\"([^ \"\:\t\>\<]*)\:([^ \"\t\>\<]*)\", \"\2/\"$1:$subst{$1}\" ,\"$subst{$1}/g; + print G "$_"; + } + } + } + else { + print STDERR "Warning file $f does not exist\n"; + } + unlink $f; +} + +sub usage { + print STDERR "Usage: installdox [options] [html-file [html-file ...]]\n"; + print STDERR "Options:\n"; + print STDERR " -l tagfile\@linkName tag file + URL or directory \n"; + print STDERR " -q Quiet mode\n\n"; + exit 1; +} diff --git a/docs/html/jquery.js b/docs/html/jquery.js new file mode 100644 index 0000000..c052173 --- /dev/null +++ b/docs/html/jquery.js @@ -0,0 +1,54 @@ +/* + * jQuery JavaScript Library v1.3.2 + * http://jquery.com/ + * + * Copyright (c) 2009 John Resig + * Dual licensed under the MIT and GPL licenses. + * http://docs.jquery.com/License + * + * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009) + * Revision: 6246 + */ +(function(){var l=this,g,y=l.jQuery,p=l.$,o=l.jQuery=l.$=function(E,F){return new o.fn.init(E,F)},D=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,f=/^.[^:#\[\.,]*$/;o.fn=o.prototype={init:function(E,H){E=E||document;if(E.nodeType){this[0]=E;this.length=1;this.context=E;return this}if(typeof E==="string"){var G=D.exec(E);if(G&&(G[1]||!H)){if(G[1]){E=o.clean([G[1]],H)}else{var I=document.getElementById(G[3]);if(I&&I.id!=G[3]){return o().find(E)}var F=o(I||[]);F.context=document;F.selector=E;return F}}else{return o(H).find(E)}}else{if(o.isFunction(E)){return o(document).ready(E)}}if(E.selector&&E.context){this.selector=E.selector;this.context=E.context}return this.setArray(o.isArray(E)?E:o.makeArray(E))},selector:"",jquery:"1.3.2",size:function(){return this.length},get:function(E){return E===g?Array.prototype.slice.call(this):this[E]},pushStack:function(F,H,E){var G=o(F);G.prevObject=this;G.context=this.context;if(H==="find"){G.selector=this.selector+(this.selector?" ":"")+E}else{if(H){G.selector=this.selector+"."+H+"("+E+")"}}return G},setArray:function(E){this.length=0;Array.prototype.push.apply(this,E);return this},each:function(F,E){return o.each(this,F,E)},index:function(E){return o.inArray(E&&E.jquery?E[0]:E,this)},attr:function(F,H,G){var E=F;if(typeof F==="string"){if(H===g){return this[0]&&o[G||"attr"](this[0],F)}else{E={};E[F]=H}}return this.each(function(I){for(F in E){o.attr(G?this.style:this,F,o.prop(this,E[F],G,I,F))}})},css:function(E,F){if((E=="width"||E=="height")&&parseFloat(F)<0){F=g}return this.attr(E,F,"curCSS")},text:function(F){if(typeof F!=="object"&&F!=null){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(F))}var E="";o.each(F||this,function(){o.each(this.childNodes,function(){if(this.nodeType!=8){E+=this.nodeType!=1?this.nodeValue:o.fn.text([this])}})});return E},wrapAll:function(E){if(this[0]){var F=o(E,this[0].ownerDocument).clone();if(this[0].parentNode){F.insertBefore(this[0])}F.map(function(){var G=this;while(G.firstChild){G=G.firstChild}return G}).append(this)}return this},wrapInner:function(E){return this.each(function(){o(this).contents().wrapAll(E)})},wrap:function(E){return this.each(function(){o(this).wrapAll(E)})},append:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.appendChild(E)}})},prepend:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.insertBefore(E,this.firstChild)}})},before:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this)})},after:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this.nextSibling)})},end:function(){return this.prevObject||o([])},push:[].push,sort:[].sort,splice:[].splice,find:function(E){if(this.length===1){var F=this.pushStack([],"find",E);F.length=0;o.find(E,this[0],F);return F}else{return this.pushStack(o.unique(o.map(this,function(G){return o.find(E,G)})),"find",E)}},clone:function(G){var E=this.map(function(){if(!o.support.noCloneEvent&&!o.isXMLDoc(this)){var I=this.outerHTML;if(!I){var J=this.ownerDocument.createElement("div");J.appendChild(this.cloneNode(true));I=J.innerHTML}return o.clean([I.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0]}else{return this.cloneNode(true)}});if(G===true){var H=this.find("*").andSelf(),F=0;E.find("*").andSelf().each(function(){if(this.nodeName!==H[F].nodeName){return}var I=o.data(H[F],"events");for(var K in I){for(var J in I[K]){o.event.add(this,K,I[K][J],I[K][J].data)}}F++})}return E},filter:function(E){return this.pushStack(o.isFunction(E)&&o.grep(this,function(G,F){return E.call(G,F)})||o.multiFilter(E,o.grep(this,function(F){return F.nodeType===1})),"filter",E)},closest:function(E){var G=o.expr.match.POS.test(E)?o(E):null,F=0;return this.map(function(){var H=this;while(H&&H.ownerDocument){if(G?G.index(H)>-1:o(H).is(E)){o.data(H,"closest",F);return H}H=H.parentNode;F++}})},not:function(E){if(typeof E==="string"){if(f.test(E)){return this.pushStack(o.multiFilter(E,this,true),"not",E)}else{E=o.multiFilter(E,this)}}var F=E.length&&E[E.length-1]!==g&&!E.nodeType;return this.filter(function(){return F?o.inArray(this,E)<0:this!=E})},add:function(E){return this.pushStack(o.unique(o.merge(this.get(),typeof E==="string"?o(E):o.makeArray(E))))},is:function(E){return !!E&&o.multiFilter(E,this).length>0},hasClass:function(E){return !!E&&this.is("."+E)},val:function(K){if(K===g){var E=this[0];if(E){if(o.nodeName(E,"option")){return(E.attributes.value||{}).specified?E.value:E.text}if(o.nodeName(E,"select")){var I=E.selectedIndex,L=[],M=E.options,H=E.type=="select-one";if(I<0){return null}for(var F=H?I:0,J=H?I+1:M.length;F=0||o.inArray(this.name,K)>=0)}else{if(o.nodeName(this,"select")){var N=o.makeArray(K);o("option",this).each(function(){this.selected=(o.inArray(this.value,N)>=0||o.inArray(this.text,N)>=0)});if(!N.length){this.selectedIndex=-1}}else{this.value=K}}})},html:function(E){return E===g?(this[0]?this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g,""):null):this.empty().append(E)},replaceWith:function(E){return this.after(E).remove()},eq:function(E){return this.slice(E,+E+1)},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","))},map:function(E){return this.pushStack(o.map(this,function(G,F){return E.call(G,F,G)}))},andSelf:function(){return this.add(this.prevObject)},domManip:function(J,M,L){if(this[0]){var I=(this[0].ownerDocument||this[0]).createDocumentFragment(),F=o.clean(J,(this[0].ownerDocument||this[0]),I),H=I.firstChild;if(H){for(var G=0,E=this.length;G1||G>0?I.cloneNode(true):I)}}if(F){o.each(F,z)}}return this;function K(N,O){return M&&o.nodeName(N,"table")&&o.nodeName(O,"tr")?(N.getElementsByTagName("tbody")[0]||N.appendChild(N.ownerDocument.createElement("tbody"))):N}}};o.fn.init.prototype=o.fn;function z(E,F){if(F.src){o.ajax({url:F.src,async:false,dataType:"script"})}else{o.globalEval(F.text||F.textContent||F.innerHTML||"")}if(F.parentNode){F.parentNode.removeChild(F)}}function e(){return +new Date}o.extend=o.fn.extend=function(){var J=arguments[0]||{},H=1,I=arguments.length,E=false,G;if(typeof J==="boolean"){E=J;J=arguments[1]||{};H=2}if(typeof J!=="object"&&!o.isFunction(J)){J={}}if(I==H){J=this;--H}for(;H-1}},swap:function(H,G,I){var E={};for(var F in G){E[F]=H.style[F];H.style[F]=G[F]}I.call(H);for(var F in G){H.style[F]=E[F]}},css:function(H,F,J,E){if(F=="width"||F=="height"){var L,G={position:"absolute",visibility:"hidden",display:"block"},K=F=="width"?["Left","Right"]:["Top","Bottom"];function I(){L=F=="width"?H.offsetWidth:H.offsetHeight;if(E==="border"){return}o.each(K,function(){if(!E){L-=parseFloat(o.curCSS(H,"padding"+this,true))||0}if(E==="margin"){L+=parseFloat(o.curCSS(H,"margin"+this,true))||0}else{L-=parseFloat(o.curCSS(H,"border"+this+"Width",true))||0}})}if(H.offsetWidth!==0){I()}else{o.swap(H,G,I)}return Math.max(0,Math.round(L))}return o.curCSS(H,F,J)},curCSS:function(I,F,G){var L,E=I.style;if(F=="opacity"&&!o.support.opacity){L=o.attr(E,"opacity");return L==""?"1":L}if(F.match(/float/i)){F=w}if(!G&&E&&E[F]){L=E[F]}else{if(q.getComputedStyle){if(F.match(/float/i)){F="float"}F=F.replace(/([A-Z])/g,"-$1").toLowerCase();var M=q.getComputedStyle(I,null);if(M){L=M.getPropertyValue(F)}if(F=="opacity"&&L==""){L="1"}}else{if(I.currentStyle){var J=F.replace(/\-(\w)/g,function(N,O){return O.toUpperCase()});L=I.currentStyle[F]||I.currentStyle[J];if(!/^\d+(px)?$/i.test(L)&&/^\d/.test(L)){var H=E.left,K=I.runtimeStyle.left;I.runtimeStyle.left=I.currentStyle.left;E.left=L||0;L=E.pixelLeft+"px";E.left=H;I.runtimeStyle.left=K}}}}return L},clean:function(F,K,I){K=K||document;if(typeof K.createElement==="undefined"){K=K.ownerDocument||K[0]&&K[0].ownerDocument||document}if(!I&&F.length===1&&typeof F[0]==="string"){var H=/^<(\w+)\s*\/?>$/.exec(F[0]);if(H){return[K.createElement(H[1])]}}var G=[],E=[],L=K.createElement("div");o.each(F,function(P,S){if(typeof S==="number"){S+=""}if(!S){return}if(typeof S==="string"){S=S.replace(/(<(\w+)[^>]*?)\/>/g,function(U,V,T){return T.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?U:V+">"});var O=S.replace(/^\s+/,"").substring(0,10).toLowerCase();var Q=!O.indexOf("",""]||!O.indexOf("",""]||O.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"","
"]||!O.indexOf("",""]||(!O.indexOf("",""]||!O.indexOf("",""]||!o.support.htmlSerialize&&[1,"div
","
"]||[0,"",""];L.innerHTML=Q[1]+S+Q[2];while(Q[0]--){L=L.lastChild}if(!o.support.tbody){var R=/"&&!R?L.childNodes:[];for(var M=N.length-1;M>=0;--M){if(o.nodeName(N[M],"tbody")&&!N[M].childNodes.length){N[M].parentNode.removeChild(N[M])}}}if(!o.support.leadingWhitespace&&/^\s/.test(S)){L.insertBefore(K.createTextNode(S.match(/^\s*/)[0]),L.firstChild)}S=o.makeArray(L.childNodes)}if(S.nodeType){G.push(S)}else{G=o.merge(G,S)}});if(I){for(var J=0;G[J];J++){if(o.nodeName(G[J],"script")&&(!G[J].type||G[J].type.toLowerCase()==="text/javascript")){E.push(G[J].parentNode?G[J].parentNode.removeChild(G[J]):G[J])}else{if(G[J].nodeType===1){G.splice.apply(G,[J+1,0].concat(o.makeArray(G[J].getElementsByTagName("script"))))}I.appendChild(G[J])}}return E}return G},attr:function(J,G,K){if(!J||J.nodeType==3||J.nodeType==8){return g}var H=!o.isXMLDoc(J),L=K!==g;G=H&&o.props[G]||G;if(J.tagName){var F=/href|src|style/.test(G);if(G=="selected"&&J.parentNode){J.parentNode.selectedIndex}if(G in J&&H&&!F){if(L){if(G=="type"&&o.nodeName(J,"input")&&J.parentNode){throw"type property can't be changed"}J[G]=K}if(o.nodeName(J,"form")&&J.getAttributeNode(G)){return J.getAttributeNode(G).nodeValue}if(G=="tabIndex"){var I=J.getAttributeNode("tabIndex");return I&&I.specified?I.value:J.nodeName.match(/(button|input|object|select|textarea)/i)?0:J.nodeName.match(/^(a|area)$/i)&&J.href?0:g}return J[G]}if(!o.support.style&&H&&G=="style"){return o.attr(J.style,"cssText",K)}if(L){J.setAttribute(G,""+K)}var E=!o.support.hrefNormalized&&H&&F?J.getAttribute(G,2):J.getAttribute(G);return E===null?g:E}if(!o.support.opacity&&G=="opacity"){if(L){J.zoom=1;J.filter=(J.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(K)+""=="NaN"?"":"alpha(opacity="+K*100+")")}return J.filter&&J.filter.indexOf("opacity=")>=0?(parseFloat(J.filter.match(/opacity=([^)]*)/)[1])/100)+"":""}G=G.replace(/-([a-z])/ig,function(M,N){return N.toUpperCase()});if(L){J[G]=K}return J[G]},trim:function(E){return(E||"").replace(/^\s+|\s+$/g,"")},makeArray:function(G){var E=[];if(G!=null){var F=G.length;if(F==null||typeof G==="string"||o.isFunction(G)||G.setInterval){E[0]=G}else{while(F){E[--F]=G[F]}}}return E},inArray:function(G,H){for(var E=0,F=H.length;E0?this.clone(true):this).get();o.fn[F].apply(o(L[K]),I);J=J.concat(I)}return this.pushStack(J,E,G)}});o.each({removeAttr:function(E){o.attr(this,E,"");if(this.nodeType==1){this.removeAttribute(E)}},addClass:function(E){o.className.add(this,E)},removeClass:function(E){o.className.remove(this,E)},toggleClass:function(F,E){if(typeof E!=="boolean"){E=!o.className.has(this,F)}o.className[E?"add":"remove"](this,F)},remove:function(E){if(!E||o.filter(E,[this]).length){o("*",this).add([this]).each(function(){o.event.remove(this);o.removeData(this)});if(this.parentNode){this.parentNode.removeChild(this)}}},empty:function(){o(this).children().remove();while(this.firstChild){this.removeChild(this.firstChild)}}},function(E,F){o.fn[E]=function(){return this.each(F,arguments)}});function j(E,F){return E[0]&&parseInt(o.curCSS(E[0],F,true),10)||0}var h="jQuery"+e(),v=0,A={};o.extend({cache:{},data:function(F,E,G){F=F==l?A:F;var H=F[h];if(!H){H=F[h]=++v}if(E&&!o.cache[H]){o.cache[H]={}}if(G!==g){o.cache[H][E]=G}return E?o.cache[H][E]:H},removeData:function(F,E){F=F==l?A:F;var H=F[h];if(E){if(o.cache[H]){delete o.cache[H][E];E="";for(E in o.cache[H]){break}if(!E){o.removeData(F)}}}else{try{delete F[h]}catch(G){if(F.removeAttribute){F.removeAttribute(h)}}delete o.cache[H]}},queue:function(F,E,H){if(F){E=(E||"fx")+"queue";var G=o.data(F,E);if(!G||o.isArray(H)){G=o.data(F,E,o.makeArray(H))}else{if(H){G.push(H)}}}return G},dequeue:function(H,G){var E=o.queue(H,G),F=E.shift();if(!G||G==="fx"){F=E[0]}if(F!==g){F.call(H)}}});o.fn.extend({data:function(E,G){var H=E.split(".");H[1]=H[1]?"."+H[1]:"";if(G===g){var F=this.triggerHandler("getData"+H[1]+"!",[H[0]]);if(F===g&&this.length){F=o.data(this[0],E)}return F===g&&H[1]?this.data(H[0]):F}else{return this.trigger("setData"+H[1]+"!",[H[0],G]).each(function(){o.data(this,E,G)})}},removeData:function(E){return this.each(function(){o.removeData(this,E)})},queue:function(E,F){if(typeof E!=="string"){F=E;E="fx"}if(F===g){return o.queue(this[0],E)}return this.each(function(){var G=o.queue(this,E,F);if(E=="fx"&&G.length==1){G[0].call(this)}})},dequeue:function(E){return this.each(function(){o.dequeue(this,E)})}}); +/* + * Sizzle CSS Selector Engine - v0.9.3 + * Copyright 2009, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * More information: http://sizzlejs.com/ + */ +(function(){var R=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,L=0,H=Object.prototype.toString;var F=function(Y,U,ab,ac){ab=ab||[];U=U||document;if(U.nodeType!==1&&U.nodeType!==9){return[]}if(!Y||typeof Y!=="string"){return ab}var Z=[],W,af,ai,T,ad,V,X=true;R.lastIndex=0;while((W=R.exec(Y))!==null){Z.push(W[1]);if(W[2]){V=RegExp.rightContext;break}}if(Z.length>1&&M.exec(Y)){if(Z.length===2&&I.relative[Z[0]]){af=J(Z[0]+Z[1],U)}else{af=I.relative[Z[0]]?[U]:F(Z.shift(),U);while(Z.length){Y=Z.shift();if(I.relative[Y]){Y+=Z.shift()}af=J(Y,af)}}}else{var ae=ac?{expr:Z.pop(),set:E(ac)}:F.find(Z.pop(),Z.length===1&&U.parentNode?U.parentNode:U,Q(U));af=F.filter(ae.expr,ae.set);if(Z.length>0){ai=E(af)}else{X=false}while(Z.length){var ah=Z.pop(),ag=ah;if(!I.relative[ah]){ah=""}else{ag=Z.pop()}if(ag==null){ag=U}I.relative[ah](ai,ag,Q(U))}}if(!ai){ai=af}if(!ai){throw"Syntax error, unrecognized expression: "+(ah||Y)}if(H.call(ai)==="[object Array]"){if(!X){ab.push.apply(ab,ai)}else{if(U.nodeType===1){for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&(ai[aa]===true||ai[aa].nodeType===1&&K(U,ai[aa]))){ab.push(af[aa])}}}else{for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&ai[aa].nodeType===1){ab.push(af[aa])}}}}}else{E(ai,ab)}if(V){F(V,U,ab,ac);if(G){hasDuplicate=false;ab.sort(G);if(hasDuplicate){for(var aa=1;aa":function(Z,U,aa){var X=typeof U==="string";if(X&&!/\W/.test(U)){U=aa?U:U.toUpperCase();for(var V=0,T=Z.length;V=0)){if(!V){T.push(Y)}}else{if(V){U[X]=false}}}}return false},ID:function(T){return T[1].replace(/\\/g,"")},TAG:function(U,T){for(var V=0;T[V]===false;V++){}return T[V]&&Q(T[V])?U[1]:U[1].toUpperCase()},CHILD:function(T){if(T[1]=="nth"){var U=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(T[2]=="even"&&"2n"||T[2]=="odd"&&"2n+1"||!/\D/.test(T[2])&&"0n+"+T[2]||T[2]);T[2]=(U[1]+(U[2]||1))-0;T[3]=U[3]-0}T[0]=L++;return T},ATTR:function(X,U,V,T,Y,Z){var W=X[1].replace(/\\/g,"");if(!Z&&I.attrMap[W]){X[1]=I.attrMap[W]}if(X[2]==="~="){X[4]=" "+X[4]+" "}return X},PSEUDO:function(X,U,V,T,Y){if(X[1]==="not"){if(X[3].match(R).length>1||/^\w/.test(X[3])){X[3]=F(X[3],null,null,U)}else{var W=F.filter(X[3],U,V,true^Y);if(!V){T.push.apply(T,W)}return false}}else{if(I.match.POS.test(X[0])||I.match.CHILD.test(X[0])){return true}}return X},POS:function(T){T.unshift(true);return T}},filters:{enabled:function(T){return T.disabled===false&&T.type!=="hidden"},disabled:function(T){return T.disabled===true},checked:function(T){return T.checked===true},selected:function(T){T.parentNode.selectedIndex;return T.selected===true},parent:function(T){return !!T.firstChild},empty:function(T){return !T.firstChild},has:function(V,U,T){return !!F(T[3],V).length},header:function(T){return/h\d/i.test(T.nodeName)},text:function(T){return"text"===T.type},radio:function(T){return"radio"===T.type},checkbox:function(T){return"checkbox"===T.type},file:function(T){return"file"===T.type},password:function(T){return"password"===T.type},submit:function(T){return"submit"===T.type},image:function(T){return"image"===T.type},reset:function(T){return"reset"===T.type},button:function(T){return"button"===T.type||T.nodeName.toUpperCase()==="BUTTON"},input:function(T){return/input|select|textarea|button/i.test(T.nodeName)}},setFilters:{first:function(U,T){return T===0},last:function(V,U,T,W){return U===W.length-1},even:function(U,T){return T%2===0},odd:function(U,T){return T%2===1},lt:function(V,U,T){return UT[3]-0},nth:function(V,U,T){return T[3]-0==U},eq:function(V,U,T){return T[3]-0==U}},filter:{PSEUDO:function(Z,V,W,aa){var U=V[1],X=I.filters[U];if(X){return X(Z,W,V,aa)}else{if(U==="contains"){return(Z.textContent||Z.innerText||"").indexOf(V[3])>=0}else{if(U==="not"){var Y=V[3];for(var W=0,T=Y.length;W=0)}}},ID:function(U,T){return U.nodeType===1&&U.getAttribute("id")===T},TAG:function(U,T){return(T==="*"&&U.nodeType===1)||U.nodeName===T},CLASS:function(U,T){return(" "+(U.className||U.getAttribute("class"))+" ").indexOf(T)>-1},ATTR:function(Y,W){var V=W[1],T=I.attrHandle[V]?I.attrHandle[V](Y):Y[V]!=null?Y[V]:Y.getAttribute(V),Z=T+"",X=W[2],U=W[4];return T==null?X==="!=":X==="="?Z===U:X==="*="?Z.indexOf(U)>=0:X==="~="?(" "+Z+" ").indexOf(U)>=0:!U?Z&&T!==false:X==="!="?Z!=U:X==="^="?Z.indexOf(U)===0:X==="$="?Z.substr(Z.length-U.length)===U:X==="|="?Z===U||Z.substr(0,U.length+1)===U+"-":false},POS:function(X,U,V,Y){var T=U[2],W=I.setFilters[T];if(W){return W(X,V,U,Y)}}}};var M=I.match.POS;for(var O in I.match){I.match[O]=RegExp(I.match[O].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var E=function(U,T){U=Array.prototype.slice.call(U);if(T){T.push.apply(T,U);return T}return U};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(N){E=function(X,W){var U=W||[];if(H.call(X)==="[object Array]"){Array.prototype.push.apply(U,X)}else{if(typeof X.length==="number"){for(var V=0,T=X.length;V";var T=document.documentElement;T.insertBefore(U,T.firstChild);if(!!document.getElementById(V)){I.find.ID=function(X,Y,Z){if(typeof Y.getElementById!=="undefined"&&!Z){var W=Y.getElementById(X[1]);return W?W.id===X[1]||typeof W.getAttributeNode!=="undefined"&&W.getAttributeNode("id").nodeValue===X[1]?[W]:g:[]}};I.filter.ID=function(Y,W){var X=typeof Y.getAttributeNode!=="undefined"&&Y.getAttributeNode("id");return Y.nodeType===1&&X&&X.nodeValue===W}}T.removeChild(U)})();(function(){var T=document.createElement("div");T.appendChild(document.createComment(""));if(T.getElementsByTagName("*").length>0){I.find.TAG=function(U,Y){var X=Y.getElementsByTagName(U[1]);if(U[1]==="*"){var W=[];for(var V=0;X[V];V++){if(X[V].nodeType===1){W.push(X[V])}}X=W}return X}}T.innerHTML="";if(T.firstChild&&typeof T.firstChild.getAttribute!=="undefined"&&T.firstChild.getAttribute("href")!=="#"){I.attrHandle.href=function(U){return U.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var T=F,U=document.createElement("div");U.innerHTML="

";if(U.querySelectorAll&&U.querySelectorAll(".TEST").length===0){return}F=function(Y,X,V,W){X=X||document;if(!W&&X.nodeType===9&&!Q(X)){try{return E(X.querySelectorAll(Y),V)}catch(Z){}}return T(Y,X,V,W)};F.find=T.find;F.filter=T.filter;F.selectors=T.selectors;F.matches=T.matches})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var T=document.createElement("div");T.innerHTML="
";if(T.getElementsByClassName("e").length===0){return}T.lastChild.className="e";if(T.getElementsByClassName("e").length===1){return}I.order.splice(1,0,"CLASS");I.find.CLASS=function(U,V,W){if(typeof V.getElementsByClassName!=="undefined"&&!W){return V.getElementsByClassName(U[1])}}})()}function P(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W0){X=T;break}}}T=T[U]}ad[W]=X}}}var K=document.compareDocumentPosition?function(U,T){return U.compareDocumentPosition(T)&16}:function(U,T){return U!==T&&(U.contains?U.contains(T):true)};var Q=function(T){return T.nodeType===9&&T.documentElement.nodeName!=="HTML"||!!T.ownerDocument&&Q(T.ownerDocument)};var J=function(T,aa){var W=[],X="",Y,V=aa.nodeType?[aa]:aa;while((Y=I.match.PSEUDO.exec(T))){X+=Y[0];T=T.replace(I.match.PSEUDO,"")}T=I.relative[T]?T+"*":T;for(var Z=0,U=V.length;Z0||T.offsetHeight>0};F.selectors.filters.animated=function(T){return o.grep(o.timers,function(U){return T===U.elem}).length};o.multiFilter=function(V,T,U){if(U){V=":not("+V+")"}return F.matches(V,T)};o.dir=function(V,U){var T=[],W=V[U];while(W&&W!=document){if(W.nodeType==1){T.push(W)}W=W[U]}return T};o.nth=function(X,T,V,W){T=T||1;var U=0;for(;X;X=X[V]){if(X.nodeType==1&&++U==T){break}}return X};o.sibling=function(V,U){var T=[];for(;V;V=V.nextSibling){if(V.nodeType==1&&V!=U){T.push(V)}}return T};return;l.Sizzle=F})();o.event={add:function(I,F,H,K){if(I.nodeType==3||I.nodeType==8){return}if(I.setInterval&&I!=l){I=l}if(!H.guid){H.guid=this.guid++}if(K!==g){var G=H;H=this.proxy(G);H.data=K}var E=o.data(I,"events")||o.data(I,"events",{}),J=o.data(I,"handle")||o.data(I,"handle",function(){return typeof o!=="undefined"&&!o.event.triggered?o.event.handle.apply(arguments.callee.elem,arguments):g});J.elem=I;o.each(F.split(/\s+/),function(M,N){var O=N.split(".");N=O.shift();H.type=O.slice().sort().join(".");var L=E[N];if(o.event.specialAll[N]){o.event.specialAll[N].setup.call(I,K,O)}if(!L){L=E[N]={};if(!o.event.special[N]||o.event.special[N].setup.call(I,K,O)===false){if(I.addEventListener){I.addEventListener(N,J,false)}else{if(I.attachEvent){I.attachEvent("on"+N,J)}}}}L[H.guid]=H;o.event.global[N]=true});I=null},guid:1,global:{},remove:function(K,H,J){if(K.nodeType==3||K.nodeType==8){return}var G=o.data(K,"events"),F,E;if(G){if(H===g||(typeof H==="string"&&H.charAt(0)==".")){for(var I in G){this.remove(K,I+(H||""))}}else{if(H.type){J=H.handler;H=H.type}o.each(H.split(/\s+/),function(M,O){var Q=O.split(".");O=Q.shift();var N=RegExp("(^|\\.)"+Q.slice().sort().join(".*\\.")+"(\\.|$)");if(G[O]){if(J){delete G[O][J.guid]}else{for(var P in G[O]){if(N.test(G[O][P].type)){delete G[O][P]}}}if(o.event.specialAll[O]){o.event.specialAll[O].teardown.call(K,Q)}for(F in G[O]){break}if(!F){if(!o.event.special[O]||o.event.special[O].teardown.call(K,Q)===false){if(K.removeEventListener){K.removeEventListener(O,o.data(K,"handle"),false)}else{if(K.detachEvent){K.detachEvent("on"+O,o.data(K,"handle"))}}}F=null;delete G[O]}}})}for(F in G){break}if(!F){var L=o.data(K,"handle");if(L){L.elem=null}o.removeData(K,"events");o.removeData(K,"handle")}}},trigger:function(I,K,H,E){var G=I.type||I;if(!E){I=typeof I==="object"?I[h]?I:o.extend(o.Event(G),I):o.Event(G);if(G.indexOf("!")>=0) +{I.type=G=G.slice(0,-1);I.exclusive=true}if(!H){I.stopPropagation();if(this.global[G]){o.each(o.cache,function(){if(this.events&&this.events[G]){o.event.trigger(I,K,this.handle.elem)}})}}if(!H||H.nodeType==3||H.nodeType==8){return g}I.result=g;I.target=H;K=o.makeArray(K);K.unshift(I)}I.currentTarget=H;var J=o.data(H,"handle");if(J){J.apply(H,K)}if((!H[G]||(o.nodeName(H,"a")&&G=="click"))&&H["on"+G]&&H["on"+G].apply(H,K)===false){I.result=false}if(!E&&H[G]&&!I.isDefaultPrevented()&&!(o.nodeName(H,"a")&&G=="click")){this.triggered=true;try{H[G]()}catch(L){}}this.triggered=false;if(!I.isPropagationStopped()){var F=H.parentNode||H.ownerDocument;if(F){o.event.trigger(I,K,F,true)}}},handle:function(K){var J,E;K=arguments[0]=o.event.fix(K||l.event);K.currentTarget=this;var L=K.type.split(".");K.type=L.shift();J=!L.length&&!K.exclusive;var I=RegExp("(^|\\.)"+L.slice().sort().join(".*\\.")+"(\\.|$)");E=(o.data(this,"events")||{})[K.type];for(var G in E){var H=E[G];if(J||I.test(H.type)){K.handler=H;K.data=H.data;var F=H.apply(this,arguments);if(F!==g){K.result=F;if(F===false){K.preventDefault();K.stopPropagation()}}if(K.isImmediatePropagationStopped()){break}}}},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(H){if(H[h]){return H}var F=H;H=o.Event(F);for(var G=this.props.length,J;G;){J=this.props[--G];H[J]=F[J]}if(!H.target){H.target=H.srcElement||document}if(H.target.nodeType==3){H.target=H.target.parentNode}if(!H.relatedTarget&&H.fromElement){H.relatedTarget=H.fromElement==H.target?H.toElement:H.fromElement}if(H.pageX==null&&H.clientX!=null){var I=document.documentElement,E=document.body;H.pageX=H.clientX+(I&&I.scrollLeft||E&&E.scrollLeft||0)-(I.clientLeft||0);H.pageY=H.clientY+(I&&I.scrollTop||E&&E.scrollTop||0)-(I.clientTop||0)}if(!H.which&&((H.charCode||H.charCode===0)?H.charCode:H.keyCode)){H.which=H.charCode||H.keyCode}if(!H.metaKey&&H.ctrlKey){H.metaKey=H.ctrlKey}if(!H.which&&H.button){H.which=(H.button&1?1:(H.button&2?3:(H.button&4?2:0)))}return H},proxy:function(F,E){E=E||function(){return F.apply(this,arguments)};E.guid=F.guid=F.guid||E.guid||this.guid++;return E},special:{ready:{setup:B,teardown:function(){}}},specialAll:{live:{setup:function(E,F){o.event.add(this,F[0],c)},teardown:function(G){if(G.length){var E=0,F=RegExp("(^|\\.)"+G[0]+"(\\.|$)");o.each((o.data(this,"events").live||{}),function(){if(F.test(this.type)){E++}});if(E<1){o.event.remove(this,G[0],c)}}}}}};o.Event=function(E){if(!this.preventDefault){return new o.Event(E)}if(E&&E.type){this.originalEvent=E;this.type=E.type}else{this.type=E}this.timeStamp=e();this[h]=true};function k(){return false}function u(){return true}o.Event.prototype={preventDefault:function(){this.isDefaultPrevented=u;var E=this.originalEvent;if(!E){return}if(E.preventDefault){E.preventDefault()}E.returnValue=false},stopPropagation:function(){this.isPropagationStopped=u;var E=this.originalEvent;if(!E){return}if(E.stopPropagation){E.stopPropagation()}E.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=u;this.stopPropagation()},isDefaultPrevented:k,isPropagationStopped:k,isImmediatePropagationStopped:k};var a=function(F){var E=F.relatedTarget;while(E&&E!=this){try{E=E.parentNode}catch(G){E=this}}if(E!=this){F.type=F.data;o.event.handle.apply(this,arguments)}};o.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(F,E){o.event.special[E]={setup:function(){o.event.add(this,F,a,E)},teardown:function(){o.event.remove(this,F,a)}}});o.fn.extend({bind:function(F,G,E){return F=="unload"?this.one(F,G,E):this.each(function(){o.event.add(this,F,E||G,E&&G)})},one:function(G,H,F){var E=o.event.proxy(F||H,function(I){o(this).unbind(I,E);return(F||H).apply(this,arguments)});return this.each(function(){o.event.add(this,G,E,F&&H)})},unbind:function(F,E){return this.each(function(){o.event.remove(this,F,E)})},trigger:function(E,F){return this.each(function(){o.event.trigger(E,F,this)})},triggerHandler:function(E,G){if(this[0]){var F=o.Event(E);F.preventDefault();F.stopPropagation();o.event.trigger(F,G,this[0]);return F.result}},toggle:function(G){var E=arguments,F=1;while(F=0){var E=G.slice(I,G.length);G=G.slice(0,I)}var H="GET";if(J){if(o.isFunction(J)){K=J;J=null}else{if(typeof J==="object"){J=o.param(J);H="POST"}}}var F=this;o.ajax({url:G,type:H,dataType:"html",data:J,complete:function(M,L){if(L=="success"||L=="notmodified"){F.html(E?o("
").append(M.responseText.replace(//g,"")).find(E):M.responseText)}if(K){F.each(K,[M.responseText,L,M])}}});return this},serialize:function(){return o.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?o.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password|search/i.test(this.type))}).map(function(E,F){var G=o(this).val();return G==null?null:o.isArray(G)?o.map(G,function(I,H){return{name:F.name,value:I}}):{name:F.name,value:G}}).get()}});o.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(E,F){o.fn[F]=function(G){return this.bind(F,G)}});var r=e();o.extend({get:function(E,G,H,F){if(o.isFunction(G)){H=G;G=null}return o.ajax({type:"GET",url:E,data:G,success:H,dataType:F})},getScript:function(E,F){return o.get(E,null,F,"script")},getJSON:function(E,F,G){return o.get(E,F,G,"json")},post:function(E,G,H,F){if(o.isFunction(G)){H=G;G={}}return o.ajax({type:"POST",url:E,data:G,success:H,dataType:F})},ajaxSetup:function(E){o.extend(o.ajaxSettings,E)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return l.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest()},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(M){M=o.extend(true,M,o.extend(true,{},o.ajaxSettings,M));var W,F=/=\?(&|$)/g,R,V,G=M.type.toUpperCase();if(M.data&&M.processData&&typeof M.data!=="string"){M.data=o.param(M.data)}if(M.dataType=="jsonp"){if(G=="GET"){if(!M.url.match(F)){M.url+=(M.url.match(/\?/)?"&":"?")+(M.jsonp||"callback")+"=?"}}else{if(!M.data||!M.data.match(F)){M.data=(M.data?M.data+"&":"")+(M.jsonp||"callback")+"=?"}}M.dataType="json"}if(M.dataType=="json"&&(M.data&&M.data.match(F)||M.url.match(F))){W="jsonp"+r++;if(M.data){M.data=(M.data+"").replace(F,"="+W+"$1")}M.url=M.url.replace(F,"="+W+"$1");M.dataType="script";l[W]=function(X){V=X;I();L();l[W]=g;try{delete l[W]}catch(Y){}if(H){H.removeChild(T)}}}if(M.dataType=="script"&&M.cache==null){M.cache=false}if(M.cache===false&&G=="GET"){var E=e();var U=M.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+E+"$2");M.url=U+((U==M.url)?(M.url.match(/\?/)?"&":"?")+"_="+E:"")}if(M.data&&G=="GET"){M.url+=(M.url.match(/\?/)?"&":"?")+M.data;M.data=null}if(M.global&&!o.active++){o.event.trigger("ajaxStart")}var Q=/^(\w+:)?\/\/([^\/?#]+)/.exec(M.url);if(M.dataType=="script"&&G=="GET"&&Q&&(Q[1]&&Q[1]!=location.protocol||Q[2]!=location.host)){var H=document.getElementsByTagName("head")[0];var T=document.createElement("script");T.src=M.url;if(M.scriptCharset){T.charset=M.scriptCharset}if(!W){var O=false;T.onload=T.onreadystatechange=function(){if(!O&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){O=true;I();L();T.onload=T.onreadystatechange=null;H.removeChild(T)}}}H.appendChild(T);return g}var K=false;var J=M.xhr();if(M.username){J.open(G,M.url,M.async,M.username,M.password)}else{J.open(G,M.url,M.async)}try{if(M.data){J.setRequestHeader("Content-Type",M.contentType)}if(M.ifModified){J.setRequestHeader("If-Modified-Since",o.lastModified[M.url]||"Thu, 01 Jan 1970 00:00:00 GMT")}J.setRequestHeader("X-Requested-With","XMLHttpRequest");J.setRequestHeader("Accept",M.dataType&&M.accepts[M.dataType]?M.accepts[M.dataType]+", */*":M.accepts._default)}catch(S){}if(M.beforeSend&&M.beforeSend(J,M)===false){if(M.global&&!--o.active){o.event.trigger("ajaxStop")}J.abort();return false}if(M.global){o.event.trigger("ajaxSend",[J,M])}var N=function(X){if(J.readyState==0){if(P){clearInterval(P);P=null;if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}}else{if(!K&&J&&(J.readyState==4||X=="timeout")){K=true;if(P){clearInterval(P);P=null}R=X=="timeout"?"timeout":!o.httpSuccess(J)?"error":M.ifModified&&o.httpNotModified(J,M.url)?"notmodified":"success";if(R=="success"){try{V=o.httpData(J,M.dataType,M)}catch(Z){R="parsererror"}}if(R=="success"){var Y;try{Y=J.getResponseHeader("Last-Modified")}catch(Z){}if(M.ifModified&&Y){o.lastModified[M.url]=Y}if(!W){I()}}else{o.handleError(M,J,R)}L();if(X){J.abort()}if(M.async){J=null}}}};if(M.async){var P=setInterval(N,13);if(M.timeout>0){setTimeout(function(){if(J&&!K){N("timeout")}},M.timeout)}}try{J.send(M.data)}catch(S){o.handleError(M,J,null,S)}if(!M.async){N()}function I(){if(M.success){M.success(V,R)}if(M.global){o.event.trigger("ajaxSuccess",[J,M])}}function L(){if(M.complete){M.complete(J,R)}if(M.global){o.event.trigger("ajaxComplete",[J,M])}if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}return J},handleError:function(F,H,E,G){if(F.error){F.error(H,E,G)}if(F.global){o.event.trigger("ajaxError",[H,F,G])}},active:0,httpSuccess:function(F){try{return !F.status&&location.protocol=="file:"||(F.status>=200&&F.status<300)||F.status==304||F.status==1223}catch(E){}return false},httpNotModified:function(G,E){try{var H=G.getResponseHeader("Last-Modified");return G.status==304||H==o.lastModified[E]}catch(F){}return false},httpData:function(J,H,G){var F=J.getResponseHeader("content-type"),E=H=="xml"||!H&&F&&F.indexOf("xml")>=0,I=E?J.responseXML:J.responseText;if(E&&I.documentElement.tagName=="parsererror"){throw"parsererror"}if(G&&G.dataFilter){I=G.dataFilter(I,H)}if(typeof I==="string"){if(H=="script"){o.globalEval(I)}if(H=="json"){I=l["eval"]("("+I+")")}}return I},param:function(E){var G=[];function H(I,J){G[G.length]=encodeURIComponent(I)+"="+encodeURIComponent(J)}if(o.isArray(E)||E.jquery){o.each(E,function(){H(this.name,this.value)})}else{for(var F in E){if(o.isArray(E[F])){o.each(E[F],function(){H(F,this)})}else{H(F,o.isFunction(E[F])?E[F]():E[F])}}}return G.join("&").replace(/%20/g,"+")}});var m={},n,d=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];function t(F,E){var G={};o.each(d.concat.apply([],d.slice(0,E)),function() +{G[this]=F});return G}o.fn.extend({show:function(J,L){if(J){return this.animate(t("show",3),J,L)}else{for(var H=0,F=this.length;H").appendTo("body");K=I.css("display");if(K==="none"){K="block"}I.remove();m[G]=K}o.data(this[H],"olddisplay",K)}}for(var H=0,F=this.length;H=0;H--){if(G[H].elem==this){if(E){G[H](true)}G.splice(H,1)}}});if(!E){this.dequeue()}return this}});o.each({slideDown:t("show",1),slideUp:t("hide",1),slideToggle:t("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(E,F){o.fn[E]=function(G,H){return this.animate(F,G,H)}});o.extend({speed:function(G,H,F){var E=typeof G==="object"?G:{complete:F||!F&&H||o.isFunction(G)&&G,duration:G,easing:F&&H||H&&!o.isFunction(H)&&H};E.duration=o.fx.off?0:typeof E.duration==="number"?E.duration:o.fx.speeds[E.duration]||o.fx.speeds._default;E.old=E.complete;E.complete=function(){if(E.queue!==false){o(this).dequeue()}if(o.isFunction(E.old)){E.old.call(this)}};return E},easing:{linear:function(G,H,E,F){return E+F*G},swing:function(G,H,E,F){return((-Math.cos(G*Math.PI)/2)+0.5)*F+E}},timers:[],fx:function(F,E,G){this.options=E;this.elem=F;this.prop=G;if(!E.orig){E.orig={}}}});o.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(o.fx.step[this.prop]||o.fx.step._default)(this);if((this.prop=="height"||this.prop=="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(F){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var E=parseFloat(o.css(this.elem,this.prop,F));return E&&E>-10000?E:parseFloat(o.curCSS(this.elem,this.prop))||0},custom:function(I,H,G){this.startTime=e();this.start=I;this.end=H;this.unit=G||this.unit||"px";this.now=this.start;this.pos=this.state=0;var E=this;function F(J){return E.step(J)}F.elem=this.elem;if(F()&&o.timers.push(F)&&!n){n=setInterval(function(){var K=o.timers;for(var J=0;J=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var E=true;for(var F in this.options.curAnim){if(this.options.curAnim[F]!==true){E=false}}if(E){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(o.css(this.elem,"display")=="none"){this.elem.style.display="block"}}if(this.options.hide){o(this.elem).hide()}if(this.options.hide||this.options.show){for(var I in this.options.curAnim){o.attr(this.elem.style,I,this.options.orig[I])}}this.options.complete.call(this.elem)}return false}else{var J=G-this.startTime;this.state=J/this.options.duration;this.pos=o.easing[this.options.easing||(o.easing.swing?"swing":"linear")](this.state,J,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};o.extend(o.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(E){o.attr(E.elem.style,"opacity",E.now)},_default:function(E){if(E.elem.style&&E.elem.style[E.prop]!=null){E.elem.style[E.prop]=E.now+E.unit}else{E.elem[E.prop]=E.now}}}});if(document.documentElement.getBoundingClientRect){o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}var G=this[0].getBoundingClientRect(),J=this[0].ownerDocument,F=J.body,E=J.documentElement,L=E.clientTop||F.clientTop||0,K=E.clientLeft||F.clientLeft||0,I=G.top+(self.pageYOffset||o.boxModel&&E.scrollTop||F.scrollTop)-L,H=G.left+(self.pageXOffset||o.boxModel&&E.scrollLeft||F.scrollLeft)-K;return{top:I,left:H}}}else{o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}o.offset.initialized||o.offset.initialize();var J=this[0],G=J.offsetParent,F=J,O=J.ownerDocument,M,H=O.documentElement,K=O.body,L=O.defaultView,E=L.getComputedStyle(J,null),N=J.offsetTop,I=J.offsetLeft;while((J=J.parentNode)&&J!==K&&J!==H){M=L.getComputedStyle(J,null);N-=J.scrollTop,I-=J.scrollLeft;if(J===G){N+=J.offsetTop,I+=J.offsetLeft;if(o.offset.doesNotAddBorder&&!(o.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(J.tagName))){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}F=G,G=J.offsetParent}if(o.offset.subtractsBorderForOverflowNotVisible&&M.overflow!=="visible"){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}E=M}if(E.position==="relative"||E.position==="static"){N+=K.offsetTop,I+=K.offsetLeft}if(E.position==="fixed"){N+=Math.max(H.scrollTop,K.scrollTop),I+=Math.max(H.scrollLeft,K.scrollLeft)}return{top:N,left:I}}}o.offset={initialize:function(){if(this.initialized){return}var L=document.body,F=document.createElement("div"),H,G,N,I,M,E,J=L.style.marginTop,K='
';M={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};for(E in M){F.style[E]=M[E]}F.innerHTML=K;L.insertBefore(F,L.firstChild);H=F.firstChild,G=H.firstChild,I=H.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(G.offsetTop!==5);this.doesAddBorderForTableAndCells=(I.offsetTop===5);H.style.overflow="hidden",H.style.position="relative";this.subtractsBorderForOverflowNotVisible=(G.offsetTop===-5);L.style.marginTop="1px";this.doesNotIncludeMarginInBodyOffset=(L.offsetTop===0);L.style.marginTop=J;L.removeChild(F);this.initialized=true},bodyOffset:function(E){o.offset.initialized||o.offset.initialize();var G=E.offsetTop,F=E.offsetLeft;if(o.offset.doesNotIncludeMarginInBodyOffset){G+=parseInt(o.curCSS(E,"marginTop",true),10)||0,F+=parseInt(o.curCSS(E,"marginLeft",true),10)||0}return{top:G,left:F}}};o.fn.extend({position:function(){var I=0,H=0,F;if(this[0]){var G=this.offsetParent(),J=this.offset(),E=/^body|html$/i.test(G[0].tagName)?{top:0,left:0}:G.offset();J.top-=j(this,"marginTop");J.left-=j(this,"marginLeft");E.top+=j(G,"borderTopWidth");E.left+=j(G,"borderLeftWidth");F={top:J.top-E.top,left:J.left-E.left}}return F},offsetParent:function(){var E=this[0].offsetParent||document.body;while(E&&(!/^body|html$/i.test(E.tagName)&&o.css(E,"position")=="static")){E=E.offsetParent}return o(E)}});o.each(["Left","Top"],function(F,E){var G="scroll"+E;o.fn[G]=function(H){if(!this[0]){return null}return H!==g?this.each(function(){this==l||this==document?l.scrollTo(!F?H:o(l).scrollLeft(),F?H:o(l).scrollTop()):this[G]=H}):this[0]==l||this[0]==document?self[F?"pageYOffset":"pageXOffset"]||o.boxModel&&document.documentElement[G]||document.body[G]:this[0][G]}});o.each(["Height","Width"],function(I,G){var E=I?"Left":"Top",H=I?"Right":"Bottom",F=G.toLowerCase();o.fn["inner"+G]=function(){return this[0]?o.css(this[0],F,false,"padding"):null};o.fn["outer"+G]=function(K){return this[0]?o.css(this[0],F,false,K?"margin":"border"):null};var J=G.toLowerCase();o.fn[J]=function(K){return this[0]==l?document.compatMode=="CSS1Compat"&&document.documentElement["client"+G]||document.body["client"+G]:this[0]==document?Math.max(document.documentElement["client"+G],document.body["scroll"+G],document.documentElement["scroll"+G],document.body["offset"+G],document.documentElement["offset"+G]):K===g?(this.length?o.css(this[0],J):null):this.css(J,typeof K==="string"?K:K+"px")}})})(); +/* + * jQuery UI 1.7.2 + * + * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI + */ +jQuery.ui||(function(c){var i=c.fn.remove,d=c.browser.mozilla&&(parseFloat(c.browser.version)<1.9);c.ui={version:"1.7.2",plugin:{add:function(k,l,n){var m=c.ui[k].prototype;for(var j in n){m.plugins[j]=m.plugins[j]||[];m.plugins[j].push([l,n[j]])}},call:function(j,l,k){var n=j.plugins[l];if(!n||!j.element[0].parentNode){return}for(var m=0;m0){return true}m[j]=1;l=(m[j]>0);m[j]=0;return l},isOverAxis:function(k,j,l){return(k>j)&&(k<(j+l))},isOver:function(o,k,n,m,j,l){return c.ui.isOverAxis(o,n,j)&&c.ui.isOverAxis(k,m,l)},keyCode:{BACKSPACE:8,CAPS_LOCK:20,COMMA:188,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38}};if(d){var f=c.attr,e=c.fn.removeAttr,h="http://www.w3.org/2005/07/aaa",a=/^aria-/,b=/^wairole:/;c.attr=function(k,j,l){var m=l!==undefined;return(j=="role"?(m?f.call(this,k,j,"wairole:"+l):(f.apply(this,arguments)||"").replace(b,"")):(a.test(j)?(m?k.setAttributeNS(h,j.replace(a,"aaa:"),l):f.call(this,k,j.replace(a,"aaa:"))):f.apply(this,arguments)))};c.fn.removeAttr=function(j){return(a.test(j)?this.each(function(){this.removeAttributeNS(h,j.replace(a,""))}):e.call(this,j))}}c.fn.extend({remove:function(){c("*",this).add(this).each(function(){c(this).triggerHandler("remove")});return i.apply(this,arguments)},enableSelection:function(){return this.attr("unselectable","off").css("MozUserSelect","").unbind("selectstart.ui")},disableSelection:function(){return this.attr("unselectable","on").css("MozUserSelect","none").bind("selectstart.ui",function(){return false})},scrollParent:function(){var j;if((c.browser.msie&&(/(static|relative)/).test(this.css("position")))||(/absolute/).test(this.css("position"))){j=this.parents().filter(function(){return(/(relative|absolute|fixed)/).test(c.curCSS(this,"position",1))&&(/(auto|scroll)/).test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0)}else{j=this.parents().filter(function(){return(/(auto|scroll)/).test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0)}return(/fixed/).test(this.css("position"))||!j.length?c(document):j}});c.extend(c.expr[":"],{data:function(l,k,j){return !!c.data(l,j[3])},focusable:function(k){var l=k.nodeName.toLowerCase(),j=c.attr(k,"tabindex");return(/input|select|textarea|button|object/.test(l)?!k.disabled:"a"==l||"area"==l?k.href||!isNaN(j):!isNaN(j))&&!c(k)["area"==l?"parents":"closest"](":hidden").length},tabbable:function(k){var j=c.attr(k,"tabindex");return(isNaN(j)||j>=0)&&c(k).is(":focusable")}});function g(m,n,o,l){function k(q){var p=c[m][n][q]||[];return(typeof p=="string"?p.split(/,?\s+/):p)}var j=k("getter");if(l.length==1&&typeof l[0]=="string"){j=j.concat(k("getterSetter"))}return(c.inArray(o,j)!=-1)}c.widget=function(k,j){var l=k.split(".")[0];k=k.split(".")[1];c.fn[k]=function(p){var n=(typeof p=="string"),o=Array.prototype.slice.call(arguments,1);if(n&&p.substring(0,1)=="_"){return this}if(n&&g(l,k,p,o)){var m=c.data(this[0],k);return(m?m[p].apply(m,o):undefined)}return this.each(function(){var q=c.data(this,k);(!q&&!n&&c.data(this,k,new c[l][k](this,p))._init());(q&&n&&c.isFunction(q[p])&&q[p].apply(q,o))})};c[l]=c[l]||{};c[l][k]=function(o,n){var m=this;this.namespace=l;this.widgetName=k;this.widgetEventPrefix=c[l][k].eventPrefix||k;this.widgetBaseClass=l+"-"+k;this.options=c.extend({},c.widget.defaults,c[l][k].defaults,c.metadata&&c.metadata.get(o)[k],n);this.element=c(o).bind("setData."+k,function(q,p,r){if(q.target==o){return m._setData(p,r)}}).bind("getData."+k,function(q,p){if(q.target==o){return m._getData(p)}}).bind("remove",function(){return m.destroy()})};c[l][k].prototype=c.extend({},c.widget.prototype,j);c[l][k].getterSetter="option"};c.widget.prototype={_init:function(){},destroy:function(){this.element.removeData(this.widgetName).removeClass(this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").removeAttr("aria-disabled")},option:function(l,m){var k=l,j=this;if(typeof l=="string"){if(m===undefined){return this._getData(l)}k={};k[l]=m}c.each(k,function(n,o){j._setData(n,o)})},_getData:function(j){return this.options[j]},_setData:function(j,k){this.options[j]=k;if(j=="disabled"){this.element[k?"addClass":"removeClass"](this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").attr("aria-disabled",k)}},enable:function(){this._setData("disabled",false)},disable:function(){this._setData("disabled",true)},_trigger:function(l,m,n){var p=this.options[l],j=(l==this.widgetEventPrefix?l:this.widgetEventPrefix+l);m=c.Event(m);m.type=j;if(m.originalEvent){for(var k=c.event.props.length,o;k;){o=c.event.props[--k];m[o]=m.originalEvent[o]}}this.element.trigger(m,n);return !(c.isFunction(p)&&p.call(this.element[0],m,n)===false||m.isDefaultPrevented())}};c.widget.defaults={disabled:false};c.ui.mouse={_mouseInit:function(){var j=this;this.element.bind("mousedown."+this.widgetName,function(k){return j._mouseDown(k)}).bind("click."+this.widgetName,function(k){if(j._preventClickEvent){j._preventClickEvent=false;k.stopImmediatePropagation();return false}});if(c.browser.msie){this._mouseUnselectable=this.element.attr("unselectable");this.element.attr("unselectable","on")}this.started=false},_mouseDestroy:function(){this.element.unbind("."+this.widgetName);(c.browser.msie&&this.element.attr("unselectable",this._mouseUnselectable))},_mouseDown:function(l){l.originalEvent=l.originalEvent||{};if(l.originalEvent.mouseHandled){return}(this._mouseStarted&&this._mouseUp(l));this._mouseDownEvent=l;var k=this,m=(l.which==1),j=(typeof this.options.cancel=="string"?c(l.target).parents().add(l.target).filter(this.options.cancel).length:false);if(!m||j||!this._mouseCapture(l)){return true}this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){k.mouseDelayMet=true},this.options.delay)}if(this._mouseDistanceMet(l)&&this._mouseDelayMet(l)){this._mouseStarted=(this._mouseStart(l)!==false);if(!this._mouseStarted){l.preventDefault();return true}}this._mouseMoveDelegate=function(n){return k._mouseMove(n)};this._mouseUpDelegate=function(n){return k._mouseUp(n)};c(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);(c.browser.safari||l.preventDefault());l.originalEvent.mouseHandled=true;return true},_mouseMove:function(j){if(c.browser.msie&&!j.button){return this._mouseUp(j)}if(this._mouseStarted){this._mouseDrag(j);return j.preventDefault()}if(this._mouseDistanceMet(j)&&this._mouseDelayMet(j)){this._mouseStarted=(this._mouseStart(this._mouseDownEvent,j)!==false);(this._mouseStarted?this._mouseDrag(j):this._mouseUp(j))}return !this._mouseStarted},_mouseUp:function(j){c(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;this._preventClickEvent=(j.target==this._mouseDownEvent.target);this._mouseStop(j)}return false},_mouseDistanceMet:function(j){return(Math.max(Math.abs(this._mouseDownEvent.pageX-j.pageX),Math.abs(this._mouseDownEvent.pageY-j.pageY))>=this.options.distance)},_mouseDelayMet:function(j){return this.mouseDelayMet},_mouseStart:function(j){},_mouseDrag:function(j){},_mouseStop:function(j){},_mouseCapture:function(j){return true}};c.ui.mouse.defaults={cancel:null,distance:1,delay:0}})(jQuery);;/* * jQuery UI Resizable 1.7.2 + * + * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Resizables + * + * Depends: + * ui.core.js + */ +(function(c){c.widget("ui.resizable",c.extend({},c.ui.mouse,{_init:function(){var e=this,j=this.options;this.element.addClass("ui-resizable");c.extend(this,{_aspectRatio:!!(j.aspectRatio),aspectRatio:j.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:j.helper||j.ghost||j.animate?j.helper||"ui-resizable-helper":null});if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)){if(/relative/.test(this.element.css("position"))&&c.browser.opera){this.element.css({position:"relative",top:"auto",left:"auto"})}this.element.wrap(c('
').css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")}));this.element=this.element.parent().data("resizable",this.element.data("resizable"));this.elementIsWrapper=true;this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")});this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0});this.originalResizeStyle=this.originalElement.css("resize");this.originalElement.css("resize","none");this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"}));this.originalElement.css({margin:this.originalElement.css("margin")});this._proportionallyResize()}this.handles=j.handles||(!c(".ui-resizable-handle",this.element).length?"e,s,se":{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"});if(this.handles.constructor==String){if(this.handles=="all"){this.handles="n,e,s,w,se,sw,ne,nw"}var k=this.handles.split(",");this.handles={};for(var f=0;f
');if(/sw|se|ne|nw/.test(h)){g.css({zIndex:++j.zIndex})}if("se"==h){g.addClass("ui-icon ui-icon-gripsmall-diagonal-se")}this.handles[h]=".ui-resizable-"+h;this.element.append(g)}}this._renderAxis=function(p){p=p||this.element;for(var m in this.handles){if(this.handles[m].constructor==String){this.handles[m]=c(this.handles[m],this.element).show()}if(this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)){var n=c(this.handles[m],this.element),o=0;o=/sw|ne|nw|se|n|s/.test(m)?n.outerHeight():n.outerWidth();var l=["padding",/ne|nw|n/.test(m)?"Top":/se|sw|s/.test(m)?"Bottom":/^e$/.test(m)?"Right":"Left"].join("");p.css(l,o);this._proportionallyResize()}if(!c(this.handles[m]).length){continue}}};this._renderAxis(this.element);this._handles=c(".ui-resizable-handle",this.element).disableSelection();this._handles.mouseover(function(){if(!e.resizing){if(this.className){var i=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)}e.axis=i&&i[1]?i[1]:"se"}});if(j.autoHide){this._handles.hide();c(this.element).addClass("ui-resizable-autohide").hover(function(){c(this).removeClass("ui-resizable-autohide");e._handles.show()},function(){if(!e.resizing){c(this).addClass("ui-resizable-autohide");e._handles.hide()}})}this._mouseInit()},destroy:function(){this._mouseDestroy();var d=function(f){c(f).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};if(this.elementIsWrapper){d(this.element);var e=this.element;e.parent().append(this.originalElement.css({position:e.css("position"),width:e.outerWidth(),height:e.outerHeight(),top:e.css("top"),left:e.css("left")})).end().remove()}this.originalElement.css("resize",this.originalResizeStyle);d(this.originalElement)},_mouseCapture:function(e){var f=false;for(var d in this.handles){if(c(this.handles[d])[0]==e.target){f=true}}return this.options.disabled||!!f},_mouseStart:function(f){var i=this.options,e=this.element.position(),d=this.element;this.resizing=true;this.documentScroll={top:c(document).scrollTop(),left:c(document).scrollLeft()};if(d.is(".ui-draggable")||(/absolute/).test(d.css("position"))){d.css({position:"absolute",top:e.top,left:e.left})}if(c.browser.opera&&(/relative/).test(d.css("position"))){d.css({position:"relative",top:"auto",left:"auto"})}this._renderProxy();var j=b(this.helper.css("left")),g=b(this.helper.css("top"));if(i.containment){j+=c(i.containment).scrollLeft()||0;g+=c(i.containment).scrollTop()||0}this.offset=this.helper.offset();this.position={left:j,top:g};this.size=this._helper?{width:d.outerWidth(),height:d.outerHeight()}:{width:d.width(),height:d.height()};this.originalSize=this._helper?{width:d.outerWidth(),height:d.outerHeight()}:{width:d.width(),height:d.height()};this.originalPosition={left:j,top:g};this.sizeDiff={width:d.outerWidth()-d.width(),height:d.outerHeight()-d.height()};this.originalMousePosition={left:f.pageX,top:f.pageY};this.aspectRatio=(typeof i.aspectRatio=="number")?i.aspectRatio:((this.originalSize.width/this.originalSize.height)||1);var h=c(".ui-resizable-"+this.axis).css("cursor");c("body").css("cursor",h=="auto"?this.axis+"-resize":h);d.addClass("ui-resizable-resizing");this._propagate("start",f);return true},_mouseDrag:function(d){var g=this.helper,f=this.options,l={},p=this,i=this.originalMousePosition,m=this.axis;var q=(d.pageX-i.left)||0,n=(d.pageY-i.top)||0;var h=this._change[m];if(!h){return false}var k=h.apply(this,[d,q,n]),j=c.browser.msie&&c.browser.version<7,e=this.sizeDiff;if(this._aspectRatio||d.shiftKey){k=this._updateRatio(k,d)}k=this._respectSize(k,d);this._propagate("resize",d);g.css({top:this.position.top+"px",left:this.position.left+"px",width:this.size.width+"px",height:this.size.height+"px"});if(!this._helper&&this._proportionallyResizeElements.length){this._proportionallyResize()}this._updateCache(k);this._trigger("resize",d,this.ui());return false},_mouseStop:function(g){this.resizing=false;var h=this.options,l=this;if(this._helper){var f=this._proportionallyResizeElements,d=f.length&&(/textarea/i).test(f[0].nodeName),e=d&&c.ui.hasScroll(f[0],"left")?0:l.sizeDiff.height,j=d?0:l.sizeDiff.width;var m={width:(l.size.width-j),height:(l.size.height-e)},i=(parseInt(l.element.css("left"),10)+(l.position.left-l.originalPosition.left))||null,k=(parseInt(l.element.css("top"),10)+(l.position.top-l.originalPosition.top))||null;if(!h.animate){this.element.css(c.extend(m,{top:k,left:i}))}l.helper.height(l.size.height);l.helper.width(l.size.width);if(this._helper&&!h.animate){this._proportionallyResize()}}c("body").css("cursor","auto");this.element.removeClass("ui-resizable-resizing");this._propagate("stop",g);if(this._helper){this.helper.remove()}return false},_updateCache:function(d){var e=this.options;this.offset=this.helper.offset();if(a(d.left)){this.position.left=d.left}if(a(d.top)){this.position.top=d.top}if(a(d.height)){this.size.height=d.height}if(a(d.width)){this.size.width=d.width}},_updateRatio:function(g,f){var h=this.options,i=this.position,e=this.size,d=this.axis;if(g.height){g.width=(e.height*this.aspectRatio)}else{if(g.width){g.height=(e.width/this.aspectRatio)}}if(d=="sw"){g.left=i.left+(e.width-g.width);g.top=null}if(d=="nw"){g.top=i.top+(e.height-g.height);g.left=i.left+(e.width-g.width)}return g},_respectSize:function(k,f){var i=this.helper,h=this.options,q=this._aspectRatio||f.shiftKey,p=this.axis,s=a(k.width)&&h.maxWidth&&(h.maxWidthk.width),r=a(k.height)&&h.minHeight&&(h.minHeight>k.height);if(g){k.width=h.minWidth}if(r){k.height=h.minHeight}if(s){k.width=h.maxWidth}if(l){k.height=h.maxHeight}var e=this.originalPosition.left+this.originalSize.width,n=this.position.top+this.size.height;var j=/sw|nw|w/.test(p),d=/nw|ne|n/.test(p);if(g&&j){k.left=e-h.minWidth}if(s&&j){k.left=e-h.maxWidth}if(r&&d){k.top=n-h.minHeight}if(l&&d){k.top=n-h.maxHeight}var m=!k.width&&!k.height;if(m&&!k.left&&k.top){k.top=null}else{if(m&&!k.top&&k.left){k.left=null}}return k},_proportionallyResize:function(){var j=this.options;if(!this._proportionallyResizeElements.length){return}var f=this.helper||this.element;for(var e=0;e');var d=c.browser.msie&&c.browser.version<7,f=(d?1:0),g=(d?2:-1);this.helper.addClass(this._helper).css({width:this.element.outerWidth()+g,height:this.element.outerHeight()+g,position:"absolute",left:this.elementOffset.left-f+"px",top:this.elementOffset.top-f+"px",zIndex:++h.zIndex});this.helper.appendTo("body").disableSelection()}else{this.helper=this.element}},_change:{e:function(f,e,d){return{width:this.originalSize.width+e}},w:function(g,e,d){var i=this.options,f=this.originalSize,h=this.originalPosition;return{left:h.left+e,width:f.width-e}},n:function(g,e,d){var i=this.options,f=this.originalSize,h=this.originalPosition;return{top:h.top+d,height:f.height-d}},s:function(f,e,d){return{height:this.originalSize.height+d}},se:function(f,e,d){return c.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[f,e,d]))},sw:function(f,e,d){return c.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[f,e,d]))},ne:function(f,e,d){return c.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[f,e,d]))},nw:function(f,e,d){return c.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[f,e,d]))}},_propagate:function(e,d){c.ui.plugin.call(this,e,[d,this.ui()]);(e!="resize"&&this._trigger(e,d,this.ui()))},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}));c.extend(c.ui.resizable,{version:"1.7.2",eventPrefix:"resize",defaults:{alsoResize:false,animate:false,animateDuration:"slow",animateEasing:"swing",aspectRatio:false,autoHide:false,cancel:":input,option",containment:false,delay:0,distance:1,ghost:false,grid:false,handles:"e,s,se",helper:false,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:1000}});c.ui.plugin.add("resizable","alsoResize",{start:function(e,f){var d=c(this).data("resizable"),g=d.options;_store=function(h){c(h).each(function(){c(this).data("resizable-alsoresize",{width:parseInt(c(this).width(),10),height:parseInt(c(this).height(),10),left:parseInt(c(this).css("left"),10),top:parseInt(c(this).css("top"),10)})})};if(typeof(g.alsoResize)=="object"&&!g.alsoResize.parentNode){if(g.alsoResize.length){g.alsoResize=g.alsoResize[0];_store(g.alsoResize)}else{c.each(g.alsoResize,function(h,i){_store(h)})}}else{_store(g.alsoResize)}},resize:function(f,h){var e=c(this).data("resizable"),i=e.options,g=e.originalSize,k=e.originalPosition;var j={height:(e.size.height-g.height)||0,width:(e.size.width-g.width)||0,top:(e.position.top-k.top)||0,left:(e.position.left-k.left)||0},d=function(l,m){c(l).each(function(){var p=c(this),q=c(this).data("resizable-alsoresize"),o={},n=m&&m.length?m:["width","height","top","left"];c.each(n||["width","height","top","left"],function(r,t){var s=(q[t]||0)+(j[t]||0);if(s&&s>=0){o[t]=s||null}});if(/relative/.test(p.css("position"))&&c.browser.opera){e._revertToRelativePosition=true;p.css({position:"absolute",top:"auto",left:"auto"})}p.css(o)})};if(typeof(i.alsoResize)=="object"&&!i.alsoResize.nodeType){c.each(i.alsoResize,function(l,m){d(l,m)})}else{d(i.alsoResize)}},stop:function(e,f){var d=c(this).data("resizable");if(d._revertToRelativePosition&&c.browser.opera){d._revertToRelativePosition=false;el.css({position:"relative"})}c(this).removeData("resizable-alsoresize-start")}});c.ui.plugin.add("resizable","animate",{stop:function(h,m){var n=c(this).data("resizable"),i=n.options;var g=n._proportionallyResizeElements,d=g.length&&(/textarea/i).test(g[0].nodeName),e=d&&c.ui.hasScroll(g[0],"left")?0:n.sizeDiff.height,k=d?0:n.sizeDiff.width;var f={width:(n.size.width-k),height:(n.size.height-e)},j=(parseInt(n.element.css("left"),10)+(n.position.left-n.originalPosition.left))||null,l=(parseInt(n.element.css("top"),10)+(n.position.top-n.originalPosition.top))||null;n.element.animate(c.extend(f,l&&j?{top:l,left:j}:{}),{duration:i.animateDuration,easing:i.animateEasing,step:function(){var o={width:parseInt(n.element.css("width"),10),height:parseInt(n.element.css("height"),10),top:parseInt(n.element.css("top"),10),left:parseInt(n.element.css("left"),10)};if(g&&g.length){c(g[0]).css({width:o.width,height:o.height})}n._updateCache(o);n._propagate("resize",h)}})}});c.ui.plugin.add("resizable","containment",{start:function(e,q){var s=c(this).data("resizable"),i=s.options,k=s.element;var f=i.containment,j=(f instanceof c)?f.get(0):(/parent/.test(f))?k.parent().get(0):f;if(!j){return}s.containerElement=c(j);if(/document/.test(f)||f==document){s.containerOffset={left:0,top:0};s.containerPosition={left:0,top:0};s.parentData={element:c(document),left:0,top:0,width:c(document).width(),height:c(document).height()||document.body.parentNode.scrollHeight}}else{var m=c(j),h=[];c(["Top","Right","Left","Bottom"]).each(function(p,o){h[p]=b(m.css("padding"+o))});s.containerOffset=m.offset();s.containerPosition=m.position();s.containerSize={height:(m.innerHeight()-h[3]),width:(m.innerWidth()-h[1])};var n=s.containerOffset,d=s.containerSize.height,l=s.containerSize.width,g=(c.ui.hasScroll(j,"left")?j.scrollWidth:l),r=(c.ui.hasScroll(j)?j.scrollHeight:d);s.parentData={element:j,left:n.left,top:n.top,width:g,height:r}}},resize:function(f,p){var s=c(this).data("resizable"),h=s.options,e=s.containerSize,n=s.containerOffset,l=s.size,m=s.position,q=s._aspectRatio||f.shiftKey,d={top:0,left:0},g=s.containerElement;if(g[0]!=document&&(/static/).test(g.css("position"))){d=n}if(m.left<(s._helper?n.left:0)){s.size.width=s.size.width+(s._helper?(s.position.left-n.left):(s.position.left-d.left));if(q){s.size.height=s.size.width/h.aspectRatio}s.position.left=h.helper?n.left:0}if(m.top<(s._helper?n.top:0)) +{s.size.height=s.size.height+(s._helper?(s.position.top-n.top):s.position.top);if(q){s.size.width=s.size.height*h.aspectRatio}s.position.top=s._helper?n.top:0}s.offset.left=s.parentData.left+s.position.left;s.offset.top=s.parentData.top+s.position.top;var k=Math.abs((s._helper?s.offset.left-d.left:(s.offset.left-d.left))+s.sizeDiff.width),r=Math.abs((s._helper?s.offset.top-d.top:(s.offset.top-n.top))+s.sizeDiff.height);var j=s.containerElement.get(0)==s.element.parent().get(0),i=/relative|absolute/.test(s.containerElement.css("position"));if(j&&i){k-=s.parentData.left}if(k+s.size.width>=s.parentData.width){s.size.width=s.parentData.width-k;if(q){s.size.height=s.size.width/s.aspectRatio}}if(r+s.size.height>=s.parentData.height){s.size.height=s.parentData.height-r;if(q){s.size.width=s.size.height*s.aspectRatio}}},stop:function(e,m){var p=c(this).data("resizable"),f=p.options,k=p.position,l=p.containerOffset,d=p.containerPosition,g=p.containerElement;var i=c(p.helper),q=i.offset(),n=i.outerWidth()-p.sizeDiff.width,j=i.outerHeight()-p.sizeDiff.height;if(p._helper&&!f.animate&&(/relative/).test(g.css("position"))){c(this).css({left:q.left-d.left-l.left,width:n,height:j})}if(p._helper&&!f.animate&&(/static/).test(g.css("position"))){c(this).css({left:q.left-d.left-l.left,width:n,height:j})}}});c.ui.plugin.add("resizable","ghost",{start:function(f,g){var d=c(this).data("resizable"),h=d.options,e=d.size;d.ghost=d.originalElement.clone();d.ghost.css({opacity:0.25,display:"block",position:"relative",height:e.height,width:e.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass(typeof h.ghost=="string"?h.ghost:"");d.ghost.appendTo(d.helper)},resize:function(e,f){var d=c(this).data("resizable"),g=d.options;if(d.ghost){d.ghost.css({position:"relative",height:d.size.height,width:d.size.width})}},stop:function(e,f){var d=c(this).data("resizable"),g=d.options;if(d.ghost&&d.helper){d.helper.get(0).removeChild(d.ghost.get(0))}}});c.ui.plugin.add("resizable","grid",{resize:function(d,l){var n=c(this).data("resizable"),g=n.options,j=n.size,h=n.originalSize,i=n.originalPosition,m=n.axis,k=g._aspectRatio||d.shiftKey;g.grid=typeof g.grid=="number"?[g.grid,g.grid]:g.grid;var f=Math.round((j.width-h.width)/(g.grid[0]||1))*(g.grid[0]||1),e=Math.round((j.height-h.height)/(g.grid[1]||1))*(g.grid[1]||1);if(/^(se|s|e)$/.test(m)){n.size.width=h.width+f;n.size.height=h.height+e}else{if(/^(ne)$/.test(m)){n.size.width=h.width+f;n.size.height=h.height+e;n.position.top=i.top-e}else{if(/^(sw)$/.test(m)){n.size.width=h.width+f;n.size.height=h.height+e;n.position.left=i.left-f}else{n.size.width=h.width+f;n.size.height=h.height+e;n.position.top=i.top-e;n.position.left=i.left-f}}}}});var b=function(d){return parseInt(d,10)||0};var a=function(d){return !isNaN(parseInt(d,10))}})(jQuery);; +/** + * jQuery.ScrollTo - Easy element scrolling using jQuery. + * Copyright (c) 2008 Ariel Flesler - aflesler(at)gmail(dot)com + * Licensed under GPL license (http://www.opensource.org/licenses/gpl-license.php). + * Date: 2/8/2008 + * @author Ariel Flesler + * @version 1.3.2 + */ +;(function($){var o=$.scrollTo=function(a,b,c){o.window().scrollTo(a,b,c)};o.defaults={axis:'y',duration:1};o.window=function(){return $($.browser.safari?'body':'html')};$.fn.scrollTo=function(l,m,n){if(typeof m=='object'){n=m;m=0}n=$.extend({},o.defaults,n);m=m||n.speed||n.duration;n.queue=n.queue&&n.axis.length>1;if(n.queue)m/=2;n.offset=j(n.offset);n.over=j(n.over);return this.each(function(){var a=this,b=$(a),t=l,c,d={},w=b.is('html,body');switch(typeof t){case'number':case'string':if(/^([+-]=)?\d+(px)?$/.test(t)){t=j(t);break}t=$(t,this);case'object':if(t.is||t.style)c=(t=$(t)).offset()}$.each(n.axis.split(''),function(i,f){var P=f=='x'?'Left':'Top',p=P.toLowerCase(),k='scroll'+P,e=a[k],D=f=='x'?'Width':'Height';if(c){d[k]=c[p]+(w?0:e-b.offset()[p]);if(n.margin){d[k]-=parseInt(t.css('margin'+P))||0;d[k]-=parseInt(t.css('border'+P+'Width'))||0}d[k]+=n.offset[p]||0;if(n.over[p])d[k]+=t[D.toLowerCase()]()*n.over[p]}else d[k]=t[p];if(/^\d+$/.test(d[k]))d[k]=d[k]<=0?0:Math.min(d[k],h(D));if(!i&&n.queue){if(e!=d[k])g(n.onAfterFirst);delete d[k]}});g(n.onAfter);function g(a){b.animate(d,m,n.easing,a&&function(){a.call(this,l)})};function h(D){var b=w?$.browser.opera?document.body:document.documentElement:a;return b['scroll'+D]-b['client'+D]}})};function j(a){return typeof a=='object'?a:{top:a,left:a}}})(jQuery); + diff --git a/docs/html/logic_tests_8cpp.html b/docs/html/logic_tests_8cpp.html new file mode 100644 index 0000000..d97e511 --- /dev/null +++ b/docs/html/logic_tests_8cpp.html @@ -0,0 +1,1013 @@ + + + + +Rally X: tests/logicTests.cpp File Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+ +
+
tests/logicTests.cpp File Reference
+
+
+ +

Unit tests for the logic layer of a Rally-X game. +More...

+
#include <vector>
+#include <list>
+#include <utility>
+#include <gtest/gtest.h>
+#include "../source/logic/CollisionDetector.h"
+#include "../source/logic/PlayerCar.h"
+#include "../source/logic/EnemyCar.h"
+#include "../source/logic/Checkpoint.h"
+#include "../source/logic/Rock.h"
+#include "../source/logic/Smokescreen.h"
+#include "../source/logic/Maze.h"
+#include "../source/logic/MazeMath.h"
+#include "../source/logic/DestroyedObjectPopup.h"
+
+

Go to the source code of this file.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Functions

 TEST (Car, updateMovesPlayerUpInEmptyMaze)
 Tests that PlayerCar moves the correct amount in the up direction on each frame without obstacles.
 TEST (Car, updateMovesPlayerDownInEmptyMaze)
 Tests that PlayerCar moves the correct amount in the down direction on each frame without obstacles.
 TEST (Car, updateMovesPlayerLeftInEmptyMaze)
 Tests that PlayerCar moves the correct amount in the left direction on each frame without obstacles.
 TEST (Car, updateMovesPlayerRightInEmptyMaze)
 Tests that PlayerCar moves the correct amount in the right direction on each frame without obstacles.
 TEST (Car, carNotMovedWhenPathUpBlocked)
 Tests that PlayerCar does not move up if the path is blocked.
 TEST (Car, carNotMovedWhenPathDownBlocked)
 Tests that PlayerCar does not move down if the path is blocked.
 TEST (Car, carNotMovedWhenPathLeftBlocked)
 Tests that PlayerCar does not move left if the path is blocked.
 TEST (Car, carNotMovedWhenPathRightBlocked)
 Tests that PlayerCar does not move right if the path is blocked.
 TEST (Car, carDoesNotMoveUpOutMaze)
 Tests that PlayerCar does not move up if currently on the top row of the maze.
 TEST (Car, carDoesNotMoveDownOutMaze)
 Tests that PlayerCar does not move down if currently on the bottom row of the maze.
 TEST (Car, carDoesNotMoveLeftOutMaze)
 Tests that PlayerCar does not move left if currently on the first column of the maze.
 TEST (Car, carDoesNotMoveRightOutMaze)
 Tests that PlayerCar does not move right if currently on the last column of the maze.
 TEST (Checkpoint, countIncrementsAndDecrements)
 Tests that counting of the number of checkpoints happens correctly.
 TEST (CollisionDetector, playerAndEnemyBothDestroyed)
 Tests that when a player and enemy overlap, both are marked for destruction.
 TEST (CollisionDetector, playerDestroyedByRock)
 Tests that when a player and rock overlap, only the player is marked for destruction.
 TEST (CollisionDetector, checkpointDestroyedByPlayer)
 Tests that when a player and checkpoint overlap, only the checkpoint is marked for destruction.
 TEST (CollisionDetector, enemyStoppedBySmokescreen)
 Tests that when an enemy and smokescreen overlap, the enemy's speed becomes zero.
 TEST (DestroyedObjectPopup, destroyedAfterSetTime)
 Tests that a DestroyedObjectPopup is destroyed 30 frames after it is created.
 TEST (Maze, queryOutsideBoundsReturnsSolid)
 Tests that the maze treats the undefined area outside its bounds as being walls.
 TEST (Maze, generationWithWallsWithoutObjectMax)
 Tests that a maze can be generated without extending the width and height for objects.
 TEST (Maze, generationWithWallsWithObjectMax)
 Tests that a maze can be generated with extending the width and height for objects.
 TEST (MazeMath, distanceGivesExpectedResult)
 Tests that the formula for a straight line distance works as expected.
 TEST (MazeMath, roundGivesExpectedResult)
 Tests that rounding off function works as expected.
 TEST (PlayerCar, creationAndDestructionCanHappen)
 Tests that a PlayerCar can be created and destroyed repeatedly without incident.
 TEST (PlayerCar, playerSpeedAffectedByPetrol)
 Tests that the player's petrol runs out, and that the player's speed is halved after that.
 TEST (Smokescreen, destroyedAfterSetTime)
 Tests that a Smokescreen is destroyed 60 frames after it is created.
+

Detailed Description

+

Unit tests for the logic layer of a Rally-X game.

+

The classes used to run Allegro's install and uninstall functions were tested indirectly through the use of other classes. If the AllegroWrappers classes are not working, they will result in tests failing, or the program crashing.

+

The Car class's movement is tested through implementing a subclass of Car, PlayerCar, facing in a given direction with and without maze walls in the way, and testing its position after a frame has passed.

+

The counting system with the Checkpoint class is tested through repeated creation and destruction of Checkpoint objects.

+

The CollisionDetecter class is tested by setting up situations with each type of collision, and checking that they have the desired results on the objects involved.

+

The DestroyedObjectPopup class is tested to ensure that it lasts the desired amount of time before being destroyed.

+

The intelligence of the EnemyCar class is not unit tested, as it may change as extra states and AI schemes are implemented, possibly including a random element. Therefore, it should be tested manually by playing example levels and monitoring if the enemies appear to behave in a manner that makes gameplay interesting.

+

The Game class is not tested directly. It pulls all of the units being tested together into a complete game, and so should be tested by running the Game.

+

The GameObject class is tested indirectly through testing its subclasses.

+

The LimitedTimeObject class is tested indirectly through the DestroyedObjectPopup and Smokescreen classes.

+

The Maze class is tested in terms of its ability to construct itself correctly from a list of coordinates. It is also tested with the PlayerCar class where the movement of the PlayerCar is tested in a Maze.

+

The MazeMath class is tested by running each of its functions with expected input and output values.

+

The PlayerCar class is tested on its ability to move correctly as part of the tests for the Car class. The functioning of the PlayerCar's petrol system is also tested. Controlling of the PlayerCar is not tested, and should be tested manually by running the game and verifying that the arrow keys cause the direction of the PlayerCar to change appropriately. Further, the creation of Smokescreens by pressing the spacebar should also be tested manually.

+

The Rock class only has functionality in collisions, and so is tested through the CollisionDetector's tests.

+

The Smokescreen class is tested in that it disappears after a set time. Its affect on the EnemyCar class is tested through the CollisionDetector's tests.

+
Author:
Justin Wernick
+
+David Schneider
+ +

Definition in file logicTests.cpp.

+

Function Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + +
TEST (Car ,
updateMovesPlayerUpInEmptyMaze  
)
+
+
+ +

Tests that PlayerCar moves the correct amount in the up direction on each frame without obstacles.

+ +

Definition at line 75 of file logicTests.cpp.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
TEST (Car ,
updateMovesPlayerDownInEmptyMaze  
)
+
+
+ +

Tests that PlayerCar moves the correct amount in the down direction on each frame without obstacles.

+ +

Definition at line 95 of file logicTests.cpp.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
TEST (Car ,
updateMovesPlayerLeftInEmptyMaze  
)
+
+
+ +

Tests that PlayerCar moves the correct amount in the left direction on each frame without obstacles.

+ +

Definition at line 115 of file logicTests.cpp.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
TEST (Car ,
updateMovesPlayerRightInEmptyMaze  
)
+
+
+ +

Tests that PlayerCar moves the correct amount in the right direction on each frame without obstacles.

+ +

Definition at line 135 of file logicTests.cpp.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
TEST (Car ,
carNotMovedWhenPathUpBlocked  
)
+
+
+ +

Tests that PlayerCar does not move up if the path is blocked.

+ +

Definition at line 155 of file logicTests.cpp.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
TEST (Car ,
carNotMovedWhenPathDownBlocked  
)
+
+
+ +

Tests that PlayerCar does not move down if the path is blocked.

+ +

Definition at line 175 of file logicTests.cpp.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
TEST (Car ,
carNotMovedWhenPathLeftBlocked  
)
+
+
+ +

Tests that PlayerCar does not move left if the path is blocked.

+ +

Definition at line 195 of file logicTests.cpp.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
TEST (Car ,
carNotMovedWhenPathRightBlocked  
)
+
+
+ +

Tests that PlayerCar does not move right if the path is blocked.

+ +

Definition at line 215 of file logicTests.cpp.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
TEST (Car ,
carDoesNotMoveUpOutMaze  
)
+
+
+ +

Tests that PlayerCar does not move up if currently on the top row of the maze.

+ +

Definition at line 236 of file logicTests.cpp.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
TEST (Car ,
carDoesNotMoveDownOutMaze  
)
+
+
+ +

Tests that PlayerCar does not move down if currently on the bottom row of the maze.

+ +

Definition at line 255 of file logicTests.cpp.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
TEST (Car ,
carDoesNotMoveLeftOutMaze  
)
+
+
+ +

Tests that PlayerCar does not move left if currently on the first column of the maze.

+ +

Definition at line 274 of file logicTests.cpp.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
TEST (Car ,
carDoesNotMoveRightOutMaze  
)
+
+
+ +

Tests that PlayerCar does not move right if currently on the last column of the maze.

+ +

Definition at line 293 of file logicTests.cpp.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
TEST (Checkpoint ,
countIncrementsAndDecrements  
)
+
+
+ +

Tests that counting of the number of checkpoints happens correctly.

+ +

Definition at line 313 of file logicTests.cpp.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
TEST (CollisionDetector ,
playerAndEnemyBothDestroyed  
)
+
+
+ +

Tests that when a player and enemy overlap, both are marked for destruction.

+ +

Definition at line 344 of file logicTests.cpp.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
TEST (CollisionDetector ,
playerDestroyedByRock  
)
+
+
+ +

Tests that when a player and rock overlap, only the player is marked for destruction.

+ +

Definition at line 387 of file logicTests.cpp.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
TEST (CollisionDetector ,
checkpointDestroyedByPlayer  
)
+
+
+ +

Tests that when a player and checkpoint overlap, only the checkpoint is marked for destruction.

+ +

Definition at line 430 of file logicTests.cpp.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
TEST (CollisionDetector ,
enemyStoppedBySmokescreen  
)
+
+
+ +

Tests that when an enemy and smokescreen overlap, the enemy's speed becomes zero.

+ +

Definition at line 473 of file logicTests.cpp.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
TEST (DestroyedObjectPopup ,
destroyedAfterSetTime  
)
+
+
+ +

Tests that a DestroyedObjectPopup is destroyed 30 frames after it is created.

+ +

Definition at line 507 of file logicTests.cpp.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
TEST (Maze ,
queryOutsideBoundsReturnsSolid  
)
+
+
+ +

Tests that the maze treats the undefined area outside its bounds as being walls.

+ +

Definition at line 524 of file logicTests.cpp.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
TEST (Maze ,
generationWithWallsWithoutObjectMax  
)
+
+
+ +

Tests that a maze can be generated without extending the width and height for objects.

+ +

Definition at line 541 of file logicTests.cpp.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
TEST (Maze ,
generationWithWallsWithObjectMax  
)
+
+
+ +

Tests that a maze can be generated with extending the width and height for objects.

+ +

Definition at line 565 of file logicTests.cpp.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
TEST (MazeMath ,
distanceGivesExpectedResult  
)
+
+
+ +

Tests that the formula for a straight line distance works as expected.

+ +

Definition at line 591 of file logicTests.cpp.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
TEST (MazeMath ,
roundGivesExpectedResult  
)
+
+
+ +

Tests that rounding off function works as expected.

+ +

Definition at line 607 of file logicTests.cpp.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
TEST (PlayerCar ,
creationAndDestructionCanHappen  
)
+
+
+ +

Tests that a PlayerCar can be created and destroyed repeatedly without incident.

+

This tests that the PlayerCar can handle its own dependencies on Allegro, even when copy constructors are used (through vector).

+ +

Definition at line 626 of file logicTests.cpp.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
TEST (PlayerCar ,
playerSpeedAffectedByPetrol  
)
+
+
+ +

Tests that the player's petrol runs out, and that the player's speed is halved after that.

+

Also tests that the speed is recovered if petrol is increased again.

+ +

Definition at line 648 of file logicTests.cpp.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
TEST (Smokescreen ,
destroyedAfterSetTime  
)
+
+
+ +

Tests that a Smokescreen is destroyed 60 frames after it is created.

+ +

Definition at line 673 of file logicTests.cpp.

+ +
+
+
+ + + + +
+ +
+ + + + + + + diff --git a/docs/html/logic_tests_8cpp_source.html b/docs/html/logic_tests_8cpp_source.html new file mode 100644 index 0000000..e3344b4 --- /dev/null +++ b/docs/html/logic_tests_8cpp_source.html @@ -0,0 +1,656 @@ + + + + +Rally X: tests/logicTests.cpp Source File + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
tests/logicTests.cpp
+
+
+Go to the documentation of this file.
00001 
+00055 #include <vector>
+00056 #include <list>
+00057 #include <utility>
+00058 using namespace std;
+00059 
+00060 #include <gtest/gtest.h>
+00061 
+00062 #include "../source/logic/CollisionDetector.h"
+00063 #include "../source/logic/PlayerCar.h"
+00064 #include "../source/logic/EnemyCar.h"
+00065 #include "../source/logic/Checkpoint.h"
+00066 #include "../source/logic/Rock.h"
+00067 #include "../source/logic/Smokescreen.h"
+00068 #include "../source/logic/Maze.h"
+00069 #include "../source/logic/MazeMath.h"
+00070 #include "../source/logic/DestroyedObjectPopup.h"
+00071 
+00075 TEST(Car, updateMovesPlayerUpInEmptyMaze)
+00076 {
+00077     Maze testMaze;
+00078     vector<pair<int,int> > walls;
+00079     testMaze.generateMaze(walls,5,5);
+00080 
+00081     PlayerCar player(2,2,Maze::UP);
+00082 
+00083     list<Smokescreen> smokescreens;
+00084     player.update(testMaze, smokescreens);
+00085 
+00086     double expectX = 2;
+00087     double expectY = 2-player.speed();
+00088     EXPECT_FLOAT_EQ(expectX, player.x());
+00089     EXPECT_FLOAT_EQ(expectY, player.y());
+00090 }
+00091 
+00095 TEST(Car, updateMovesPlayerDownInEmptyMaze)
+00096 {
+00097     Maze testMaze;
+00098     vector<pair<int,int> > walls;
+00099     testMaze.generateMaze(walls,5,5);
+00100 
+00101     PlayerCar player(2,2,Maze::DOWN);
+00102 
+00103     list<Smokescreen> smokescreens;
+00104     player.update(testMaze, smokescreens);
+00105 
+00106     double expectX = 2;
+00107     double expectY = 2+player.speed();
+00108     EXPECT_FLOAT_EQ(expectX, player.x());
+00109     EXPECT_FLOAT_EQ(expectY, player.y());
+00110 }
+00111 
+00115 TEST(Car, updateMovesPlayerLeftInEmptyMaze)
+00116 {
+00117     Maze testMaze;
+00118     vector<pair<int,int> > walls;
+00119     testMaze.generateMaze(walls,5,5);
+00120 
+00121     PlayerCar player(2,2,Maze::LEFT);
+00122 
+00123     list<Smokescreen> smokescreens;
+00124     player.update(testMaze, smokescreens);
+00125 
+00126     double expectX = 2-player.speed();
+00127     double expectY = 2;
+00128     EXPECT_FLOAT_EQ(expectX, player.x());
+00129     EXPECT_FLOAT_EQ(expectY, player.y());
+00130 }
+00131 
+00135 TEST(Car, updateMovesPlayerRightInEmptyMaze)
+00136 {
+00137     Maze testMaze;
+00138     vector<pair<int,int> > walls;
+00139     testMaze.generateMaze(walls,5,5);
+00140 
+00141     PlayerCar player(2,2,Maze::RIGHT);
+00142 
+00143     list<Smokescreen> smokescreens;
+00144     player.update(testMaze, smokescreens);
+00145 
+00146     double expectX = 2+player.speed();
+00147     double expectY = 2;
+00148     EXPECT_FLOAT_EQ(expectX, player.x());
+00149     EXPECT_FLOAT_EQ(expectY, player.y());
+00150 }
+00151 
+00155 TEST(Car, carNotMovedWhenPathUpBlocked)
+00156 {
+00157     Maze testMaze;
+00158     vector<pair<int,int> > walls;
+00159     walls.push_back(make_pair(3,3));
+00160     testMaze.generateMaze(walls,5,5);
+00161 
+00162     PlayerCar player(3,4,Maze::UP);
+00163 
+00164     list<Smokescreen> smokescreens;
+00165     player.update(testMaze, smokescreens);
+00166 
+00167     double expectX = 3;
+00168     double expectY = 4;
+00169     EXPECT_FLOAT_EQ(expectX, player.x());
+00170     EXPECT_FLOAT_EQ(expectY, player.y());
+00171 }
+00175 TEST(Car, carNotMovedWhenPathDownBlocked)
+00176 {
+00177     Maze testMaze;
+00178     vector<pair<int,int> > walls;
+00179     walls.push_back(make_pair(3,3));
+00180     testMaze.generateMaze(walls,5,5);
+00181 
+00182     PlayerCar player(3,2,Maze::DOWN);
+00183 
+00184     list<Smokescreen> smokescreens;
+00185     player.update(testMaze, smokescreens);
+00186 
+00187     double expectX = 3;
+00188     double expectY = 2;
+00189     EXPECT_FLOAT_EQ(expectX, player.x());
+00190     EXPECT_FLOAT_EQ(expectY, player.y());
+00191 }
+00195 TEST(Car, carNotMovedWhenPathLeftBlocked)
+00196 {
+00197     Maze testMaze;
+00198     vector<pair<int,int> > walls;
+00199     walls.push_back(make_pair(3,3));
+00200     testMaze.generateMaze(walls,5,5);
+00201 
+00202     PlayerCar player(4,3,Maze::LEFT);
+00203 
+00204     list<Smokescreen> smokescreens;
+00205     player.update(testMaze, smokescreens);
+00206 
+00207     double expectX = 4;
+00208     double expectY = 3;
+00209     EXPECT_FLOAT_EQ(expectX, player.x());
+00210     EXPECT_FLOAT_EQ(expectY, player.y());
+00211 }
+00215 TEST(Car, carNotMovedWhenPathRightBlocked)
+00216 {
+00217     Maze testMaze;
+00218     vector<pair<int,int> > walls;
+00219     walls.push_back(make_pair(3,3));
+00220     testMaze.generateMaze(walls,5,5);
+00221 
+00222     PlayerCar player(2,3,Maze::RIGHT);
+00223 
+00224     list<Smokescreen> smokescreens;
+00225     player.update(testMaze, smokescreens);
+00226 
+00227     double expectX = 2;
+00228     double expectY = 3;
+00229     EXPECT_FLOAT_EQ(expectX, player.x());
+00230     EXPECT_FLOAT_EQ(expectY, player.y());
+00231 }
+00232 
+00236 TEST(Car, carDoesNotMoveUpOutMaze)
+00237 {
+00238     Maze testMaze;
+00239     vector<pair<int,int> > walls;
+00240     testMaze.generateMaze(walls,5,5);
+00241 
+00242     PlayerCar player(3,0,Maze::UP);
+00243 
+00244     list<Smokescreen> smokescreens;
+00245     player.update(testMaze, smokescreens);
+00246 
+00247     double expectX = 3;
+00248     double expectY = 0;
+00249     EXPECT_FLOAT_EQ(expectX, player.x());
+00250     EXPECT_FLOAT_EQ(expectY, player.y());
+00251 }
+00255 TEST(Car, carDoesNotMoveDownOutMaze)
+00256 {
+00257     Maze testMaze;
+00258     vector<pair<int,int> > walls;
+00259     testMaze.generateMaze(walls,5,5);
+00260 
+00261     PlayerCar player(3,5,Maze::DOWN);
+00262 
+00263     list<Smokescreen> smokescreens;
+00264     player.update(testMaze, smokescreens);
+00265 
+00266     double expectX = 3;
+00267     double expectY = 5;
+00268     EXPECT_FLOAT_EQ(expectX, player.x());
+00269     EXPECT_FLOAT_EQ(expectY, player.y());
+00270 }
+00274 TEST(Car, carDoesNotMoveLeftOutMaze)
+00275 {
+00276     Maze testMaze;
+00277     vector<pair<int,int> > walls;
+00278     testMaze.generateMaze(walls,5,5);
+00279 
+00280     PlayerCar player(0,3,Maze::LEFT);
+00281 
+00282     list<Smokescreen> smokescreens;
+00283     player.update(testMaze, smokescreens);
+00284 
+00285     double expectX = 0;
+00286     double expectY = 3;
+00287     EXPECT_FLOAT_EQ(expectX, player.x());
+00288     EXPECT_FLOAT_EQ(expectY, player.y());
+00289 }
+00293 TEST(Car, carDoesNotMoveRightOutMaze)
+00294 {
+00295     Maze testMaze;
+00296     vector<pair<int,int> > walls;
+00297     testMaze.generateMaze(walls,5,5);
+00298 
+00299     PlayerCar player(5,3,Maze::RIGHT);
+00300 
+00301     list<Smokescreen> smokescreens;
+00302     player.update(testMaze, smokescreens);
+00303 
+00304     double expectX = 5;
+00305     double expectY = 3;
+00306     EXPECT_FLOAT_EQ(expectX, player.x());
+00307     EXPECT_FLOAT_EQ(expectY, player.y());
+00308 }
+00309 
+00313 TEST(Checkpoint, countIncrementsAndDecrements)
+00314 {
+00315     vector<Checkpoint> checkpoints;
+00316     EXPECT_EQ(0, Checkpoint::checkpointCount());
+00317 
+00318     for (int i=0; i<1000; ++i)
+00319     {
+00320         checkpoints.push_back(Checkpoint(i,i));
+00321     }
+00322     EXPECT_EQ(1000, Checkpoint::checkpointCount());
+00323 
+00324     //brackets to limit scope
+00325     {
+00326         Checkpoint extraCheck1(0,0);
+00327         Checkpoint extraCheck2 = extraCheck1;
+00328         EXPECT_EQ(1002, Checkpoint::checkpointCount());
+00329         extraCheck2 = extraCheck1;
+00330         EXPECT_EQ(1002, Checkpoint::checkpointCount());
+00331     }
+00332     EXPECT_EQ(1000, Checkpoint::checkpointCount());
+00333 
+00334     while(!checkpoints.empty())
+00335     {
+00336         checkpoints.pop_back();
+00337     }
+00338     EXPECT_EQ(0, Checkpoint::checkpointCount());
+00339 }
+00340 
+00344 TEST(CollisionDetector, playerAndEnemyBothDestroyed)
+00345 {
+00346     list<PlayerCar> players;
+00347     list<EnemyCar> enemies;
+00348     list<Checkpoint> checkpoints;
+00349     list<Rock> rocks;
+00350     list<Smokescreen> smokescreens;
+00351     CollisionDetector detector;
+00352 
+00353     players.push_back(PlayerCar(5,5));
+00354     players.push_back(PlayerCar(5,6));
+00355     players.push_back(PlayerCar(6,5));
+00356     players.push_back(PlayerCar(7,7.5));
+00357 
+00358     enemies.push_back(EnemyCar(5,6));
+00359     enemies.push_back(EnemyCar(4,5));
+00360     enemies.push_back(EnemyCar(6,6));
+00361     enemies.push_back(EnemyCar(6.5,8));
+00362 
+00363     detector.checkCollisions(players, enemies, checkpoints, rocks, smokescreens);
+00364 
+00365     list<PlayerCar>::const_iterator playerIter = players.begin();
+00366     EXPECT_FALSE(playerIter->destroyed());
+00367     ++playerIter;
+00368     EXPECT_TRUE(playerIter->destroyed());
+00369     ++playerIter;
+00370     EXPECT_FALSE(playerIter->destroyed());
+00371     ++playerIter;
+00372     EXPECT_TRUE(playerIter->destroyed());
+00373 
+00374     list<EnemyCar>::const_iterator enemyIter = enemies.begin();
+00375     EXPECT_TRUE(enemyIter->destroyed());
+00376     ++enemyIter;
+00377     EXPECT_FALSE(enemyIter->destroyed());
+00378     ++enemyIter;
+00379     EXPECT_FALSE(enemyIter->destroyed());
+00380     ++enemyIter;
+00381     EXPECT_TRUE(enemyIter->destroyed());
+00382 }
+00383 
+00387 TEST(CollisionDetector, playerDestroyedByRock)
+00388 {
+00389     list<PlayerCar> players;
+00390     list<EnemyCar> enemies;
+00391     list<Checkpoint> checkpoints;
+00392     list<Rock> rocks;
+00393     list<Smokescreen> smokescreens;
+00394     CollisionDetector detector;
+00395 
+00396     players.push_back(PlayerCar(5,5));
+00397     players.push_back(PlayerCar(5,6));
+00398     players.push_back(PlayerCar(6,5));
+00399     players.push_back(PlayerCar(7,7.5));
+00400 
+00401     rocks.push_back(Rock(5,6));
+00402     rocks.push_back(Rock(4,5));
+00403     rocks.push_back(Rock(6,6));
+00404     rocks.push_back(Rock(6.5,8));
+00405 
+00406     detector.checkCollisions(players, enemies, checkpoints, rocks, smokescreens);
+00407 
+00408     list<PlayerCar>::const_iterator playerIter = players.begin();
+00409     EXPECT_FALSE(playerIter->destroyed());
+00410     ++playerIter;
+00411     EXPECT_TRUE(playerIter->destroyed());
+00412     ++playerIter;
+00413     EXPECT_FALSE(playerIter->destroyed());
+00414     ++playerIter;
+00415     EXPECT_TRUE(playerIter->destroyed());
+00416 
+00417     list<Rock>::const_iterator rockIter = rocks.begin();
+00418     EXPECT_FALSE(rockIter->destroyed());
+00419     ++rockIter;
+00420     EXPECT_FALSE(rockIter->destroyed());
+00421     ++rockIter;
+00422     EXPECT_FALSE(rockIter->destroyed());
+00423     ++rockIter;
+00424     EXPECT_FALSE(rockIter->destroyed());
+00425 }
+00426 
+00430 TEST(CollisionDetector, checkpointDestroyedByPlayer)
+00431 {
+00432     list<PlayerCar> players;
+00433     list<EnemyCar> enemies;
+00434     list<Checkpoint> checkpoints;
+00435     list<Rock> rocks;
+00436     list<Smokescreen> smokescreens;
+00437     CollisionDetector detector;
+00438 
+00439     players.push_back(PlayerCar(5,5));
+00440     players.push_back(PlayerCar(5,6));
+00441     players.push_back(PlayerCar(6,5));
+00442     players.push_back(PlayerCar(7,7.5));
+00443 
+00444     checkpoints.push_back(Checkpoint(5,6));
+00445     checkpoints.push_back(Checkpoint(4,5));
+00446     checkpoints.push_back(Checkpoint(6,6));
+00447     checkpoints.push_back(Checkpoint(6.5,8));
+00448 
+00449     detector.checkCollisions(players, enemies, checkpoints, rocks, smokescreens);
+00450 
+00451     list<PlayerCar>::const_iterator playerIter = players.begin();
+00452     EXPECT_FALSE(playerIter->destroyed());
+00453     ++playerIter;
+00454     EXPECT_FALSE(playerIter->destroyed());
+00455     ++playerIter;
+00456     EXPECT_FALSE(playerIter->destroyed());
+00457     ++playerIter;
+00458     EXPECT_FALSE(playerIter->destroyed());
+00459 
+00460     list<Checkpoint>::const_iterator checkpointIter = checkpoints.begin();
+00461     EXPECT_TRUE(checkpointIter->destroyed());
+00462     ++checkpointIter;
+00463     EXPECT_FALSE(checkpointIter->destroyed());
+00464     ++checkpointIter;
+00465     EXPECT_FALSE(checkpointIter->destroyed());
+00466     ++checkpointIter;
+00467     EXPECT_TRUE(checkpointIter->destroyed());
+00468 }
+00469 
+00473 TEST(CollisionDetector, enemyStoppedBySmokescreen)
+00474 {
+00475     list<PlayerCar> players;
+00476     list<EnemyCar> enemies;
+00477     list<Checkpoint> checkpoints;
+00478     list<Rock> rocks;
+00479     list<Smokescreen> smokescreens;
+00480     CollisionDetector detector;
+00481 
+00482     enemies.push_back(EnemyCar(5,5));
+00483     enemies.push_back(EnemyCar(5,6));
+00484     enemies.push_back(EnemyCar(6,5));
+00485     enemies.push_back(EnemyCar(7,7.5));
+00486 
+00487     smokescreens.push_back(Smokescreen(5,6));
+00488     smokescreens.push_back(Smokescreen(4,5));
+00489     smokescreens.push_back(Smokescreen(6,6));
+00490     smokescreens.push_back(Smokescreen(6.5,8));
+00491 
+00492     detector.checkCollisions(players, enemies, checkpoints, rocks, smokescreens);
+00493 
+00494     list<EnemyCar>::const_iterator enemyIter = enemies.begin();
+00495     EXPECT_GT(enemyIter->speed(),0);
+00496     ++enemyIter;
+00497     EXPECT_FLOAT_EQ(0, enemyIter->speed());
+00498     ++enemyIter;
+00499     EXPECT_GT(enemyIter->speed(),0);
+00500     ++enemyIter;
+00501     EXPECT_FLOAT_EQ(0, enemyIter->speed());
+00502 }
+00503 
+00507 TEST(DestroyedObjectPopup, destroyedAfterSetTime)
+00508 {
+00509     DestroyedObjectPopup testPopup(3,2,BitmapStore::CRASHED_CAR);
+00510 
+00511     int i=0;
+00512     while (!testPopup.destroyed())
+00513     {
+00514         testPopup.update();
+00515         ++i;
+00516     }
+00517 
+00518     EXPECT_EQ(30,i);
+00519 }
+00520 
+00524 TEST(Maze, queryOutsideBoundsReturnsSolid)
+00525 {
+00526     Maze testMaze;
+00527     vector<pair<int,int> > walls;
+00528     testMaze.generateMaze(walls,5,5);
+00529 
+00530     EXPECT_FALSE(testMaze.getSolid(5,5));
+00531     EXPECT_FALSE(testMaze.getSolid(0,0));
+00532     EXPECT_TRUE(testMaze.getSolid(6,5));
+00533     EXPECT_TRUE(testMaze.getSolid(5,6));
+00534     EXPECT_TRUE(testMaze.getSolid(-1,3));
+00535     EXPECT_TRUE(testMaze.getSolid(3,-1));
+00536 }
+00537 
+00541 TEST(Maze, generationWithWallsWithoutObjectMax)
+00542 {
+00543     Maze testMaze;
+00544     vector<pair<int,int> > walls;
+00545     walls.push_back(make_pair(1,2));
+00546     walls.push_back(make_pair(4,3));
+00547     testMaze.generateMaze(walls);
+00548 
+00549     //test random empty blocks
+00550     EXPECT_FALSE(testMaze.getSolid(2,1));
+00551     EXPECT_FALSE(testMaze.getSolid(0,0));
+00552 
+00553     //test wall blocks
+00554     EXPECT_TRUE(testMaze.getSolid(1,2));
+00555     EXPECT_TRUE(testMaze.getSolid(4,3));
+00556 
+00557     //test bounds are being set right
+00558     EXPECT_TRUE(testMaze.getSolid(4,4));
+00559     EXPECT_TRUE(testMaze.getSolid(5,3));
+00560 }
+00561 
+00565 TEST(Maze, generationWithWallsWithObjectMax)
+00566 {
+00567     Maze testMaze;
+00568     vector<pair<int,int> > walls;
+00569     walls.push_back(make_pair(1,2));
+00570     walls.push_back(make_pair(4,3));
+00571     testMaze.generateMaze(walls,5,6);
+00572 
+00573     //test random empty blocks
+00574     EXPECT_FALSE(testMaze.getSolid(2,1));
+00575     EXPECT_FALSE(testMaze.getSolid(0,0));
+00576 
+00577     //test wall blocks
+00578     EXPECT_TRUE(testMaze.getSolid(1,2));
+00579     EXPECT_TRUE(testMaze.getSolid(4,3));
+00580 
+00581     //test bounds are being set right
+00582     EXPECT_FALSE(testMaze.getSolid(4,4));
+00583     EXPECT_FALSE(testMaze.getSolid(5,6));
+00584     EXPECT_TRUE(testMaze.getSolid(6,6));
+00585     EXPECT_TRUE(testMaze.getSolid(5,7));
+00586 }
+00587 
+00591 TEST(MazeMath, distanceGivesExpectedResult)
+00592 {
+00593     //right angle triange with sides of length 3, 4, and 5
+00594     double x1 = 1;
+00595     double y1 = 1;
+00596     double x2 = 4;
+00597     double y2 = 5;
+00598 
+00599     double expectedResult = 5;
+00600 
+00601     EXPECT_DOUBLE_EQ(expectedResult, MazeMath::distance(x1,y1,x2,y2));
+00602 }
+00603 
+00607 TEST(MazeMath, roundGivesExpectedResult)
+00608 {
+00609     //right angle triange with sides of length 3, 4, and 5
+00610     double roundUp = 5.5;
+00611     double roundDown = 5.49;
+00612 
+00613     double expectUp = 6;
+00614     double expectDown = 5;
+00615 
+00616     EXPECT_DOUBLE_EQ(expectUp, MazeMath::round(roundUp));
+00617     EXPECT_DOUBLE_EQ(expectDown, MazeMath::round(roundDown));
+00618 }
+00619 
+00626 TEST(PlayerCar, creationAndDestructionCanHappen)
+00627 {
+00628     EXPECT_NO_THROW({
+00629         vector<PlayerCar> players;
+00630         for (int i=0; i<10; ++i)
+00631         {
+00632             players.push_back(PlayerCar(i,i));
+00633         }
+00634         while(!players.empty())
+00635         {
+00636             players.pop_back();
+00637         }
+00638     });
+00639 
+00640     EXPECT_FALSE(al_is_system_installed());
+00641 }
+00642 
+00648 TEST(PlayerCar, playerSpeedAffectedByPetrol)
+00649 {
+00650     Maze testMaze;
+00651     vector<pair<int,int> > walls;
+00652     testMaze.generateMaze(walls,5,5);
+00653 
+00654     PlayerCar player(5,3,Maze::RIGHT);
+00655 
+00656     list<Smokescreen> smokescreens;
+00657     for (int i=0; i<1429; ++i)
+00658     {
+00659         player.update(testMaze, smokescreens);
+00660     }
+00661 
+00662     EXPECT_FLOAT_EQ(0, player.petrol());
+00663     EXPECT_FLOAT_EQ(0.05, player.speed());
+00664 
+00665     player.gotCheckpoint();
+00666     EXPECT_GT(player.petrol(), 0);
+00667     EXPECT_FLOAT_EQ(0.1, player.speed());
+00668 }
+00669 
+00673 TEST(Smokescreen, destroyedAfterSetTime)
+00674 {
+00675     Smokescreen testSmokescreen(3,2);
+00676 
+00677     int i=0;
+00678     while (!testSmokescreen.destroyed())
+00679     {
+00680         testSmokescreen.update();
+00681         ++i;
+00682     }
+00683 
+00684     EXPECT_EQ(60,i);
+00685 }
+
+
+ + + + +
+ +
+ + + + + + + diff --git a/docs/html/main_8cpp.html b/docs/html/main_8cpp.html new file mode 100644 index 0000000..c841d59 --- /dev/null +++ b/docs/html/main_8cpp.html @@ -0,0 +1,136 @@ + + + + +Rally X: source/main.cpp File Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+ +
+
source/main.cpp File Reference
+
+
+
#include "logic/Game.h"
+
+

Go to the source code of this file.

+ + + +

+Functions

int main ()
+

Function Documentation

+ +
+
+ + + + + + + +
int main ()
+
+
+ +

Definition at line 3 of file main.cpp.

+ +
+
+
+ + + + +
+ +
+ + + + + + + diff --git a/docs/html/main_8cpp_source.html b/docs/html/main_8cpp_source.html new file mode 100644 index 0000000..3573fd0 --- /dev/null +++ b/docs/html/main_8cpp_source.html @@ -0,0 +1,128 @@ + + + + +Rally X: source/main.cpp Source File + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
source/main.cpp
+
+
+Go to the documentation of this file.
00001 #include "logic/Game.h"
+00002 
+00003 int main()
+00004 {
+00005     try
+00006     {
+00007         Game game;
+00008         game.start();
+00009     }
+00010     catch (BadResolution)
+00011     {
+00012     }
+00013     catch (InstallFailure)
+00014     {
+00015     }
+00016     catch (FileOpenError)
+00017     {
+00018     }
+00019 
+00020     return 0;
+00021 }
+
+
+ + + + +
+ +
+ + + + + + + diff --git a/docs/html/nav_f.png b/docs/html/nav_f.png new file mode 100644 index 0000000..1b07a16 Binary files /dev/null and b/docs/html/nav_f.png differ diff --git a/docs/html/nav_h.png b/docs/html/nav_h.png new file mode 100644 index 0000000..01f5fa6 Binary files /dev/null and b/docs/html/nav_h.png differ diff --git a/docs/html/open.png b/docs/html/open.png new file mode 100644 index 0000000..7b35d2c Binary files /dev/null and b/docs/html/open.png differ diff --git a/docs/html/presentation_tests_8cpp.html b/docs/html/presentation_tests_8cpp.html new file mode 100644 index 0000000..90e46db --- /dev/null +++ b/docs/html/presentation_tests_8cpp.html @@ -0,0 +1,371 @@ + + + + +Rally X: tests/presentationTests.cpp File Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+ +
+
tests/presentationTests.cpp File Reference
+
+
+ +

Unit tests for the presentation layer of a Rally-X game. +More...

+
#include <utility>
+#include <list>
+#include <gtest/gtest.h>
+#include "../source/presentation/BitmapStore.h"
+#include "../source/presentation/ColourStore.h"
+#include "../source/presentation/GamePanel.h"
+#include "../source/presentation/Screen.h"
+#include "../source/logic/PlayerCar.h"
+#include "../source/logic/EnemyCar.h"
+#include "../source/logic/Checkpoint.h"
+#include "../source/logic/Rock.h"
+#include "../source/logic/Smokescreen.h"
+#include "../source/logic/Maze.h"
+#include "../source/logic/DestroyedObjectPopup.h"
+
+

Go to the source code of this file.

+ + + + + + + + + + + + + +

+Functions

 TEST (BitmapStore, returnsBitmapForAllImages)
 Tests that all images can be requested without failure occuring.
 TEST (ColourStore, returnsColourForAllImages)
 Tests that all colours can be requested without failure occuring.
 TEST (Screen, exceptionOnBadResolution)
 TEST (Screen, noExceptionOnWindowed)
 TEST (Screen, noExceptionOnGoodResolution)
 TEST (ScreenPanel, drawingToCurrentBackBuffer)
 Tests that when a ScreenPanel draws to the back buffer provided.
 TEST (ScreenPanel, drawingToCurrentBackBufferAfterFlip)
 Tests that when a ScreenPanel draws to the front buffer provided after a flip has been called.
+

Detailed Description

+

Unit tests for the presentation layer of a Rally-X game.

+

The BitmapStore class is tested in its ability to return a bitmap for each image. The appearance of the bitmaps need to be tested manually by running the game and inspecting the various objects.

+

The ColourStore class is tested in its ability to return a colour for each image. The appearance of the colours need to be tested manually by running the game and inspecting the various objects.

+

The GamePanel and InfoPanel classes depend on their visual appearance in the game. Therefore, they should be tested manually. The technical part of their functionality, creating the back and front buffers and changing between them, is handled by their superclass, ScreenPanel.

+

The KeyboardHandler depends on user inputs. It should be tested manually by testing that the player's direction can be controlled, and that smokescreens can be created.

+

The Screen class's creation with various resolutions and fullscreen settings is tested. An exception should be thrown if the fullscreen resolution is not supported by the current hardware, but not otherwise. The visual appearance and creation of ScreenPanels should be tested manually by running the game.

+

The ScreenPanel class is tested by creating a false back and front display buffer. The buffer that is being drawn to is tested by sampling a pixel in the middle of the buffer.

+
Author:
Justin Wernick
+
+David Schneider
+ +

Definition in file presentationTests.cpp.

+

Function Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + +
TEST (BitmapStore ,
returnsBitmapForAllImages  
)
+
+
+ +

Tests that all images can be requested without failure occuring.

+ +

Definition at line 55 of file presentationTests.cpp.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
TEST (ColourStore ,
returnsColourForAllImages  
)
+
+
+ +

Tests that all colours can be requested without failure occuring.

+ +

Definition at line 75 of file presentationTests.cpp.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
TEST (Screen ,
exceptionOnBadResolution  
)
+
+
+

Tests that an exception is thrown if fullscreen mode is requested on an unsupported monitor resolution.

+ +

Definition at line 95 of file presentationTests.cpp.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
TEST (Screen ,
noExceptionOnWindowed  
)
+
+
+

Tests that an exception is not thrown if windowed mode is requested on an unsupported monitor resolution.

+ +

Definition at line 106 of file presentationTests.cpp.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
TEST (Screen ,
noExceptionOnGoodResolution  
)
+
+
+

Tests that an exception is not thrown if fullscreen mode is requested on a supported monitor resolution.

+ +

Definition at line 117 of file presentationTests.cpp.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
TEST (ScreenPanel ,
drawingToCurrentBackBuffer  
)
+
+
+ +

Tests that when a ScreenPanel draws to the back buffer provided.

+ +

Definition at line 129 of file presentationTests.cpp.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
TEST (ScreenPanel ,
drawingToCurrentBackBufferAfterFlip  
)
+
+
+ +

Tests that when a ScreenPanel draws to the front buffer provided after a flip has been called.

+ +

Definition at line 189 of file presentationTests.cpp.

+ +
+
+
+ + + + +
+ +
+ + + + + + + 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 @@ + + + + +Rally X: tests/presentationTests.cpp Source File + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + +
+
Rally X + +
+
ELEN3009 Project by Justin Wernick and David Schneider
+
+
+ + + + + +
+
+
tests/presentationTests.cpp
+
+
+Go to the documentation of this file.
00001 
+00033 #include <utility>
+00034 #include <list>
+00035 using namespace std;
+00036 
+00037 #include <gtest/gtest.h>
+00038 
+00039 #include "../source/presentation/BitmapStore.h"
+00040 #include "../source/presentation/ColourStore.h"
+00041 #include "../source/presentation/GamePanel.h"
+00042 #include "../source/presentation/Screen.h"
+00043 
+00044 #include "../source/logic/PlayerCar.h"
+00045 #include "../source/logic/EnemyCar.h"
+00046 #include "../source/logic/Checkpoint.h"
+00047 #include "../source/logic/Rock.h"
+00048 #include "../source/logic/Smokescreen.h"
+00049 #include "../source/logic/Maze.h"
+00050 #include "../source/logic/DestroyedObjectPopup.h"
+00051 
+00055 TEST(BitmapStore, returnsBitmapForAllImages)
+00056 {
+00057     BitmapStore testStore(50);
+00058 
+00059     ALLEGRO_BITMAP* testBitmap = NULL;
+00060 
+00061     EXPECT_NO_FATAL_FAILURE(testBitmap = testStore.getBitmap(BitmapStore::PLAYER));
+00062     EXPECT_NO_FATAL_FAILURE(testBitmap = testStore.getBitmap(BitmapStore::ENEMY));
+00063     EXPECT_NO_FATAL_FAILURE(testBitmap = testStore.getBitmap(BitmapStore::CHECKPOINT));
+00064     EXPECT_NO_FATAL_FAILURE(testBitmap = testStore.getBitmap(BitmapStore::ROCK));
+00065     EXPECT_NO_FATAL_FAILURE(testBitmap = testStore.getBitmap(BitmapStore::MAZE_WALL));
+00066     EXPECT_NO_FATAL_FAILURE(testBitmap = testStore.getBitmap(BitmapStore::MAZE_FLOOR));
+00067     EXPECT_NO_FATAL_FAILURE(testBitmap = testStore.getBitmap(BitmapStore::SMOKE));
+00068     EXPECT_NO_FATAL_FAILURE(testBitmap = testStore.getBitmap(BitmapStore::CRASHED_CAR));
+00069     EXPECT_NO_FATAL_FAILURE(testBitmap = testStore.getBitmap(BitmapStore::CLAIMED_CHECKPOINT));
+00070 }
+00071 
+00075 TEST(ColourStore, returnsColourForAllImages)
+00076 {
+00077     ColourStore testStore;
+00078 
+00079     ALLEGRO_COLOR testColour;
+00080 
+00081     EXPECT_NO_FATAL_FAILURE(testColour = testStore.getColour(BitmapStore::PLAYER));
+00082     EXPECT_NO_FATAL_FAILURE(testColour = testStore.getColour(BitmapStore::ENEMY));
+00083     EXPECT_NO_FATAL_FAILURE(testColour = testStore.getColour(BitmapStore::CHECKPOINT));
+00084     EXPECT_NO_FATAL_FAILURE(testColour = testStore.getColour(BitmapStore::ROCK));
+00085     EXPECT_NO_FATAL_FAILURE(testColour = testStore.getColour(BitmapStore::MAZE_WALL));
+00086     EXPECT_NO_FATAL_FAILURE(testColour = testStore.getColour(BitmapStore::MAZE_FLOOR));
+00087     EXPECT_NO_FATAL_FAILURE(testColour = testStore.getColour(BitmapStore::SMOKE));
+00088     EXPECT_NO_FATAL_FAILURE(testColour = testStore.getColour(BitmapStore::CRASHED_CAR));
+00089     EXPECT_NO_FATAL_FAILURE(testColour = testStore.getColour(BitmapStore::CLAIMED_CHECKPOINT));
+00090 }
+00091 
+00095 TEST(Screen, exceptionOnBadResolution)
+00096 {
+00097     //resolution should be unsupported on most displays
+00098     int badWidth = 1000;
+00099     int badHeight = 5;
+00100 
+00101     EXPECT_ANY_THROW(Screen(badWidth, badHeight, true));
+00102 }
+00106 TEST(Screen, noExceptionOnWindowed)
+00107 {
+00108     int badWidth = 1000;
+00109     int badHeight = 5;
+00110 
+00111     EXPECT_NO_THROW(Screen(badWidth, badHeight, false));
+00112 
+00113 }
+00117 TEST(Screen, noExceptionOnGoodResolution)
+00118 {
+00119     //resolution should be supported on most monitors
+00120     int goodWidth = 800;
+00121     int goodHeight = 600;
+00122 
+00123     EXPECT_NO_THROW(Screen(goodWidth, goodHeight, true));
+00124 }
+00125 
+00129 TEST(ScreenPanel, drawingToCurrentBackBuffer)
+00130 {
+00131     al_init();
+00132 
+00133     ALLEGRO_BITMAP* testBitmapBack = al_create_bitmap(500,500);
+00134     ALLEGRO_BITMAP* testBitmapFront = al_create_bitmap(500,500);
+00135 
+00136     ALLEGRO_COLOR blankColour = al_map_rgb(0,0,0);
+00137     al_set_target_bitmap(testBitmapBack);
+00138     al_clear_to_color(blankColour);
+00139     al_set_target_bitmap(testBitmapFront);
+00140     al_clear_to_color(blankColour);
+00141 
+00142     GamePanel testPanel(testBitmapBack, testBitmapFront, 0, 0, 500, 500);
+00143     Maze testMaze;
+00144 
+00145     vector<pair<int,int> > wallsFull;
+00146 
+00147     for (int x=0; x<20; ++x)
+00148     {
+00149         for (int y=0; y<20; ++y)
+00150         {
+00151             wallsFull.push_back(make_pair(x,y));
+00152         }
+00153     }
+00154     testMaze.generateMaze(wallsFull,20,20);
+00155 
+00156     list<PlayerCar> players;
+00157     list<EnemyCar> enemies;
+00158     list<Checkpoint> checkpoints;
+00159     list<Rock> rocks;
+00160     list<Smokescreen> smokescreens;
+00161     list<DestroyedObjectPopup> popups;
+00162 
+00163     testPanel.draw(testMaze, players, enemies, checkpoints, rocks, smokescreens, popups);
+00164 
+00165     BitmapStore bitmapStore(50);
+00166     ALLEGRO_BITMAP* wall = bitmapStore.getBitmap(BitmapStore::MAZE_WALL);
+00167     ALLEGRO_COLOR mazeColour = al_get_pixel(wall, 25, 25);
+00168 
+00169     ALLEGRO_COLOR backSample = al_get_pixel(testBitmapBack, 250, 250);
+00170     ALLEGRO_COLOR frontSample = al_get_pixel(testBitmapFront, 250, 250);
+00171 
+00172     EXPECT_FLOAT_EQ(mazeColour.r, backSample.r);
+00173     EXPECT_FLOAT_EQ(mazeColour.g, backSample.g);
+00174     EXPECT_FLOAT_EQ(mazeColour.b, backSample.b);
+00175     EXPECT_FLOAT_EQ(mazeColour.a, backSample.a);
+00176 
+00177     EXPECT_FLOAT_EQ(blankColour.r, frontSample.r);
+00178     EXPECT_FLOAT_EQ(blankColour.g, frontSample.g);
+00179     EXPECT_FLOAT_EQ(blankColour.b, frontSample.b);
+00180     EXPECT_FLOAT_EQ(blankColour.a, frontSample.a);
+00181 
+00182     al_destroy_bitmap(testBitmapBack);
+00183     al_destroy_bitmap(testBitmapFront);
+00184 }
+00185 
+00189 TEST(ScreenPanel, drawingToCurrentBackBufferAfterFlip)
+00190 {
+00191     al_init();
+00192 
+00193     al_set_new_bitmap_flags(ALLEGRO_MEMORY_BITMAP); //removes dependency on display existing
+00194 
+00195     ALLEGRO_BITMAP* testBitmapBack = al_create_bitmap(500,500);
+00196     ALLEGRO_BITMAP* testBitmapFront = al_create_bitmap(500,500);
+00197 
+00198     ALLEGRO_COLOR blankColour = al_map_rgb(0,0,0);
+00199     al_set_target_bitmap(testBitmapBack);
+00200     al_clear_to_color(blankColour);
+00201     al_set_target_bitmap(testBitmapFront);
+00202     al_clear_to_color(blankColour);
+00203 
+00204     GamePanel testPanel(testBitmapBack, testBitmapFront, 0, 0, 500, 500);
+00205     Maze testMaze;
+00206 
+00207     vector<pair<int,int> > wallsFull;
+00208 
+00209     for (int x=0; x<20; ++x)
+00210     {
+00211         for (int y=0; y<20; ++y)
+00212         {
+00213             wallsFull.push_back(make_pair(x,y));
+00214         }
+00215     }
+00216     testMaze.generateMaze(wallsFull,20,20);
+00217 
+00218     list<PlayerCar> players;
+00219     list<EnemyCar> enemies;
+00220     list<Checkpoint> checkpoints;
+00221     list<Rock> rocks;
+00222     list<Smokescreen> smokescreens;
+00223     list<DestroyedObjectPopup> popups;
+00224 
+00225     testPanel.flip();
+00226 
+00227     testPanel.draw(testMaze, players, enemies, checkpoints, rocks, smokescreens, popups);
+00228 
+00229     BitmapStore bitmapStore(50);
+00230     ALLEGRO_BITMAP* wall = bitmapStore.getBitmap(BitmapStore::MAZE_WALL);
+00231     ALLEGRO_COLOR mazeColour = al_get_pixel(wall, 25, 25);
+00232 
+00233     ALLEGRO_COLOR backSample = al_get_pixel(testBitmapBack, 250, 250);
+00234     ALLEGRO_COLOR frontSample = al_get_pixel(testBitmapFront, 250, 250);
+00235 
+00236     EXPECT_FLOAT_EQ(mazeColour.r, frontSample.r);
+00237     EXPECT_FLOAT_EQ(mazeColour.g, frontSample.g);
+00238     EXPECT_FLOAT_EQ(mazeColour.b, frontSample.b);
+00239     EXPECT_FLOAT_EQ(mazeColour.a, frontSample.a);
+00240 
+00241     EXPECT_FLOAT_EQ(blankColour.r, backSample.r);
+00242     EXPECT_FLOAT_EQ(blankColour.g, backSample.g);
+00243     EXPECT_FLOAT_EQ(blankColour.b, backSample.b);
+00244     EXPECT_FLOAT_EQ(blankColour.a, backSample.a);
+00245 
+00246     al_destroy_bitmap(testBitmapBack);
+00247     al_destroy_bitmap(testBitmapFront);
+00248 }
+
+
+ + + + +
+ +
+ + + + + + + diff --git a/docs/html/search/all_5f.html b/docs/html/search/all_5f.html new file mode 100644 index 0000000..24a1857 --- /dev/null +++ b/docs/html/search/all_5f.html @@ -0,0 +1,487 @@ + + + + + + + +
+
Loading...
+ +
+
+ _back + ScreenPanel +
+
+
+
+ _baseSpeed + Car +
+
+
+
+ _bitmapFont + BitmapStore +
+
+
+
+ _bitmaps + BitmapStore +
+
+
+
+ _bitmapStore + GamePanel +
+
+
+
+ _blockWidth + BitmapStore +
+
+
+
+ _checkpointCount + Checkpoint +
+
+
+
+ _checkpointHeadingY + InfoPanel +
+
+
+
+ _checkpoints + Game +
+
+
+
+ _checkpointValueY + InfoPanel +
+
+
+
+ _collisionDetector + Game +
+
+
+
+ _colours + ColourStore +
+
+
+
+ _colourStore + InfoPanel +
+
+
+
+ _config + Game +
+
+
+
+ _destroyed + GameObject +
+
+
+
+ _display + Screen +
+
+
+
+ _down + KeyboardHandler +
+
+ +
+
+ _drawingInstalls + BitmapStore +
+
+
+
+ _enemies + Game +
+
+
+
+ _exitClicked + Screen +
+
+
+
+ _facing + GameObject +
+
+
+
+ _filename + LevelReader +
+
+
+
+ _font + Screen +
+
+
+
+ _front + ScreenPanel +
+
+
+
+ _fullscreen + Config +
+
+
+
+ _gameAreaWidth + Screen +
+
+ +
+
+ _image + GameObject +
+
+
+
+ _infoPanelWidth + Screen +
+
+ +
+
+ _input + PlayerCar +
+
+ +
+
+ _keyboardEvents + KeyboardHandler +
+
+
+
+ _left + KeyboardHandler +
+
+
+
+ _maze + Game +
+
+
+
+ _mazeblockWidth + GamePanel +
+
+
+
+ _miniMazeblockWidth + InfoPanel +
+
+
+
+ _miniMazeHeight + InfoPanel +
+
+
+
+ _miniMazeY + InfoPanel +
+
+
+
+ _offsetX + GamePanel +
+
+
+
+ _offsetY + GamePanel +
+
+
+
+ _panelFont + InfoPanel +
+
+
+
+ _panels + Screen +
+
+
+
+ _petrol + PlayerCar +
+
+
+
+ _petrolGuageHeight + InfoPanel +
+
+
+
+ _petrolGuageY + InfoPanel +
+
+
+
+ _petrolHeadingY + InfoPanel +
+
+
+
+ _players + Game +
+
+
+
+ _popups + Game +
+
+
+
+ _previousFacing + KeyboardHandler +
+
+
+
+ _remainingTime + LimitedTimeObject +
+
+
+
+ _right + KeyboardHandler +
+
+
+
+ _rocks + Game +
+
+
+
+ _screen + Game +
+
+ + +
+
+ _smokescreen + KeyboardHandler +
+
+
+
+ _smokescreens + Game +
+
+
+
+ _speed + Car +
+
+
+
+ _state + EnemyCar +
+
+
+
+ _targetX + EnemyCar +
+
+
+
+ _targetY + EnemyCar +
+
+
+
+ _timer + Game +
+
+
+
+ _timerEvents + Game +
+
+
+
+ _transparent + ColourStore +
+
+
+
+ _up + KeyboardHandler +
+
+
+
+ _wallLocations + Maze +
+
+ +
+
+ _windowEvents + Screen +
+
+
+
+ _x + GameObject +
+
+
+
+ _y + GameObject +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/all_61.html b/docs/html/search/all_61.html new file mode 100644 index 0000000..7435343 --- /dev/null +++ b/docs/html/search/all_61.html @@ -0,0 +1,60 @@ + + + + + + + +
+
Loading...
+ + + + + +
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/all_62.html b/docs/html/search/all_62.html new file mode 100644 index 0000000..8bd4630 --- /dev/null +++ b/docs/html/search/all_62.html @@ -0,0 +1,81 @@ + + + + + + + +
+
Loading...
+
+
+ backwards + Maze +
+
+
+ +
+ + +
+ +
+
+
+ BLANK + ScreenPanel +
+
+
+
+ blind + EnemyCar +
+
+
+
+ BLINDED + EnemyCar +
+
+
+
+ BLOCKS_PER_ROW + GamePanel +
+
+
+
+ BoolGrid + Maze +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/all_63.html b/docs/html/search/all_63.html new file mode 100644 index 0000000..91ac042 --- /dev/null +++ b/docs/html/search/all_63.html @@ -0,0 +1,194 @@ + + + + + + + +
+
Loading...
+
+
+ Car +
+ Car + Car::Car() +
+
+
+
+
+ Car.cpp +
+
+
+
+ Car.h +
+
+
+
+ CHASING + EnemyCar +
+
+
+
+ checkCollisions + CollisionDetector +
+
+
+
+ checkFacing + EnemyCar +
+
+ + +
+ +
+
+
+ CHECKPOINT_CHAR + LevelReader +
+
+
+
+ checkpointCount + Checkpoint +
+
+
+
+ CLAIMED_CHECKPOINT + BitmapStore +
+
+
+
+ cleanup + Game +
+
+
+
+ clearLists + Game +
+
+
+
+ collect + Checkpoint +
+
+ + + + + + +
+ +
+
+ +
+
+ +
+
+
+ Config.h +
+
+ +
+
+ CRASHED_CAR + BitmapStore +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/all_64.html b/docs/html/search/all_64.html new file mode 100644 index 0000000..e67cbc0 --- /dev/null +++ b/docs/html/search/all_64.html @@ -0,0 +1,155 @@ + + + + + + + +
+
Loading...
+
+ +
+
+
+ destroyed + GameObject +
+
+ + + +
+
+ Direction + Maze +
+
+
+
+ distance + MazeMath +
+
+
+
+ DOWN + Maze +
+
+
+
+ DOWN_KEY + KeyboardHandler +
+
+ +
+
+ drawCheckpoint + BitmapStore +
+
+
+
+ drawClaimedCheckpoint + BitmapStore +
+
+
+
+ drawCrashedCar + BitmapStore +
+
+
+
+ drawEnemyCar + BitmapStore +
+
+
+
+ drawLoss + Screen +
+
+
+
+ drawMazeFloor + BitmapStore +
+
+
+
+ drawMazeWall + BitmapStore +
+
+
+
+ drawPlayerCar + BitmapStore +
+
+
+
+ drawRock + BitmapStore +
+
+
+
+ drawSmoke + BitmapStore +
+
+
+
+ drawWin + Screen +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/all_65.html b/docs/html/search/all_65.html new file mode 100644 index 0000000..6a11cd8 --- /dev/null +++ b/docs/html/search/all_65.html @@ -0,0 +1,63 @@ + + + + + + + +
+
Loading...
+
+
+ ENEMY + BitmapStore +
+
+
+
+ ENEMY_CHAR + LevelReader +
+
+ +
+ +
+
+ +
+
+
+ exitClicked + Screen +
+
+
+
+ extractValue + Config +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/all_66.html b/docs/html/search/all_66.html new file mode 100644 index 0000000..033294d --- /dev/null +++ b/docs/html/search/all_66.html @@ -0,0 +1,70 @@ + + + + + + + +
+
Loading...
+
+
+ facing + GameObject +
+
+
+ +
+
+
+ fillValues + Config +
+
+ +
+
+ FPS + Game +
+
+
+
+ fullscreen + Config +
+
+
+
+ FULLSCREEN_DEFAULT + Config +
+
+
+
+ FULLSCREEN_KEY + Config +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/all_67.html b/docs/html/search/all_67.html new file mode 100644 index 0000000..0adc01a --- /dev/null +++ b/docs/html/search/all_67.html @@ -0,0 +1,145 @@ + + + + + + + +
+
Loading...
+ +
+
+ Game.cpp +
+
+
+
+ Game.h +
+
+ + +
+ +
+ +
+ +
+
+ +
+
+
+ generateMaze + Maze +
+
+
+
+ getBitmap + BitmapStore +
+
+
+
+ getColour + ColourStore +
+
+
+
+ getFacing + KeyboardHandler +
+
+
+
+ getLevel + Screen +
+
+ + +
+
+ getSmokescreen + KeyboardHandler +
+
+
+
+ getSolid + Maze +
+
+
+
+ gotCheckpoint + PlayerCar +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/all_68.html b/docs/html/search/all_68.html new file mode 100644 index 0000000..4af788f --- /dev/null +++ b/docs/html/search/all_68.html @@ -0,0 +1,26 @@ + + + + + + + +
+
Loading...
+
+
+ height + Maze +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/all_69.html b/docs/html/search/all_69.html new file mode 100644 index 0000000..611c1ca --- /dev/null +++ b/docs/html/search/all_69.html @@ -0,0 +1,60 @@ + + + + + + + +
+
Loading...
+ + +
+ +
+
+ +
+
+
+ initLevel + Game +
+
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/all_6b.html b/docs/html/search/all_6b.html new file mode 100644 index 0000000..0e1664d --- /dev/null +++ b/docs/html/search/all_6b.html @@ -0,0 +1,40 @@ + + + + + + + +
+
Loading...
+ + + +
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/all_6c.html b/docs/html/search/all_6c.html new file mode 100644 index 0000000..e291c17 --- /dev/null +++ b/docs/html/search/all_6c.html @@ -0,0 +1,75 @@ + + + + + + + +
+
Loading...
+
+
+ LEFT + Maze +
+
+
+
+ LEFT_KEY + KeyboardHandler +
+
+ + +
+ +
+ + + + +
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/all_6d.html b/docs/html/search/all_6d.html new file mode 100644 index 0000000..03af45c --- /dev/null +++ b/docs/html/search/all_6d.html @@ -0,0 +1,94 @@ + + + + + + + +
+
Loading...
+
+
+ main + main.cpp +
+
+
+
+ main.cpp +
+
+
+
+ makeSmoke + PlayerCar +
+
+
+
+ Maze + +
+
+
+
+ Maze.cpp +
+
+
+
+ Maze.h +
+
+
+
+ MAZE_FLOOR + BitmapStore +
+
+
+
+ MAZE_WALL + BitmapStore +
+
+ +
+ +
+
+ +
+
+
+ move + Car +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/all_6f.html b/docs/html/search/all_6f.html new file mode 100644 index 0000000..daab4e0 --- /dev/null +++ b/docs/html/search/all_6f.html @@ -0,0 +1,36 @@ + + + + + + + +
+
Loading...
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/all_70.html b/docs/html/search/all_70.html new file mode 100644 index 0000000..7563628 --- /dev/null +++ b/docs/html/search/all_70.html @@ -0,0 +1,92 @@ + + + + + + + +
+
Loading...
+
+
+ petrol + PlayerCar +
+
+
+
+ PETROL_FROM_CHECKPOINT + PlayerCar +
+
+
+
+ PETROL_USE_RATE + PlayerCar +
+
+
+
+ PETROL_USE_SMOKESCREEN + PlayerCar +
+
+
+
+ PLAYER + BitmapStore +
+
+
+
+ PLAYER_CHAR + LevelReader +
+
+ +
+ +
+
+ +
+
+
+ populateColours + ColourStore +
+
+
+
+ POPUP_TIME + DestroyedObjectPopup +
+
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/all_72.html b/docs/html/search/all_72.html new file mode 100644 index 0000000..5402ce1 --- /dev/null +++ b/docs/html/search/all_72.html @@ -0,0 +1,94 @@ + + + + + + + +
+
Loading...
+
+
+ readFile + Config +
+
+
+
+ readLevel + LevelReader +
+
+
+
+ resolutionSupported + Screen +
+
+
+
+ RIGHT + Maze +
+
+
+
+ RIGHT_KEY + KeyboardHandler +
+
+ +
+
+ Rock.cpp +
+
+
+
+ Rock.h +
+
+
+
+ ROCK_CHAR + LevelReader +
+
+
+
+ rockAtLocation + EnemyCar +
+
+
+
+ round + MazeMath +
+
+
+
+ runloop + Game +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/all_73.html b/docs/html/search/all_73.html new file mode 100644 index 0000000..582af0b --- /dev/null +++ b/docs/html/search/all_73.html @@ -0,0 +1,169 @@ + + + + + + + +
+
Loading...
+ +
+ +
+
+
+ Screen.h +
+
+
+
+ SCREEN_HEIGHT_DEFAULT + Config +
+
+
+
+ SCREEN_HEIGHT_KEY + Config +
+
+
+
+ SCREEN_WIDTH_DEFAULT + Config +
+
+
+
+ SCREEN_WIDTH_KEY + Config +
+
+
+
+ screenHeight + Config +
+
+ + +
+ +
+
+
+ screenWidth + Config +
+
+
+
+ setFullscreen + Config +
+
+
+
+ setScreenHeight + Config +
+
+
+
+ setScreenWidth + Config +
+
+
+
+ SMOKE + BitmapStore +
+
+
+
+ SMOKE_TIME + Smokescreen +
+
+ + +
+ +
+
+
+ SMOKESCREEN_KEY + KeyboardHandler +
+
+
+
+ speed + Car +
+
+
+
+ start + Game +
+
+
+
+ States + EnemyCar +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/all_74.html b/docs/html/search/all_74.html new file mode 100644 index 0000000..18c22e8 --- /dev/null +++ b/docs/html/search/all_74.html @@ -0,0 +1,65 @@ + + + + + + + +
+
Loading...
+
+
+ TEST +
+ TEST(Config, readsSettingsCorrectly): dataTests.cpp + TEST(Config, createsFileIfNeeded): dataTests.cpp + TEST(Config, incompleteFileFilled): dataTests.cpp + TEST(LevelReader, readsFileInfoObjects): dataTests.cpp + TEST(LevelReader, throwsExceptionOnBadFilename): dataTests.cpp + TEST(Car, updateMovesPlayerUpInEmptyMaze): logicTests.cpp + TEST(Car, updateMovesPlayerDownInEmptyMaze): logicTests.cpp + TEST(Car, updateMovesPlayerLeftInEmptyMaze): logicTests.cpp + TEST(Car, updateMovesPlayerRightInEmptyMaze): logicTests.cpp + TEST(Car, carNotMovedWhenPathUpBlocked): logicTests.cpp + TEST(Car, carNotMovedWhenPathDownBlocked): logicTests.cpp + TEST(Car, carNotMovedWhenPathLeftBlocked): logicTests.cpp + TEST(Car, carNotMovedWhenPathRightBlocked): logicTests.cpp + TEST(Car, carDoesNotMoveUpOutMaze): logicTests.cpp + TEST(Car, carDoesNotMoveDownOutMaze): logicTests.cpp + TEST(Car, carDoesNotMoveLeftOutMaze): logicTests.cpp + TEST(Car, carDoesNotMoveRightOutMaze): logicTests.cpp + TEST(Checkpoint, countIncrementsAndDecrements): logicTests.cpp + TEST(CollisionDetector, playerAndEnemyBothDestroyed): logicTests.cpp + TEST(CollisionDetector, playerDestroyedByRock): logicTests.cpp + TEST(CollisionDetector, checkpointDestroyedByPlayer): logicTests.cpp + TEST(CollisionDetector, enemyStoppedBySmokescreen): logicTests.cpp + TEST(DestroyedObjectPopup, destroyedAfterSetTime): logicTests.cpp + TEST(Maze, queryOutsideBoundsReturnsSolid): logicTests.cpp + TEST(Maze, generationWithWallsWithoutObjectMax): logicTests.cpp + TEST(Maze, generationWithWallsWithObjectMax): logicTests.cpp + TEST(MazeMath, distanceGivesExpectedResult): logicTests.cpp + TEST(MazeMath, roundGivesExpectedResult): logicTests.cpp + TEST(PlayerCar, creationAndDestructionCanHappen): logicTests.cpp + TEST(PlayerCar, playerSpeedAffectedByPetrol): logicTests.cpp + TEST(Smokescreen, destroyedAfterSetTime): logicTests.cpp + TEST(BitmapStore, returnsBitmapForAllImages): presentationTests.cpp + TEST(ColourStore, returnsColourForAllImages): presentationTests.cpp + TEST(Screen, exceptionOnBadResolution): presentationTests.cpp + TEST(Screen, noExceptionOnWindowed): presentationTests.cpp + TEST(Screen, noExceptionOnGoodResolution): presentationTests.cpp + TEST(ScreenPanel, drawingToCurrentBackBuffer): presentationTests.cpp + TEST(ScreenPanel, drawingToCurrentBackBufferAfterFlip): presentationTests.cpp +
+
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/all_75.html b/docs/html/search/all_75.html new file mode 100644 index 0000000..4c6a3a0 --- /dev/null +++ b/docs/html/search/all_75.html @@ -0,0 +1,49 @@ + + + + + + + +
+
Loading...
+
+
+ UP + Maze +
+
+
+
+ UP_KEY + KeyboardHandler +
+
+ +
+
+ updateFlags + KeyboardHandler +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/all_77.html b/docs/html/search/all_77.html new file mode 100644 index 0000000..f17fa83 --- /dev/null +++ b/docs/html/search/all_77.html @@ -0,0 +1,38 @@ + + + + + + + +
+
Loading...
+
+
+ WALL_CHAR + LevelReader +
+
+
+
+ width + Maze +
+
+
+
+ writeUnfoundValues + Config +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/all_78.html b/docs/html/search/all_78.html new file mode 100644 index 0000000..ff7579d --- /dev/null +++ b/docs/html/search/all_78.html @@ -0,0 +1,26 @@ + + + + + + + +
+
Loading...
+
+
+ x + GameObject +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/all_79.html b/docs/html/search/all_79.html new file mode 100644 index 0000000..ae80e5f --- /dev/null +++ b/docs/html/search/all_79.html @@ -0,0 +1,26 @@ + + + + + + + +
+
Loading...
+
+
+ y + GameObject +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/all_7e.html b/docs/html/search/all_7e.html new file mode 100644 index 0000000..19a8b8d --- /dev/null +++ b/docs/html/search/all_7e.html @@ -0,0 +1,80 @@ + + + + + + + +
+
Loading...
+
+
+ ~AllegroDrawingInit + AllegroDrawingInit +
+
+
+
+ ~AllegroInit + AllegroInit +
+
+
+
+ ~AllegroKeyboardInit + AllegroKeyboardInit +
+
+
+
+ ~BitmapStore + BitmapStore +
+
+
+
+ ~Checkpoint + Checkpoint +
+
+
+
+ ~Game + Game +
+
+
+
+ ~InfoPanel + InfoPanel +
+
+
+
+ ~KeyboardHandler + KeyboardHandler +
+
+
+
+ ~Screen + Screen +
+
+
+
+ ~ScreenPanel + ScreenPanel +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/classes_61.html b/docs/html/search/classes_61.html new file mode 100644 index 0000000..ae9f121 --- /dev/null +++ b/docs/html/search/classes_61.html @@ -0,0 +1,35 @@ + + + + + + + +
+
Loading...
+ +
+ +
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/classes_62.html b/docs/html/search/classes_62.html new file mode 100644 index 0000000..8a8211d --- /dev/null +++ b/docs/html/search/classes_62.html @@ -0,0 +1,30 @@ + + + + + + + +
+
Loading...
+
+ +
+
+ +
+
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/classes_63.html b/docs/html/search/classes_63.html new file mode 100644 index 0000000..823371b --- /dev/null +++ b/docs/html/search/classes_63.html @@ -0,0 +1,45 @@ + + + + + + + +
+
Loading...
+
+
+ Car +
+
+
+ +
+ +
+ +
+
+
+ Config +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/classes_64.html b/docs/html/search/classes_64.html new file mode 100644 index 0000000..f9c5933 --- /dev/null +++ b/docs/html/search/classes_64.html @@ -0,0 +1,25 @@ + + + + + + + +
+
Loading...
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/classes_65.html b/docs/html/search/classes_65.html new file mode 100644 index 0000000..d1c9969 --- /dev/null +++ b/docs/html/search/classes_65.html @@ -0,0 +1,25 @@ + + + + + + + +
+
Loading...
+
+
+ EnemyCar +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/classes_66.html b/docs/html/search/classes_66.html new file mode 100644 index 0000000..bfec288 --- /dev/null +++ b/docs/html/search/classes_66.html @@ -0,0 +1,25 @@ + + + + + + + +
+
Loading...
+
+ +
+
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/classes_67.html b/docs/html/search/classes_67.html new file mode 100644 index 0000000..dfe34c9 --- /dev/null +++ b/docs/html/search/classes_67.html @@ -0,0 +1,35 @@ + + + + + + + +
+
Loading...
+
+
+ Game +
+
+
+ +
+
+
+ GamePanel +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/classes_69.html b/docs/html/search/classes_69.html new file mode 100644 index 0000000..5c2c70c --- /dev/null +++ b/docs/html/search/classes_69.html @@ -0,0 +1,30 @@ + + + + + + + +
+
Loading...
+
+
+ InfoPanel +
+
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/classes_6b.html b/docs/html/search/classes_6b.html new file mode 100644 index 0000000..83c51f5 --- /dev/null +++ b/docs/html/search/classes_6b.html @@ -0,0 +1,25 @@ + + + + + + + +
+
Loading...
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/classes_6c.html b/docs/html/search/classes_6c.html new file mode 100644 index 0000000..5c5affb --- /dev/null +++ b/docs/html/search/classes_6c.html @@ -0,0 +1,30 @@ + + + + + + + +
+
Loading...
+
+ +
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/classes_6d.html b/docs/html/search/classes_6d.html new file mode 100644 index 0000000..caef00a --- /dev/null +++ b/docs/html/search/classes_6d.html @@ -0,0 +1,30 @@ + + + + + + + +
+
Loading...
+
+
+ Maze +
+
+
+
+ MazeMath +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/classes_70.html b/docs/html/search/classes_70.html new file mode 100644 index 0000000..2c68ad2 --- /dev/null +++ b/docs/html/search/classes_70.html @@ -0,0 +1,25 @@ + + + + + + + +
+
Loading...
+
+
+ PlayerCar +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/classes_72.html b/docs/html/search/classes_72.html new file mode 100644 index 0000000..87cfb96 --- /dev/null +++ b/docs/html/search/classes_72.html @@ -0,0 +1,25 @@ + + + + + + + +
+
Loading...
+
+
+ Rock +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/classes_73.html b/docs/html/search/classes_73.html new file mode 100644 index 0000000..d18c026 --- /dev/null +++ b/docs/html/search/classes_73.html @@ -0,0 +1,35 @@ + + + + + + + +
+
Loading...
+
+
+ Screen +
+
+
+ +
+
+ +
+
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/close.png b/docs/html/search/close.png new file mode 100644 index 0000000..9342d3d Binary files /dev/null and b/docs/html/search/close.png differ diff --git a/docs/html/search/enums_64.html b/docs/html/search/enums_64.html new file mode 100644 index 0000000..3e8936c --- /dev/null +++ b/docs/html/search/enums_64.html @@ -0,0 +1,26 @@ + + + + + + + +
+
Loading...
+
+
+ Direction + Maze +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/enums_69.html b/docs/html/search/enums_69.html new file mode 100644 index 0000000..27c99fb --- /dev/null +++ b/docs/html/search/enums_69.html @@ -0,0 +1,26 @@ + + + + + + + +
+
Loading...
+
+
+ Image + BitmapStore +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/enums_73.html b/docs/html/search/enums_73.html new file mode 100644 index 0000000..33a34da --- /dev/null +++ b/docs/html/search/enums_73.html @@ -0,0 +1,26 @@ + + + + + + + +
+
Loading...
+
+
+ States + EnemyCar +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/enumvalues_62.html b/docs/html/search/enumvalues_62.html new file mode 100644 index 0000000..10e8fd0 --- /dev/null +++ b/docs/html/search/enumvalues_62.html @@ -0,0 +1,26 @@ + + + + + + + +
+
Loading...
+
+
+ BLINDED + EnemyCar +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/enumvalues_63.html b/docs/html/search/enumvalues_63.html new file mode 100644 index 0000000..b0bd8b7 --- /dev/null +++ b/docs/html/search/enumvalues_63.html @@ -0,0 +1,44 @@ + + + + + + + +
+
Loading...
+
+
+ CHASING + EnemyCar +
+
+
+
+ CHECKPOINT + BitmapStore +
+
+
+
+ CLAIMED_CHECKPOINT + BitmapStore +
+
+
+
+ CRASHED_CAR + BitmapStore +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/enumvalues_64.html b/docs/html/search/enumvalues_64.html new file mode 100644 index 0000000..f080072 --- /dev/null +++ b/docs/html/search/enumvalues_64.html @@ -0,0 +1,26 @@ + + + + + + + +
+
Loading...
+
+
+ DOWN + Maze +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/enumvalues_65.html b/docs/html/search/enumvalues_65.html new file mode 100644 index 0000000..65e33bb --- /dev/null +++ b/docs/html/search/enumvalues_65.html @@ -0,0 +1,26 @@ + + + + + + + +
+
Loading...
+
+
+ ENEMY + BitmapStore +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/enumvalues_6c.html b/docs/html/search/enumvalues_6c.html new file mode 100644 index 0000000..d3813bd --- /dev/null +++ b/docs/html/search/enumvalues_6c.html @@ -0,0 +1,26 @@ + + + + + + + +
+
Loading...
+
+
+ LEFT + Maze +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/enumvalues_6d.html b/docs/html/search/enumvalues_6d.html new file mode 100644 index 0000000..58f5604 --- /dev/null +++ b/docs/html/search/enumvalues_6d.html @@ -0,0 +1,32 @@ + + + + + + + +
+
Loading...
+
+
+ MAZE_FLOOR + BitmapStore +
+
+
+
+ MAZE_WALL + BitmapStore +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/enumvalues_70.html b/docs/html/search/enumvalues_70.html new file mode 100644 index 0000000..a0bfa22 --- /dev/null +++ b/docs/html/search/enumvalues_70.html @@ -0,0 +1,26 @@ + + + + + + + +
+
Loading...
+
+
+ PLAYER + BitmapStore +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/enumvalues_72.html b/docs/html/search/enumvalues_72.html new file mode 100644 index 0000000..ecc9b9a --- /dev/null +++ b/docs/html/search/enumvalues_72.html @@ -0,0 +1,32 @@ + + + + + + + +
+
Loading...
+
+
+ RIGHT + Maze +
+
+
+
+ ROCK + BitmapStore +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/enumvalues_73.html b/docs/html/search/enumvalues_73.html new file mode 100644 index 0000000..710a98d --- /dev/null +++ b/docs/html/search/enumvalues_73.html @@ -0,0 +1,26 @@ + + + + + + + +
+
Loading...
+
+
+ SMOKE + BitmapStore +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/enumvalues_75.html b/docs/html/search/enumvalues_75.html new file mode 100644 index 0000000..0734bfe --- /dev/null +++ b/docs/html/search/enumvalues_75.html @@ -0,0 +1,26 @@ + + + + + + + +
+
Loading...
+
+
+ UP + Maze +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/files_61.html b/docs/html/search/files_61.html new file mode 100644 index 0000000..a491010 --- /dev/null +++ b/docs/html/search/files_61.html @@ -0,0 +1,30 @@ + + + + + + + +
+
Loading...
+ + +
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/files_62.html b/docs/html/search/files_62.html new file mode 100644 index 0000000..ff00283 --- /dev/null +++ b/docs/html/search/files_62.html @@ -0,0 +1,30 @@ + + + + + + + +
+
Loading...
+ +
+ +
+
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/files_63.html b/docs/html/search/files_63.html new file mode 100644 index 0000000..5ddc56a --- /dev/null +++ b/docs/html/search/files_63.html @@ -0,0 +1,70 @@ + + + + + + + +
+
Loading...
+
+
+ Car.cpp +
+
+
+
+ Car.h +
+
+ +
+ +
+ + + +
+ +
+
+ +
+
+
+ Config.h +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/files_64.html b/docs/html/search/files_64.html new file mode 100644 index 0000000..f7f39a3 --- /dev/null +++ b/docs/html/search/files_64.html @@ -0,0 +1,35 @@ + + + + + + + +
+
Loading...
+
+ +
+ + +
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/files_65.html b/docs/html/search/files_65.html new file mode 100644 index 0000000..8bd7b7b --- /dev/null +++ b/docs/html/search/files_65.html @@ -0,0 +1,30 @@ + + + + + + + +
+
Loading...
+
+ +
+
+ +
+
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/files_67.html b/docs/html/search/files_67.html new file mode 100644 index 0000000..95bc570 --- /dev/null +++ b/docs/html/search/files_67.html @@ -0,0 +1,50 @@ + + + + + + + +
+
Loading...
+
+
+ Game.cpp +
+
+
+
+ Game.h +
+
+ +
+ +
+
+ +
+
+ +
+
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/files_69.html b/docs/html/search/files_69.html new file mode 100644 index 0000000..921bd65 --- /dev/null +++ b/docs/html/search/files_69.html @@ -0,0 +1,30 @@ + + + + + + + +
+
Loading...
+
+ +
+
+ +
+
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/files_6b.html b/docs/html/search/files_6b.html new file mode 100644 index 0000000..e1f674d --- /dev/null +++ b/docs/html/search/files_6b.html @@ -0,0 +1,30 @@ + + + + + + + +
+
Loading...
+ + +
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/files_6c.html b/docs/html/search/files_6c.html new file mode 100644 index 0000000..d14eae0 --- /dev/null +++ b/docs/html/search/files_6c.html @@ -0,0 +1,45 @@ + + + + + + + +
+
Loading...
+ +
+ +
+ + + +
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/files_6d.html b/docs/html/search/files_6d.html new file mode 100644 index 0000000..97c7f44 --- /dev/null +++ b/docs/html/search/files_6d.html @@ -0,0 +1,45 @@ + + + + + + + +
+
Loading...
+
+
+ main.cpp +
+
+
+
+ Maze.cpp +
+
+
+
+ Maze.h +
+
+
+ +
+
+ +
+
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/files_70.html b/docs/html/search/files_70.html new file mode 100644 index 0000000..fa4a831 --- /dev/null +++ b/docs/html/search/files_70.html @@ -0,0 +1,35 @@ + + + + + + + +
+
Loading...
+
+ +
+
+ +
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/files_72.html b/docs/html/search/files_72.html new file mode 100644 index 0000000..60131e0 --- /dev/null +++ b/docs/html/search/files_72.html @@ -0,0 +1,30 @@ + + + + + + + +
+
Loading...
+
+
+ Rock.cpp +
+
+
+
+ Rock.h +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/files_73.html b/docs/html/search/files_73.html new file mode 100644 index 0000000..adb71a2 --- /dev/null +++ b/docs/html/search/files_73.html @@ -0,0 +1,50 @@ + + + + + + + +
+
Loading...
+
+ +
+
+
+ Screen.h +
+
+ +
+ +
+ +
+ +
+
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/functions_61.html b/docs/html/search/functions_61.html new file mode 100644 index 0000000..4a6eac0 --- /dev/null +++ b/docs/html/search/functions_61.html @@ -0,0 +1,47 @@ + + + + + + + +
+
Loading...
+ + + +
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/functions_62.html b/docs/html/search/functions_62.html new file mode 100644 index 0000000..0c04b25 --- /dev/null +++ b/docs/html/search/functions_62.html @@ -0,0 +1,41 @@ + + + + + + + +
+
Loading...
+
+
+ backwards + Maze +
+
+ +
+
+ blind + EnemyCar +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/functions_63.html b/docs/html/search/functions_63.html new file mode 100644 index 0000000..db220d6 --- /dev/null +++ b/docs/html/search/functions_63.html @@ -0,0 +1,106 @@ + + + + + + + +
+
Loading...
+
+
+ Car + Car +
+
+
+
+ checkCollisions + CollisionDetector +
+
+
+
+ checkFacing + EnemyCar +
+
+ +
+
+ checkpointCount + Checkpoint +
+
+
+
+ cleanup + Game +
+
+
+
+ clearLists + Game +
+
+
+
+ collect + Checkpoint +
+
+ + +
+
+ Config + Config +
+
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/functions_64.html b/docs/html/search/functions_64.html new file mode 100644 index 0000000..613f3e0 --- /dev/null +++ b/docs/html/search/functions_64.html @@ -0,0 +1,119 @@ + + + + + + + +
+
Loading...
+
+
+ destroyed + GameObject +
+
+
+
+ DestroyedObjectPopup + DestroyedObjectPopup +
+
+
+
+ distance + MazeMath +
+
+ +
+
+ drawCheckpoint + BitmapStore +
+
+
+
+ drawClaimedCheckpoint + BitmapStore +
+
+
+
+ drawCrashedCar + BitmapStore +
+
+
+
+ drawEnemyCar + BitmapStore +
+
+
+
+ drawLoss + Screen +
+
+
+
+ drawMazeFloor + BitmapStore +
+
+
+
+ drawMazeWall + BitmapStore +
+
+
+
+ drawPlayerCar + BitmapStore +
+
+
+
+ drawRock + BitmapStore +
+
+
+
+ drawSmoke + BitmapStore +
+
+
+
+ drawWin + Screen +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/functions_65.html b/docs/html/search/functions_65.html new file mode 100644 index 0000000..f2d7516 --- /dev/null +++ b/docs/html/search/functions_65.html @@ -0,0 +1,38 @@ + + + + + + + +
+
Loading...
+
+
+ EnemyCar + EnemyCar +
+
+
+
+ exitClicked + Screen +
+
+
+
+ extractValue + Config +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/functions_66.html b/docs/html/search/functions_66.html new file mode 100644 index 0000000..1b2cdc1 --- /dev/null +++ b/docs/html/search/functions_66.html @@ -0,0 +1,47 @@ + + + + + + + +
+
Loading...
+
+
+ facing + GameObject +
+
+
+
+ fillValues + Config +
+
+ +
+
+ fullscreen + Config +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/functions_67.html b/docs/html/search/functions_67.html new file mode 100644 index 0000000..3a15fa4 --- /dev/null +++ b/docs/html/search/functions_67.html @@ -0,0 +1,110 @@ + + + + + + + +
+
Loading...
+ +
+
+ GameObject + GameObject +
+
+ +
+
+ generateMaze + Maze +
+
+
+
+ getBitmap + BitmapStore +
+
+
+
+ getColour + ColourStore +
+
+
+
+ getFacing + KeyboardHandler +
+
+
+
+ getLevel + Screen +
+
+ + +
+
+ getSmokescreen + KeyboardHandler +
+
+
+
+ getSolid + Maze +
+
+
+
+ gotCheckpoint + PlayerCar +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/functions_68.html b/docs/html/search/functions_68.html new file mode 100644 index 0000000..4af788f --- /dev/null +++ b/docs/html/search/functions_68.html @@ -0,0 +1,26 @@ + + + + + + + +
+
Loading...
+
+
+ height + Maze +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/functions_69.html b/docs/html/search/functions_69.html new file mode 100644 index 0000000..39c5363 --- /dev/null +++ b/docs/html/search/functions_69.html @@ -0,0 +1,41 @@ + + + + + + + +
+
Loading...
+
+
+ image + GameObject +
+
+ +
+
+ initLevel + Game +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/functions_6b.html b/docs/html/search/functions_6b.html new file mode 100644 index 0000000..a1c6ce6 --- /dev/null +++ b/docs/html/search/functions_6b.html @@ -0,0 +1,29 @@ + + + + + + + +
+
Loading...
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/functions_6c.html b/docs/html/search/functions_6c.html new file mode 100644 index 0000000..f814eba --- /dev/null +++ b/docs/html/search/functions_6c.html @@ -0,0 +1,32 @@ + + + + + + + +
+
Loading...
+
+
+ LevelReader + LevelReader +
+
+
+
+ LimitedTimeObject + LimitedTimeObject +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/functions_6d.html b/docs/html/search/functions_6d.html new file mode 100644 index 0000000..eeaf51b --- /dev/null +++ b/docs/html/search/functions_6d.html @@ -0,0 +1,53 @@ + + + + + + + +
+
Loading...
+
+
+ main + main.cpp +
+
+
+
+ makeSmoke + PlayerCar +
+
+
+
+ Maze + Maze +
+
+ +
+
+ move + Car +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/functions_6f.html b/docs/html/search/functions_6f.html new file mode 100644 index 0000000..daab4e0 --- /dev/null +++ b/docs/html/search/functions_6f.html @@ -0,0 +1,36 @@ + + + + + + + +
+
Loading...
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/functions_70.html b/docs/html/search/functions_70.html new file mode 100644 index 0000000..1c49c64 --- /dev/null +++ b/docs/html/search/functions_70.html @@ -0,0 +1,38 @@ + + + + + + + +
+
Loading...
+
+
+ petrol + PlayerCar +
+
+
+
+ PlayerCar + PlayerCar +
+
+
+
+ populateColours + ColourStore +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/functions_72.html b/docs/html/search/functions_72.html new file mode 100644 index 0000000..0117f67 --- /dev/null +++ b/docs/html/search/functions_72.html @@ -0,0 +1,62 @@ + + + + + + + +
+
Loading...
+
+
+ readFile + Config +
+
+
+
+ readLevel + LevelReader +
+
+
+
+ resolutionSupported + Screen +
+
+
+
+ Rock + Rock +
+
+
+
+ rockAtLocation + EnemyCar +
+
+
+
+ round + MazeMath +
+
+
+
+ runloop + Game +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/functions_73.html b/docs/html/search/functions_73.html new file mode 100644 index 0000000..cf812a0 --- /dev/null +++ b/docs/html/search/functions_73.html @@ -0,0 +1,86 @@ + + + + + + + +
+
Loading...
+ +
+
+ screenHeight + Config +
+
+ +
+
+ screenWidth + Config +
+
+
+
+ setFullscreen + Config +
+
+
+
+ setScreenHeight + Config +
+
+
+
+ setScreenWidth + Config +
+
+
+
+ Smokescreen + Smokescreen +
+
+
+
+ speed + Car +
+
+
+
+ start + Game +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/functions_74.html b/docs/html/search/functions_74.html new file mode 100644 index 0000000..18c22e8 --- /dev/null +++ b/docs/html/search/functions_74.html @@ -0,0 +1,65 @@ + + + + + + + +
+
Loading...
+
+
+ TEST +
+ TEST(Config, readsSettingsCorrectly): dataTests.cpp + TEST(Config, createsFileIfNeeded): dataTests.cpp + TEST(Config, incompleteFileFilled): dataTests.cpp + TEST(LevelReader, readsFileInfoObjects): dataTests.cpp + TEST(LevelReader, throwsExceptionOnBadFilename): dataTests.cpp + TEST(Car, updateMovesPlayerUpInEmptyMaze): logicTests.cpp + TEST(Car, updateMovesPlayerDownInEmptyMaze): logicTests.cpp + TEST(Car, updateMovesPlayerLeftInEmptyMaze): logicTests.cpp + TEST(Car, updateMovesPlayerRightInEmptyMaze): logicTests.cpp + TEST(Car, carNotMovedWhenPathUpBlocked): logicTests.cpp + TEST(Car, carNotMovedWhenPathDownBlocked): logicTests.cpp + TEST(Car, carNotMovedWhenPathLeftBlocked): logicTests.cpp + TEST(Car, carNotMovedWhenPathRightBlocked): logicTests.cpp + TEST(Car, carDoesNotMoveUpOutMaze): logicTests.cpp + TEST(Car, carDoesNotMoveDownOutMaze): logicTests.cpp + TEST(Car, carDoesNotMoveLeftOutMaze): logicTests.cpp + TEST(Car, carDoesNotMoveRightOutMaze): logicTests.cpp + TEST(Checkpoint, countIncrementsAndDecrements): logicTests.cpp + TEST(CollisionDetector, playerAndEnemyBothDestroyed): logicTests.cpp + TEST(CollisionDetector, playerDestroyedByRock): logicTests.cpp + TEST(CollisionDetector, checkpointDestroyedByPlayer): logicTests.cpp + TEST(CollisionDetector, enemyStoppedBySmokescreen): logicTests.cpp + TEST(DestroyedObjectPopup, destroyedAfterSetTime): logicTests.cpp + TEST(Maze, queryOutsideBoundsReturnsSolid): logicTests.cpp + TEST(Maze, generationWithWallsWithoutObjectMax): logicTests.cpp + TEST(Maze, generationWithWallsWithObjectMax): logicTests.cpp + TEST(MazeMath, distanceGivesExpectedResult): logicTests.cpp + TEST(MazeMath, roundGivesExpectedResult): logicTests.cpp + TEST(PlayerCar, creationAndDestructionCanHappen): logicTests.cpp + TEST(PlayerCar, playerSpeedAffectedByPetrol): logicTests.cpp + TEST(Smokescreen, destroyedAfterSetTime): logicTests.cpp + TEST(BitmapStore, returnsBitmapForAllImages): presentationTests.cpp + TEST(ColourStore, returnsColourForAllImages): presentationTests.cpp + TEST(Screen, exceptionOnBadResolution): presentationTests.cpp + TEST(Screen, noExceptionOnWindowed): presentationTests.cpp + TEST(Screen, noExceptionOnGoodResolution): presentationTests.cpp + TEST(ScreenPanel, drawingToCurrentBackBuffer): presentationTests.cpp + TEST(ScreenPanel, drawingToCurrentBackBufferAfterFlip): presentationTests.cpp +
+
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/functions_75.html b/docs/html/search/functions_75.html new file mode 100644 index 0000000..8ff10d7 --- /dev/null +++ b/docs/html/search/functions_75.html @@ -0,0 +1,37 @@ + + + + + + + +
+
Loading...
+ +
+
+ updateFlags + KeyboardHandler +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/functions_77.html b/docs/html/search/functions_77.html new file mode 100644 index 0000000..cde1b62 --- /dev/null +++ b/docs/html/search/functions_77.html @@ -0,0 +1,32 @@ + + + + + + + +
+
Loading...
+
+
+ width + Maze +
+
+
+
+ writeUnfoundValues + Config +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/functions_78.html b/docs/html/search/functions_78.html new file mode 100644 index 0000000..ff7579d --- /dev/null +++ b/docs/html/search/functions_78.html @@ -0,0 +1,26 @@ + + + + + + + +
+
Loading...
+
+
+ x + GameObject +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/functions_79.html b/docs/html/search/functions_79.html new file mode 100644 index 0000000..ae80e5f --- /dev/null +++ b/docs/html/search/functions_79.html @@ -0,0 +1,26 @@ + + + + + + + +
+
Loading...
+
+
+ y + GameObject +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/functions_7e.html b/docs/html/search/functions_7e.html new file mode 100644 index 0000000..19a8b8d --- /dev/null +++ b/docs/html/search/functions_7e.html @@ -0,0 +1,80 @@ + + + + + + + +
+
Loading...
+
+
+ ~AllegroDrawingInit + AllegroDrawingInit +
+
+
+
+ ~AllegroInit + AllegroInit +
+
+
+
+ ~AllegroKeyboardInit + AllegroKeyboardInit +
+
+
+
+ ~BitmapStore + BitmapStore +
+
+
+
+ ~Checkpoint + Checkpoint +
+
+
+
+ ~Game + Game +
+
+
+
+ ~InfoPanel + InfoPanel +
+
+
+
+ ~KeyboardHandler + KeyboardHandler +
+
+
+
+ ~Screen + Screen +
+
+
+
+ ~ScreenPanel + ScreenPanel +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/mag_sel.png b/docs/html/search/mag_sel.png new file mode 100644 index 0000000..81f6040 Binary files /dev/null and b/docs/html/search/mag_sel.png differ diff --git a/docs/html/search/nomatches.html b/docs/html/search/nomatches.html new file mode 100644 index 0000000..b1ded27 --- /dev/null +++ b/docs/html/search/nomatches.html @@ -0,0 +1,12 @@ + + + + + + + +
+
No Matches
+
+ + diff --git a/docs/html/search/search.css b/docs/html/search/search.css new file mode 100644 index 0000000..dae426e --- /dev/null +++ b/docs/html/search/search.css @@ -0,0 +1,233 @@ +/*---------------- Search Box */ + +#FSearchBox { + float: left; +} + +#MSearchBox { + white-space : nowrap; + position: absolute; + float: none; + display: inline; + margin-top: 8px; + right: 0px; + width: 170px; + z-index: 102; +} + +#MSearchBox .left +{ + display:block; + position:absolute; + left:10px; + width:20px; + height:19px; + background:url('search_l.png') no-repeat; + background-position:right; +} + +#MSearchSelect { + display:block; + position:absolute; + width:20px; + height:19px; +} + +.left #MSearchSelect { + left:4px; +} + +.right #MSearchSelect { + right:5px; +} + +#MSearchField { + display:block; + position:absolute; + height:19px; + background:url('search_m.png') repeat-x; + border:none; + width:116px; + margin-left:20px; + padding-left:4px; + color: #909090; + outline: none; + font: 9pt Arial, Verdana, sans-serif; +} + +#FSearchBox #MSearchField { + margin-left:15px; +} + +#MSearchBox .right { + display:block; + position:absolute; + right:10px; + top:0px; + width:20px; + height:19px; + background:url('search_r.png') no-repeat; + background-position:left; +} + +#MSearchClose { + display: none; + position: absolute; + top: 4px; + background : none; + border: none; + margin: 0px 4px 0px 0px; + padding: 0px 0px; + outline: none; +} + +.left #MSearchClose { + left: 6px; +} + +.right #MSearchClose { + right: 2px; +} + +.MSearchBoxActive #MSearchField { + color: #000000; +} + +/*---------------- Search filter selection */ + +#MSearchSelectWindow { + display: none; + position: absolute; + left: 0; top: 0; + border: 1px solid #90A5CE; + background-color: #F9FAFC; + z-index: 1; + padding-top: 4px; + padding-bottom: 4px; + -moz-border-radius: 4px; + -webkit-border-top-left-radius: 4px; + -webkit-border-top-right-radius: 4px; + -webkit-border-bottom-left-radius: 4px; + -webkit-border-bottom-right-radius: 4px; + -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); +} + +.SelectItem { + font: 8pt Arial, Verdana, sans-serif; + padding-left: 2px; + padding-right: 12px; + border: 0px; +} + +span.SelectionMark { + margin-right: 4px; + font-family: monospace; + outline-style: none; + text-decoration: none; +} + +a.SelectItem { + display: block; + outline-style: none; + color: #000000; + text-decoration: none; + padding-left: 6px; + padding-right: 12px; +} + +a.SelectItem:focus, +a.SelectItem:active { + color: #000000; + outline-style: none; + text-decoration: none; +} + +a.SelectItem:hover { + color: #FFFFFF; + background-color: #3D578C; + outline-style: none; + text-decoration: none; + cursor: pointer; + display: block; +} + +/*---------------- Search results window */ + +iframe#MSearchResults { + width: 60ex; + height: 15em; +} + +#MSearchResultsWindow { + display: none; + position: absolute; + left: 0; top: 0; + border: 1px solid #000; + background-color: #EEF1F7; +} + +/* ----------------------------------- */ + + +#SRIndex { + clear:both; + padding-bottom: 15px; +} + +.SREntry { + font-size: 10pt; + padding-left: 1ex; +} + +.SRPage .SREntry { + font-size: 8pt; + padding: 1px 5px; +} + +body.SRPage { + margin: 5px 2px; +} + +.SRChildren { + padding-left: 3ex; padding-bottom: .5em +} + +.SRPage .SRChildren { + display: none; +} + +.SRSymbol { + font-weight: bold; + color: #425E97; + font-family: Arial, Verdana, sans-serif; + text-decoration: none; + outline: none; +} + +a.SRScope { + display: block; + color: #425E97; + font-family: Arial, Verdana, sans-serif; + text-decoration: none; + outline: none; +} + +a.SRSymbol:focus, a.SRSymbol:active, +a.SRScope:focus, a.SRScope:active { + text-decoration: underline; +} + +.SRPage .SRStatus { + padding: 2px 5px; + font-size: 8pt; + font-style: italic; +} + +.SRResult { + display: none; +} + +DIV.searchresults { + margin-left: 10px; + margin-right: 10px; +} diff --git a/docs/html/search/search.js b/docs/html/search/search.js new file mode 100644 index 0000000..cf54460 --- /dev/null +++ b/docs/html/search/search.js @@ -0,0 +1,740 @@ +// Search script generated by doxygen +// Copyright (C) 2009 by Dimitri van Heesch. + +// The code in this file is loosly based on main.js, part of Natural Docs, +// which is Copyright (C) 2003-2008 Greg Valure +// Natural Docs is licensed under the GPL. + +var indexSectionsWithContent = +{ + 0: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010111111111011101101111011100001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + 1: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111101011100101100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + 2: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111110101011100101100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + 3: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111111011101101111011100001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + 4: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010011111000001000101101010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + 5: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + 6: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100001000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + 7: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011110000001100101101000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" +}; + +var indexSectionNames = +{ + 0: "all", + 1: "classes", + 2: "files", + 3: "functions", + 4: "variables", + 5: "typedefs", + 6: "enums", + 7: "enumvalues" +}; + +function convertToId(search) +{ + var result = ''; + for (i=0;i do a search + { + this.Search(); + } + } + + this.OnSearchSelectKey = function(evt) + { + var e = (evt) ? evt : window.event; // for IE + if (e.keyCode==40 && this.searchIndex0) // Up + { + this.searchIndex--; + this.OnSelectItem(this.searchIndex); + } + else if (e.keyCode==13 || e.keyCode==27) + { + this.OnSelectItem(this.searchIndex); + this.CloseSelectionWindow(); + this.DOMSearchField().focus(); + } + return false; + } + + // --------- Actions + + // Closes the results window. + this.CloseResultsWindow = function() + { + this.DOMPopupSearchResultsWindow().style.display = 'none'; + this.DOMSearchClose().style.display = 'none'; + this.Activate(false); + } + + this.CloseSelectionWindow = function() + { + this.DOMSearchSelectWindow().style.display = 'none'; + } + + // Performs a search. + this.Search = function() + { + this.keyTimeout = 0; + + // strip leading whitespace + var searchValue = this.DOMSearchField().value.replace(/^ +/, ""); + + var code = searchValue.toLowerCase().charCodeAt(0); + var hexCode; + if (code<16) + { + hexCode="0"+code.toString(16); + } + else + { + hexCode=code.toString(16); + } + + var resultsPage; + var resultsPageWithSearch; + var hasResultsPage; + + if (indexSectionsWithContent[this.searchIndex].charAt(code) == '1') + { + resultsPage = this.resultsPath + '/' + indexSectionNames[this.searchIndex] + '_' + hexCode + '.html'; + resultsPageWithSearch = resultsPage+'?'+escape(searchValue); + hasResultsPage = true; + } + else // nothing available for this search term + { + resultsPage = this.resultsPath + '/nomatches.html'; + resultsPageWithSearch = resultsPage; + hasResultsPage = false; + } + + window.frames.MSearchResults.location = resultsPageWithSearch; + var domPopupSearchResultsWindow = this.DOMPopupSearchResultsWindow(); + + if (domPopupSearchResultsWindow.style.display!='block') + { + var domSearchBox = this.DOMSearchBox(); + this.DOMSearchClose().style.display = 'inline'; + if (this.insideFrame) + { + var domPopupSearchResults = this.DOMPopupSearchResults(); + domPopupSearchResultsWindow.style.position = 'relative'; + domPopupSearchResultsWindow.style.display = 'block'; + var width = document.body.clientWidth - 8; // the -8 is for IE :-( + domPopupSearchResultsWindow.style.width = width + 'px'; + domPopupSearchResults.style.width = width + 'px'; + } + else + { + var domPopupSearchResults = this.DOMPopupSearchResults(); + var left = getXPos(domSearchBox) + 150; // domSearchBox.offsetWidth; + var top = getYPos(domSearchBox) + 20; // domSearchBox.offsetHeight + 1; + domPopupSearchResultsWindow.style.display = 'block'; + left -= domPopupSearchResults.offsetWidth; + domPopupSearchResultsWindow.style.top = top + 'px'; + domPopupSearchResultsWindow.style.left = left + 'px'; + } + } + + this.lastSearchValue = searchValue; + this.lastResultsPage = resultsPage; + } + + // -------- Activation Functions + + // Activates or deactivates the search panel, resetting things to + // their default values if necessary. + this.Activate = function(isActive) + { + if (isActive || // open it + this.DOMPopupSearchResultsWindow().style.display == 'block' + ) + { + this.DOMSearchBox().className = 'MSearchBoxActive'; + + var searchField = this.DOMSearchField(); + + if (searchField.value == this.searchLabel) // clear "Search" term upon entry + { + searchField.value = ''; + this.searchActive = true; + } + } + else if (!isActive) // directly remove the panel + { + this.DOMSearchBox().className = 'MSearchBoxInactive'; + this.DOMSearchField().value = this.searchLabel; + this.searchActive = false; + this.lastSearchValue = '' + this.lastResultsPage = ''; + } + } +} + +// ----------------------------------------------------------------------- + +// The class that handles everything on the search results page. +function SearchResults(name) +{ + // The number of matches from the last run of . + this.lastMatchCount = 0; + this.lastKey = 0; + this.repeatOn = false; + + // Toggles the visibility of the passed element ID. + this.FindChildElement = function(id) + { + var parentElement = document.getElementById(id); + var element = parentElement.firstChild; + + while (element && element!=parentElement) + { + if (element.nodeName == 'DIV' && element.className == 'SRChildren') + { + return element; + } + + if (element.nodeName == 'DIV' && element.hasChildNodes()) + { + element = element.firstChild; + } + else if (element.nextSibling) + { + element = element.nextSibling; + } + else + { + do + { + element = element.parentNode; + } + while (element && element!=parentElement && !element.nextSibling); + + if (element && element!=parentElement) + { + element = element.nextSibling; + } + } + } + } + + this.Toggle = function(id) + { + var element = this.FindChildElement(id); + if (element) + { + if (element.style.display == 'block') + { + element.style.display = 'none'; + } + else + { + element.style.display = 'block'; + } + } + } + + // Searches for the passed string. If there is no parameter, + // it takes it from the URL query. + // + // Always returns true, since other documents may try to call it + // and that may or may not be possible. + this.Search = function(search) + { + if (!search) // get search word from URL + { + search = window.location.search; + search = search.substring(1); // Remove the leading '?' + search = unescape(search); + } + + search = search.replace(/^ +/, ""); // strip leading spaces + search = search.replace(/ +$/, ""); // strip trailing spaces + search = search.toLowerCase(); + search = convertToId(search); + + var resultRows = document.getElementsByTagName("div"); + var matches = 0; + + var i = 0; + while (i < resultRows.length) + { + var row = resultRows.item(i); + if (row.className == "SRResult") + { + var rowMatchName = row.id.toLowerCase(); + rowMatchName = rowMatchName.replace(/^sr\d*_/, ''); // strip 'sr123_' + + if (search.length<=rowMatchName.length && + rowMatchName.substr(0, search.length)==search) + { + row.style.display = 'block'; + matches++; + } + else + { + row.style.display = 'none'; + } + } + i++; + } + document.getElementById("Searching").style.display='none'; + if (matches == 0) // no results + { + document.getElementById("NoMatches").style.display='block'; + } + else // at least one result + { + document.getElementById("NoMatches").style.display='none'; + } + this.lastMatchCount = matches; + return true; + } + + // return the first item with index index or higher that is visible + this.NavNext = function(index) + { + var focusItem; + while (1) + { + var focusName = 'Item'+index; + focusItem = document.getElementById(focusName); + if (focusItem && focusItem.parentNode.parentNode.style.display=='block') + { + break; + } + else if (!focusItem) // last element + { + break; + } + focusItem=null; + index++; + } + return focusItem; + } + + this.NavPrev = function(index) + { + var focusItem; + while (1) + { + var focusName = 'Item'+index; + focusItem = document.getElementById(focusName); + if (focusItem && focusItem.parentNode.parentNode.style.display=='block') + { + break; + } + else if (!focusItem) // last element + { + break; + } + focusItem=null; + index--; + } + return focusItem; + } + + this.ProcessKeys = function(e) + { + if (e.type == "keydown") + { + this.repeatOn = false; + this.lastKey = e.keyCode; + } + else if (e.type == "keypress") + { + if (!this.repeatOn) + { + if (this.lastKey) this.repeatOn = true; + return false; // ignore first keypress after keydown + } + } + else if (e.type == "keyup") + { + this.lastKey = 0; + this.repeatOn = false; + } + return this.lastKey!=0; + } + + this.Nav = function(evt,itemIndex) + { + var e = (evt) ? evt : window.event; // for IE + if (e.keyCode==13) return true; + if (!this.ProcessKeys(e)) return false; + + if (this.lastKey==38) // Up + { + var newIndex = itemIndex-1; + var focusItem = this.NavPrev(newIndex); + if (focusItem) + { + var child = this.FindChildElement(focusItem.parentNode.parentNode.id); + if (child && child.style.display == 'block') // children visible + { + var n=0; + var tmpElem; + while (1) // search for last child + { + tmpElem = document.getElementById('Item'+newIndex+'_c'+n); + if (tmpElem) + { + focusItem = tmpElem; + } + else // found it! + { + break; + } + n++; + } + } + } + if (focusItem) + { + focusItem.focus(); + } + else // return focus to search field + { + parent.document.getElementById("MSearchField").focus(); + } + } + else if (this.lastKey==40) // Down + { + var newIndex = itemIndex+1; + var focusItem; + var item = document.getElementById('Item'+itemIndex); + var elem = this.FindChildElement(item.parentNode.parentNode.id); + if (elem && elem.style.display == 'block') // children visible + { + focusItem = document.getElementById('Item'+itemIndex+'_c0'); + } + if (!focusItem) focusItem = this.NavNext(newIndex); + if (focusItem) focusItem.focus(); + } + else if (this.lastKey==39) // Right + { + var item = document.getElementById('Item'+itemIndex); + var elem = this.FindChildElement(item.parentNode.parentNode.id); + if (elem) elem.style.display = 'block'; + } + else if (this.lastKey==37) // Left + { + var item = document.getElementById('Item'+itemIndex); + var elem = this.FindChildElement(item.parentNode.parentNode.id); + if (elem) elem.style.display = 'none'; + } + else if (this.lastKey==27) // Escape + { + parent.searchBox.CloseResultsWindow(); + parent.document.getElementById("MSearchField").focus(); + } + else if (this.lastKey==13) // Enter + { + return true; + } + return false; + } + + this.NavChild = function(evt,itemIndex,childIndex) + { + var e = (evt) ? evt : window.event; // for IE + if (e.keyCode==13) return true; + if (!this.ProcessKeys(e)) return false; + + if (this.lastKey==38) // Up + { + if (childIndex>0) + { + var newIndex = childIndex-1; + document.getElementById('Item'+itemIndex+'_c'+newIndex).focus(); + } + else // already at first child, jump to parent + { + document.getElementById('Item'+itemIndex).focus(); + } + } + else if (this.lastKey==40) // Down + { + var newIndex = childIndex+1; + var elem = document.getElementById('Item'+itemIndex+'_c'+newIndex); + if (!elem) // last child, jump to parent next parent + { + elem = this.NavNext(itemIndex+1); + } + if (elem) + { + elem.focus(); + } + } + else if (this.lastKey==27) // Escape + { + parent.searchBox.CloseResultsWindow(); + parent.document.getElementById("MSearchField").focus(); + } + else if (this.lastKey==13) // Enter + { + return true; + } + return false; + } +} diff --git a/docs/html/search/search_l.png b/docs/html/search/search_l.png new file mode 100644 index 0000000..c872f4d Binary files /dev/null and b/docs/html/search/search_l.png differ diff --git a/docs/html/search/search_m.png b/docs/html/search/search_m.png new file mode 100644 index 0000000..b429a16 Binary files /dev/null and b/docs/html/search/search_m.png differ diff --git a/docs/html/search/search_r.png b/docs/html/search/search_r.png new file mode 100644 index 0000000..97ee8b4 Binary files /dev/null and b/docs/html/search/search_r.png differ diff --git a/docs/html/search/typedefs_62.html b/docs/html/search/typedefs_62.html new file mode 100644 index 0000000..526498b --- /dev/null +++ b/docs/html/search/typedefs_62.html @@ -0,0 +1,26 @@ + + + + + + + +
+
Loading...
+
+
+ BoolGrid + Maze +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/variables_5f.html b/docs/html/search/variables_5f.html new file mode 100644 index 0000000..24a1857 --- /dev/null +++ b/docs/html/search/variables_5f.html @@ -0,0 +1,487 @@ + + + + + + + +
+
Loading...
+ +
+
+ _back + ScreenPanel +
+
+
+
+ _baseSpeed + Car +
+
+
+
+ _bitmapFont + BitmapStore +
+
+
+
+ _bitmaps + BitmapStore +
+
+
+
+ _bitmapStore + GamePanel +
+
+
+
+ _blockWidth + BitmapStore +
+
+
+
+ _checkpointCount + Checkpoint +
+
+
+
+ _checkpointHeadingY + InfoPanel +
+
+
+
+ _checkpoints + Game +
+
+
+
+ _checkpointValueY + InfoPanel +
+
+
+
+ _collisionDetector + Game +
+
+
+
+ _colours + ColourStore +
+
+
+
+ _colourStore + InfoPanel +
+
+
+
+ _config + Game +
+
+
+
+ _destroyed + GameObject +
+
+
+
+ _display + Screen +
+
+
+
+ _down + KeyboardHandler +
+
+ +
+
+ _drawingInstalls + BitmapStore +
+
+
+
+ _enemies + Game +
+
+
+
+ _exitClicked + Screen +
+
+
+
+ _facing + GameObject +
+
+
+
+ _filename + LevelReader +
+
+
+
+ _font + Screen +
+
+
+
+ _front + ScreenPanel +
+
+
+
+ _fullscreen + Config +
+
+
+
+ _gameAreaWidth + Screen +
+
+ +
+
+ _image + GameObject +
+
+
+
+ _infoPanelWidth + Screen +
+
+ +
+
+ _input + PlayerCar +
+
+ +
+
+ _keyboardEvents + KeyboardHandler +
+
+
+
+ _left + KeyboardHandler +
+
+
+
+ _maze + Game +
+
+
+
+ _mazeblockWidth + GamePanel +
+
+
+
+ _miniMazeblockWidth + InfoPanel +
+
+
+
+ _miniMazeHeight + InfoPanel +
+
+
+
+ _miniMazeY + InfoPanel +
+
+
+
+ _offsetX + GamePanel +
+
+
+
+ _offsetY + GamePanel +
+
+
+
+ _panelFont + InfoPanel +
+
+
+
+ _panels + Screen +
+
+
+
+ _petrol + PlayerCar +
+
+
+
+ _petrolGuageHeight + InfoPanel +
+
+
+
+ _petrolGuageY + InfoPanel +
+
+
+
+ _petrolHeadingY + InfoPanel +
+
+
+
+ _players + Game +
+
+
+
+ _popups + Game +
+
+
+
+ _previousFacing + KeyboardHandler +
+
+
+
+ _remainingTime + LimitedTimeObject +
+
+
+
+ _right + KeyboardHandler +
+
+
+
+ _rocks + Game +
+
+
+
+ _screen + Game +
+
+ + +
+
+ _smokescreen + KeyboardHandler +
+
+
+
+ _smokescreens + Game +
+
+
+
+ _speed + Car +
+
+
+
+ _state + EnemyCar +
+
+
+
+ _targetX + EnemyCar +
+
+
+
+ _targetY + EnemyCar +
+
+
+
+ _timer + Game +
+
+
+
+ _timerEvents + Game +
+
+
+
+ _transparent + ColourStore +
+
+
+
+ _up + KeyboardHandler +
+
+
+
+ _wallLocations + Maze +
+
+ +
+
+ _windowEvents + Screen +
+
+
+
+ _x + GameObject +
+
+
+
+ _y + GameObject +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/variables_62.html b/docs/html/search/variables_62.html new file mode 100644 index 0000000..3e07075 --- /dev/null +++ b/docs/html/search/variables_62.html @@ -0,0 +1,32 @@ + + + + + + + +
+
Loading...
+
+
+ BLANK + ScreenPanel +
+
+
+
+ BLOCKS_PER_ROW + GamePanel +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/variables_63.html b/docs/html/search/variables_63.html new file mode 100644 index 0000000..f9415b9 --- /dev/null +++ b/docs/html/search/variables_63.html @@ -0,0 +1,26 @@ + + + + + + + +
+
Loading...
+
+
+ CHECKPOINT_CHAR + LevelReader +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/variables_64.html b/docs/html/search/variables_64.html new file mode 100644 index 0000000..061bb3f --- /dev/null +++ b/docs/html/search/variables_64.html @@ -0,0 +1,26 @@ + + + + + + + +
+
Loading...
+
+
+ DOWN_KEY + KeyboardHandler +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/variables_65.html b/docs/html/search/variables_65.html new file mode 100644 index 0000000..c28fe29 --- /dev/null +++ b/docs/html/search/variables_65.html @@ -0,0 +1,26 @@ + + + + + + + +
+
Loading...
+
+
+ ENEMY_CHAR + LevelReader +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/variables_66.html b/docs/html/search/variables_66.html new file mode 100644 index 0000000..71d264c --- /dev/null +++ b/docs/html/search/variables_66.html @@ -0,0 +1,38 @@ + + + + + + + +
+
Loading...
+
+
+ FPS + Game +
+
+
+
+ FULLSCREEN_DEFAULT + Config +
+
+
+
+ FULLSCREEN_KEY + Config +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/variables_6c.html b/docs/html/search/variables_6c.html new file mode 100644 index 0000000..cd1c8d6 --- /dev/null +++ b/docs/html/search/variables_6c.html @@ -0,0 +1,26 @@ + + + + + + + +
+
Loading...
+
+
+ LEFT_KEY + KeyboardHandler +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/variables_70.html b/docs/html/search/variables_70.html new file mode 100644 index 0000000..4aac788 --- /dev/null +++ b/docs/html/search/variables_70.html @@ -0,0 +1,50 @@ + + + + + + + +
+
Loading...
+
+
+ PETROL_FROM_CHECKPOINT + PlayerCar +
+
+
+
+ PETROL_USE_RATE + PlayerCar +
+
+
+
+ PETROL_USE_SMOKESCREEN + PlayerCar +
+
+
+
+ PLAYER_CHAR + LevelReader +
+
+
+
+ POPUP_TIME + DestroyedObjectPopup +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/variables_72.html b/docs/html/search/variables_72.html new file mode 100644 index 0000000..2d3c244 --- /dev/null +++ b/docs/html/search/variables_72.html @@ -0,0 +1,32 @@ + + + + + + + +
+
Loading...
+
+
+ RIGHT_KEY + KeyboardHandler +
+
+
+
+ ROCK_CHAR + LevelReader +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/variables_73.html b/docs/html/search/variables_73.html new file mode 100644 index 0000000..002ceeb --- /dev/null +++ b/docs/html/search/variables_73.html @@ -0,0 +1,56 @@ + + + + + + + +
+
Loading...
+
+
+ SCREEN_HEIGHT_DEFAULT + Config +
+
+
+
+ SCREEN_HEIGHT_KEY + Config +
+
+
+
+ SCREEN_WIDTH_DEFAULT + Config +
+
+
+
+ SCREEN_WIDTH_KEY + Config +
+
+
+
+ SMOKE_TIME + Smokescreen +
+
+
+
+ SMOKESCREEN_KEY + KeyboardHandler +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/variables_75.html b/docs/html/search/variables_75.html new file mode 100644 index 0000000..72bec15 --- /dev/null +++ b/docs/html/search/variables_75.html @@ -0,0 +1,26 @@ + + + + + + + +
+
Loading...
+
+
+ UP_KEY + KeyboardHandler +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/search/variables_77.html b/docs/html/search/variables_77.html new file mode 100644 index 0000000..3af4371 --- /dev/null +++ b/docs/html/search/variables_77.html @@ -0,0 +1,26 @@ + + + + + + + +
+
Loading...
+
+
+ WALL_CHAR + LevelReader +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/docs/html/tab_a.png b/docs/html/tab_a.png new file mode 100644 index 0000000..2d99ef2 Binary files /dev/null and b/docs/html/tab_a.png differ diff --git a/docs/html/tab_b.png b/docs/html/tab_b.png new file mode 100644 index 0000000..b2c3d2b Binary files /dev/null and b/docs/html/tab_b.png differ diff --git a/docs/html/tab_h.png b/docs/html/tab_h.png new file mode 100644 index 0000000..c11f48f Binary files /dev/null and b/docs/html/tab_h.png differ diff --git a/docs/html/tab_s.png b/docs/html/tab_s.png new file mode 100644 index 0000000..978943a Binary files /dev/null and b/docs/html/tab_s.png differ diff --git a/docs/html/tabs.css b/docs/html/tabs.css new file mode 100644 index 0000000..2192056 --- /dev/null +++ b/docs/html/tabs.css @@ -0,0 +1,59 @@ +.tabs, .tabs2, .tabs3 { + background-image: url('tab_b.png'); + width: 100%; + z-index: 101; + font-size: 13px; +} + +.tabs2 { + font-size: 10px; +} +.tabs3 { + font-size: 9px; +} + +.tablist { + margin: 0; + padding: 0; + display: table; +} + +.tablist li { + float: left; + display: table-cell; + background-image: url('tab_b.png'); + line-height: 36px; + list-style: none; +} + +.tablist a { + display: block; + padding: 0 20px; + font-weight: bold; + background-image:url('tab_s.png'); + background-repeat:no-repeat; + background-position:right; + color: #283A5D; + text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9); + text-decoration: none; + outline: none; +} + +.tabs3 .tablist a { + padding: 0 10px; +} + +.tablist a:hover { + background-image: url('tab_h.png'); + background-repeat:repeat-x; + color: #fff; + text-shadow: 0px 1px 1px rgba(0, 0, 0, 1.0); + text-decoration: none; +} + +.tablist li.current a { + background-image: url('tab_a.png'); + background-repeat:repeat-x; + color: #fff; + text-shadow: 0px 1px 1px rgba(0, 0, 0, 1.0); +} diff --git a/exe/Junction 02.ttf b/exe/Junction 02.ttf new file mode 100644 index 0000000..cd8877e Binary files /dev/null and b/exe/Junction 02.ttf differ diff --git a/exe/Junction FONTLOG.txt b/exe/Junction FONTLOG.txt new file mode 100644 index 0000000..4461408 --- /dev/null +++ b/exe/Junction FONTLOG.txt @@ -0,0 +1,32 @@ +FONTLOG for Junction +This file provides detailed information on the Junction Font Software. +This information should be distributed along with the Junction fonts +and any derivative works. + +Licence: Open Font Licence + +Basic Font Information: +Junction is an open source humanist san serif typeface. + + +ChangeLog +This is a list of both major and minor changes, most recent first: + +2. Feb 2010 (Caroline Hadilaksono) Junction Version 2.0 +- Added ISO 8859-1 Latin 1 (Western) glyphs +- Added OpenType ligatures (liga) & lining numerals (lnum) features +- Re-released as "Junction" + +1. Feb 2009 (Caroline Hadilaksono) Junction Version 1.0 +- Initial release of font Junction + + +Acknowledgements +If you make modifications be sure to add your name (N), email (E), +web-address (W) and description (D). This list is sorted by last name in +alphabetical order: + +N: Caroline Hadilaksono +E: caroline@hadilaksono.com +W: www.hadilaksono.com +D: Designer - original font & the extended Latin 1 (Western) glyphs diff --git a/exe/RallyX.exe b/exe/RallyX.exe new file mode 100644 index 0000000..a3f7211 Binary files /dev/null and b/exe/RallyX.exe differ diff --git a/exe/allegro-5.0.3-monolith-md-debug.dll b/exe/allegro-5.0.3-monolith-md-debug.dll new file mode 100644 index 0000000..a17ee48 Binary files /dev/null and b/exe/allegro-5.0.3-monolith-md-debug.dll differ diff --git a/exe/config.txt b/exe/config.txt new file mode 100644 index 0000000..b5759cb --- /dev/null +++ b/exe/config.txt @@ -0,0 +1,3 @@ +screen_width=1366 +screen_height=768 +fullscreen=true \ No newline at end of file diff --git a/exe/level1.lvl b/exe/level1.lvl new file mode 100644 index 0000000..3023154 --- /dev/null +++ b/exe/level1.lvl @@ -0,0 +1,31 @@ +############################ +# ## # +# #### ##### ## ##### #### # +#P#### ##### ## ##### ####P# +# #### ##### ## ##### #### # +# # +# #### ## ######## ## #### # +# #### ## ######## ## #### # +# ## ## ## # +###### ##### ## ##### ###### +###### ##### ## ##### ###### +###### ## ## ###### +###### ## ###XX### ## ###### +###### ## # OO # ## ###### +###### # # ###### +###### ## # X # ## ###### +###### ## ######## ## ###### +###### ## ## ###### +###### ## ######## ## ###### +###### ## ######## ## ###### +# ## ## ## # +# #### ##### ## ##### #### # +# #### ##### ## ##### #### # +#P ## @ ## P# +### ## ## ######## ## ## ### +### ## ## ######## ## ## ### +# ## ## ## # +# ########## ## ########## # +# ########## ## ########## # +# # +############################ diff --git a/exe/level2.lvl b/exe/level2.lvl new file mode 100644 index 0000000..d147ffe --- /dev/null +++ b/exe/level2.lvl @@ -0,0 +1,25 @@ +######################################################## +# O ## P X ## # X# +#### ########## # # ##O###### ## # ###### # # ## # +# #P # # ## ##O###### ## ## # # # # P# # +# # # # # # # # # # # # # +# X# # ########## ###### ###### # # ### # # +# ## # # # # # # # # # # # +# ## ## ## ### # # # ## #### ## # # # # # # #### # +#### ## ### # # # # # # # # # #### # +#### ## ## # # # ## ## # # ###### # +# # O# # # # # # # # # # # # O# # +# ######## # # # # # # # # @ # # # # # # # # ######## +# # # # # # O OO O # # # # # +# # ######## # # # #P# # # # # #P# # # # ######## # +# #O # # # # # # # # # # # #O # # +#### ## ## # # # ## ## # # ###### # +#### ## ### # # # # # # # # ###### # +# ## ## ## ### # # # ## #### ## # # # # # #### # +# ## # # # # # # # # # # # +# X# ########## # ###### ###### # # ### # # +# # #P # # # # # # # # # # +# # # # ## ## ######O## ## # # # # P# # +#### # ########## # ## ######O## # ###### # # ## # +# O ## P ## X# +######################################################## diff --git a/exe/level3.lvl b/exe/level3.lvl new file mode 100644 index 0000000..dfb67eb --- /dev/null +++ b/exe/level3.lvl @@ -0,0 +1,57 @@ +######################################################## +# # #O# # # #O# # +# ##### # # # #O# # # ###### # # #O# ####### ### # +# #OOO# # # # #O# # # # # #O# # #O# # +# #O### # # # #O# # # # ## # # #O# # POX #O# # +# #O#P # # # #O# ### # # ## # ####### #O# # #O# # +# ### ### # # ### # P # ### # ##### #O# # +# # # ##### ###### ##### # #OO## #O# # +# ### # ### # ### ### # # #### #O# # +# #O# # #O##### ### ## ### #####O# # #O# # +# #O# # ##### ####### ### ## ### ####### # ####### #O# # +# #O# # # # ## # # # #O# # +# ### # # X #P####### ### ## ### ####### # # X # ### # +# # # # #O##### ### ## ### #####O# # # # # +##### # ##### ### ### # ####### ##### +# ###### #### ###### P # +#X############### ################# # +# # ## ############ ## # # +#### ############ # #OOOOOOOOOO# X# ###### # #### # +# # X # # ## ############ ## # # # # # # +# # # # # #P # # # O # # # # +# # ############ ###### ####### # O # ### # # +# ##P ### # # ### # O # # X# # +# ## ## ## ### #O# # ## #### ## # #O# # P# ###### # +#### ## ### #O# # # # # #O# # #### # +#### ## ## # #O# # ## ## # #O# ###### # +# #### #O# # # # # # # #O# #### # +# ########## #OO# #O# # # # # #O# #OO# ########## +# ########## #OO# #O# # #@ # # #O# #OO# ########## +# #### #O# # # # # # # #O# #### P# +#### ## ## # #O# # ## ## # #O# ###### # +#### ## ### #O# # # # # #O# ###### # +# ## ## ## ### #O# # ## #### ## # #O# # ###### # +# ## ### # # ### # O # # X# # +# P# ############ ####### ###### # O # ### # # +# # # # # # P# # # O # # # # +# # X # # ## ############ ## # # # # # # +#### ############ #X #OOOOOOOOOO# # ###### # #### # +# # ## ############ ## # # +# ############### #################X# +# P ###### #### ###### # +##### ####### ### ### # ##### # ##### +# # # #O##### ### ## ### #####O# # # # # # +# ### # X # ####### ### ## ### ####### #P# X # # ### # +# #O# # # ## # # # # #O# # +# #O# ####### ####### ### ## ### ####### # ##### # #O# # +# #O# #O##### ### ## ### #####O# # # #O# # +# #O# #### # ### ### # # ### # ### # +# #O# ##OO# # ##### ###### ##### # # # +# #O# ##### # ### # P # ### # # ### ### # +# #O# # #O# ### # # ## # ####### #O# # # # P#O# # +# #O# XOP # #O# # # # ## # # #O# # # # ###O# # +# #O# # #O# # # # # #O# # # # #OOO# # +# ### ####### #O# # # ###### # # #O# # # # ##### # +# #O# # # #O# # # +######################################################## + diff --git a/exe/libgcc_s_dw2-1.dll b/exe/libgcc_s_dw2-1.dll new file mode 100644 index 0000000..9e32dc2 Binary files /dev/null and b/exe/libgcc_s_dw2-1.dll differ diff --git a/exe/rallyx-test.exe b/exe/rallyx-test.exe new file mode 100644 index 0000000..a4b8eba Binary files /dev/null and b/exe/rallyx-test.exe differ diff --git a/source/data/Config.cpp b/source/data/Config.cpp new file mode 100644 index 0000000..6cdda2f --- /dev/null +++ b/source/data/Config.cpp @@ -0,0 +1,105 @@ +#include "Config.h" + +const string Config::SCREEN_WIDTH_KEY("screen_width"); +const string Config::SCREEN_HEIGHT_KEY("screen_height"); +const string Config::FULLSCREEN_KEY("fullscreen"); + +const string Config::SCREEN_WIDTH_DEFAULT("800"); +const string Config::SCREEN_HEIGHT_DEFAULT("600"); +const string Config::FULLSCREEN_DEFAULT("false"); + + +Config::Config(const string& filename) + :_screenWidth(0), + _screenHeight(0) +{ + ifstream inStream(filename.c_str(), fstream::in); + + map readValues; + map unfoundValues; + readFile(inStream, readValues); + fillValues(readValues, unfoundValues); + + inStream.close(); + + ofstream outStream(filename.c_str(), fstream::app); + + writeUnfoundValues(outStream, unfoundValues); + + outStream.close(); +} + +unsigned int Config::screenWidth() const +{ + return _screenWidth; +} +unsigned int Config::screenHeight() const +{ + return _screenHeight; +} +bool Config::fullscreen() const +{ + return _fullscreen; +} + +void Config::readFile(ifstream& file, map& map) +{ + if (!file.is_open()) return; + + string nextEntry; + while(!file.eof()) + { + file >> nextEntry; + + string::size_type equalsIndex = nextEntry.find("=",0); + if (equalsIndex!=string::npos) + { + string key = nextEntry.substr(0,equalsIndex); + string value = nextEntry.substr(equalsIndex+1); + + map[key] = value; + } + } +} + +void Config::fillValues(const map& readValues, map& unfoundValues) +{ + setScreenWidth(extractValue(readValues, unfoundValues, SCREEN_WIDTH_KEY, SCREEN_WIDTH_DEFAULT)); + setScreenHeight(extractValue(readValues, unfoundValues, SCREEN_HEIGHT_KEY, SCREEN_HEIGHT_DEFAULT)); + setFullscreen(extractValue(readValues, unfoundValues, FULLSCREEN_KEY, FULLSCREEN_DEFAULT)); +} + +string Config::extractValue(const map& readValues, map& unfoundValues, const string& key, const string& defaultValue) +{ + map::const_iterator findIter = readValues.find(key); + if (findIter != readValues.end()) + { + return findIter->second; + } + else + { + unfoundValues[key] = defaultValue; + return defaultValue; + } +} + +void Config::writeUnfoundValues(ofstream& file, const map& unfoundValues) +{ + for (map::const_iterator iter = unfoundValues.begin(); iter!=unfoundValues.end(); ++iter) + { + file << iter->first << "=" << iter->second << endl; + } +} + +void Config::setScreenWidth(const string& screenWidthStr) +{ + _screenWidth = atoi(screenWidthStr.c_str()); +} +void Config::setScreenHeight(const string& screenHeightStr) +{ + _screenHeight = atoi(screenHeightStr.c_str()); +} +void Config::setFullscreen(const string& fullscreenStr) +{ + _fullscreen = fullscreenStr=="true"; +} diff --git a/source/data/Config.h b/source/data/Config.h new file mode 100644 index 0000000..8fdf5aa --- /dev/null +++ b/source/data/Config.h @@ -0,0 +1,136 @@ +#ifndef CONFIG_H +#define CONFIG_H + +#include +#include +#include +#include +using namespace std; + +/** +* @brief Object for handling user settings loaded from a file. +* +* These settings are currently all related to the screen (resolution and windowed or fullscreen). +* If custom controls are implemented in a later release, they will be loaded here. If a setting exists +* but is not found in the config file, it is set to a default value and written to the file. +* +* @author Justin Wernick +* @author David Schneider +*/ +class Config +{ + public: + /** + * @brief Constructs a Config object from a file with the given path. + * + * Opens the file and reads all of the settings in the file. The read settings are + * bound to the settings that have keys defined in the class. And settings missing from + * the file are set to default values, and the default values are written to the file. + * + * @param [in] filename The path of the file in which the settings are stored. + */ + Config(const string& filename); + + //Assignment and copy operations are handled by the compiler generated versions + + /** + * @brief Function for accessing the screen width setting in pixels. + * + * @return The desired width of the screen in pixels. + */ + unsigned int screenWidth() const; + + /** + * @brief Function for accessing the screen height setting in pixels. + * + * @return The desired height of the screen in pixels. + */ + unsigned int screenHeight() const; + + /** + * @brief Function for accessing whether the game should be displayed in fullscreen or windowed mode. + * + * @return The desired fullscreen setting. A result of true means fullscreen mode, while a result of false means windowed mode. + */ + bool fullscreen() const; + + private: + /** + * @brief Reads all of the settings defined in a file into a map. + * + * Reads each line that is in the format "key=value" in a file into a map. + * Lines that do not contain a '=' are ignored. + * + * @param [in] file An opened filestream object at the beginning of the file to be read. After the function call, file will be at the end of the file. + * @param [out] map The map that is populated with settings. + */ + void readFile(ifstream& file, map& map); + + /** + * @brief Initialises the Config option's parameters to those in the readValues map. + * + * Parameters with a key that does not appear in readValues are initialised to a default value. + * The default value, and its key, are then added to the unfoundValues map. + * + * @param [in] readValues A map containing all of the settings read in from a config file. + * @param [out] unfoundValues A map that is populated with and settings not found in readValues. + */ + void fillValues(const map& readValues, map& unfoundValues); + + /** + * @brief Helper function for fillValues. Finds the value for a single key. + * + * If the given key does not appear, it is added to the unfoundValues map with the given default + * + * @param [in] readValues A map containing all of the settings read in from a config file. + * @param [out] unfoundValues A map that is populated with and settings not found in readValues. + * @param [in] key The key of the setting to be found in readValues. + * @param [in] defaultValue The value to return and add to unfoundValues if the setting is not found in readValues. + * + * @return The value corresponding to the requested key. + */ + string extractValue(const map& readValues, map& unfoundValues, const string& key, const string& defaultValue); + + /** + * @brief Writes settings that were not found in the file to the file with default values. + * + * @param [in] file The opened filestream to which the key=value pairs are written. + * @param [in] unfoundValues The map of key value pairs to be written to the file. + */ + void writeUnfoundValues(ofstream& file, const map& unfoundValues); + + /** + * @brief Initializes the screen width in pixels from a given string. + * + * @param [in] screenWidthStr A string representing the desired screen width, read from a file. + */ + void setScreenWidth(const string& screenWidthStr); + + /** + * @brief Initializes the screen height in pixels from a given string. + * + * @param [in] screenHeightStr A string representing the desired screen height, read from a file. + */ + void setScreenHeight(const string& screenHeightStr); + + /** + * @brief Initializes the fullscreen setting from a given string. + * + * @param [in] fullscreenStr A string representing whether the screen should be in fullscreen mode ("true") or windowed mode (anything else). + */ + void setFullscreen(const string& fullscreenStr); + + unsigned int _screenWidth; ///< The desired width of the screen in pixels. + unsigned int _screenHeight; ///< The desired height of the screen in pixels. + bool _fullscreen; ///< The desired fullscreen or windowed setting. + + static const string SCREEN_WIDTH_KEY; ///< The key for the screen width setting, initialized to "screen_width". + static const string SCREEN_HEIGHT_KEY; ///< The key for the screen height setting, initialized to "screen_height". + static const string FULLSCREEN_KEY; ///< The key for the fullscreen setting, initialized to "fullscreen". + + static const string SCREEN_WIDTH_DEFAULT; ///< The default value for the screen width setting, initialized to 800. + static const string SCREEN_HEIGHT_DEFAULT; ///< The default value for the screen height setting, initialized to 600. + static const string FULLSCREEN_DEFAULT; ///< The default value for the fullscreen setting, initialized to false. +}; + +#endif // CONFIG_H diff --git a/source/data/LevelReader.cpp b/source/data/LevelReader.cpp new file mode 100644 index 0000000..e5364d8 --- /dev/null +++ b/source/data/LevelReader.cpp @@ -0,0 +1,54 @@ +#include "LevelReader.h" + +LevelReader::LevelReader(string filename) + :_filename(filename) +{} + +void LevelReader::readLevel(Maze& maze, list& players, list& enemies, list& checkpoints, list& rocks) +{ + ifstream file(_filename.c_str()); + if (!file) + { + al_show_native_message_box(NULL, "Fatal error", "Fatal error", "The requested level file could not be opened.", NULL, ALLEGRO_MESSAGEBOX_ERROR); + throw FileOpenError(); + } + + int maxX = 0; + int maxY = 0; + + string line; + char element; + int y = 0; + vector > walls; + + while (!file.eof()) + { + getline (file, line); + + for (int x = 0; x < static_cast(line.length()); ++x) + { + element = line.at(x); + switch (element) + { + case PLAYER_CHAR: players.push_back(PlayerCar(x,y)); + break; + case ENEMY_CHAR: enemies.push_back (EnemyCar(x,y)); + break; + case CHECKPOINT_CHAR: checkpoints.push_back(Checkpoint(x,y)); + break; + case ROCK_CHAR: rocks.push_back(Rock(x,y)); + break; + case WALL_CHAR: walls.push_back (make_pair(x,y)); + break; + } + if (maxX < x) maxX = x; + if (maxY < y) maxY = y; + } + + ++y; + } + + maze.generateMaze (walls, maxX, maxY); + + file.close(); +} diff --git a/source/data/LevelReader.h b/source/data/LevelReader.h new file mode 100644 index 0000000..293d820 --- /dev/null +++ b/source/data/LevelReader.h @@ -0,0 +1,71 @@ +#ifndef MAZEREADER_H +#define MAZEREADER_H + +#include +#include +#include +#include +using namespace std; + +#include + +#include "../logic/Maze.h" +#include "../logic/PlayerCar.h" +#include "../logic/EnemyCar.h" +#include "../logic/Checkpoint.h" +#include "../logic/Rock.h" + +/** +* @brief An exception that is thrown if the file selected for opening does not exist. +* +* This should never be thrown, since the Allegro native file dialog is being used to select +* this file, and it only allows one to select existing files. +* +* @author Justin Wernick +* @author David Schneider +*/ +class FileOpenError{}; + +/** +* @brief Reads the game objects from a text file and calls relevant constructors. +* +* @author Justin Wernick +* @author David Schneider +*/ +class LevelReader +{ + public: + /** + * @brief Constructor that stores the path of the file containing the level to be read with the readLevel function. + * + * @param [in] filename The path of the file containing the level. + */ + LevelReader(string filename); + + //Assignment and copy operations are handled by the compiler generated versions + + /** + * @brief Function to read the chosen file into the data structures used in the game. + * + * Each character in the file is iterated through, and added to the appropriate data structure if it matches + * one of the defined constants. Lists should be cleared prior to calling this function. + * + * @param [out] maze Object representing the walls, populated with a vector of x,y pairs. + * @param [out] players List representing the player(s) in the game. + * @param [out] enemies List representing the enemies in the game. + * @param [out] checkpoints List representing the checkpoints in the game. + * @param [out] rocks List representing the rocks in the game. + */ + void readLevel(Maze& maze, list& players, list& enemies, list& checkpoints, list& rocks); + + private: + static const char PLAYER_CHAR = '@'; ///< Character represented a PlayerCar in the level file. + static const char ENEMY_CHAR = 'X'; ///< Character represented an EnemyCar in the level file. + static const char CHECKPOINT_CHAR = 'P'; ///< Character represented a Checkpoint in the level file. + static const char ROCK_CHAR = 'O'; ///< Character represented a Rock in the level file. + static const char WALL_CHAR = '#'; ///< Character represented a solid part of the maze in the level file. + + string _filename; ///< Path of the file containing the level. +}; + +#endif // MAZEREADER_H diff --git a/source/logic/AllegroWrappers.cpp b/source/logic/AllegroWrappers.cpp new file mode 100644 index 0000000..4094cfe --- /dev/null +++ b/source/logic/AllegroWrappers.cpp @@ -0,0 +1,116 @@ +#include "AllegroWrappers.h" + +int AllegroInit::_initCount = 0; + +AllegroInit::AllegroInit() +{ + if (_initCount==0) + { + if (!al_init()) + { + throw InstallFailure(); + } + } + ++_initCount; +} + +AllegroInit::AllegroInit(const AllegroInit& ref) +{ + if (_initCount==0) + { + if (!al_init()) + { + throw InstallFailure(); + } + } + ++_initCount; +} + +AllegroInit::~AllegroInit() +{ + --_initCount; + if (_initCount==0) + { + al_uninstall_system(); + } +} + + +int AllegroKeyboardInit::_initCount = 0; + +AllegroKeyboardInit::AllegroKeyboardInit() +{ + if (_initCount==0) + { + if (!al_install_keyboard()) + { + throw InstallFailure(); + } + } + ++_initCount; +} + +AllegroKeyboardInit::AllegroKeyboardInit(const AllegroKeyboardInit& ref) +{ + if (_initCount==0) + { + if (!al_install_keyboard()) + { + throw InstallFailure(); + } + } + ++_initCount; +} + +AllegroKeyboardInit::~AllegroKeyboardInit() +{ + --_initCount; + if (_initCount==0) al_uninstall_keyboard(); +} + +int AllegroDrawingInit::_initCount = 0; + +AllegroDrawingInit::AllegroDrawingInit() +{ + if (_initCount==0) + { + if (!al_init_primitives_addon()) + { + throw InstallFailure(); + } + al_init_font_addon(); + if (!al_init_ttf_addon()) + { + throw InstallFailure(); + } + } + ++_initCount; +} + +AllegroDrawingInit::AllegroDrawingInit(const AllegroDrawingInit& ref) +{ + if (_initCount==0) + { + if (!al_init_primitives_addon()) + { + throw InstallFailure(); + } + al_init_font_addon(); + if (!al_init_ttf_addon()) + { + throw InstallFailure(); + } + } + ++_initCount; +} + +AllegroDrawingInit::~AllegroDrawingInit() +{ + --_initCount; + if (_initCount==0) + { + al_shutdown_ttf_addon(); + al_shutdown_font_addon(); + al_shutdown_primitives_addon(); + } +} diff --git a/source/logic/AllegroWrappers.h b/source/logic/AllegroWrappers.h new file mode 100644 index 0000000..851f219 --- /dev/null +++ b/source/logic/AllegroWrappers.h @@ -0,0 +1,112 @@ +#ifndef ALLEGRO_WRAPPERS_H +#define ALLEGRO_WRAPPERS_H + +#include +#include +#include +#include + +/** +* @brief Exception to be thrown if any component of Allegro fails to install at runtime. +* +* @author Justin Wernick +* @author David Schneider +*/ +class InstallFailure {}; + +/** +* @brief Class ensures that Allegro is initialized and uninstalled when appropriate. +* +* Any classes that use Allegro should include this class as a data member. +* +* @author Justin Wernick +* @author David Schneider +*/ +class AllegroInit +{ + public: + /** + * @brief Constructor calls al_init() if it is the first instance. + */ + AllegroInit(); + /** + * @brief Copy constructor, implemented to be included in instance count. + */ + AllegroInit(const AllegroInit& ref); + /** + * @brief Destructor calls al_uninstall_system() if it is the last instant. + */ + + //assignment operator provided by compiler. _initCount does not need incrementing on assignment, + //because assignment does not make a new instance, just changes one. + + ~AllegroInit(); + private: + static int _initCount; ///< Count of the current number of initialised AllegroInit objects. +}; + +/** +* @brief Class ensures that Allegro's keyboard is installed and uninstalled when appropriate. +* +* Any classes that use the keyboard for input should include this class as a data member. +* This class includes AllegroInit, so both of them do not need to be included. +* +* @author Justin Wernick +* @author David Schneider +*/ +class AllegroKeyboardInit +{ + public: + /** + * @brief Constructor calls al_install_keyboard() if it is the first instance. + */ + AllegroKeyboardInit(); + /** + * @brief Copy constructor, implemented to be included in instance count. + */ + AllegroKeyboardInit(const AllegroKeyboardInit& ref); + /** + * @brief Destructor calls al_uninstall_keyboard() if it is the last instant. + */ + ~AllegroKeyboardInit(); + private: + static int _initCount; ///< Count of the current number of initialised AllegroKeyboardInit objects. + AllegroInit _allegro; ///< Depends on Allegro being initialised. + + //assignment operator provided by compiler. _initCount does not need incrementing on assignment, + //because assignment does not make a new instance, just changes one. +}; + +/** +* @brief Class ensures that Allegro's primitive and text drawing is installed and uninstalled when appropriate. +* +* Any classes that draw primitives should include this class as a data member. +* This class includes AllegroInit, so both of them do not need to be included. +* +* @author Justin Wernick +* @author David Schneider +*/ +class AllegroDrawingInit +{ + public: + /** + * @brief Constructor calls al_init_primitives_addon(), al_init_font_addon(), and al_init_ttf_addon() if it is the first instance. + */ + AllegroDrawingInit(); + /** + * @brief Copy constructor, implemented to be included in instance count. + */ + AllegroDrawingInit(const AllegroDrawingInit& ref); + /** + * @brief Destructor calls al_shutdown_primitives_addon(), al_shutdown_font_addon(), and al_shutdown_ttf_addon() if it is the last instant. + */ + ~AllegroDrawingInit(); + private: + static int _initCount; + AllegroInit _allegro; + + //assignment operator provided by compiler. _initCount does not need incrementing on assignment, + //because assignment does not make a new instance, just changes one. +}; + +#endif diff --git a/source/logic/Car.cpp b/source/logic/Car.cpp new file mode 100644 index 0000000..3e531a3 --- /dev/null +++ b/source/logic/Car.cpp @@ -0,0 +1,75 @@ +#include "Car.h" + +Car::Car(double x, double y, BitmapStore::Image image, Maze::Direction facing) + :GameObject(x,y,image,facing), + _speed(_baseSpeed) +{ +} + +double Car::speed() const +{ + return _speed; +} + +void Car::move(const Maze& maze) +{ + double targetX = 0; + double targetY = 0; + + int checkX = 0; + int checkY = 0; + + switch(_facing) + { + case Maze::UP: + targetX = MazeMath::round(_x); + targetY = _y - _speed; + checkX = floor(targetX); + checkY = floor(targetY); + break; + case Maze::DOWN: + targetX = MazeMath::round(_x); + targetY = _y + _speed; + checkX = floor(targetX); + checkY = ceil(targetY); + break; + case Maze::LEFT: + targetX = _x - _speed; + targetY = MazeMath::round(_y); + checkX = floor(targetX); + checkY = floor(targetY); + break; + case Maze::RIGHT: + targetX = _x + _speed; + targetY = MazeMath::round(_y); + checkX = ceil(targetX); + checkY = floor(targetY); + break; + } + + if (!maze.getSolid(checkX, checkY)) + { + //can move that way + _x = targetX; + _y = targetY; + } + else + { + //can not move to targetX and targetY, but move to the edge of current block + switch(_facing) + { + case Maze::UP: + _y = floor(_y); + break; + case Maze::DOWN: + _y = ceil(_y); + break; + case Maze::LEFT: + _x = floor(_x); + break; + case Maze::RIGHT: + _x = ceil(_x); + break; + } + } +} diff --git a/source/logic/Car.h b/source/logic/Car.h new file mode 100644 index 0000000..4b8d16c --- /dev/null +++ b/source/logic/Car.h @@ -0,0 +1,57 @@ +#ifndef CAR_H +#define CAR_H + +#include +using namespace std; + +#include "../presentation/BitmapStore.h" +#include "../logic/GameObject.h" +#include "../logic/MazeMath.h" + +/** +* @brief GameObject that moves through the maze and changes direction. +* +* Should not be instantiated directly, but rather instantiated through one of the subclasses, +* PlayerCar or EnemyCar. +* +* @author Justin Wernick +* @author David Schneider +*/ +class Car : public GameObject +{ + public: + /** + * @brief Creates a Car at the given position, with the given image, facing in the given direction. + * + * @param [in] x x coordinate of initial position. + * @param [in] y y coordinate of initial position. + * @param [in] image Bitmap to be drawn on the screen to represent the car. + * @param [in] facing Direction in which the Car is initially facing. + */ + Car(double x, double y, BitmapStore::Image image, Maze::Direction facing); + + //assignment and copy constructors have been left with the compiler generated versions + + /** + * @brief Function to access the current speed of the car. + * + * @return The current speed of the car, in pixels per update. + */ + double speed() const; + + protected: + /** + * @brief Moves the car by its current speed in the direction of its facing. + * + * Only moves along the x or y axis, and snaps to the grid in the other direction. + * Does not allow movement through solid parts of the maze. + * + * @param [in] maze The maze in which the Car is moving, confining its movements. + */ + void move(const Maze& maze); + + double _speed; ///< The current speed that the Car is moving at. + static const double _baseSpeed = 0.1; ///< The speed that a Car moves at in normal conditions. +}; + +#endif // CAR_H diff --git a/source/logic/Checkpoint.cpp b/source/logic/Checkpoint.cpp new file mode 100644 index 0000000..8a6406c --- /dev/null +++ b/source/logic/Checkpoint.cpp @@ -0,0 +1,30 @@ +#include "Checkpoint.h" + +int Checkpoint::_checkpointCount = 0; + +Checkpoint::Checkpoint(double x, double y) + :GameObject(x,y,BitmapStore::CHECKPOINT) +{ + ++_checkpointCount; +} + +Checkpoint::Checkpoint(const Checkpoint& ref) + :GameObject(ref._x,ref._y,ref._image) +{ + ++_checkpointCount; +} + +Checkpoint::~Checkpoint() +{ + --_checkpointCount; +} + +int Checkpoint::checkpointCount() +{ + return _checkpointCount; +} + +void Checkpoint::collect() +{ + _destroyed = true; +} diff --git a/source/logic/Checkpoint.h b/source/logic/Checkpoint.h new file mode 100644 index 0000000..f6dfeb3 --- /dev/null +++ b/source/logic/Checkpoint.h @@ -0,0 +1,53 @@ +#ifndef CHECKPOINT_H +#define CHECKPOINT_H + +#include "../logic/GameObject.h" +#include "../presentation/BitmapStore.h" + +/** +* @brief GameObject that the player needs to pick up by driving over. +* +* The level is complete when all checkpoints have been collected. +* +* @author Justin Wernick +* @author David Schneider +*/ +class Checkpoint: public GameObject +{ + public: + /** + * @brief Function for accessing the number of checkpoints that currently exist. + * + * @return The number of checkpoints that currently exist. + */ + static int checkpointCount(); + + /** + * @brief Creates a checkpoint at the given coordinates. + * + * @param [in] x x coordinate of Checkpoint's position. + * @param [in] y y coordinate of Checkpoint's position. + */ + Checkpoint(double x, double y); + /** + * @brief Copy constuctor, overwritten to include in the counting of Checkpoints. + */ + Checkpoint(const Checkpoint& ref); + + //assignment operator has been left with the compiler generated version. + + /** + * @brief Destructor, decreases the number of Checkpoints in existence. + */ + ~Checkpoint(); + + /** + * @brief Function to be called when a PlayerCar collects the Checkpoint. + */ + void collect(); + + private: + static int _checkpointCount; ///< Count of the number of Checkpoints currently in existence. +}; + +#endif // CHECKPOINT_H diff --git a/source/logic/CollisionDetector.cpp b/source/logic/CollisionDetector.cpp new file mode 100644 index 0000000..85ebaa8 --- /dev/null +++ b/source/logic/CollisionDetector.cpp @@ -0,0 +1,64 @@ +#include "CollisionDetector.h" + +void CollisionDetector::checkCollisions(list& players, list& enemies, list& checkpoints, list& rocks, list& smokescreens) +{ + for (list::iterator playIter = players.begin(); playIter!=players.end(); ++playIter) + { + for (list::iterator enemyIter = enemies.begin(); enemyIter!=enemies.end(); ++enemyIter) + { + if ((abs(playIter->x() - enemyIter->x())<1)&&(abs(playIter->y() - enemyIter->y())<1)) + { + collision(*playIter, *enemyIter); + } + } + + for (list::iterator checkIter = checkpoints.begin(); checkIter!=checkpoints.end(); ++checkIter) + { + if ((abs(playIter->x() - checkIter->x())<1)&&(abs(playIter->y() - checkIter->y())<1)) + { + collision(*playIter, *checkIter); + } + } + + for (list::iterator rockIter = rocks.begin(); rockIter!=rocks.end(); ++rockIter) + { + if ((abs(playIter->x() - rockIter->x())<1)&&(abs(playIter->y() - rockIter->y())<1)) + { + collision(*playIter, *rockIter); + } + } + } + + for (list::iterator enemyIter = enemies.begin(); enemyIter!=enemies.end(); ++enemyIter) + { + for (list::iterator smokeIter = smokescreens.begin(); smokeIter!=smokescreens.end(); ++smokeIter) + { + if ((abs(enemyIter->x() - smokeIter->x())<1)&&(abs(enemyIter->y() - smokeIter->y())<1)) + { + collision(*enemyIter, *smokeIter); + } + } + } +} + +void CollisionDetector::collision(PlayerCar& player, Checkpoint& checkpoint) +{ + player.gotCheckpoint(); + checkpoint.collect(); +} + +void CollisionDetector::collision(PlayerCar& player, Rock& rock) +{ + player.crash(); +} + +void CollisionDetector::collision(PlayerCar& player, EnemyCar& enemy) +{ + player.crash(); + enemy.crash(); +} + +void CollisionDetector::collision(EnemyCar& enemy, Smokescreen& smokescreen) +{ + enemy.blind(); +} diff --git a/source/logic/CollisionDetector.h b/source/logic/CollisionDetector.h new file mode 100644 index 0000000..294852d --- /dev/null +++ b/source/logic/CollisionDetector.h @@ -0,0 +1,75 @@ +#ifndef COLLISIONDETECTOR_H +#define COLLISIONDETECTOR_H + +#include +using namespace std; + +#include "../logic/PlayerCar.h" +#include "../logic/EnemyCar.h" +#include "../logic/Checkpoint.h" +#include "../logic/Rock.h" +#include "../logic/Smokescreen.h" + +/** +* @brief Object for handling collisions between GameObjects. +* +* Collisions between all relevant objects are checked and the appropriate methods on the GameObjects +* are called when a collision occurs. +* +* @author Justin Wernick +* @author David Schneider +*/ +class CollisionDetector +{ + public: + /** + * @brief Checks for collisions between all relevant pairs of objects, and calls the relevant collision function if one is found. + * + * A collision occurs if the distance between two object's x values is less than 1, + * and the distance between their y values is also less than 1. + * + * @param [in,out] players List of PlayerCars, that can collide with EnemieCars, Checkpoints, or Rocks. + * @param [in,out] enemies List of EnemyCars, that can collide with PlayerCars, or Smokescreens. + * @param [in,out] checkpoints List of Checkpoints, that can collide with PlayerCars. + * @param [in,out] rocks List of Rocks, that can collide with PlayerCars. + * @param [in,out] smokescreens List of Smokescreens, that can collide with EnemyCars. + */ + void checkCollisions(list& players, list& enemies, list& checkpoints, list& rocks, list& smokescreens); + + //assignment and copy constructors have been left with the compiler generated versions + + private: + /** + * @brief Collision between a PlayerCar and a Checkpoint. + * + * @param [in,out] player PlayerCar involved in the collision. + * @param [in,out] checkpoint Checkpoint involved in the collision. + */ + void collision(PlayerCar& player, Checkpoint& checkpoint); + + /** + * @brief Collision between a PlayerCar and an EnemyCar. + * + * @param [in,out] player PlayerCar involved in the collision. + * @param [in,out] enemy EnemyCar involved in the collision. + */ + void collision(PlayerCar& player, EnemyCar& enemy); + + /** + * @brief Collision between a PlayerCar and a Rock. + * + * @param [in,out] player PlayerCar involved in the collision. + * @param [in,out] rock Rock involved in the collision. + */ + void collision(PlayerCar& player, Rock& rock); + + /** + * @brief Collision between an EnemyCar and a Smokescreen. + * + * @param [in,out] enemy EnemyCar involved in the collision. + * @param [in,out] smokescreen Smokescreen involved in the collision. + */ + void collision(EnemyCar& enemy, Smokescreen& smokescreen); +}; + +#endif // COLLISIONDETECTOR_H diff --git a/source/logic/DestroyedObjectPopup.cpp b/source/logic/DestroyedObjectPopup.cpp new file mode 100644 index 0000000..42ce08d --- /dev/null +++ b/source/logic/DestroyedObjectPopup.cpp @@ -0,0 +1,6 @@ +#include "DestroyedObjectPopup.h" + +DestroyedObjectPopup::DestroyedObjectPopup(double x, double y, BitmapStore::Image image) + :LimitedTimeObject(x, y, image, POPUP_TIME) +{ +} diff --git a/source/logic/DestroyedObjectPopup.h b/source/logic/DestroyedObjectPopup.h new file mode 100644 index 0000000..3e694f5 --- /dev/null +++ b/source/logic/DestroyedObjectPopup.h @@ -0,0 +1,33 @@ +#ifndef DESTROYEDOBJECTPOPUP_H +#define DESTROYEDOBJECTPOPUP_H + +#include "../logic/LimitedTimeObject.h" +#include "../presentation/BitmapStore.h" + +/** +* @brief Object that appears on the screen for a short time when another object has been destroyed. +* +* Used to give extra visual feedback when a checkpoint has been collected or a Car crashes. +* +* @author Justin Wernick +* @author David Schneider +*/ +class DestroyedObjectPopup : public LimitedTimeObject +{ + public: + /** + * @brief Creates the popup at the given location, with the given image. + * + * @param [in] x The x coordinate of the object's position. + * @param [in] y The y coordinate of the object's position. + * @param [in] image The bitmap to be shown until the popup disappears. + */ + DestroyedObjectPopup(double x, double y, BitmapStore::Image image); + + //assignment and copy constructors have been left with the compiler generated versions + + private: + static const int POPUP_TIME = 30; ///< The number of frames that the DestroyedObjectPopup exists before it is destroyed. 1 second at FPS=30. +}; + +#endif // DESTROYEDOBJECTPOPUP_H diff --git a/source/logic/EnemyCar.cpp b/source/logic/EnemyCar.cpp new file mode 100644 index 0000000..ce455a6 --- /dev/null +++ b/source/logic/EnemyCar.cpp @@ -0,0 +1,104 @@ +#include "EnemyCar.h" + +EnemyCar::EnemyCar(double x, double y) + :Car(x,y,BitmapStore::ENEMY,Maze::UP), + _state(CHASING), + _targetX(x), + _targetY(y) +{ +} + +void EnemyCar::update(const Maze& maze, const list& players, const list& rocks) +{ + if (!players.empty()) checkFacing(maze, players.front().x(), players.front().y(), rocks); + + if (_state!=BLINDED) + { + move(maze); + } + else + { + _state = CHASING; + _speed = _baseSpeed; + } +} + +void EnemyCar::checkFacing(const Maze& maze, double chasingX, double chasingY, const list& rocks) +{ + if (abs(_x - _targetX)>_speed || abs(_y - _targetY)>_speed) return; + + map > adjacentBlocks; + pair evaluatingTarget; + + adjacentBlocks[Maze::LEFT] = make_pair(MazeMath::round(_x-1), MazeMath::round(_y)); + adjacentBlocks[Maze::RIGHT] = make_pair(MazeMath::round(_x+1), MazeMath::round(_y)); + adjacentBlocks[Maze::UP] = make_pair(MazeMath::round(_x), MazeMath::round(_y-1)); + adjacentBlocks[Maze::DOWN] = make_pair(MazeMath::round(_x), MazeMath::round(_y+1)); + + //remove adjacent blocks that would result in crashing into a rock or a wall + for (map >::iterator iter=adjacentBlocks.begin(); iter!=adjacentBlocks.end(); ) + { + if (rockAtLocation(iter->second.first, iter->second.second, rocks) || maze.getSolid(static_cast(iter->second.first),static_cast(iter->second.second))) + { + adjacentBlocks.erase(iter); + iter = adjacentBlocks.begin(); + } + else + { + ++iter; + } + } + + if (adjacentBlocks.empty()) + { + _speed = 0; + return; + } + else + { + _speed = _baseSpeed; + } + + map >::iterator reverseFacing = adjacentBlocks.find(Maze::backwards(_facing)); + if ((reverseFacing != adjacentBlocks.end()) && (adjacentBlocks.size()>1)) + { + adjacentBlocks.erase(reverseFacing); + } + + map >::const_iterator closestAdjacent = adjacentBlocks.begin(); + double closestDistance = MazeMath::distance(closestAdjacent->second.first, closestAdjacent->second.second, chasingX, chasingY); + + for (map >::const_iterator iter = ++adjacentBlocks.begin(); iter!=adjacentBlocks.end(); ++iter) + { + double newDistance = MazeMath::distance(iter->second.first, iter->second.second, chasingX, chasingY); + if (newDistance < closestDistance) + { + closestDistance = newDistance; + closestAdjacent = iter; + } + } + + _targetX = closestAdjacent->second.first; + _targetY = closestAdjacent->second.second; + _facing = closestAdjacent->first; +} + +bool EnemyCar::rockAtLocation(double x, double y, const list& rocks) +{ + for (list::const_iterator iter = rocks.begin(); iter!=rocks.end(); ++iter) + { + if (abs(x - iter->x())<1 && abs(y - iter->y())<1) return true; + } + return false; +} + +void EnemyCar::crash() +{ + _destroyed = true; +} + +void EnemyCar::blind() +{ + _state = BLINDED; + _speed = 0; +} diff --git a/source/logic/EnemyCar.h b/source/logic/EnemyCar.h new file mode 100644 index 0000000..b56c9d3 --- /dev/null +++ b/source/logic/EnemyCar.h @@ -0,0 +1,97 @@ +#ifndef ENEMYCAR_H +#define ENEMYCAR_H + +#include + +#include "../presentation/BitmapStore.h" + +#include "../logic/Car.h" +#include "../logic/PlayerCar.h" +#include "../logic/Rock.h" +#include "../logic/MazeMath.h" + +/** +* @brief GameObject that chases the player around the maze. +* +* Attempts to collide with the player, causing the player to lose. +* +* @author Justin Wernick +* @author David Schneider +*/ +class EnemyCar: public Car +{ + public: + /** + * @brief Creates an EnemyCar at the given coordinates. + * + * @param [in] x The x coordinate of the EnemyCar's initial position. + * @param [in] y The y coordinate of the EnemyCar's initial position. + */ + EnemyCar(double x, double y); + + //assignment and copy constructors have been left with the compiler generated versions + + /** + * @brief Processes one frame's worth of activity for the object, called every frame. + * + * Primarily adjusts the facing if neccesary and then moves using the inhereted move function. + * + * @param maze The maze that confines the EnemyCar's movements. + * @param players The list of PlayerCars that the EnemyCar can chase. + * @param rocks The list of Rocks that need to be avoided. + */ + void update(const Maze& maze, const list& players, const list& rocks); + + /** + * @brief Function that is called when an EnemyCar crashes into a PlayerCar. + */ + void crash(); + + /** + * @brief Function that is called when an EnemyCar drives into a Smokescreen. + */ + void blind(); + + private: + /** + * @brief States that define how the EnemyCar's AI should behave. + * + * This would need to be expanded to include more states in order to make the enemies appear smarter. + */ + enum States { + BLINDED, ///< The EnemyCar can not see, and so does not move. + CHASING ///< The EnemyCar tries to drive to the block that the player is currently on. + }; + + States _state; ///< The state that the object is currently in. + double _targetX; ///< The x coordinate that the EnemyCar is driving towards. + double _targetY; ///< The y coordinate that the EnemyCar is driving towards. + + /** + * @brief Updates the direction that the EnemyCar is facing, if neccesary. + * + * The facing is only changed once the current _targetX and _targetY are reached. After that, a facing is + * chosen that points into an empty block (no maze walls or rocks) that is closest to the chasing x and y + * using a straight line. This results in the enemy not always taking the shortest route, but it makes it + * possible to escape enemies. _targetX and _targetY are updated to one block in the new facing direction. + * The enemy may only turn around and head backwards if there is no other options, so once the enemy starts + * driving down narrow a path it will continue to the end of the path. + * + * @param [in] maze The maze that confines the EnemyCar's movements. + * @param [in] chasingX The x coordinate that the EnemyCar is ultimately trying to reach. + * @param [in] chasingY The y coordinate that the EnemyCar is ultimately trying to reach. + * @param [in] rocks The Rocks that the EnemyCar needs to avoid. + */ + void checkFacing(const Maze& maze, double chasingX, double chasingY, const list& rocks); + + /** + * @brief Iterates through a list of Rocks and determines if moving to a given position would result in a collision. + * + * @param [in] x The potential new x coordinate. + * @param [in] y The potential new y coordinate. + * @param [in] rocks The Rocks that are checked for a collision at x and y. + */ + bool rockAtLocation(double x, double y, const list& rocks); +}; + +#endif // ENEMYCAR_H diff --git a/source/logic/Game.cpp b/source/logic/Game.cpp new file mode 100644 index 0000000..57abd79 --- /dev/null +++ b/source/logic/Game.cpp @@ -0,0 +1,185 @@ +#include "Game.h" + +Game::Game() + :_config("config.txt"), + _screen(_config.screenWidth(), _config.screenHeight(), _config.fullscreen()) +{ + _timer = al_create_timer(1.0/FPS); + _timerEvents = al_create_event_queue(); + al_register_event_source(_timerEvents, al_get_timer_event_source(_timer)); +} + +Game::~Game() +{ + al_destroy_event_queue(_timerEvents); + al_destroy_timer(_timer); + +} + +void Game::start() +{ + while (!_screen.exitClicked()) + { + string filename = _screen.getLevel(); + if (!filename.empty()) + { + initLevel(filename); + runloop(); + } + } +} + +void Game::initLevel(const string& levelFile) +{ + clearLists(); + LevelReader reader(levelFile); + reader.readLevel(_maze, _players, _enemies, _checkpoints, _rocks); +} + +void Game::runloop() +{ + bool gameWon = false; + bool gameLost = false; + al_start_timer(_timer); + + while (!_screen.exitClicked()) + { + al_wait_for_event(_timerEvents, NULL); + al_flush_event_queue(_timerEvents); + + update(); + _collisionDetector.checkCollisions(_players, _enemies, _checkpoints, _rocks, _smokescreens); + cleanup(); + _screen.draw(_maze, _players, _enemies, _checkpoints, _rocks, _smokescreens, _popups); + + gameLost = _players.empty(); + gameWon = Checkpoint::checkpointCount()==0; + + if (gameLost) + { + _screen.drawLoss(); + for (int i=0; i<90; i++) + { + al_wait_for_event(_timerEvents, NULL); + al_drop_next_event(_timerEvents); + } + break; + } + else if (gameWon) + { + _screen.drawWin(); + for (int i=0; i<90; i++) + { + al_wait_for_event(_timerEvents, NULL); + al_drop_next_event(_timerEvents); + } + break; + } + } + al_stop_timer(_timer); +} + +void Game::update() +{ + for (list::iterator iter = _players.begin(); iter!=_players.end(); ++iter) + { + iter->update(_maze, _smokescreens); + } + + for (list::iterator iter = _enemies.begin(); iter!=_enemies.end(); ++iter) + { + iter->update(_maze, _players, _rocks); + } + + for (list::iterator iter = _smokescreens.begin(); iter!=_smokescreens.end(); ++iter) + { + iter->update(); + } + for (list::iterator iter = _popups.begin(); iter!=_popups.end(); ++iter) + { + iter->update(); + } +} + +void Game::cleanup() +{ + for (list::iterator iter = _players.begin(); iter!=_players.end();) + { + if (iter->destroyed()) + { + _popups.push_back(DestroyedObjectPopup(iter->x(), iter->y(), BitmapStore::CRASHED_CAR)); + iter = _players.erase(iter); + } + else + { + ++iter; + } + } + for (list::iterator iter = _enemies.begin(); iter!=_enemies.end();) + { + if (iter->destroyed()) + { + _popups.push_back(DestroyedObjectPopup(iter->x(), iter->y(), BitmapStore::CRASHED_CAR)); + iter = _enemies.erase(iter); + } + else + { + ++iter; + } + } + for (list::iterator iter = _checkpoints.begin(); iter!=_checkpoints.end();) + { + if (iter->destroyed()) + { + _popups.push_back(DestroyedObjectPopup(iter->x(), iter->y(), BitmapStore::CLAIMED_CHECKPOINT)); + iter = _checkpoints.erase(iter); + } + else + { + ++iter; + } + } + for (list::iterator iter = _rocks.begin(); iter!=_rocks.end();) + { + if (iter->destroyed()) + { + iter = _rocks.erase(iter); + } + else + { + ++iter; + } + } + for (list::iterator iter = _smokescreens.begin(); iter!=_smokescreens.end();) + { + if (iter->destroyed()) + { + iter = _smokescreens.erase(iter); + } + else + { + ++iter; + } + } + for (list::iterator iter = _popups.begin(); iter!=_popups.end();) + { + if (iter->destroyed()) + { + iter = _popups.erase(iter); + } + else + { + ++iter; + } + } +} + +void Game::clearLists() +{ + _players.clear(); + _enemies.clear(); + _checkpoints.clear(); + _rocks.clear(); + _smokescreens.clear(); + _popups.clear(); +} diff --git a/source/logic/Game.h b/source/logic/Game.h new file mode 100644 index 0000000..9adff76 --- /dev/null +++ b/source/logic/Game.h @@ -0,0 +1,135 @@ +#ifndef GAME_H +#define GAME_H + +#include +#include +using namespace std; + +#include + +#include "../presentation/Screen.h" +#include "../presentation/BitmapStore.h" + +#include "../logic/Maze.h" +#include "../logic/PlayerCar.h" +#include "../logic/EnemyCar.h" +#include "../logic/Checkpoint.h" +#include "../logic/Rock.h" +#include "../logic/Smokescreen.h" +#include "../logic/DestroyedObjectPopup.h" +#include "../logic/AllegroWrappers.h" +#include "../logic/CollisionDetector.h" + +#include "../data/LevelReader.h" +#include "../data/Config.h" + +/** +* @brief The object that controls the flow of the game, and the launch point of the game. +* +* Game contains the various components, including the screen, the maze, and all of the +* objects in the maze. The timing of the gameloop also falls under Game's control. +* Essencially, Game is the central point that everything connects to. +* +* @author Justin Wernick +* @author David Schneider +*/ +class Game +{ + public: + static const unsigned int FPS = 30; ///< Frames per second, the number of times the gameloop is run every second. + + /** + * @brief Constructor, that creates the relevant Allegro entities. + */ + Game(); + + /** + * @brief Constructor, that destroys the relevant Allegro entities. + */ + ~Game(); + + /** + * @brief Entry point for the program. This should be called from main. + */ + void start(); + + private: + /** + * @brief Unimplemented copy constructor, prevents copying of Game objects. + * + * Copying a Game is unneccesary as there should only be a single Game object. + */ + Game(const Game& ref); + /** + * @brief Unimplemented assignment operator. + * + * @see Game::Game(const Game& ref) + */ + Game& operator=(const Game& rhs); + + /** + * @brief Initialises all of the GameObject lists using a file. + * + * @param [in] levelFile The path of the file that contains the level layout. + */ + void initLevel(const string& levelFile); + + /** + * @brief Main part of the game, performs the actions in each frame FPS times per second until the game is over. + * + * Each frame runs the update methods of each of the GameObjects in the lists. The CollisionDetector + * then checks for collisions between objects. Any GameObjects that have been destroyed are then removed + * from their lists. Finally, the Screen is called to draw all of the GameObjects that still exist in + * their new positions. + * + * Before the next iteration begins, a check is done for the victory and loss conditions. The loop is + * ended if either of these are met, or if the player has quit the game. + */ + void runloop(); + + /** + * @brief Calls the update method on each of the GameObjects in the game. + */ + void update(); + /** + * @brief Removes any GameObjects that have been destroyed from their lists. + */ + void cleanup(); + + /** + * @brief Destroys all GameObjects in the game, resetting the lists for a new level to be loaded. + * + * This should always be called before a new level is loaded. + */ + void clearLists(); + + AllegroInit _allegro; ///< Handles dependencies on Allegro being installed. + + Config _config; ///< Loads configuration from file on construction, used to set resolution of screen. + Screen _screen; ///< Handles all drawing operations. + ALLEGRO_TIMER* _timer; ///< Creates FPS events per second, that are put into _timerEvents. + ALLEGRO_EVENT_QUEUE* _timerEvents; ///< Catches events from _timer, used to regulate speed of runloop. + + Maze _maze; ///< The environment that confines the movements of GameObjects, specifically Cars. + /** + * @brief Typically a single PlayerCar, controlled by the person playing the game. + * + * A list was used for _players to allow the Game object to be constructed without needing to initialise + * a meaningless PlayerCar object. This also allows the PlayerCar to be destroyed by Rocks or EnemyCars. + * An added benefit is that it adds the ease of extending the game to allow multiple players. To add + * multiplayer, the KeyboardHandler would need to be modified to allow different sets of input keys, + * and the Screen would need to be modified to keep all players visible, but the Game class would be + * able to remain largely unchanged. + */ + list _players; + + list _enemies; ///< List of all EnemyCars chasing the player. + list _checkpoints; ///< List of checkpoints that the player needs to collect. + list _rocks; ///< List of rocks that the player and EnemyCars need to avoid. + list _smokescreens; ///< List of Smokescreen objects that are currently able to delay EnemyCars. + list _popups; ///< List of purely visual DestroyedObjectPopups that need to be drawn. + + CollisionDetector _collisionDetector; ///< Object that checks for collisions each frame. +}; + +#endif // GAME_H diff --git a/source/logic/GameObject.cpp b/source/logic/GameObject.cpp new file mode 100644 index 0000000..07957e5 --- /dev/null +++ b/source/logic/GameObject.cpp @@ -0,0 +1,27 @@ +#include "GameObject.h" + +GameObject::GameObject(double x, double y, BitmapStore::Image image, Maze::Direction facing) + :_x(x), _y(y), _destroyed(false), _image(image), _facing(facing) +{ +} + +double GameObject::x() const +{ + return _x; +} +double GameObject::y() const +{ + return _y; +} +bool GameObject::destroyed() const +{ + return _destroyed; +} +BitmapStore::Image GameObject::image() const +{ + return _image; +} +Maze::Direction GameObject::facing() const +{ + return _facing; +} diff --git a/source/logic/GameObject.h b/source/logic/GameObject.h new file mode 100644 index 0000000..bd7fd0b --- /dev/null +++ b/source/logic/GameObject.h @@ -0,0 +1,82 @@ +#ifndef GAMEOBJECT_H +#define GAMEOBJECT_H + +#include "../presentation/BitmapStore.h" +#include "../logic/Maze.h" + +/** +* @brief Parent class for objects that are placed in the maze. +* +* These objects are one maze block big. The image in the bitmap store will be drawn +* on the screen every frame at the Screen class's discression, being rotated to face +* in the 'facing' direction. Coordinates are given in terms of the Maze class's coordinate +* system. For example, increasing the x coordinate of an object by 1 will move it one maze +* block to the right. The number of pixels that this corresponds to is handled by the +* Screen class. +* +* When an object is in a situation that it should be destroyed, it is marked for destruction. +* It is then the responsibility of the Game class to actually destroy it. +* +* @author Justin Wernick +* @author David Schneider +*/ +class GameObject +{ + public: + /** + * @brief Creates a GameObject with the given parameters. + * + * @param [in] x The x coordinate of the new object. + * @param [in] y The y coordinate of the new object. + * @param [in] image The image that is drawn to represent the object. + * @param [in] facing The direction that the object is facing. If the object has no direction, + * such as with Checkpoint or Rock, the default value of Maze::UP should be used. + */ + GameObject(double x, double y, BitmapStore::Image image, Maze::Direction facing=Maze::UP); + + //assignment and copy constructors have been left with the compiler generated versions + + /** + * @brief Provides access to the x coordinate of the object. + * + * @return The x coordinate of the object, in maze blocks, where 0 is the far left column of the maze. + */ + double x() const; + + /** + * @brief Provides access to the y coordinate of the object. + * + * @return The y coordinate of the object, in maze blocks, where 0 is the top row of the maze. + */ + double y() const; + + /** + * @brief Checks if an object has been marked for destruction, for example through a collision. + * + * @return True is the object has been marked for destruction, false otherwise. + */ + bool destroyed() const; + + /** + * @brief Provides access to the image that should be drawn to represent the object. + * + * @return An image, corresponding to an enumerated type that can be converted into a bitmap by the BitmapStore class. + */ + BitmapStore::Image image() const; + + /** + * @brief Provides access to the direction that the object is facing. + * + * @return A direction, corresponding to the rotation that should be done to the drawn image and, in the case of Cars, the direction that they move forward. + */ + Maze::Direction facing() const; + + protected: + double _x; ///< The x coordinate of the object's position. + double _y; ///< The y coordinate of the object's position. + bool _destroyed; ///< True if the object has been marked for destruction. + BitmapStore::Image _image; ///< The bitmap that should be drawn on the screen to represent the object. + Maze::Direction _facing; ///< The direction in which the object is facing, up, down, left, or right. +}; + +#endif // GAMEOBJECT_H diff --git a/source/logic/LimitedTimeObject.cpp b/source/logic/LimitedTimeObject.cpp new file mode 100644 index 0000000..55ff31b --- /dev/null +++ b/source/logic/LimitedTimeObject.cpp @@ -0,0 +1,16 @@ +#include "LimitedTimeObject.h" + +LimitedTimeObject::LimitedTimeObject(double x, double y, BitmapStore::Image image, int time) + :GameObject(x,y,image), + _remainingTime(time) +{ +} + +void LimitedTimeObject::update() +{ + --_remainingTime; + if (_remainingTime<=0) + { + _destroyed = true; + } +} diff --git a/source/logic/LimitedTimeObject.h b/source/logic/LimitedTimeObject.h new file mode 100644 index 0000000..242965b --- /dev/null +++ b/source/logic/LimitedTimeObject.h @@ -0,0 +1,45 @@ +#ifndef LIMITEDTIMEOBJECT_H +#define LIMITEDTIMEOBJECT_H + +#include "../logic/GameObject.h" +#include "../logic/Maze.h" +#include "../presentation/BitmapStore.h" + +/** +* @brief Parent class for GameObjects that are created, exist for a given time, and are then destroyed. +* +* @author Justin Wernick +* @author David Schneider +*/ +class LimitedTimeObject: public GameObject +{ + public: + /** + * @brief Creates a LimitedTimeObject with the given parameters. + * + * @param [in] x The x coordinate of the new object. + * @param [in] y The y coordinate of the new object. + * @param [in] image The image that is drawn to represent the object. + * @param [in] time The number of times that the update function is run before the object is destroyed. + */ + LimitedTimeObject(double x, double y, BitmapStore::Image image, int time); + + //assignment and copy constructors have been left with the compiler generated versions + + /** + * @brief Function that should be run on every iteration of the gameloop. + * + * The time remaining is decremented, and the object is marked for destruction when it reaches zero. + */ + void update(); + + private: + /** + * @brief The number of times that update still needs to be run before the object is marked for destruction. + * + * For example, if the remaining time is 1, then the object is marked on the next update. + */ + int _remainingTime; +}; + +#endif // LIMITEDTIMEOBJECT_H diff --git a/source/logic/Maze.cpp b/source/logic/Maze.cpp new file mode 100644 index 0000000..ab24035 --- /dev/null +++ b/source/logic/Maze.cpp @@ -0,0 +1,77 @@ +#include "Maze.h" + +Maze::Maze() + :_width(0), + _height(0) +{ +} + +void Maze::generateMaze(const vector >& walls, int maxObjectX, int maxObjectY) +{ + //find bounds so that rectangular vector can be generated + int maxX = maxObjectX; + int maxY = maxObjectY; + for (vector >::const_iterator iter = walls.begin(); iter!=walls.end(); ++iter) + { + if (iter->first > maxX) maxX = iter->first; + if (iter->second > maxY) maxY = iter->second; + } + _width = maxX+1; //need to convert from highest index to required size + _height = maxY+1; + + + _wallLocations.clear(); + + for (int x=0; x<_width; ++x) + { + _wallLocations.push_back(vector()); + for (int y=0; y<_height; ++y) + { + _wallLocations.back().push_back(false); + } + } + + for (vector >::const_iterator iter = walls.begin(); iter!=walls.end(); ++iter) + { + _wallLocations.at(iter->first).at(iter->second) = true; + } +} + +bool Maze::getSolid(const int& x, const int& y) const +{ + if (x<0 || y<0) return true; + if (x>=width() || y>=height()) return true; + //bounds have already been checked, can use more efficient, less safe, indexing + return _wallLocations[x][y]; +} + +int Maze::width() const +{ + return _width; +} +int Maze::height() const +{ + return _height; +} + +Maze::Direction Maze::backwards(Direction forwards) +{ + Direction backwards; + switch (forwards) + { + case LEFT: + backwards = RIGHT; + break; + case RIGHT: + backwards = LEFT; + break; + case UP: + backwards = DOWN; + break; + case DOWN: + backwards = UP; + break; + } + + return backwards; +} diff --git a/source/logic/Maze.h b/source/logic/Maze.h new file mode 100644 index 0000000..245528d --- /dev/null +++ b/source/logic/Maze.h @@ -0,0 +1,100 @@ +#ifndef MAZE_H +#define MAZE_H + +#include +#include +using namespace std; + +/** +* @brief A rectangular 2D boolean array, representing where cars can drive and where they cannot. +* +* @author Justin Wernick +* @author David Schneider +*/ +class Maze +{ + public: + /** + * @brief Defines the directions in which movement can happen in the maze. + */ + enum Direction {UP, DOWN, LEFT, RIGHT}; + + /** + * @brief Creates an empty Maze with width and height of zero. + */ + Maze(); + + //assignment and copy constructors have been left with the compiler generated versions + + /** + * @brief Generates a new Maze from the vector of wall coordinates. + * + * The size of the Maze is chosen to just fit all of the walls. If objects exist outside + * of the walls, the x of the rightmost object and the y of the bottommost object can be + * passed in to make the Maze at least reach those coordinates. + * + * @param [in] walls A vector of x,y coordinate pairs representing the locations of each wall block. + * @param [in] maxObjectX The minimum x value that the Maze must be able to index. + * @param [in] maxObjectY The minimum y value that the Maze must be able to index. + */ + void generateMaze(const vector >& walls, int maxObjectX=0, int maxObjectY=0); + + /** + * @brief Checks if a given position contains a wall or not. + * + * This function is one of the most called as it is called for each block drawing the + * Maze on the Screen, by any Car checking if it can move, and by the EnemyCar to choose a + * viable direction to face. As such, it has been optimised by passing the parameters by + * constant reference, even though they are primitives. Further, the vector class's bounds + * checking is bypassed, with bounds checking performed manually with the assumption that the + * 2D vector is rectangular, to increase performance. Neither of these changes impare readability. + * + * @param [in] x The x coordinate being queried. + * @param [in] y The y coordinate being queried. + * + * @return True if the location contains a wall. Also returns true if the coordinate is outside of the Maze. + */ + bool getSolid(const int& x, const int& y) const; + + /** + * @brief Provides access to the width of the Maze object. + * + * @return The amount of blocks in each row of the maze. + */ + int width() const; + /** + * @brief Provides access to the height of the Maze object. + * + * @return The amount of blocks in each column of the maze. + */ + int height() const; + + /** + * @brief Inverts a given direction, to give the value to face in the opposite direction. + * + * @param [in] forwards The direction to be inverted. + * + * @return The inverse of the given direction. + */ + static Direction backwards(Direction forwards); + + private: + /** + * @brief Provides an easier to read pseudonym for a 2 dimensional boolean vector. + */ + typedef vector > BoolGrid; + + /** + * @brief The 2 dimensional vector that stores the locations of walls. + * + * The outer vector is columns, indexed with the x coordinate, and the inner vectors + * are the vertical positions in the column, indexed with the y coordinate. + * This results in a vector that is acced with _wallLocations.at(x).at(y). + */ + BoolGrid _wallLocations; + + int _width; ///< The number of blocks in each row. + int _height; ///< The number of blocks in each column. +}; + +#endif // MAZE_H diff --git a/source/logic/MazeMath.cpp b/source/logic/MazeMath.cpp new file mode 100644 index 0000000..84b27dd --- /dev/null +++ b/source/logic/MazeMath.cpp @@ -0,0 +1,18 @@ +#include "MazeMath.h" + +double MazeMath::round(double value) +{ + if (static_cast(value*10)%10 < 5) + { + return floor(value); + } + else + { + return ceil(value); + } +} + +double MazeMath::distance(double x1, double y1, double x2, double y2) +{ + return sqrt(pow(x1-x2, 2) + pow(y1-y2, 2)); +} diff --git a/source/logic/MazeMath.h b/source/logic/MazeMath.h new file mode 100644 index 0000000..d5a2aa9 --- /dev/null +++ b/source/logic/MazeMath.h @@ -0,0 +1,59 @@ +#ifndef MAZEMATH_H +#define MAZEMATH_H + +#include + +/** +* @brief Class of static methods for common math functions that occur in the 2D maze setting. +* +* @author Justin Wernick +* @author David Schneider +*/ +class MazeMath +{ + public: + /** + * @brief Rounds a value to the nearest integer. + * + * Values with a decimal fraction less than 0.5 are floored, while values with + * a decimal fraction greater than or eqaul to 0.5 are ceiled. + * + * @param [in] value The number to be rounded off. + * + * @return The rounded off version of the given value. + */ + static double round(double value); + + /** + * @brief Finds the straight line distance between two points on a 2D plane. + * + * Implemented using Pythagoras' Theorem. + * + * @param [in] x1 The x coordinate of the first point. + * @param [in] y1 The y coordinate of the first point. + * @param [in] x2 The x coordinate of the second point. + * @param [in] y2 The y coordinate of the second point. + * + * @return The distance between the two given points. + */ + static double distance(double x1, double y1, double x2, double y2); + + private: + /** + * @brief Unimplemented constructor. + * + * being a grouping of static functions, construction and destruction of MazeMath + * objects is unneccesary. + */ + MazeMath(); + /** + * @brief Unimplemented copy constructor. + */ + MazeMath(const MazeMath& ref); + /** + * @brief Unimplemented assignment operator. + */ + MazeMath& operator=(const MazeMath& rhs); +}; + +#endif // MAZEMATH_H diff --git a/source/logic/PlayerCar.cpp b/source/logic/PlayerCar.cpp new file mode 100644 index 0000000..5da4ba0 --- /dev/null +++ b/source/logic/PlayerCar.cpp @@ -0,0 +1,87 @@ +#include "PlayerCar.h" + +PlayerCar::PlayerCar(double x, double y, Maze::Direction facing) + :Car(x,y,BitmapStore::PLAYER, facing), + _input(_facing), + _petrol(1) +{ +} + +void PlayerCar::update(const Maze& maze, list& currentSmoke) +{ + _petrol -= PETROL_USE_RATE; + if (_petrol<0) + { + _speed = _baseSpeed/2; + _petrol = 0; + } + + _facing = _input.getFacing(); + move(maze); + + if (_input.getSmokescreen()) + { + makeSmoke(currentSmoke); + } +} + +void PlayerCar::makeSmoke(list& currentSmoke) +{ + if (_petrol < PETROL_USE_SMOKESCREEN) return; + + double targetX = 0; + double targetY = 0; + + switch(_facing) + { + case Maze::UP: + targetX = round(_x); + targetY = round(_y+1); + break; + case Maze::DOWN: + targetX = round(_x); + targetY = round(_y-1); + break; + case Maze::LEFT: + targetX = round(_x+1); + targetY = round(_y); + break; + case Maze::RIGHT: + targetX = round(_x-1); + targetY = round(_y); + break; + } + + bool overlap = false; + + for (list::const_iterator iter = currentSmoke.begin(); iter!=currentSmoke.end(); ++iter) + { + if ((abs(iter->x() - targetX)<1)&&(abs(iter->y() - targetY)<1)) + { + overlap = true; + break; + } + } + + if (!overlap) + { + currentSmoke.push_back(Smokescreen(targetX, targetY)); + _petrol -= PETROL_USE_SMOKESCREEN; + } +} + +void PlayerCar::crash() +{ + _destroyed = true; +} + +void PlayerCar::gotCheckpoint() +{ + _petrol+=PETROL_FROM_CHECKPOINT; + _speed = _baseSpeed; +} + +double PlayerCar::petrol() const +{ + return _petrol; +} diff --git a/source/logic/PlayerCar.h b/source/logic/PlayerCar.h new file mode 100644 index 0000000..8e9338d --- /dev/null +++ b/source/logic/PlayerCar.h @@ -0,0 +1,99 @@ +#ifndef PLAYERCAR_H +#define PLAYERCAR_H + +#include +#include +using namespace std; + +#include "../presentation/KeyboardHandler.h" +#include "../presentation/BitmapStore.h" + +#include "../logic/Car.h" +#include "../logic/Maze.h" +#include "../logic/Smokescreen.h" + +/** +* @brief A GameObject that is controlled by the player. +* +* Contains a KeyboardHandler to accept user input. +* +* @author Justin Wernick +* @author David Schneider +*/ +class PlayerCar: public Car +{ + public: + /** + * @brief Creates a PlayerCar at the given location facing in the given direction. + * + * In the current form of the level files, there is no way to distinguish the direction + * that the player is facing, so the default of UP is used. However, the ability to + * pass in a facing is useful in the unit tests. + * + * @param [in] x The x coordinate of the object's initial position. + * @param [in] y The y coordinate of the object's initial position. + * @param [in] facing The direction that the object is initially facing. + */ + PlayerCar(double x, double y, Maze::Direction facing=Maze::UP); + + //assignment and copy constructors have been left with the compiler generated versions + + /** + * @brief Processes one frame's worth of activity for the object, called every frame. + * + * The Keyboard handler is called for the user's input. Based on this, the direction + * can be changed, and a Smokescreen can be created and added to the list of already + * existing Smokescreens. The PlayerCar is then moved. + * Petrol is decreased by PETROL_USE_RATE on every update. + * + * @param [in] maze The Maze that confines the PlayerCar's movement. + * @param [in,out] currentSmoke The list of Smokescreens being drawn, that the new Smokescreens will be added to the back of. + */ + void update(const Maze& maze, list& currentSmoke); + + /** + * @brief Creates a Smokescreen one block behind the player if the action is viable. + * + * The action is viable if the object has more than PETROL_USE_SMOKESCREEN petrol. Further, + * the position must not overlap with existing Smokescreens. This allows the player to hold down + * the Smokescreen button without creating a new Smokescreen every frame. + * Creating a Smokescreen decreases the petrol by PETROL_USE_SMOKESCREEN. + * + * @param [in,out] currentSmoke The list of Smokescreens being drawn, that the new Smokescreens will be added to the back of. + */ + void makeSmoke(list& currentSmoke); + + /** + * @brief Function that is called when the PlayerCar collides with a Checkpoint. + * + * Increases the amount of petrol by PETROL_FROM_CHECKPOINT. + */ + void gotCheckpoint(); + + /** + * @brief Function that is called when the PlayerCar collides with an EnemyCar. + */ + void crash(); + + /** + * @brief Function to allow access to the amount of petrol that the PlayerCar still has. + */ + double petrol() const; + + private: + KeyboardHandler _input; ///< Object that handles all interaction with the player. + + /** + * @brief The amount of petrol that the PlayerCar still has. + * + * Measured as a fraction, with 1 being a full tank and 0 being empty. When the petrol reaches + * 0, it is kept at zero and the PlayerCar's speed is halved. + */ + double _petrol; + + static const double PETROL_USE_RATE = 0.0007; ///< The amount of petrol used every frame. + static const double PETROL_USE_SMOKESCREEN = 0.05; ///< The amount of petrol used to create a Smokescreen. + static const double PETROL_FROM_CHECKPOINT = 0.2; ///< The amount of petrol gained from collecting a Checkpoint. +}; + +#endif // PLAYERCAR_H diff --git a/source/logic/Rock.cpp b/source/logic/Rock.cpp new file mode 100644 index 0000000..bb1053a --- /dev/null +++ b/source/logic/Rock.cpp @@ -0,0 +1,6 @@ +#include "Rock.h" + +Rock::Rock(double x, double y) + :GameObject(x,y,BitmapStore::ROCK) +{ +} diff --git a/source/logic/Rock.h b/source/logic/Rock.h new file mode 100644 index 0000000..106fd18 --- /dev/null +++ b/source/logic/Rock.h @@ -0,0 +1,29 @@ +#ifndef ROCK_H +#define ROCK_H + +#include "../logic/GameObject.h" +#include "../presentation/BitmapStore.h" + +/** +* @brief A game object that acts as an obstacle to the player. +* +* Does nothing actively. +* +* @author Justin Wernick +* @author David Schneider +*/ +class Rock: public GameObject +{ + public: + /** + * @brief Creates a Rock at the given coordinates. + * + * @param [in] x The x coordinate of the Rock's position. + * @param [in] y The y coordinate of the Rock's position. + */ + Rock(double x, double y); + + //assignment and copy constructors have been left with the compiler generated versions +}; + +#endif // ROCK_H diff --git a/source/logic/Smokescreen.cpp b/source/logic/Smokescreen.cpp new file mode 100644 index 0000000..9ad4316 --- /dev/null +++ b/source/logic/Smokescreen.cpp @@ -0,0 +1,6 @@ +#include "Smokescreen.h" + +Smokescreen::Smokescreen(double x, double y) + :LimitedTimeObject(x,y,BitmapStore::SMOKE,SMOKE_TIME) +{ +} diff --git a/source/logic/Smokescreen.h b/source/logic/Smokescreen.h new file mode 100644 index 0000000..59d1871 --- /dev/null +++ b/source/logic/Smokescreen.h @@ -0,0 +1,31 @@ +#ifndef SMOKESCREEN_H +#define SMOKESCREEN_H + +#include "../logic/LimitedTimeObject.h" +#include "../presentation/BitmapStore.h" + +/** +* @brief GameObject that causes the EnemyCar to be delayed if they crash into it. +* +* After a short time, the SmokeScreen dissipates. +* +* @author Justin Wernick +* @author David Schneider +*/ +class Smokescreen : public LimitedTimeObject +{ + public: + /** + * @brief Creates a Smokescreen at the given location. + * + * @param [in] x The x coordinate of the object's position. + * @param [in] y The y coordinate of the object's position. + */ + Smokescreen(double x, double y); + + //assignment and copy constructors have been left with the compiler generated versions + private: + static const int SMOKE_TIME = 60; ///< The number of frames that the Smokescreen exists before it is destroyed. 2 second at FPS=30. +}; + +#endif // SMOKESCREEN_H diff --git a/source/main.cpp b/source/main.cpp new file mode 100644 index 0000000..f990ca4 --- /dev/null +++ b/source/main.cpp @@ -0,0 +1,21 @@ +#include "logic/Game.h" + +int main() +{ + try + { + Game game; + game.start(); + } + catch (BadResolution) + { + } + catch (InstallFailure) + { + } + catch (FileOpenError) + { + } + + return 0; +} diff --git a/source/presentation/BitmapStore.cpp b/source/presentation/BitmapStore.cpp new file mode 100644 index 0000000..c289ff3 --- /dev/null +++ b/source/presentation/BitmapStore.cpp @@ -0,0 +1,238 @@ +#include "BitmapStore.h" + +BitmapStore::BitmapStore(unsigned int blockWidth) + :_blockWidth(blockWidth) +{ + _bitmapFont = al_load_font("junction 02.ttf", blockWidth/6, 0); + if (_bitmapFont == NULL) + { + al_show_native_message_box(NULL, "Fatal error", "Fatal error", "The file 'junction 02.ttf' was not found. Ensure that it is located in the working directory.", NULL, ALLEGRO_MESSAGEBOX_ERROR); + throw InstallFailure(); + } +} + +BitmapStore::~BitmapStore() +{ + for (map::iterator iter = _bitmaps.begin(); + iter != _bitmaps.end(); ++iter) + { + al_destroy_bitmap(iter->second); + } + _bitmaps.clear(); + al_destroy_font(_bitmapFont); +} + +ALLEGRO_BITMAP* BitmapStore::getBitmap(Image image) +{ + map::const_iterator iter = _bitmaps.find(image); + if (iter != _bitmaps.end()) + { + return iter->second; + } + else + { + ALLEGRO_BITMAP* newImage = al_create_bitmap(_blockWidth, _blockWidth); + switch (image) + { + case PLAYER: + drawPlayerCar(newImage); + break; + case ENEMY: + drawEnemyCar(newImage); + break; + case CHECKPOINT: + drawCheckpoint(newImage); + break; + case ROCK: + drawRock(newImage); + break; + case MAZE_WALL: + drawMazeWall(newImage); + break; + case MAZE_FLOOR: + drawMazeFloor(newImage); + break; + case SMOKE: + drawSmoke(newImage); + break; + case CRASHED_CAR: + drawCrashedCar(newImage); + break; + case CLAIMED_CHECKPOINT: + drawClaimedCheckpoint(newImage); + break; + } + + _bitmaps.insert(make_pair(image, newImage)); + return newImage; + } +} + +void BitmapStore::drawPlayerCar(ALLEGRO_BITMAP* canvas) +{ + ALLEGRO_BITMAP* prev_draw = al_get_target_bitmap(); + al_set_target_bitmap(canvas); + + //car body + al_draw_filled_rounded_rectangle(_blockWidth*0.2, 0, _blockWidth*0.8, _blockWidth*0.96, _blockWidth*0.1, _blockWidth*0.1, al_map_rgb(0,0,255)); + + //racing stripes + al_draw_filled_rectangle(_blockWidth*0.35, 0, _blockWidth*0.4, _blockWidth*0.3, al_map_rgb(255,255,255)); + al_draw_filled_rectangle(_blockWidth*0.6, 0, _blockWidth*0.65, _blockWidth*0.3, al_map_rgb(255,255,255)); + + //windscreen + al_draw_filled_rectangle(_blockWidth*0.3, _blockWidth*0.3, _blockWidth*0.7, _blockWidth*0.5, al_map_rgb (0,0,0)); + + //roof + al_draw_rounded_rectangle(_blockWidth*0.3, _blockWidth*0.5, _blockWidth*0.7, _blockWidth*0.9, _blockWidth*0.04, _blockWidth*0.04, al_map_rgb (25,25, 112), _blockWidth*0.04); + + //spoiler + al_draw_filled_rectangle(_blockWidth*0.2, _blockWidth*0.96, _blockWidth*0.8, _blockWidth, al_map_rgb (0,0, 225)); + al_draw_rectangle(_blockWidth*0.2, _blockWidth*0.96, _blockWidth*0.8, _blockWidth, al_map_rgb(25,25, 112),_blockWidth*0.04); + + //headlights + al_draw_filled_rectangle (_blockWidth*0.3,0,_blockWidth*0.35,_blockWidth*0.06, al_map_rgb(255,225,0)); + al_draw_filled_rectangle (_blockWidth*0.65,0,_blockWidth*0.7,_blockWidth*0.06, al_map_rgb(255,225,0)); + + //tyres + al_draw_filled_rounded_rectangle (_blockWidth*0.1,_blockWidth*0.13,_blockWidth*0.2,_blockWidth*0.37,_blockWidth*0.03,_blockWidth*0.03, al_map_rgb(131,139,131)); + al_draw_filled_rounded_rectangle (_blockWidth*0.8,_blockWidth*0.13,_blockWidth*0.9,_blockWidth*0.37,_blockWidth*0.03,_blockWidth*0.03, al_map_rgb(131,139,131)); + al_draw_filled_rounded_rectangle (_blockWidth*0.1,_blockWidth*0.63,_blockWidth*0.2,_blockWidth*0.87,_blockWidth*0.03,_blockWidth*0.03, al_map_rgb(131,139,131)); + al_draw_filled_rounded_rectangle (_blockWidth*0.8,_blockWidth*0.63,_blockWidth*0.9,_blockWidth*0.87,_blockWidth*0.03,_blockWidth*0.03, al_map_rgb(131,139,131)); + + al_set_target_bitmap(prev_draw); +} +void BitmapStore::drawEnemyCar(ALLEGRO_BITMAP* canvas) +{ + ALLEGRO_BITMAP* prev_draw = al_get_target_bitmap(); + al_set_target_bitmap(canvas); + + //car body + al_draw_filled_rounded_rectangle(_blockWidth*0.2, 0, _blockWidth*0.8, _blockWidth*0.96, _blockWidth*0.1, _blockWidth*0.1, al_map_rgb(255,0,0)); + + //racing stripes + al_draw_filled_rectangle(_blockWidth*0.35, 0, _blockWidth*0.4, _blockWidth*0.3, al_map_rgb(255,255,255)); + al_draw_filled_rectangle(_blockWidth*0.6, 0, _blockWidth*0.65, _blockWidth*0.3, al_map_rgb(255,255,255)); + + //windscreen + al_draw_filled_rectangle(_blockWidth*0.3, _blockWidth*0.3, _blockWidth*0.7, _blockWidth*0.5, al_map_rgb (0,0,0)); + + //roof + al_draw_rounded_rectangle(_blockWidth*0.3, _blockWidth*0.5, _blockWidth*0.7, _blockWidth*0.9, _blockWidth*0.04, _blockWidth*0.04, al_map_rgb (25,25, 112), _blockWidth*0.04); + + //spoiler + al_draw_filled_rectangle(_blockWidth*0.2, _blockWidth*0.96, _blockWidth*0.8, _blockWidth, al_map_rgb (0,0, 225)); + al_draw_rectangle(_blockWidth*0.2, _blockWidth*0.96, _blockWidth*0.8, _blockWidth, al_map_rgb(25,25, 112),_blockWidth*0.04); + + //headlights + al_draw_filled_rectangle (_blockWidth*0.3,0,_blockWidth*0.35,_blockWidth*0.06, al_map_rgb(255,225,0)); + al_draw_filled_rectangle (_blockWidth*0.65,0,_blockWidth*0.7,_blockWidth*0.06, al_map_rgb(255,225,0)); + + //tyres + al_draw_filled_rounded_rectangle (_blockWidth*0.1,_blockWidth*0.13,_blockWidth*0.2,_blockWidth*0.37,_blockWidth*0.03,_blockWidth*0.03, al_map_rgb(131,139,131)); + al_draw_filled_rounded_rectangle (_blockWidth*0.8,_blockWidth*0.13,_blockWidth*0.9,_blockWidth*0.37,_blockWidth*0.03,_blockWidth*0.03, al_map_rgb(131,139,131)); + al_draw_filled_rounded_rectangle (_blockWidth*0.1,_blockWidth*0.63,_blockWidth*0.2,_blockWidth*0.87,_blockWidth*0.03,_blockWidth*0.03, al_map_rgb(131,139,131)); + al_draw_filled_rounded_rectangle (_blockWidth*0.8,_blockWidth*0.63,_blockWidth*0.9,_blockWidth*0.87,_blockWidth*0.03,_blockWidth*0.03, al_map_rgb(131,139,131)); + + al_set_target_bitmap(prev_draw); +} +void BitmapStore::drawRock(ALLEGRO_BITMAP* canvas) +{ + ALLEGRO_BITMAP* prev_draw = al_get_target_bitmap(); + al_set_target_bitmap(canvas); + + ALLEGRO_COLOR colour = al_map_rgb(131,139,131); + al_draw_filled_circle(_blockWidth/2, _blockWidth/2, _blockWidth/2-1, colour); + + al_draw_filled_circle(_blockWidth/2, _blockWidth/2, _blockWidth/2-6, colour); + al_draw_filled_circle(_blockWidth/4, _blockWidth/4, _blockWidth/4-1, al_map_rgb(205,197,191)); + al_draw_filled_circle(_blockWidth/3.2, _blockWidth/4.2, _blockWidth/4-2, al_map_rgb(205,197,191)); + al_draw_filled_circle(_blockWidth/1.2, _blockWidth/2, _blockWidth/2-15, al_map_rgb(205,197,191)); + al_draw_filled_circle(_blockWidth/2, _blockWidth/2, _blockWidth/2-8, al_map_rgb(205,205,193)); + + al_set_target_bitmap(prev_draw); +} +void BitmapStore::drawCheckpoint(ALLEGRO_BITMAP* canvas) +{ + ALLEGRO_BITMAP* prev_draw = al_get_target_bitmap(); + al_set_target_bitmap(canvas); + + ALLEGRO_COLOR colour = al_map_rgb(255,255,0); + + al_draw_filled_rectangle (_blockWidth*0.44, _blockWidth*0.1, _blockWidth*0.5, _blockWidth*0.9, colour); + al_draw_filled_rounded_rectangle (_blockWidth*0.34, _blockWidth*0.9, _blockWidth*0.6, _blockWidth*0.98, _blockWidth*0.01, _blockWidth*0.01, colour); + al_draw_filled_circle (_blockWidth*0.47, _blockWidth*0.14, _blockWidth*0.1, colour); + al_draw_filled_triangle (_blockWidth*0.44, _blockWidth*0.26, _blockWidth*0.44, _blockWidth*0.58, _blockWidth*0.8, _blockWidth*0.42, colour); + + al_set_target_bitmap(prev_draw); +} +void BitmapStore::drawMazeWall(ALLEGRO_BITMAP* canvas) +{ + ALLEGRO_BITMAP* prev_draw = al_get_target_bitmap(); + al_set_target_bitmap(canvas); + + ALLEGRO_COLOR colour = al_map_rgb(203,255,151); + al_clear_to_color(colour); + + al_set_target_bitmap(prev_draw); +} +void BitmapStore::drawMazeFloor(ALLEGRO_BITMAP* canvas) +{ + ALLEGRO_BITMAP* prev_draw = al_get_target_bitmap(); + al_set_target_bitmap(canvas); + + ALLEGRO_COLOR colour = al_map_rgb(0,0,0); + al_clear_to_color(colour); + + al_set_target_bitmap(prev_draw); +} +void BitmapStore::drawSmoke(ALLEGRO_BITMAP* canvas) +{ + ALLEGRO_BITMAP* prev_draw = al_get_target_bitmap(); + al_set_target_bitmap(canvas); + + ALLEGRO_COLOR colour = al_map_rgb(255,255,255); + al_draw_circle (_blockWidth/2.3, _blockWidth/2.1, _blockWidth/2-1, colour,1); + al_draw_circle (_blockWidth/4, _blockWidth/4, _blockWidth/4, colour,2); + al_draw_circle (_blockWidth/5, _blockWidth/1.5, _blockWidth/4, colour,4); + al_draw_circle (_blockWidth/2.5, _blockWidth/2.7, _blockWidth/3, colour,3); + al_draw_circle (_blockWidth/1.2, _blockWidth/1.8, _blockWidth/3.7, colour,2); + al_draw_circle (_blockWidth/2.8, _blockWidth/2.2, _blockWidth/6, colour,3); + al_draw_circle (_blockWidth/1.1, _blockWidth/1.2, _blockWidth/3, colour,2); + al_draw_circle (_blockWidth/1.2, _blockWidth/1.7, _blockWidth/2, colour,3); + al_draw_circle (_blockWidth/1.3, _blockWidth/1.3, _blockWidth/5, colour,2); + + al_set_target_bitmap(prev_draw); +} + +void BitmapStore::drawCrashedCar(ALLEGRO_BITMAP* canvas) +{ + ALLEGRO_BITMAP* prev_draw = al_get_target_bitmap(); + al_set_target_bitmap(canvas); + + al_draw_filled_rounded_rectangle(_blockWidth/3.33, _blockWidth/5, _blockWidth/1.25, _blockWidth/1.04, 5, 5, al_map_rgb (200, 200, 200)); + al_draw_circle (_blockWidth/2.3, _blockWidth/2.1, _blockWidth/2-1, al_map_rgb (255, 0, 0),1); + al_draw_circle (_blockWidth/4, _blockWidth/4, _blockWidth/4, al_map_rgb (100, 100, 100),2); + al_draw_circle (_blockWidth/5, _blockWidth/1.5, _blockWidth/4, al_map_rgb (255, 0, 0),4); + al_draw_filled_rectangle(_blockWidth/2.5, _blockWidth/2, _blockWidth/1.43, _blockWidth/1.7, al_map_rgb (0,0, 0)); + al_draw_circle (_blockWidth/2.5, _blockWidth/2.7, _blockWidth/3, al_map_rgb (100, 100, 100),3); + al_draw_circle (_blockWidth/1.2, _blockWidth/1.8, _blockWidth/3.7, al_map_rgb (255, 0, 0),2); + al_draw_rectangle(_blockWidth/3.13, _blockWidth/1.04, _blockWidth/1.25, _blockWidth, al_map_rgb (25,25, 112),1); + al_draw_circle (_blockWidth/2.8, _blockWidth/2.2, _blockWidth/6, al_map_rgb (255, 0, 0),3); + al_draw_circle (_blockWidth/1.1, _blockWidth/1.2, _blockWidth/3, al_map_rgb (100, 100, 100),2); + al_draw_circle (_blockWidth/1.2, _blockWidth/1.7, _blockWidth/2, al_map_rgb (100, 100, 100),3); + al_draw_circle (_blockWidth/1.3, _blockWidth/1.3, _blockWidth/5, al_map_rgb (255, 0, 0),2); + + al_set_target_bitmap(prev_draw); +} + +void BitmapStore::drawClaimedCheckpoint(ALLEGRO_BITMAP* canvas) +{ + ALLEGRO_BITMAP* prev_draw = al_get_target_bitmap(); + al_set_target_bitmap(canvas); + + ALLEGRO_COLOR colour = al_map_rgb(255,255,255); + al_draw_text(_bitmapFont, colour, _blockWidth/2, _blockWidth/2, ALLEGRO_ALIGN_CENTRE , "GOTCHA"); + + al_set_target_bitmap(prev_draw); +} diff --git a/source/presentation/BitmapStore.h b/source/presentation/BitmapStore.h new file mode 100644 index 0000000..b551698 --- /dev/null +++ b/source/presentation/BitmapStore.h @@ -0,0 +1,140 @@ +#ifndef BITMAPSTORE_H +#define BITMAPSTORE_H + +#include +#include +using namespace std; + +#include +#include +#include +#include +#include + +#include "../logic/AllegroWrappers.h" + +/** +* @brief Class for accessing images in ALLEGRO_BITMAP format and low level drawing. +* +* The store ensures that only one copy of identical images are created. +* This is done through a map, that caches the images that have already been requested. +* If an uncached image is requested, it is added to the cache before being returned. +* The store provides an enumerated type, Image, for other classes to reference which image +* should represent the object on the screen. +* +* All images are square, to allow easy rotation and placement on the screen. +* +* @author Justin Wernick +* @author David Schneider +*/ +class BitmapStore +{ + public: + /** + * @brief Constructor for creating a BitmapStore with a set image size. + * + * @param [in] blockWidth The width (and height) of an image returned by the store in pixels. + */ + BitmapStore(unsigned int blockWidth); + /** + * @brief Destructor for clearing cache. + */ + ~BitmapStore(); + + /** + * @brief Type used to define which image should be returned. + */ + enum Image {PLAYER, ENEMY, ROCK, CHECKPOINT, MAZE_WALL, MAZE_FLOOR, SMOKE, CRASHED_CAR, CLAIMED_CHECKPOINT}; + + /** + * @brief Function to get image for drawing to the screen. + * + * @param [in] image Image to be returned. + * @return Requested image in ALLEGRO_BITMAP format. + */ + ALLEGRO_BITMAP* getBitmap(Image image); + + private: + /** + * @brief Unimplemented copy constructor, prevents copying of BitmapStore objects. + * + * Copying a BitmapStore is unneccesary as there should only be a single BitmapStore object. + */ + BitmapStore(const BitmapStore& ref); + /** + * @brief Unimplemented assignment operator. + * + * @see BitmapStore(const BitmapStore& ref); + */ + BitmapStore& operator=(const BitmapStore& rhs); + + /** + * @brief Draws the image representing the player. + * + * @param [out] canvas ALLEGRO_BITMAP onto which the image is drawn. + */ + void drawPlayerCar(ALLEGRO_BITMAP* canvas); + /** + * @brief Draws the image representing an enemy. + * + * @param [out] canvas ALLEGRO_BITMAP onto which the image is drawn. + */ + void drawEnemyCar(ALLEGRO_BITMAP* canvas); + /** + * @brief Draws the image representing a rock. + * + * @param [out] canvas ALLEGRO_BITMAP onto which the image is drawn. + */ + void drawRock(ALLEGRO_BITMAP* canvas); + /** + * @brief Draws the image representing a checkpoint. + * + * @param [out] canvas ALLEGRO_BITMAP onto which the image is drawn. + */ + void drawCheckpoint(ALLEGRO_BITMAP* canvas); + /** + * @brief Draws the image representing a solid part of the maze. + * + * @param [out] canvas ALLEGRO_BITMAP onto which the image is drawn. + */ + void drawMazeWall(ALLEGRO_BITMAP* canvas); + /** + * @brief Draws the image representing a non-solid part of the maze. + * + * @param [out] canvas ALLEGRO_BITMAP onto which the image is drawn. + */ + void drawMazeFloor(ALLEGRO_BITMAP* canvas); + /** + * @brief Draws the image representing a smokescreen. + * + * @param [out] canvas ALLEGRO_BITMAP onto which the image is drawn. + */ + void drawSmoke(ALLEGRO_BITMAP* canvas); + /** + * @brief Draws the popup that appears when a car crashes. + * + * @param [out] canvas ALLEGRO_BITMAP onto which the image is drawn. + */ + void drawCrashedCar(ALLEGRO_BITMAP* canvas); + /** + * @brief Draws the popup that appears when a checkpoint is collected. + * + * @param [out] canvas ALLEGRO_BITMAP onto which the image is drawn. + */ + void drawClaimedCheckpoint(ALLEGRO_BITMAP* canvas); + + AllegroDrawingInit _drawingInstalls; ///< Ensures that Allegro is initialized while an object of this class exists + + ALLEGRO_FONT* _bitmapFont; ///< Font used for writing text on bitmaps. + + /** + * @brief map containing pairs of Images (the enumerated type) and the actual images. + * + * Creates a cache for images once they have been drawn. + */ + map _bitmaps; + + unsigned int _blockWidth; ///< The width of a square image in the store +}; + +#endif // BITMAPSTORE_H diff --git a/source/presentation/ColourStore.cpp b/source/presentation/ColourStore.cpp new file mode 100644 index 0000000..e08b6f8 --- /dev/null +++ b/source/presentation/ColourStore.cpp @@ -0,0 +1,25 @@ +#include "ColourStore.h" + +ColourStore::ColourStore() +{ + populateColours(); +} + +void ColourStore::populateColours() +{ + _colours[BitmapStore::PLAYER] = al_map_rgb(0,255,255); + _colours[BitmapStore::ENEMY] = al_map_rgb(255,0,0); + _colours[BitmapStore::CHECKPOINT] = al_map_rgb(0,255,0); + _colours[BitmapStore::MAZE_WALL] = al_map_rgb(255,255,255); + _colours[BitmapStore::MAZE_FLOOR] = al_map_rgb(0,0,0); + _transparent = al_map_rgba(0,0,0,0); +} + +ALLEGRO_COLOR ColourStore::getColour(BitmapStore::Image image) +{ + if (_colours.find(image) != _colours.end()) + { + return _colours[image]; + } + else return _transparent; +} diff --git a/source/presentation/ColourStore.h b/source/presentation/ColourStore.h new file mode 100644 index 0000000..8985099 --- /dev/null +++ b/source/presentation/ColourStore.h @@ -0,0 +1,60 @@ +#ifndef COLOURSTORE_H +#define COLOURSTORE_H + +#include + +#include "../presentation/BitmapStore.h" + +/** +* @brief Class for mapping BitmapStore images to colours for use in the minimap. +* +* @author Justin Wernick +* @author David Schneider +*/ +class ColourStore +{ + public: + /** + * @brief Creates the ColourStore object and initialises all of the colours. + */ + ColourStore(); + + /** + * @brief Returns the colour associated with a given image. + * + * If no colour makes sense for the image, then when it is requested a colour + * with an alpha of 0 (completely transparent) is returned. + * + * @param [in] image The BitmapStore image to be associated with a colour. + * + * @return The requested colour. + */ + ALLEGRO_COLOR getColour(BitmapStore::Image image); + private: + /** + * @brief Unimplemented copy constructor, prevents copying of ColourStore objects. + * + * Copying a ColourStore is unneccesary as there should only be a single ColourStore object. + */ + ColourStore(const ColourStore& ref); + /** + * @brief Unimplemented assignment operator. + * + * @see ColourStore(const ColourStore& ref); + */ + ColourStore& operator=(const ColourStore& rhs); + + map _colours; + + /** + * @brief Initialised to have an alpha of 0, and returned when the colour of an unlisted image is requested. + */ + ALLEGRO_COLOR _transparent; + + /** + * @brief Initialises all of the relevant colours. + */ + void populateColours(); +}; + +#endif // COLOURSTORE_H diff --git a/source/presentation/GamePanel.cpp b/source/presentation/GamePanel.cpp new file mode 100644 index 0000000..71ef290 --- /dev/null +++ b/source/presentation/GamePanel.cpp @@ -0,0 +1,133 @@ +#include "GamePanel.h" + +GamePanel::GamePanel(ALLEGRO_BITMAP* back, ALLEGRO_BITMAP* front, int x, int y, int width, int height) + :ScreenPanel(back, front, x, y, width, height), + _mazeblockWidth(_width/BLOCKS_PER_ROW), + _offsetX(0), + _offsetY(0), + _bitmapStore(_mazeblockWidth) +{ +} + +void GamePanel::draw(const Maze& maze, const list& players, const list& enemies, const list& checkpoints, const list& rocks, const list& smokescreens, const list& popups) +{ + ALLEGRO_BITMAP* prev_draw = al_get_target_bitmap(); + al_set_target_bitmap(_back); + + al_clear_to_color(BLANK); + + float _maxOffsetX = getPanelX(maze.width()) - _width; + float _maxOffsetY = getPanelY(maze.height()) - _height; + + if (!players.empty()) + { + _offsetX = getPanelX(players.front().x()) - _width/2; + if (_offsetX < 0) _offsetX = 0; + else if (_offsetX > _maxOffsetX) _offsetX = _maxOffsetX; + + _offsetY = getPanelY(players.front().y()) - _height/2; + if (_offsetY < 0) _offsetY = 0; + else if (_offsetY > _maxOffsetY) _offsetY = _maxOffsetY; + } + + draw(maze); + + for (list::const_iterator iter = players.begin(); iter != players.end(); ++iter) + { + draw(*iter); + } + for (list::const_iterator iter = enemies.begin(); iter != enemies.end(); ++iter) + { + draw(*iter); + } + for (list::const_iterator iter = checkpoints.begin(); iter != checkpoints.end(); ++iter) + { + draw(*iter); + } + for (list::const_iterator iter = rocks.begin(); iter != rocks.end(); ++iter) + { + draw(*iter); + } + for (list::const_iterator iter = smokescreens.begin(); iter != smokescreens.end(); ++iter) + { + draw(*iter); + } + for (list::const_iterator iter = popups.begin(); iter != popups.end(); ++iter) + { + draw(*iter); + } + + al_set_target_bitmap(prev_draw); +} + +void GamePanel::draw(const Maze& maze) +{ + //only draws a parts of the maze that would appear on the screen + int minX = floor((_offsetX-_mazeblockWidth)/_mazeblockWidth); + int maxX = ceil((_offsetX+_width)/_mazeblockWidth); + int minY = floor((_offsetY-_mazeblockWidth)/_mazeblockWidth); + int maxY = ceil((_offsetY+_height)/_mazeblockWidth); + + ALLEGRO_BITMAP* wallBitmap = _bitmapStore.getBitmap(BitmapStore::MAZE_WALL); + ALLEGRO_BITMAP* floorBitmap = _bitmapStore.getBitmap(BitmapStore::MAZE_FLOOR); + //used to only have one al_draw_bitmap command + ALLEGRO_BITMAP* currentBitmap = floorBitmap; + for (int x=minX; x (_offsetX+_width)/_mazeblockWidth) return; + if (object.y() < (_offsetY-_mazeblockWidth)/_mazeblockWidth) return; + if (object.y() > (_offsetY+_height)/_mazeblockWidth) return; + + ALLEGRO_BITMAP* bitmap = _bitmapStore.getBitmap(object.image()); + + float angle = 0; + switch(object.facing()) + { + case Maze::UP: + angle = 0; + break; + case Maze::RIGHT: + angle = ALLEGRO_PI/2; + break; + case Maze::DOWN: + angle = ALLEGRO_PI; + break; + case Maze::LEFT: + angle = 3*ALLEGRO_PI/2; + break; + } + + float objectX = getPanelX(object.x()); + float objectY = getPanelY(object.y()); + float center = _mazeblockWidth/2; + + al_draw_rotated_bitmap(bitmap, center , center , objectX+center-_offsetX, objectY+center-_offsetY, angle, 0); +} + +float GamePanel::getPanelX(const double& x) const +{ + return static_cast(x*_mazeblockWidth); +} +float GamePanel::getPanelY(const double& y) const +{ + return static_cast(y*_mazeblockWidth); +} diff --git a/source/presentation/GamePanel.h b/source/presentation/GamePanel.h new file mode 100644 index 0000000..916ac13 --- /dev/null +++ b/source/presentation/GamePanel.h @@ -0,0 +1,117 @@ +#ifndef GAMEPANEL_H +#define GAMEPANEL_H + +#include "../presentation/ScreenPanel.h" +#include "../logic/Maze.h" +#include "../logic/GameObject.h" +#include "../logic/PlayerCar.h" +#include "../logic/EnemyCar.h" +#include "../logic/Checkpoint.h" +#include "../logic/Rock.h" +#include "../logic/Smokescreen.h" +#include "../logic/DestroyedObjectPopup.h" +#include "../logic/AllegroWrappers.h" + +/** +* @brief ScreenPanel to be drawn on the screen to draw the area where the game takes place. +* +* This includes the scrolling maze and all of the GameObjects. +* +* @author Justin Wernick +* @author David Schneider +*/ +class GamePanel : public ScreenPanel +{ + public: + /** + * @brief Creates a GamePanel from the given back and front buffers. + * + * The sub-bitmaps that GamePanel uses are created from a rectangular region on back and front + * that has its top left corner at the coordinate x,y, is width long in the x direction, and + * height long in the y direction. + * + * @param [in] back The current back buffer of the display being sub-bitmapped. + * @param [in] front The current front buffer (image currently being displayed) of the display being sub-bitmapped. + * @param [in] x The x coordinate of the left side of the sub-bitmap in pixels. + * @param [in] y The x coordinate of the top of the sub-bitmap in pixels. + * @param [in] width The length in the x direction of the new sub-bitmap in pixels. + * @param [in] height The length in the y direction of the new sub-bitmap in pixels. + */ + GamePanel(ALLEGRO_BITMAP* back, ALLEGRO_BITMAP* front, int x, int y, int width, int height); + + + /** + * @brief Draws the given objects on the screen. + * + * The drawing is offset so that the first entry in players is in the middle of the panel. + * However, the offset will never be such that the drawing area will be outside of the maze. + * + * @param [in] maze The Maze that all of the objects are in. + * @param [in] players The list of PlayerCars to be drawn. + * @param [in] enemies The list of EnemyCars to be drawn. + * @param [in] checkpoints The list of Checkpoints to be drawn. + * @param [in] rocks The list of Rocks to be drawn. + * @param [in] smokescreens The list of Smokescreens to be drawn. + * @param [in] popups The list of DestroyedObjectPopups to be drawn. + */ + virtual void draw(const Maze& maze, const list& players, const list& enemies, const list& checkpoints, const list& rocks, const list& smokescreens, const list& popups); + private: + /** + * @brief Copy constructor not implemented, ScreenPanels should not be copied. + */ + GamePanel(const GamePanel& ref); + /** + * @brief Assignment operator not implemented, ScreenPanels should not be copied. + */ + GamePanel& operator=(const GamePanel& rhs); + /** + * @brief Converts an x game coordinate value to its equivalent in pixels. + * + * Converting to the pixel coordinates happens for every object every frame. To increase + * performance, the parameters are passed in by constant reference instead of by value. + * + * @param [in] x The game coordinate to be converted into pixels. + */ + float getPanelX(const double& x) const; + /** + * @brief Converts a y game coordinate value to its equivalent in pixels. + * + * Converting to the pixel coordinates happens for every object every frame. To increase + * performance, the parameters are passed in by constant reference instead of by value. + * + * @param [in] y The game coordinate to be converted into pixels. + */ + float getPanelY(const double& y) const; + + /** + * @brief Draws a Maze on the screen. + * + * Bitmaps used to represent solid and non-solid parts of the Maze are stored in the + * BitmapStore. + * + * @param [in] maze The Maze to be drawn. + */ + void draw(const Maze& maze); + + /** + * @brief Draws a single GameObject on the screen. + * + * The bitmap to be drawn is retrieved from the BitmapStore using the GameObject's image. + * + * @param [in] object The GameObject to be drawn. + */ + void draw(const GameObject& object); + + const static int BLOCKS_PER_ROW = 15; ///< The number of Maze blocks in one row shown on the panel at a time. Used to determine the scale. + + unsigned int _mazeblockWidth; ///< The width of one (square) Maze block on the screen, in pixels. + + float _offsetX; ///< The amount that drawing should be offset to the right, recalculated every frame. + float _offsetY; ///< The amount that drawing should be offset downwards, recalculated every frame. + + BitmapStore _bitmapStore; ///< Used to cache ALLEGRO_BITMAPs, so that they only need to be drawn once. + + AllegroInit _allegro; ///< Handles dependencies on Allegro. +}; + +#endif // GAMEPANEL_H diff --git a/source/presentation/InfoPanel.cpp b/source/presentation/InfoPanel.cpp new file mode 100644 index 0000000..b4d33fa --- /dev/null +++ b/source/presentation/InfoPanel.cpp @@ -0,0 +1,111 @@ +#include "InfoPanel.h" + +InfoPanel::InfoPanel(ALLEGRO_BITMAP* back, ALLEGRO_BITMAP* front, int x, int y, int width, int height) + :ScreenPanel(back, front, x, y, width, height), + _petrolHeadingY(_width/10), + _petrolGuageY(_petrolHeadingY + _width/10), + _petrolGuageHeight(_width/10), + _checkpointHeadingY(_petrolGuageY + _petrolGuageHeight + _width/10), + _checkpointValueY(_checkpointHeadingY + _width/10), + _miniMazeY(_checkpointValueY + _width/5), + _miniMazeHeight(_height - _miniMazeY), + _miniMazeblockWidth(0) +{ + _panelFont = al_load_font("junction 02.ttf", _width/10, 0); + if (_panelFont == NULL) + { + al_show_native_message_box(NULL, "Fatal error", "Fatal error", "The file 'junction 02.ttf' was not found. Ensure that it is located in the working directory.", NULL, ALLEGRO_MESSAGEBOX_ERROR); + throw InstallFailure(); + } +} + +InfoPanel::~InfoPanel() +{ + al_destroy_font(_panelFont); +} + +void InfoPanel::draw(const Maze& maze, const list& players, const list& enemies, const list& checkpoints, const list& rocks, const list& smokescreens, const list& popups) +{ + ALLEGRO_BITMAP* prev_draw = al_get_target_bitmap(); + al_set_target_bitmap(_back); + + double petrol = 0; + if (!players.empty()) + { + petrol = players.front().petrol(); + } + + al_clear_to_color(_colourStore.getColour(BitmapStore::MAZE_FLOOR)); + + //gets a mazeblock width the fits the current maze + _miniMazeblockWidth = min(static_cast(_width)/maze.width(), static_cast(_miniMazeHeight)/maze.height()); + + //draws petrol heading and bar + al_draw_text(_panelFont, al_map_rgb(255,255,255), 1, _petrolHeadingY, ALLEGRO_ALIGN_LEFT , "Petrol"); + al_draw_filled_rectangle(0,_petrolGuageY,_width*petrol, _petrolGuageY+_petrolGuageHeight, al_map_rgb(255,128,0)); + + //draws checkpoints remaining heading and value + al_draw_text(_panelFont, al_map_rgb(255,255,255), 1, _checkpointHeadingY, ALLEGRO_ALIGN_LEFT , "Checkpoints"); + stringstream checkpointCountString; + checkpointCountString << Checkpoint::checkpointCount(); + al_draw_text(_panelFont, al_map_rgb(255,255,255), 1, _checkpointValueY, ALLEGRO_ALIGN_LEFT , checkpointCountString.str().c_str()); + + draw(maze); + for (list::const_iterator iter = players.begin(); iter != players.end(); ++iter) + { + draw(*iter); + } + for (list::const_iterator iter = enemies.begin(); iter != enemies.end(); ++iter) + { + draw(*iter); + } + for (list::const_iterator iter = checkpoints.begin(); iter != checkpoints.end(); ++iter) + { + draw(*iter); + } + + //restore draw target + al_set_target_bitmap(prev_draw); +} + +void InfoPanel::draw(const Maze& maze) +{ + ALLEGRO_COLOR wallColour = _colourStore.getColour(BitmapStore::MAZE_WALL); + ALLEGRO_COLOR floorColour = _colourStore.getColour(BitmapStore::MAZE_FLOOR); + + for (int x=0; x(x*_miniMazeblockWidth); +} +float InfoPanel::getPanelY(const double& y) const +{ + return static_cast(y*_miniMazeblockWidth); +} diff --git a/source/presentation/InfoPanel.h b/source/presentation/InfoPanel.h new file mode 100644 index 0000000..9af6a70 --- /dev/null +++ b/source/presentation/InfoPanel.h @@ -0,0 +1,140 @@ +#ifndef INFOPANEL_H +#define INFOPANEL_H + +#include +#include + +#include +using namespace std; + +#include "../presentation/ScreenPanel.h" +#include "../presentation/ColourStore.h" +#include "../logic/Maze.h" +#include "../logic/GameObject.h" +#include "../logic/PlayerCar.h" +#include "../logic/EnemyCar.h" +#include "../logic/Checkpoint.h" +#include "../logic/AllegroWrappers.h" + +/** +* @brief ScreenPanel to be drawn on the screen to give the player information. +* +* This includes the minimap, a scaled down version of the entire maze that does not scroll, with +* icons to represent the PlayerCar, EnemyCars, and Checkpoints. Text is drawn to show the player the +* number of Checkpoints that needed to be collected for victory, and a rectangle is drawn representing +* the amount of petrol that the PlayerCar has left. +* +* @author Justin Wernick +* @author David Schneider +*/ +class InfoPanel : public ScreenPanel +{ + public: + /** + * @brief Creates an InfoPanel from the given back and front buffers. + * + * The sub-bitmaps that InfoPanel uses are created from a rectangular region on back and front + * that has its top left corner at the coordinate x,y, is width long in the x direction, and + * height long in the y direction. + * + * @param [in] back The current back buffer of the display being sub-bitmapped. + * @param [in] front The current front buffer (image currently being displayed) of the display being sub-bitmapped. + * @param [in] x The x coordinate of the left side of the sub-bitmap in pixels. + * @param [in] y The x coordinate of the top of the sub-bitmap in pixels. + * @param [in] width The length in the x direction of the new sub-bitmap in pixels. + * @param [in] height The length in the y direction of the new sub-bitmap in pixels. + */ + InfoPanel(ALLEGRO_BITMAP* back, ALLEGRO_BITMAP* front, int x, int y, int width, int height); + + /** + * @brief Destructor that ensured that the font created is destroyed. + * + * The memory for the sub-bitmaps are handled by the parent class, ScreenPanel. + */ + ~InfoPanel(); + + /** + * @brief Draws the InfoPanel using the given objects. + * + * Not all of the provided objects are needed for the drawing process, but they are included + * to give the most general drawing case. This is to support polymorphism, where the InfoPanel + * can be told to draw its sub-bitmap in the same manner as any other ScreenPanel. + * + * The scale of the minimap is determined at the beginning of each frame, so that it will + * always fit even if the maze is larger than on the last frame. + * + * @param [in] maze The Maze that all of the objects are in. + * @param [in] players The list of PlayerCars to be drawn. + * @param [in] enemies The list of EnemyCars to be drawn. + * @param [in] checkpoints The list of Checkpoints to be drawn. + * @param [in] rocks Rocks are not actually drawn. + * @param [in] smokescreens Smokescreens are not actually drawn. + * @param [in] popups DestroyedObjectPopups are not actually drawn. + */ + virtual void draw(const Maze& maze, const list& players, const list& enemies, const list& checkpoints, const list& rocks, const list& smokescreens, const list& popups); + private: + /** + * @brief Copy constructor not implemented, ScreenPanels should not be copied. + */ + InfoPanel(const InfoPanel& ref); + /** + * @brief Assignment operator not implemented, ScreenPanels should not be copied. + */ + InfoPanel& operator=(const InfoPanel& rhs); + /** + * @brief Converts an x game coordinate value to its equivalent in pixels. + * + * Converting to the pixel coordinates happens for every object every frame. To increase + * performance, the parameters are passed in by constant reference instead of by value. + * + * @param [in] x The game coordinate to be converted into pixels. + */ + float getPanelX(const double& x) const; + /** + * @brief Converts a y game coordinate value to its equivalent in pixels. + * + * Converting to the pixel coordinates happens for every object every frame. To increase + * performance, the parameters are passed in by constant reference instead of by value. + * + * @param [in] y The game coordinate to be converted into pixels. + */ + float getPanelY(const double& y) const; + + /** + * @brief Draws a Maze on the panel. + * + * The Maze is constructed of coloured squares. The colour of the squares is retrieved from + * the ColourStore. + * + * Unlike in the GamePanel, the entire Maze is drawn. + * + * @param [in] maze The Maze to be drawn. + */ + void draw(const Maze& maze); + + /** + * @brief Draws a single GameObject on the panel. + * + * The GameObject is represented by a coloured circle in the Maze. The colour is based on + * the GameObject's image and is retrieved from the ColourStore. + * + * @param [in] object The GameObject to be drawn. + */ + void draw(const GameObject& object); + + AllegroDrawingInit _drawing; ///< Handles dependencies on Allegro's primitive drawing functions. + ColourStore _colourStore; ///< Caches colours for drawing. + + float _petrolHeadingY; ///< The y coordinate of the heading for the petrol guage. + float _petrolGuageY; ///< The y coordinate of top of the petrol guage. + float _petrolGuageHeight; ///< The height of the rectangle that is the petrol guage. + float _checkpointHeadingY; ///< The y coordinate of the heading for the number of remaining checkpoints. + float _checkpointValueY; ///< The y coordinate of the text stating the number of remaining checkpoints. + float _miniMazeY; ///< The y coordinate of the top of the Maze. + float _miniMazeHeight; ///< The height of the Maze. + float _miniMazeblockWidth; ///< The width of each Maze block being drawn. + + ALLEGRO_FONT* _panelFont; ///< The font being used to write the headings and number of checkpoints remaining. +}; + +#endif // INFOPANEL_H diff --git a/source/presentation/KeyboardHandler.cpp b/source/presentation/KeyboardHandler.cpp new file mode 100644 index 0000000..b588cbe --- /dev/null +++ b/source/presentation/KeyboardHandler.cpp @@ -0,0 +1,114 @@ +#include "KeyboardHandler.h" + +KeyboardHandler::KeyboardHandler(Maze::Direction currentFacing) + :_up(false), + _down(false), + _left(false), + _right(false), + _smokescreen(false), + _previousFacing(currentFacing) +{ + _keyboardEvents = al_create_event_queue(); + al_register_event_source(_keyboardEvents, al_get_keyboard_event_source()); +} + +KeyboardHandler::KeyboardHandler(const KeyboardHandler& ref) + :_up(ref._up), + _down(ref._down), + _left(ref._left), + _right(ref._right), + _smokescreen(ref._smokescreen), + _previousFacing(ref._previousFacing) +{ + _keyboardEvents = al_create_event_queue(); + al_register_event_source(_keyboardEvents, al_get_keyboard_event_source()); +} + +KeyboardHandler& KeyboardHandler::operator=(const KeyboardHandler& rhs) +{ + _up = rhs._up; + _down = rhs._down; + _left = rhs._left; + _right = rhs._right; + _smokescreen = rhs._smokescreen; + _previousFacing = rhs._previousFacing; + + if (_keyboardEvents!=rhs._keyboardEvents) al_destroy_event_queue(_keyboardEvents); + + _keyboardEvents = al_create_event_queue(); + al_register_event_source(_keyboardEvents, al_get_keyboard_event_source()); + + return *this; +} + +KeyboardHandler::~KeyboardHandler() +{ + al_destroy_event_queue(_keyboardEvents); +} + +void KeyboardHandler::updateFlags() +{ + ALLEGRO_EVENT event; + while (al_get_next_event(_keyboardEvents, &event)) + { + if (event.type==ALLEGRO_EVENT_KEY_DOWN) + { + switch (event.keyboard.keycode) + { + case UP_KEY: + _up = true; + break; + case DOWN_KEY: + _down = true; + break; + case LEFT_KEY: + _left = true; + break; + case RIGHT_KEY: + _right = true; + break; + case SMOKESCREEN_KEY: + _smokescreen = true; + break; + } + } + else if (event.type==ALLEGRO_EVENT_KEY_UP) + { + switch (event.keyboard.keycode) + { + case UP_KEY: + _up = false; + break; + case DOWN_KEY: + _down = false; + break; + case LEFT_KEY: + _left = false; + break; + case RIGHT_KEY: + _right = false; + break; + case SMOKESCREEN_KEY: + _smokescreen = false; + break; + } + } + } +} + +Maze::Direction KeyboardHandler::getFacing() +{ + updateFlags(); + + if (_up) _previousFacing = Maze::UP; + else if (_down) _previousFacing = Maze::DOWN; + else if (_left) _previousFacing = Maze::LEFT; + else if (_right) _previousFacing = Maze::RIGHT; + + return _previousFacing; +} + +bool KeyboardHandler::getSmokescreen() +{ + return _smokescreen; +} diff --git a/source/presentation/KeyboardHandler.h b/source/presentation/KeyboardHandler.h new file mode 100644 index 0000000..00d7821 --- /dev/null +++ b/source/presentation/KeyboardHandler.h @@ -0,0 +1,83 @@ +#ifndef KEYBOARDHANDLER_H +#define KEYBOARDHANDLER_H + +#include + +#include "../logic/Maze.h" +#include "../logic/AllegroWrappers.h" + +/** +* @brief Class for handling keyboard related game inputs from the player. +* +* Written with controlling a PlayerCar in mind. The handler keeps track of the last direction +* pushed and responds to requests from the PlayerCar for which direction it should face next, +* and whether the player is pressing the Smokescreen button. +* +* @author Justin Wernick +* @author David Schneider +*/ +class KeyboardHandler +{ + public: + /** + * @brief Creates a KeyboardHandler with a given initial state. + * + * @param [in] currentFacing The initial value for the previous facing of the object being controlled. + */ + KeyboardHandler(Maze::Direction currentFacing); + /** + * @brief Copy constructor that ensures that a copy of a KeyboardHandler will have its own event queue. + */ + KeyboardHandler(const KeyboardHandler& ref); + /** + * @brief Assignment operator that ensures that an assigned KeyboardHandler will have its own event queue. + */ + KeyboardHandler& operator=(const KeyboardHandler& rhs); + /** + * @brief Cleans up the keyboard event queue + */ + ~KeyboardHandler(); + + /** + * @brief Gives the last direction that the player entered on the keyboard. + * + * All pending keyboard events are processed, then a key out of those currently depressed is returned. + * The precendence for keys held down (up, down, left, then right) is arbitrary, since the player + * should not be holding down more than one arrow key at a time. + * If no keys are currently depressed, the value returned on the last call is returned again. + * + * @return The direction that the player has chosen through pressing arrow keys. + */ + Maze::Direction getFacing(); + + /** + * @brief Gives whether or not the key for creating a Smokescreen is currently pressed. + * + * @return True if a Smokescreen should be created. + */ + bool getSmokescreen(); + + private: + AllegroKeyboardInit _keyboard; ///< Ensures that dependencies on the Allegro keyboard library are installed. + + /** + * @brief Processes all pending keyboard inputs, and updates flags as appropriate. + */ + void updateFlags(); + + bool _up; ///< True if the up arrow key is depressed. + bool _down; ///< True if the down arrow key is depressed. + bool _left; ///< True if the left arrow key is depressed. + bool _right; ///< True if the right arrow key is depressed. + bool _smokescreen; ///< True if the smokescreen key is depressed. + Maze::Direction _previousFacing; ///< The direction that was returned on the last call of getFacing. + ALLEGRO_EVENT_QUEUE* _keyboardEvents; ///< Queue for all keyboard events. + + static const int UP_KEY = ALLEGRO_KEY_UP; ///< Key that must be pressed to turn up. + static const int DOWN_KEY = ALLEGRO_KEY_DOWN; ///< Key that must be pressed to turn down. + static const int LEFT_KEY = ALLEGRO_KEY_LEFT; ///< Key that must be pressed to turn left. + static const int RIGHT_KEY = ALLEGRO_KEY_RIGHT; ///< Key that must be pressed to turn right. + static const int SMOKESCREEN_KEY = ALLEGRO_KEY_SPACE; ///< Key that must be pressed to create a smokescreen. +}; + +#endif // KEYBOARDHANDLER_H diff --git a/source/presentation/Screen.cpp b/source/presentation/Screen.cpp new file mode 100644 index 0000000..0f5ba4c --- /dev/null +++ b/source/presentation/Screen.cpp @@ -0,0 +1,159 @@ +#include "Screen.h" + +Screen::Screen(unsigned int screenWidth, unsigned int screenHeight, bool fullscreen) + :_exitClicked(false), + _screenWidth(screenWidth), + _screenHeight(screenHeight), + _gameAreaWidth(_screenWidth*0.75), + _infoPanelWidth(_screenWidth - _gameAreaWidth) +{ + if (fullscreen) + { + al_set_new_display_flags(ALLEGRO_FULLSCREEN_WINDOW); + if (!resolutionSupported()) + { + al_show_native_message_box(NULL, "Fatal error", "Fatal error", "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.", NULL, ALLEGRO_MESSAGEBOX_ERROR); + throw BadResolution(); + } + } + else + { + al_set_new_display_flags(ALLEGRO_WINDOWED); + //need to add error checking for windows that are way too big + } + + al_set_new_display_option(ALLEGRO_VSYNC, 1, ALLEGRO_SUGGEST); + + _display = al_create_display(_screenWidth, _screenHeight); + + al_hide_mouse_cursor(_display); + _windowEvents = al_create_event_queue(); + al_register_event_source(_windowEvents, al_get_display_event_source(_display)); + //used so that ESC can be pressed to exit. + al_register_event_source(_windowEvents, al_get_keyboard_event_source()); + + _font = al_load_font("junction 02.ttf", _screenWidth/10, 0); + if (_font == NULL) + { + al_show_native_message_box(NULL, "Fatal error", "Fatal error", "The file 'junction 02.ttf' was not found. Ensure that it is located in the working directory.", NULL, ALLEGRO_MESSAGEBOX_ERROR); + al_destroy_event_queue(_windowEvents); + al_destroy_display(_display); + throw InstallFailure(); + } + + ALLEGRO_BITMAP* front = al_get_backbuffer(_display); + al_flip_display(); + ALLEGRO_BITMAP* back = al_get_backbuffer(_display); + + _panels.push_back(new GamePanel(back, front, 0, 0, _gameAreaWidth, _screenHeight)); + _panels.push_back(new InfoPanel(back, front, _gameAreaWidth, 0, _infoPanelWidth, _screenHeight)); +} + +Screen::~Screen() +{ + for (vector::iterator iter = _panels.begin(); iter!=_panels.end(); ++iter) + { + delete (*iter); + } + _panels.clear(); + + al_destroy_font(_font); + al_destroy_event_queue(_windowEvents); + al_destroy_display(_display); +} + +string Screen::getLevel() +{ + string result(""); + ALLEGRO_FILECHOOSER* filechooser = al_create_native_file_dialog(".", "Choose your level", "*.lvl",ALLEGRO_FILECHOOSER_FILE_MUST_EXIST); + al_show_native_file_dialog(_display, filechooser); + if (al_get_native_file_dialog_count(filechooser)==0) + { + _exitClicked = true; + } + else + { + result = al_get_native_file_dialog_path(filechooser, 0); + } + + al_destroy_native_file_dialog(filechooser); + return result; +} + +void Screen::draw(const Maze& maze, const list& players, const list& enemies, const list& checkpoints, const list& rocks, const list& smokescreens, const list& popups) +{ + for (vector::iterator iter = _panels.begin(); iter!=_panels.end(); ++iter) + { + (*iter)->draw(maze, players, enemies, checkpoints, rocks, smokescreens, popups); + } + flip(); +} + +void Screen::flip() +{ + al_flip_display(); + for (vector::iterator iter = _panels.begin(); iter!=_panels.end(); ++iter) + { + (*iter)->flip(); + } +} + +void Screen::drawWin() +{ + flip(); + + ALLEGRO_COLOR transBlack = al_map_rgba(0,0,0,200); + al_draw_filled_rectangle(0,0,_screenWidth,_screenHeight, transBlack); + + ALLEGRO_COLOR textColour = al_map_rgb(255,255,255); + al_draw_text(_font, textColour, _screenWidth/2, _screenHeight/2, ALLEGRO_ALIGN_CENTRE , "You win!"); + + flip(); +} + +void Screen::drawLoss() +{ + flip(); + + ALLEGRO_COLOR transBlack = al_map_rgba(0,0,0,200); + al_draw_filled_rectangle(0,0,_screenWidth,_screenHeight, transBlack); + + ALLEGRO_COLOR textColour = al_map_rgb(255,255,255); + al_draw_text(_font, textColour, _screenWidth/2, _screenHeight/2, ALLEGRO_ALIGN_CENTRE , "You lose!"); + + flip(); +} + +bool Screen::exitClicked() +{ + if (_exitClicked) return true; + + ALLEGRO_EVENT event; + while (al_get_next_event(_windowEvents, &event)) + { + if (event.type==ALLEGRO_EVENT_DISPLAY_CLOSE || (event.type==ALLEGRO_EVENT_KEY_CHAR && event.keyboard.keycode==ALLEGRO_KEY_ESCAPE)) + { + al_flush_event_queue(_windowEvents); + _exitClicked = true; + return true; + } + } + + return false; +} + +bool Screen::resolutionSupported() +{ + ALLEGRO_DISPLAY_MODE mode; + for (int i=0; i(mode.width)==_screenWidth && static_cast(mode.height)==_screenHeight) + { + return true; + } + } + + return false; +} diff --git a/source/presentation/Screen.h b/source/presentation/Screen.h new file mode 100644 index 0000000..16d8cee --- /dev/null +++ b/source/presentation/Screen.h @@ -0,0 +1,159 @@ +#ifndef SCREEN_H +#define SCREEN_H + +#include +#include +#include +using namespace std; + +#include +#include + +#include "../logic/Maze.h" +#include "../logic/GameObject.h" +#include "../logic/PlayerCar.h" +#include "../logic/EnemyCar.h" +#include "../logic/Checkpoint.h" +#include "../logic/Rock.h" +#include "../logic/Smokescreen.h" +#include "../logic/DestroyedObjectPopup.h" +#include "../logic/AllegroWrappers.h" + +#include "../presentation/GamePanel.h" +#include "../presentation/InfoPanel.h" + +/** +* @brief Exception that is thrown if the Config file requests a resolution that can not work. +* +* @author Justin Wernick +* @author David Schneider +*/ +class BadResolution{}; + +/** +* @brief Class for creating a window on the screen. +* +* Anything involving drawing on the screen is the responsibility of this class. Most of these +* responsibilities are outsourced through creating ScreenPanels with more specialised tasks, +* such as drawing specifically the area where the gameplay takes place (GamePanel) or the +* providing the player with information (InfoPanel). +* +* @author Justin Wernick +* @author David Schneider +*/ +class Screen +{ + public: + /** + * @brief Creates a Screen with the given width and height in pixels, and the given fullscreen setting. + * + * @param [in] screenWidth The width of the display that will be created in pixels. + * @param [in] screenHeight The height of the display that will be created in pixels. + * @param [in] fullscreen True if the game should be in fullscreen mode. False otherwise. + */ + Screen(unsigned int screenWidth, unsigned int screenHeight, bool fullscreen); + + /** + * @brief Destructor to ensure that the display and any ScreenPanels are destroyed properly. + */ + ~Screen(); + + /** + * @brief Presents the player with a file dialog, requesting a level file to be selected. + * + * If the cancel button is clicked, and empty string is returned and exitClicked() will return + * true on its next call. + * + * @return The path of the level file, or an empty string if no file was selected. + */ + string getLevel(); + + /** + * @brief Draws the given objects on the screen. + * + * The objects are passed to each of the ScreenPanels in turn, and then the buffers + * are flipped. + * + * @param [in] maze The Maze that all of the objects are in. + * @param [in] players The list of PlayerCars to be drawn. + * @param [in] enemies The list of EnemyCars to be drawn. + * @param [in] checkpoints The list of Checkpoints to be drawn. + * @param [in] rocks The list of Rocks to be drawn. + * @param [in] smokescreens The list of Smokescreens to be drawn. + * @param [in] popups The list of DestroyedObjectPopups to be drawn. + */ + void draw(const Maze& maze, const list& players, const list& enemies, const list& checkpoints, const list& rocks, const list& smokescreens, const list& popups); + + /** + * @brief Function to find if the player has chosen to exit the game. + * + * The game can be exited by clicking the x in the corner of the window, pressing the ESC key + * during the game, or by clicking 'cancel' on the file selection dialog. + * + * @return True if the game should be quit. + */ + bool exitClicked(); + + /** + * @brief Draws a splash screen when the level has been won. + */ + void drawWin(); + /** + * @brief Draws a splash screen when the level has been lost. + */ + void drawLoss(); + + private: + /** + * @brief Unimplemented copy constructor, prevents copying of Screen objects. + * + * Copying a Screen is unneccesary as there should only be a single Screen object. + */ + Screen(const Screen& ref); + /** + * @brief Unimplemented assignment operator. + * + * @see Screen(const Screen& ref) + */ + Screen& operator=(const Screen& rhs); + + /** + * @brief Flips the display's buffers, as well as those for all of the ScreenPanels. + */ + void flip(); + + /** + * @brief Checks the current resolution (_screenWidth and _screenHeight) against the screen's supported resolutions. + * + * Used to test if a fullscreen mode selection will launch without issue. + * + * @return True if the current resolution is supported. + */ + bool resolutionSupported(); + + AllegroInit _allegro; ///< Ensures that Allegro has been installed, for event queues and creating the display. + AllegroKeyboardInit _keyboard; ///< Ensures that the keyboard has been installed, for checking for the ESC key. + AllegroDrawingInit _drawing; ///< Ensures that drawing operations have been installed, for drawing splash screens. + + bool _exitClicked; ///< Set to true when the user chooses to quit the game. + + unsigned int _screenWidth; ///< Horizontal number of pixels per row on the screen. + unsigned int _screenHeight; ///< Vertical number of pixels per column on the screen. + + unsigned int _gameAreaWidth; ///< Width of the GamePanel created. + unsigned int _infoPanelWidth; ///< Width of the InfoPanel created. The InfoPanel is placed directly to the right of the GamePanel. + + ALLEGRO_DISPLAY* _display; ///< The window created on the player's monitor to see the game. + ALLEGRO_EVENT_QUEUE* _windowEvents; ///< Events caught by the screen, checked for an exit command. + ALLEGRO_FONT* _font; ///< Font used in drawing splash screens. + + /** + * @brief Polymorphic container used to encapsulate the different types of drawing to the screen. + * + * Since the memory of the ScreenPanels in the vector is allocated dynamically, it must be deallocated + * in the destructor. + */ + vector _panels; +}; + +#endif // SCREEN_H diff --git a/source/presentation/ScreenPanel.cpp b/source/presentation/ScreenPanel.cpp new file mode 100644 index 0000000..db2db69 --- /dev/null +++ b/source/presentation/ScreenPanel.cpp @@ -0,0 +1,24 @@ +#include "ScreenPanel.h" + +const ALLEGRO_COLOR ScreenPanel::BLANK = al_map_rgb(0,0,0); + +ScreenPanel::ScreenPanel(ALLEGRO_BITMAP* back, ALLEGRO_BITMAP* front, int x, int y, int width, int height) + :_width(width), + _height(height) +{ + _back = al_create_sub_bitmap(back, x, y, _width, _height); + _front = al_create_sub_bitmap(front, x, y, _width, _height); +} + +ScreenPanel::~ScreenPanel() +{ + al_destroy_bitmap(_back); + al_destroy_bitmap(_front); +} + +void ScreenPanel::flip() +{ + ALLEGRO_BITMAP* temp = _back; + _back = _front; + _front = temp; +} diff --git a/source/presentation/ScreenPanel.h b/source/presentation/ScreenPanel.h new file mode 100644 index 0000000..13b4978 --- /dev/null +++ b/source/presentation/ScreenPanel.h @@ -0,0 +1,98 @@ +#ifndef SCREENPANEL_H +#define SCREENPANEL_H + +#include + +#include "../logic/Maze.h" +#include "../logic/GameObject.h" +#include "../logic/PlayerCar.h" +#include "../logic/EnemyCar.h" +#include "../logic/Checkpoint.h" +#include "../logic/Rock.h" +#include "../logic/Smokescreen.h" +#include "../logic/DestroyedObjectPopup.h" +#include "../logic/AllegroWrappers.h" + +/** +* @brief Parent class for panels that are drawn on the screen. +* +* Panels are given a sub-bitmap of the Screen bitmap, which they draw their panel specific outputs on. +* The ScreenPanel class is subclassed to give specific drawing functions, like drawing the Maze and +* GameObjects on the screen. +* +* When the object is created, the back bitmap and front bitmap should correspond to the back and front buffers +* of the display respectively. This should be kept in sync by calling flip every time the display is flipped. +* +* @author Justin Wernick +* @author David Schneider +*/ +class ScreenPanel +{ + public: + /** + * @brief Creates a ScreenPanel from the given back and front buffers. + * + * The sub-bitmaps that ScreenPanel uses are created from a rectangular region on back and front + * that has its top left corner at the coordinate x,y, is width long in the x direction, and + * height long in the y direction. + * + * @param [in] back The current back buffer of the display being sub-bitmapped. + * @param [in] front The current front buffer (image currently being displayed) of the display being sub-bitmapped. + * @param [in] x The x coordinate of the left side of the sub-bitmap in pixels. + * @param [in] y The x coordinate of the top of the sub-bitmap in pixels. + * @param [in] width The length in the x direction of the new sub-bitmap in pixels. + * @param [in] height The length in the y direction of the new sub-bitmap in pixels. + */ + ScreenPanel(ALLEGRO_BITMAP* back, ALLEGRO_BITMAP* front, int x, int y, int width, int height); + + /** + * @brief Destructor to ensure that sub-bitmap memory is deallocated. + */ + virtual ~ScreenPanel(); + + /** + * @brief Pure virtual method for drawing a collection of objects onto the panel. + * + * Implementations do not need to draw all of the objects if it is not neccesary for the + * type of panel, but the interface accepts all of them to be general. + * + * @param [in] maze The Maze that all of the objects are in. + * @param [in] players The list of PlayerCars to be drawn. + * @param [in] enemies The list of EnemyCars to be drawn. + * @param [in] checkpoints The list of Checkpoints to be drawn. + * @param [in] rocks The list of Rocks to be drawn. + * @param [in] smokescreens The list of Smokescreens to be drawn. + * @param [in] popups The list of DestroyedObjectPopups to be drawn. + */ + virtual void draw(const Maze& maze, const list& players, const list& enemies, const list& checkpoints, const list& rocks, const list& smokescreens, const list& popups) = 0; + + /** + * @brief Swaps the front and back buffers. + * + * This function should be called every time the display is flipped. + */ + virtual void flip(); + + protected: + static const ALLEGRO_COLOR BLANK; ///< Colour used to clear the screen at the beginning of drawing operations. + + ALLEGRO_BITMAP* _back; ///< The back buffer. Only the back buffer can be drawn to. + + int _width; ///< The width of the sub-bitmaps being drawn to in pixels. + int _height; ///< The height of the sub-bitmaps being drawn to in pixels. + private: + /** + * @brief Copy constructor not implemented, ScreenPanels should not be copied. + */ + ScreenPanel(const ScreenPanel& ref); + /** + * @brief Assignment operator not implemented, ScreenPanels should not be copied. + */ + ScreenPanel& operator=(const ScreenPanel& rhs); + + AllegroInit _allegro; ///< Handles dependencies on Allegro being initialised. + + ALLEGRO_BITMAP* _front; ///< The front buffer, that is currently being shown on the screen. +}; + +#endif // SCREENPANEL_H diff --git a/tests/dataTests.cpp b/tests/dataTests.cpp new file mode 100644 index 0000000..6bf553e --- /dev/null +++ b/tests/dataTests.cpp @@ -0,0 +1,184 @@ +/** @file dataTests.cpp +* @brief Unit tests for the data layer of a Rally-X game. +* +* The functionality of each class in the data layer was tested. +* +* The Config class was tested in terms of its ability to read an existing config file, +* as well as its ability to create a new file with default values, or fill missing parameters +* with default values. +* +* The LevelReader class was tested in the normal case, where a correct level file is given, +* and in the case where a file that does not exist is given. +* +* @author Justin Wernick +* @author David Schneider +*/ + +#include +#include +using namespace std; + +#include + +#include "../source/data/Config.h" +#include "../source/data/LevelReader.h" +#include "../source/logic/PlayerCar.h" +#include "../source/logic/EnemyCar.h" +#include "../source/logic/Checkpoint.h" +#include "../source/logic/Rock.h" +#include "../source/logic/Smokescreen.h" +#include "../source/logic/Maze.h" + +/** +* @brief Tests that a normal complete config file can be read. +*/ +TEST(Config, readsSettingsCorrectly) +{ + string testFilepath = "testConfig.txt"; + ofstream testFile(testFilepath.c_str()); + + testFile << "screen_width=123" << endl; + testFile << "screen_height=345" << endl; + testFile << "fullscreen=true" << endl; + + testFile.close(); + + Config testConfig(testFilepath); + + EXPECT_EQ((unsigned)(123), testConfig.screenWidth()); + EXPECT_EQ((unsigned)(345), testConfig.screenHeight()); + EXPECT_TRUE(testConfig.fullscreen()); + + remove(testFilepath.c_str()); +} + +/** +* @brief Tests that, if the config file does not exist, it is created with default values. +*/ +TEST(Config, createsFileIfNeeded) +{ + string testFilepath = "testConfig.txt"; + Config testConfig(testFilepath); + + ifstream testFile(testFilepath.c_str()); + EXPECT_TRUE(testFile); + testFile.close(); + + //test for default values + EXPECT_EQ((unsigned)(800), testConfig.screenWidth()); + EXPECT_EQ((unsigned)(600), testConfig.screenHeight()); + EXPECT_FALSE(testConfig.fullscreen()); + + remove(testFilepath.c_str()); +} + +/** +* @brief Tests that an incomplete config file is loaded, with defaults for the missing values. +*/ +TEST(Config, incompleteFileFilled) +{ + string testFilepath = "testConfig.txt"; + ofstream testFile(testFilepath.c_str()); + + testFile << "screen_height=345" << endl; + + testFile.close(); + + Config testConfig(testFilepath); + + EXPECT_EQ((unsigned)(800), testConfig.screenWidth()); + EXPECT_EQ((unsigned)(345), testConfig.screenHeight()); + EXPECT_FALSE(testConfig.fullscreen()); + + remove(testFilepath.c_str()); +} + +/** +* @brief Tests that a level can be loaded correctly from a file. +*/ +TEST(LevelReader, readsFileInfoObjects) +{ + string testFilepath = "testMaze.lvl"; + ofstream testFile(testFilepath.c_str()); + + testFile << " P X " << endl; + testFile << " " << endl; + testFile << " @ " << endl; + testFile << " X" << endl; + testFile << "## " << endl; + testFile << " P " << endl; + testFile << " O " << endl; + + testFile.close(); + + LevelReader testReader(testFilepath); + Maze maze; + list players; + list enemies; + list checkpoints; + list rocks; + testReader.readLevel(maze, players, enemies, checkpoints, rocks); + + list expectedPlayers; + list expectedEnemies; + list expectedCheckpoints; + list expectedRocks; + + expectedPlayers.push_back(PlayerCar(3,2)); + expectedEnemies.push_back(EnemyCar(3,0)); + expectedEnemies.push_back(EnemyCar(5,3)); + expectedCheckpoints.push_back(Checkpoint(2,0)); + expectedCheckpoints.push_back(Checkpoint(3,5)); + expectedRocks.push_back(Rock(2,6)); + + //eqality operator was not implemented for the GameObject class or its subclasses + //because it would not be meaningful. Two objects with the same position, type, and facing + //are still two different objects. + //iterators were used because the list type does not have an 'at' function. + list::const_iterator playIter = players.begin(); + EXPECT_FLOAT_EQ(playIter->x(), 3); + EXPECT_FLOAT_EQ(playIter->y(), 2); + ++playIter; + EXPECT_EQ(playIter, players.end()); + + list::const_iterator enemyIter = enemies.begin(); + EXPECT_FLOAT_EQ(enemyIter->x(), 3); + EXPECT_FLOAT_EQ(enemyIter->y(), 0); + ++enemyIter; + EXPECT_FLOAT_EQ(enemyIter->x(), 5); + EXPECT_FLOAT_EQ(enemyIter->y(), 3); + ++enemyIter; + EXPECT_EQ(enemyIter, enemies.end()); + + list::const_iterator checkIter = checkpoints.begin(); + EXPECT_FLOAT_EQ(checkIter->x(), 1); + EXPECT_FLOAT_EQ(checkIter->y(), 0); + ++checkIter; + EXPECT_FLOAT_EQ(checkIter->x(), 3); + EXPECT_FLOAT_EQ(checkIter->y(), 5); + ++checkIter; + EXPECT_EQ(checkIter, checkpoints.end()); + + list::const_iterator rockIter = rocks.begin(); + EXPECT_FLOAT_EQ(rockIter->x(), 2); + EXPECT_FLOAT_EQ(rockIter->y(), 6); + ++rockIter; + EXPECT_EQ(rockIter, rocks.end()); + + remove(testFilepath.c_str()); +} + +/** +* @brief Tests that an exception is throws if the selected file does not exist. +*/ +TEST(LevelReader, throwsExceptionOnBadFilename) +{ + string testFilepath = "testLevel.lvl"; + LevelReader testReader(testFilepath); + Maze maze; + list players; + list enemies; + list checkpoints; + list rocks; + EXPECT_ANY_THROW(testReader.readLevel(maze, players, enemies, checkpoints, rocks)); +} diff --git a/tests/logicTests.cpp b/tests/logicTests.cpp new file mode 100644 index 0000000..97d9ed9 --- /dev/null +++ b/tests/logicTests.cpp @@ -0,0 +1,685 @@ +/** @file logicTests.cpp +* @brief Unit tests for the logic layer of a Rally-X game. +* +* The classes used to run Allegro's install and uninstall functions were tested indirectly +* through the use of other classes. If the AllegroWrappers classes are not working, they will +* result in tests failing, or the program crashing. +* +* The Car class's movement is tested through implementing a subclass of Car, PlayerCar, facing +* in a given direction with and without maze walls in the way, and testing its position after +* a frame has passed. +* +* The counting system with the Checkpoint class is tested through repeated creation and +* destruction of Checkpoint objects. +* +* The CollisionDetecter class is tested by setting up situations with each type of collision, +* and checking that they have the desired results on the objects involved. +* +* The DestroyedObjectPopup class is tested to ensure that it lasts the desired amount of time +* before being destroyed. +* +* The intelligence of the EnemyCar class is not unit tested, as it may change as extra states +* and AI schemes are implemented, possibly including a random element. Therefore, it should be +* tested manually by playing example levels and monitoring if the enemies appear to behave in +* a manner that makes gameplay interesting. +* +* The Game class is not tested directly. It pulls all of the units being tested together into +* a complete game, and so should be tested by running the Game. +* +* The GameObject class is tested indirectly through testing its subclasses. +* +* The LimitedTimeObject class is tested indirectly through the DestroyedObjectPopup and Smokescreen classes. +* +* The Maze class is tested in terms of its ability to construct itself correctly from a list of +* coordinates. It is also tested with the PlayerCar class where the movement of the PlayerCar is +* tested in a Maze. +* +* The MazeMath class is tested by running each of its functions with expected input and output values. +* +* The PlayerCar class is tested on its ability to move correctly as part of the tests for the Car class. +* The functioning of the PlayerCar's petrol system is also tested. Controlling of the PlayerCar +* is not tested, and should be tested manually by running the game and verifying that the arrow keys +* cause the direction of the PlayerCar to change appropriately. Further, the creation of Smokescreens +* by pressing the spacebar should also be tested manually. +* +* The Rock class only has functionality in collisions, and so is tested through the CollisionDetector's +* tests. +* +* The Smokescreen class is tested in that it disappears after a set time. Its affect on the EnemyCar class +* is tested through the CollisionDetector's tests. +* +* @author Justin Wernick +* @author David Schneider +*/ + +#include +#include +#include +using namespace std; + +#include + +#include "../source/logic/CollisionDetector.h" +#include "../source/logic/PlayerCar.h" +#include "../source/logic/EnemyCar.h" +#include "../source/logic/Checkpoint.h" +#include "../source/logic/Rock.h" +#include "../source/logic/Smokescreen.h" +#include "../source/logic/Maze.h" +#include "../source/logic/MazeMath.h" +#include "../source/logic/DestroyedObjectPopup.h" + +/** +* @brief Tests that PlayerCar moves the correct amount in the up direction on each frame without obstacles. +*/ +TEST(Car, updateMovesPlayerUpInEmptyMaze) +{ + Maze testMaze; + vector > walls; + testMaze.generateMaze(walls,5,5); + + PlayerCar player(2,2,Maze::UP); + + list smokescreens; + player.update(testMaze, smokescreens); + + double expectX = 2; + double expectY = 2-player.speed(); + EXPECT_FLOAT_EQ(expectX, player.x()); + EXPECT_FLOAT_EQ(expectY, player.y()); +} + +/** +* @brief Tests that PlayerCar moves the correct amount in the down direction on each frame without obstacles. +*/ +TEST(Car, updateMovesPlayerDownInEmptyMaze) +{ + Maze testMaze; + vector > walls; + testMaze.generateMaze(walls,5,5); + + PlayerCar player(2,2,Maze::DOWN); + + list smokescreens; + player.update(testMaze, smokescreens); + + double expectX = 2; + double expectY = 2+player.speed(); + EXPECT_FLOAT_EQ(expectX, player.x()); + EXPECT_FLOAT_EQ(expectY, player.y()); +} + +/** +* @brief Tests that PlayerCar moves the correct amount in the left direction on each frame without obstacles. +*/ +TEST(Car, updateMovesPlayerLeftInEmptyMaze) +{ + Maze testMaze; + vector > walls; + testMaze.generateMaze(walls,5,5); + + PlayerCar player(2,2,Maze::LEFT); + + list smokescreens; + player.update(testMaze, smokescreens); + + double expectX = 2-player.speed(); + double expectY = 2; + EXPECT_FLOAT_EQ(expectX, player.x()); + EXPECT_FLOAT_EQ(expectY, player.y()); +} + +/** +* @brief Tests that PlayerCar moves the correct amount in the right direction on each frame without obstacles. +*/ +TEST(Car, updateMovesPlayerRightInEmptyMaze) +{ + Maze testMaze; + vector > walls; + testMaze.generateMaze(walls,5,5); + + PlayerCar player(2,2,Maze::RIGHT); + + list smokescreens; + player.update(testMaze, smokescreens); + + double expectX = 2+player.speed(); + double expectY = 2; + EXPECT_FLOAT_EQ(expectX, player.x()); + EXPECT_FLOAT_EQ(expectY, player.y()); +} + +/** +* @brief Tests that PlayerCar does not move up if the path is blocked. +*/ +TEST(Car, carNotMovedWhenPathUpBlocked) +{ + Maze testMaze; + vector > walls; + walls.push_back(make_pair(3,3)); + testMaze.generateMaze(walls,5,5); + + PlayerCar player(3,4,Maze::UP); + + list smokescreens; + player.update(testMaze, smokescreens); + + double expectX = 3; + double expectY = 4; + EXPECT_FLOAT_EQ(expectX, player.x()); + EXPECT_FLOAT_EQ(expectY, player.y()); +} +/** +* @brief Tests that PlayerCar does not move down if the path is blocked. +*/ +TEST(Car, carNotMovedWhenPathDownBlocked) +{ + Maze testMaze; + vector > walls; + walls.push_back(make_pair(3,3)); + testMaze.generateMaze(walls,5,5); + + PlayerCar player(3,2,Maze::DOWN); + + list smokescreens; + player.update(testMaze, smokescreens); + + double expectX = 3; + double expectY = 2; + EXPECT_FLOAT_EQ(expectX, player.x()); + EXPECT_FLOAT_EQ(expectY, player.y()); +} +/** +* @brief Tests that PlayerCar does not move left if the path is blocked. +*/ +TEST(Car, carNotMovedWhenPathLeftBlocked) +{ + Maze testMaze; + vector > walls; + walls.push_back(make_pair(3,3)); + testMaze.generateMaze(walls,5,5); + + PlayerCar player(4,3,Maze::LEFT); + + list smokescreens; + player.update(testMaze, smokescreens); + + double expectX = 4; + double expectY = 3; + EXPECT_FLOAT_EQ(expectX, player.x()); + EXPECT_FLOAT_EQ(expectY, player.y()); +} +/** +* @brief Tests that PlayerCar does not move right if the path is blocked. +*/ +TEST(Car, carNotMovedWhenPathRightBlocked) +{ + Maze testMaze; + vector > walls; + walls.push_back(make_pair(3,3)); + testMaze.generateMaze(walls,5,5); + + PlayerCar player(2,3,Maze::RIGHT); + + list smokescreens; + player.update(testMaze, smokescreens); + + double expectX = 2; + double expectY = 3; + EXPECT_FLOAT_EQ(expectX, player.x()); + EXPECT_FLOAT_EQ(expectY, player.y()); +} + +/** +* @brief Tests that PlayerCar does not move up if currently on the top row of the maze. +*/ +TEST(Car, carDoesNotMoveUpOutMaze) +{ + Maze testMaze; + vector > walls; + testMaze.generateMaze(walls,5,5); + + PlayerCar player(3,0,Maze::UP); + + list smokescreens; + player.update(testMaze, smokescreens); + + double expectX = 3; + double expectY = 0; + EXPECT_FLOAT_EQ(expectX, player.x()); + EXPECT_FLOAT_EQ(expectY, player.y()); +} +/** +* @brief Tests that PlayerCar does not move down if currently on the bottom row of the maze. +*/ +TEST(Car, carDoesNotMoveDownOutMaze) +{ + Maze testMaze; + vector > walls; + testMaze.generateMaze(walls,5,5); + + PlayerCar player(3,5,Maze::DOWN); + + list smokescreens; + player.update(testMaze, smokescreens); + + double expectX = 3; + double expectY = 5; + EXPECT_FLOAT_EQ(expectX, player.x()); + EXPECT_FLOAT_EQ(expectY, player.y()); +} +/** +* @brief Tests that PlayerCar does not move left if currently on the first column of the maze. +*/ +TEST(Car, carDoesNotMoveLeftOutMaze) +{ + Maze testMaze; + vector > walls; + testMaze.generateMaze(walls,5,5); + + PlayerCar player(0,3,Maze::LEFT); + + list smokescreens; + player.update(testMaze, smokescreens); + + double expectX = 0; + double expectY = 3; + EXPECT_FLOAT_EQ(expectX, player.x()); + EXPECT_FLOAT_EQ(expectY, player.y()); +} +/** +* @brief Tests that PlayerCar does not move right if currently on the last column of the maze. +*/ +TEST(Car, carDoesNotMoveRightOutMaze) +{ + Maze testMaze; + vector > walls; + testMaze.generateMaze(walls,5,5); + + PlayerCar player(5,3,Maze::RIGHT); + + list smokescreens; + player.update(testMaze, smokescreens); + + double expectX = 5; + double expectY = 3; + EXPECT_FLOAT_EQ(expectX, player.x()); + EXPECT_FLOAT_EQ(expectY, player.y()); +} + +/** +* @brief Tests that counting of the number of checkpoints happens correctly. +*/ +TEST(Checkpoint, countIncrementsAndDecrements) +{ + vector checkpoints; + EXPECT_EQ(0, Checkpoint::checkpointCount()); + + for (int i=0; i<1000; ++i) + { + checkpoints.push_back(Checkpoint(i,i)); + } + EXPECT_EQ(1000, Checkpoint::checkpointCount()); + + //brackets to limit scope + { + Checkpoint extraCheck1(0,0); + Checkpoint extraCheck2 = extraCheck1; + EXPECT_EQ(1002, Checkpoint::checkpointCount()); + extraCheck2 = extraCheck1; + EXPECT_EQ(1002, Checkpoint::checkpointCount()); + } + EXPECT_EQ(1000, Checkpoint::checkpointCount()); + + while(!checkpoints.empty()) + { + checkpoints.pop_back(); + } + EXPECT_EQ(0, Checkpoint::checkpointCount()); +} + +/** +* @brief Tests that when a player and enemy overlap, both are marked for destruction. +*/ +TEST(CollisionDetector, playerAndEnemyBothDestroyed) +{ + list players; + list enemies; + list checkpoints; + list rocks; + list smokescreens; + CollisionDetector detector; + + players.push_back(PlayerCar(5,5)); + players.push_back(PlayerCar(5,6)); + players.push_back(PlayerCar(6,5)); + players.push_back(PlayerCar(7,7.5)); + + enemies.push_back(EnemyCar(5,6)); + enemies.push_back(EnemyCar(4,5)); + enemies.push_back(EnemyCar(6,6)); + enemies.push_back(EnemyCar(6.5,8)); + + detector.checkCollisions(players, enemies, checkpoints, rocks, smokescreens); + + list::const_iterator playerIter = players.begin(); + EXPECT_FALSE(playerIter->destroyed()); + ++playerIter; + EXPECT_TRUE(playerIter->destroyed()); + ++playerIter; + EXPECT_FALSE(playerIter->destroyed()); + ++playerIter; + EXPECT_TRUE(playerIter->destroyed()); + + list::const_iterator enemyIter = enemies.begin(); + EXPECT_TRUE(enemyIter->destroyed()); + ++enemyIter; + EXPECT_FALSE(enemyIter->destroyed()); + ++enemyIter; + EXPECT_FALSE(enemyIter->destroyed()); + ++enemyIter; + EXPECT_TRUE(enemyIter->destroyed()); +} + +/** +* @brief Tests that when a player and rock overlap, only the player is marked for destruction. +*/ +TEST(CollisionDetector, playerDestroyedByRock) +{ + list players; + list enemies; + list checkpoints; + list rocks; + list smokescreens; + CollisionDetector detector; + + players.push_back(PlayerCar(5,5)); + players.push_back(PlayerCar(5,6)); + players.push_back(PlayerCar(6,5)); + players.push_back(PlayerCar(7,7.5)); + + rocks.push_back(Rock(5,6)); + rocks.push_back(Rock(4,5)); + rocks.push_back(Rock(6,6)); + rocks.push_back(Rock(6.5,8)); + + detector.checkCollisions(players, enemies, checkpoints, rocks, smokescreens); + + list::const_iterator playerIter = players.begin(); + EXPECT_FALSE(playerIter->destroyed()); + ++playerIter; + EXPECT_TRUE(playerIter->destroyed()); + ++playerIter; + EXPECT_FALSE(playerIter->destroyed()); + ++playerIter; + EXPECT_TRUE(playerIter->destroyed()); + + list::const_iterator rockIter = rocks.begin(); + EXPECT_FALSE(rockIter->destroyed()); + ++rockIter; + EXPECT_FALSE(rockIter->destroyed()); + ++rockIter; + EXPECT_FALSE(rockIter->destroyed()); + ++rockIter; + EXPECT_FALSE(rockIter->destroyed()); +} + +/** +* @brief Tests that when a player and checkpoint overlap, only the checkpoint is marked for destruction. +*/ +TEST(CollisionDetector, checkpointDestroyedByPlayer) +{ + list players; + list enemies; + list checkpoints; + list rocks; + list smokescreens; + CollisionDetector detector; + + players.push_back(PlayerCar(5,5)); + players.push_back(PlayerCar(5,6)); + players.push_back(PlayerCar(6,5)); + players.push_back(PlayerCar(7,7.5)); + + checkpoints.push_back(Checkpoint(5,6)); + checkpoints.push_back(Checkpoint(4,5)); + checkpoints.push_back(Checkpoint(6,6)); + checkpoints.push_back(Checkpoint(6.5,8)); + + detector.checkCollisions(players, enemies, checkpoints, rocks, smokescreens); + + list::const_iterator playerIter = players.begin(); + EXPECT_FALSE(playerIter->destroyed()); + ++playerIter; + EXPECT_FALSE(playerIter->destroyed()); + ++playerIter; + EXPECT_FALSE(playerIter->destroyed()); + ++playerIter; + EXPECT_FALSE(playerIter->destroyed()); + + list::const_iterator checkpointIter = checkpoints.begin(); + EXPECT_TRUE(checkpointIter->destroyed()); + ++checkpointIter; + EXPECT_FALSE(checkpointIter->destroyed()); + ++checkpointIter; + EXPECT_FALSE(checkpointIter->destroyed()); + ++checkpointIter; + EXPECT_TRUE(checkpointIter->destroyed()); +} + +/** +* @brief Tests that when an enemy and smokescreen overlap, the enemy's speed becomes zero. +*/ +TEST(CollisionDetector, enemyStoppedBySmokescreen) +{ + list players; + list enemies; + list checkpoints; + list rocks; + list smokescreens; + CollisionDetector detector; + + enemies.push_back(EnemyCar(5,5)); + enemies.push_back(EnemyCar(5,6)); + enemies.push_back(EnemyCar(6,5)); + enemies.push_back(EnemyCar(7,7.5)); + + smokescreens.push_back(Smokescreen(5,6)); + smokescreens.push_back(Smokescreen(4,5)); + smokescreens.push_back(Smokescreen(6,6)); + smokescreens.push_back(Smokescreen(6.5,8)); + + detector.checkCollisions(players, enemies, checkpoints, rocks, smokescreens); + + list::const_iterator enemyIter = enemies.begin(); + EXPECT_GT(enemyIter->speed(),0); + ++enemyIter; + EXPECT_FLOAT_EQ(0, enemyIter->speed()); + ++enemyIter; + EXPECT_GT(enemyIter->speed(),0); + ++enemyIter; + EXPECT_FLOAT_EQ(0, enemyIter->speed()); +} + +/** +* @brief Tests that a DestroyedObjectPopup is destroyed 30 frames after it is created. +*/ +TEST(DestroyedObjectPopup, destroyedAfterSetTime) +{ + DestroyedObjectPopup testPopup(3,2,BitmapStore::CRASHED_CAR); + + int i=0; + while (!testPopup.destroyed()) + { + testPopup.update(); + ++i; + } + + EXPECT_EQ(30,i); +} + +/** +* @brief Tests that the maze treats the undefined area outside its bounds as being walls. +*/ +TEST(Maze, queryOutsideBoundsReturnsSolid) +{ + Maze testMaze; + vector > walls; + testMaze.generateMaze(walls,5,5); + + EXPECT_FALSE(testMaze.getSolid(5,5)); + EXPECT_FALSE(testMaze.getSolid(0,0)); + EXPECT_TRUE(testMaze.getSolid(6,5)); + EXPECT_TRUE(testMaze.getSolid(5,6)); + EXPECT_TRUE(testMaze.getSolid(-1,3)); + EXPECT_TRUE(testMaze.getSolid(3,-1)); +} + +/** +* @brief Tests that a maze can be generated without extending the width and height for objects. +*/ +TEST(Maze, generationWithWallsWithoutObjectMax) +{ + Maze testMaze; + vector > walls; + walls.push_back(make_pair(1,2)); + walls.push_back(make_pair(4,3)); + testMaze.generateMaze(walls); + + //test random empty blocks + EXPECT_FALSE(testMaze.getSolid(2,1)); + EXPECT_FALSE(testMaze.getSolid(0,0)); + + //test wall blocks + EXPECT_TRUE(testMaze.getSolid(1,2)); + EXPECT_TRUE(testMaze.getSolid(4,3)); + + //test bounds are being set right + EXPECT_TRUE(testMaze.getSolid(4,4)); + EXPECT_TRUE(testMaze.getSolid(5,3)); +} + +/** +* @brief Tests that a maze can be generated with extending the width and height for objects. +*/ +TEST(Maze, generationWithWallsWithObjectMax) +{ + Maze testMaze; + vector > walls; + walls.push_back(make_pair(1,2)); + walls.push_back(make_pair(4,3)); + testMaze.generateMaze(walls,5,6); + + //test random empty blocks + EXPECT_FALSE(testMaze.getSolid(2,1)); + EXPECT_FALSE(testMaze.getSolid(0,0)); + + //test wall blocks + EXPECT_TRUE(testMaze.getSolid(1,2)); + EXPECT_TRUE(testMaze.getSolid(4,3)); + + //test bounds are being set right + EXPECT_FALSE(testMaze.getSolid(4,4)); + EXPECT_FALSE(testMaze.getSolid(5,6)); + EXPECT_TRUE(testMaze.getSolid(6,6)); + EXPECT_TRUE(testMaze.getSolid(5,7)); +} + +/** +* @brief Tests that the formula for a straight line distance works as expected. +*/ +TEST(MazeMath, distanceGivesExpectedResult) +{ + //right angle triange with sides of length 3, 4, and 5 + double x1 = 1; + double y1 = 1; + double x2 = 4; + double y2 = 5; + + double expectedResult = 5; + + EXPECT_DOUBLE_EQ(expectedResult, MazeMath::distance(x1,y1,x2,y2)); +} + +/** +* @brief Tests that rounding off function works as expected. +*/ +TEST(MazeMath, roundGivesExpectedResult) +{ + //right angle triange with sides of length 3, 4, and 5 + double roundUp = 5.5; + double roundDown = 5.49; + + double expectUp = 6; + double expectDown = 5; + + EXPECT_DOUBLE_EQ(expectUp, MazeMath::round(roundUp)); + EXPECT_DOUBLE_EQ(expectDown, MazeMath::round(roundDown)); +} + +/** +* @brief Tests that a PlayerCar can be created and destroyed repeatedly without incident. +* +* This tests that the PlayerCar can handle its own dependencies on Allegro, even when +* copy constructors are used (through vector). +*/ +TEST(PlayerCar, creationAndDestructionCanHappen) +{ + EXPECT_NO_THROW({ + vector players; + for (int i=0; i<10; ++i) + { + players.push_back(PlayerCar(i,i)); + } + while(!players.empty()) + { + players.pop_back(); + } + }); + + EXPECT_FALSE(al_is_system_installed()); +} + +/** +* @brief Tests that the player's petrol runs out, and that the player's speed is halved after that. +* +* Also tests that the speed is recovered if petrol is increased again. +*/ +TEST(PlayerCar, playerSpeedAffectedByPetrol) +{ + Maze testMaze; + vector > walls; + testMaze.generateMaze(walls,5,5); + + PlayerCar player(5,3,Maze::RIGHT); + + list smokescreens; + for (int i=0; i<1429; ++i) + { + player.update(testMaze, smokescreens); + } + + EXPECT_FLOAT_EQ(0, player.petrol()); + EXPECT_FLOAT_EQ(0.05, player.speed()); + + player.gotCheckpoint(); + EXPECT_GT(player.petrol(), 0); + EXPECT_FLOAT_EQ(0.1, player.speed()); +} + +/** +* @brief Tests that a Smokescreen is destroyed 60 frames after it is created. +*/ +TEST(Smokescreen, destroyedAfterSetTime) +{ + Smokescreen testSmokescreen(3,2); + + int i=0; + while (!testSmokescreen.destroyed()) + { + testSmokescreen.update(); + ++i; + } + + EXPECT_EQ(60,i); +} diff --git a/tests/presentationTests.cpp b/tests/presentationTests.cpp new file mode 100644 index 0000000..d07ac99 --- /dev/null +++ b/tests/presentationTests.cpp @@ -0,0 +1,248 @@ +/** @file presentationTests.cpp +* @brief Unit tests for the presentation layer of a Rally-X game. +* +* The BitmapStore class is tested in its ability to return a bitmap for +* each image. The appearance of the bitmaps need to be tested manually +* by running the game and inspecting the various objects. +* +* The ColourStore class is tested in its ability to return a colour for +* each image. The appearance of the colours need to be tested manually +* by running the game and inspecting the various objects. +* +* The GamePanel and InfoPanel classes depend on their visual appearance in +* the game. Therefore, they should be tested manually. The technical part +* of their functionality, creating the back and front buffers and changing +* between them, is handled by their superclass, ScreenPanel. +* +* The KeyboardHandler depends on user inputs. It should be tested manually +* by testing that the player's direction can be controlled, and that smokescreens +* can be created. +* +* The Screen class's creation with various resolutions and fullscreen settings is +* tested. An exception should be thrown if the fullscreen resolution is not supported +* by the current hardware, but not otherwise. The visual appearance and creation of +* ScreenPanels should be tested manually by running the game. +* +* The ScreenPanel class is tested by creating a false back and front display buffer. The buffer +* that is being drawn to is tested by sampling a pixel in the middle of the buffer. +* +* @author Justin Wernick +* @author David Schneider +*/ + +#include +#include +using namespace std; + +#include + +#include "../source/presentation/BitmapStore.h" +#include "../source/presentation/ColourStore.h" +#include "../source/presentation/GamePanel.h" +#include "../source/presentation/Screen.h" + +#include "../source/logic/PlayerCar.h" +#include "../source/logic/EnemyCar.h" +#include "../source/logic/Checkpoint.h" +#include "../source/logic/Rock.h" +#include "../source/logic/Smokescreen.h" +#include "../source/logic/Maze.h" +#include "../source/logic/DestroyedObjectPopup.h" + +/** +* @brief Tests that all images can be requested without failure occuring. +*/ +TEST(BitmapStore, returnsBitmapForAllImages) +{ + BitmapStore testStore(50); + + ALLEGRO_BITMAP* testBitmap = NULL; + + EXPECT_NO_FATAL_FAILURE(testBitmap = testStore.getBitmap(BitmapStore::PLAYER)); + EXPECT_NO_FATAL_FAILURE(testBitmap = testStore.getBitmap(BitmapStore::ENEMY)); + EXPECT_NO_FATAL_FAILURE(testBitmap = testStore.getBitmap(BitmapStore::CHECKPOINT)); + EXPECT_NO_FATAL_FAILURE(testBitmap = testStore.getBitmap(BitmapStore::ROCK)); + EXPECT_NO_FATAL_FAILURE(testBitmap = testStore.getBitmap(BitmapStore::MAZE_WALL)); + EXPECT_NO_FATAL_FAILURE(testBitmap = testStore.getBitmap(BitmapStore::MAZE_FLOOR)); + EXPECT_NO_FATAL_FAILURE(testBitmap = testStore.getBitmap(BitmapStore::SMOKE)); + EXPECT_NO_FATAL_FAILURE(testBitmap = testStore.getBitmap(BitmapStore::CRASHED_CAR)); + EXPECT_NO_FATAL_FAILURE(testBitmap = testStore.getBitmap(BitmapStore::CLAIMED_CHECKPOINT)); +} + +/** +* @brief Tests that all colours can be requested without failure occuring. +*/ +TEST(ColourStore, returnsColourForAllImages) +{ + ColourStore testStore; + + ALLEGRO_COLOR testColour; + + EXPECT_NO_FATAL_FAILURE(testColour = testStore.getColour(BitmapStore::PLAYER)); + EXPECT_NO_FATAL_FAILURE(testColour = testStore.getColour(BitmapStore::ENEMY)); + EXPECT_NO_FATAL_FAILURE(testColour = testStore.getColour(BitmapStore::CHECKPOINT)); + EXPECT_NO_FATAL_FAILURE(testColour = testStore.getColour(BitmapStore::ROCK)); + EXPECT_NO_FATAL_FAILURE(testColour = testStore.getColour(BitmapStore::MAZE_WALL)); + EXPECT_NO_FATAL_FAILURE(testColour = testStore.getColour(BitmapStore::MAZE_FLOOR)); + EXPECT_NO_FATAL_FAILURE(testColour = testStore.getColour(BitmapStore::SMOKE)); + EXPECT_NO_FATAL_FAILURE(testColour = testStore.getColour(BitmapStore::CRASHED_CAR)); + EXPECT_NO_FATAL_FAILURE(testColour = testStore.getColour(BitmapStore::CLAIMED_CHECKPOINT)); +} + +/** +* Tests that an exception is thrown if fullscreen mode is requested on an unsupported monitor resolution. +*/ +TEST(Screen, exceptionOnBadResolution) +{ + //resolution should be unsupported on most displays + int badWidth = 1000; + int badHeight = 5; + + EXPECT_ANY_THROW(Screen(badWidth, badHeight, true)); +} +/** +* Tests that an exception is not thrown if windowed mode is requested on an unsupported monitor resolution. +*/ +TEST(Screen, noExceptionOnWindowed) +{ + int badWidth = 1000; + int badHeight = 5; + + EXPECT_NO_THROW(Screen(badWidth, badHeight, false)); + +} +/** +* Tests that an exception is not thrown if fullscreen mode is requested on a supported monitor resolution. +*/ +TEST(Screen, noExceptionOnGoodResolution) +{ + //resolution should be supported on most monitors + int goodWidth = 800; + int goodHeight = 600; + + EXPECT_NO_THROW(Screen(goodWidth, goodHeight, true)); +} + +/** +* @brief Tests that when a ScreenPanel draws to the back buffer provided. +*/ +TEST(ScreenPanel, drawingToCurrentBackBuffer) +{ + al_init(); + + ALLEGRO_BITMAP* testBitmapBack = al_create_bitmap(500,500); + ALLEGRO_BITMAP* testBitmapFront = al_create_bitmap(500,500); + + ALLEGRO_COLOR blankColour = al_map_rgb(0,0,0); + al_set_target_bitmap(testBitmapBack); + al_clear_to_color(blankColour); + al_set_target_bitmap(testBitmapFront); + al_clear_to_color(blankColour); + + GamePanel testPanel(testBitmapBack, testBitmapFront, 0, 0, 500, 500); + Maze testMaze; + + vector > wallsFull; + + for (int x=0; x<20; ++x) + { + for (int y=0; y<20; ++y) + { + wallsFull.push_back(make_pair(x,y)); + } + } + testMaze.generateMaze(wallsFull,20,20); + + list players; + list enemies; + list checkpoints; + list rocks; + list smokescreens; + list popups; + + testPanel.draw(testMaze, players, enemies, checkpoints, rocks, smokescreens, popups); + + BitmapStore bitmapStore(50); + ALLEGRO_BITMAP* wall = bitmapStore.getBitmap(BitmapStore::MAZE_WALL); + ALLEGRO_COLOR mazeColour = al_get_pixel(wall, 25, 25); + + ALLEGRO_COLOR backSample = al_get_pixel(testBitmapBack, 250, 250); + ALLEGRO_COLOR frontSample = al_get_pixel(testBitmapFront, 250, 250); + + EXPECT_FLOAT_EQ(mazeColour.r, backSample.r); + EXPECT_FLOAT_EQ(mazeColour.g, backSample.g); + EXPECT_FLOAT_EQ(mazeColour.b, backSample.b); + EXPECT_FLOAT_EQ(mazeColour.a, backSample.a); + + EXPECT_FLOAT_EQ(blankColour.r, frontSample.r); + EXPECT_FLOAT_EQ(blankColour.g, frontSample.g); + EXPECT_FLOAT_EQ(blankColour.b, frontSample.b); + EXPECT_FLOAT_EQ(blankColour.a, frontSample.a); + + al_destroy_bitmap(testBitmapBack); + al_destroy_bitmap(testBitmapFront); +} + +/** +* @brief Tests that when a ScreenPanel draws to the front buffer provided after a flip has been called. +*/ +TEST(ScreenPanel, drawingToCurrentBackBufferAfterFlip) +{ + al_init(); + + al_set_new_bitmap_flags(ALLEGRO_MEMORY_BITMAP); //removes dependency on display existing + + ALLEGRO_BITMAP* testBitmapBack = al_create_bitmap(500,500); + ALLEGRO_BITMAP* testBitmapFront = al_create_bitmap(500,500); + + ALLEGRO_COLOR blankColour = al_map_rgb(0,0,0); + al_set_target_bitmap(testBitmapBack); + al_clear_to_color(blankColour); + al_set_target_bitmap(testBitmapFront); + al_clear_to_color(blankColour); + + GamePanel testPanel(testBitmapBack, testBitmapFront, 0, 0, 500, 500); + Maze testMaze; + + vector > wallsFull; + + for (int x=0; x<20; ++x) + { + for (int y=0; y<20; ++y) + { + wallsFull.push_back(make_pair(x,y)); + } + } + testMaze.generateMaze(wallsFull,20,20); + + list players; + list enemies; + list checkpoints; + list rocks; + list smokescreens; + list popups; + + testPanel.flip(); + + testPanel.draw(testMaze, players, enemies, checkpoints, rocks, smokescreens, popups); + + BitmapStore bitmapStore(50); + ALLEGRO_BITMAP* wall = bitmapStore.getBitmap(BitmapStore::MAZE_WALL); + ALLEGRO_COLOR mazeColour = al_get_pixel(wall, 25, 25); + + ALLEGRO_COLOR backSample = al_get_pixel(testBitmapBack, 250, 250); + ALLEGRO_COLOR frontSample = al_get_pixel(testBitmapFront, 250, 250); + + EXPECT_FLOAT_EQ(mazeColour.r, frontSample.r); + EXPECT_FLOAT_EQ(mazeColour.g, frontSample.g); + EXPECT_FLOAT_EQ(mazeColour.b, frontSample.b); + EXPECT_FLOAT_EQ(mazeColour.a, frontSample.a); + + EXPECT_FLOAT_EQ(blankColour.r, backSample.r); + EXPECT_FLOAT_EQ(blankColour.g, backSample.g); + EXPECT_FLOAT_EQ(blankColour.b, backSample.b); + EXPECT_FLOAT_EQ(blankColour.a, backSample.a); + + al_destroy_bitmap(testBitmapBack); + al_destroy_bitmap(testBitmapFront); +} -- cgit v1.2.3