diff --git a/build-debug/sfml-test b/build-debug/sfml-test index 608749c..a1933ef 100755 Binary files a/build-debug/sfml-test and b/build-debug/sfml-test differ diff --git a/build-debug/test_map b/build-debug/test_map index 6a50c37..c4c0b65 100644 --- a/build-debug/test_map +++ b/build-debug/test_map @@ -1,8 +1,10 @@ size -5 5 +7 7 map -0 0 0 0 0 -0 0 1 0 0 -0 0 1 1 0 -1 1 2 2 2 -0 0 0 0 0 +2 2 2 2 2 2 2 +2 0 0 0 0 0 2 +2 0 0 1 0 0 2 +2 0 0 1 1 0 2 +2 1 1 2 2 2 2 +2 0 0 0 0 0 2 +2 2 2 2 2 2 2 diff --git a/build-release/sfml-test b/build-release/sfml-test index 159da13..4ebf91f 100755 Binary files a/build-release/sfml-test and b/build-release/sfml-test differ diff --git a/build-release/test_map b/build-release/test_map new file mode 100644 index 0000000..c4c0b65 --- /dev/null +++ b/build-release/test_map @@ -0,0 +1,10 @@ +size +7 7 +map +2 2 2 2 2 2 2 +2 0 0 0 0 0 2 +2 0 0 1 0 0 2 +2 0 0 1 1 0 2 +2 1 1 2 2 2 2 +2 0 0 0 0 0 2 +2 2 2 2 2 2 2 diff --git a/src/game.cpp b/src/game.cpp index ace2be9..686c098 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -21,6 +21,9 @@ Game::Game() main_window.create(sf::VideoMode(window_side * 3, window_side * 3), "SFML-Test Application", sf::Style::Default); main_window.setActive(); + level->mapArray()[0][0]->setHeightShift(15); + level->mapArray()[0][1]->setHeightShift(10); + current_level = 1; //loadLevel(current_level); } @@ -112,7 +115,7 @@ void Game::renderMap() { const Map &map = level->mapArray(); - float painter_x = 0, painter_y = 0; + float painter_x = 60, painter_y = 60; float horizontal_shift = 0, vertical_shift = 0; // Brush for cell sprites @@ -150,26 +153,26 @@ void Game::renderMap() vertical_shift = static_cast(map[y][x]->heightShift()); // If cell has any height value, we should draw walls for it - /*if (vertical_shift > 0) + if (vertical_shift > 0) { // Brush for vertical walls sf::ConvexShape convex_wall_brush; - convex_wall_brush.setPointCount(6); - convex_wall_brush.setPoint(0, sf::Vector2f(cell_deviation + cell_width, 0.f)); - convex_wall_brush.setPoint(1, sf::Vector2f(cell_deviation + cell_width, vertical_shift)); - convex_wall_brush.setPoint(2, sf::Vector2f(cell_width, cell_height + vertical_shift)); - convex_wall_brush.setPoint(3, sf::Vector2f(0.f, cell_height + vertical_shift)); - convex_wall_brush.setPoint(4, sf::Vector2f(0.f, cell_height)); - convex_wall_brush.setPoint(5, sf::Vector2f(cell_width, cell_height)); + convex_wall_brush.setPointCount(6); + convex_wall_brush.setPoint(0, sf::Vector2f(cell_deviation + cell_width, -vertical_shift)); + convex_wall_brush.setPoint(1, sf::Vector2f(cell_deviation + cell_width, 0.f)); + convex_wall_brush.setPoint(2, sf::Vector2f(cell_width, cell_height)); + convex_wall_brush.setPoint(3, sf::Vector2f(0.f, cell_height)); + convex_wall_brush.setPoint(4, sf::Vector2f(0.f, cell_height - vertical_shift)); + convex_wall_brush.setPoint(5, sf::Vector2f(cell_width, cell_height)); convex_wall_brush.setOutlineThickness(0); - sf::Color wall_color = map[y][x]->color(); - convex_wall_brush.setFillColor(wall_color); + sf::Color wall_color(sf::Uint8(map[y][x]->color().r - 40), sf::Uint8(map[y][x]->color().g - 40), sf::Uint8(map[y][x]->color().b - 40)); + convex_wall_brush.setFillColor(wall_color); - convex_wall_brush.setPosition(painter_x, painter_y); + convex_wall_brush.setPosition(painter_x + horizontal_shift, painter_y); main_window.draw(convex_wall_brush); - }*/ + } // Draw the top surface of the cell itself @@ -179,7 +182,7 @@ void Game::renderMap() convex_brush.setPosition(final_x, final_y); convex_brush.setFillColor(map[y][x]->color()); - main_window.draw(convex_brush); + main_window.draw(convex_brush); if (hero_row == y && hero_col == x) { @@ -194,7 +197,7 @@ void Game::renderMap() } // Move painter to next column - painter_y = 0; + painter_y = 60; painter_x += cell_width; }