diff options
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/src/main.cpp b/src/main.cpp index 9031e14..4640dfe 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -29,13 +29,19 @@ int main(int argc, char *argv[]) { // set the constants int the file that define the grid to be displayed. // for the mac - const int tile_size = 21; - const int rows = 41; - const int cols = 34; + // const int tile_size = 21; + // const int rows = 41; + // const int cols = 34; - // const int tile_size = 25; - // const int rows = 50; - // const int cols = 100; + const int tile_size = 25; + const int rows = 50; + const int cols = 100; + + const int start_x = 9; + const int start_y = 13; + + const int end_x = 89; + const int end_y = 38; // print out that information. cout << "tile size: " << tile_size << "px, rows: " << rows << ", cols: " << cols << endl; @@ -43,13 +49,9 @@ int main(int argc, char *argv[]) { // create the array of the right size using the constants. int tiles[cols * rows]; - // assign zeros to the tiles. for(int i = 0; i < cols * rows; ++i) tiles[i] = 0; - tiles[74] = 3; - tiles[41 * 34 - 85] = 2; - // create a tile map that will be used to display the array. TileMap map; @@ -79,9 +81,17 @@ int main(int argc, char *argv[]) { tiles[(int)(mouse.x / tile_size) + cols * (int)(mouse.y / tile_size)] = 0; } + for(int i = 0; i < cols * rows; ++i) + if(tiles[i] != 1) + tiles[i] = 0; + + tiles[start_y * cols + start_x] = 3; + tiles[end_y * rows + end_x] = 2; + + path_finder.start_algorithm(tiles, cols, rows); + // update tile map with the correct array. map.load("res/GridTileTexture5.png", sf::Vector2f(200, 200), sf::Vector2f(tile_size, tile_size), tiles, cols, rows); - path_finder.start_algorithm(tiles, cols, rows); // clear the screen. window.clear(sf::Color(47, 47, 47)); |