Commit ed2f7daa authored by Сулимов Игорь Андреевич's avatar Сулимов Игорь Андреевич
Browse files

FIxed bugs

parent b9fb1513
No related merge requests found
Showing with 0 additions and 54 deletions
+0 -54
...@@ -7,13 +7,11 @@ ...@@ -7,13 +7,11 @@
class Texture { class Texture {
public: public:
const sf::Texture& get_texture() const noexcept { return m_texture; } const sf::Texture& get_texture() const noexcept { return m_texture; }
void set_direction(config::Direction dir) { m_direction = dir; }
public: public:
Texture(const Texture& tex) = delete; Texture(const Texture& tex) = delete;
Texture& operator=(const Texture& tex) = delete; Texture& operator=(const Texture& tex) = delete;
protected: protected:
Texture() = default; Texture() = default;
protected: protected:
config::Direction m_direction = config::Direction::RIGHT;
sf::Texture m_texture; sf::Texture m_texture;
}; };
\ No newline at end of file
...@@ -14,7 +14,6 @@ public: ...@@ -14,7 +14,6 @@ public:
Room &room5, Room &room6, Room &room7, Room &room8); Room &room5, Room &room6, Room &room7, Room &room8);
private: private:
std::vector<std::reference_wrapper<Room>> m_rooms; std::vector<std::reference_wrapper<Room>> m_rooms;
// std::vector<std::array<sf::Vertex, 2>> lines;
std::vector<sf::RectangleShape> rectangles; std::vector<sf::RectangleShape> rectangles;
float line_thickness = 5.0f; float line_thickness = 5.0f;
}; };
\ No newline at end of file
...@@ -16,52 +16,6 @@ Teleport::Teleport(Room& room1, Room& room2, Room& room3, Room& room4, ...@@ -16,52 +16,6 @@ Teleport::Teleport(Room& room1, Room& room2, Room& room3, Room& room4,
m_rooms.emplace_back(std::ref(room8)); m_rooms.emplace_back(std::ref(room8));
} }
//void Teleport::prepare_for_drawing() {
// for (size_t i = 0; i < m_rooms.size(); ++i) {
// sf::Vector2f pos = m_rooms.at(i).get().get_position();
// switch (m_rooms.at(i).get().get_direction(this)) {
// case Room::LEFT:
// lines.emplace_back(std::array<sf::Vertex, 2>{
// sf::Vertex{sf::Vector2f(pos.x - m_rooms.at(i).get().get_size() / 2,
// pos.y - m_rooms.at(i).get().get_size() / 2), config::GAME_COLOR_TELEPORT},
// sf::Vertex{sf::Vector2f(pos.x - m_rooms.at(i).get().get_size() / 2,
// pos.y + m_rooms.at(i).get().get_size() / 2), config::GAME_COLOR_TELEPORT}
// });
// break;
//
// case Room::RIGHT:
// lines.emplace_back(std::array<sf::Vertex, 2>{
// sf::Vertex{sf::Vector2f(pos.x + m_rooms.at(i).get().get_size() / 2,
// pos.y - m_rooms.at(i).get().get_size() / 2), config::GAME_COLOR_TELEPORT},
// sf::Vertex{sf::Vector2f(pos.x + m_rooms.at(i).get().get_size() / 2,
// pos.y + m_rooms.at(i).get().get_size() / 2), config::GAME_COLOR_TELEPORT}
// });
// break;
//
// case Room::UP:
// lines.emplace_back(std::array<sf::Vertex, 2>{
// sf::Vertex{sf::Vector2f(pos.x - m_rooms.at(i).get().get_size() / 2,
// pos.y - m_rooms.at(i).get().get_size() / 2), config::GAME_COLOR_TELEPORT},
// sf::Vertex{sf::Vector2f(pos.x + m_rooms.at(i).get().get_size() / 2,
// pos.y - m_rooms.at(i).get().get_size() / 2), config::GAME_COLOR_TELEPORT}
// });
// break;
//
// case Room::DOWN:
// lines.emplace_back(std::array<sf::Vertex, 2>{
// sf::Vertex{sf::Vector2f(pos.x - m_rooms.at(i).get().get_size() / 2,
// pos.y + m_rooms.at(i).get().get_size() / 2), config::GAME_COLOR_TELEPORT},
// sf::Vertex{sf::Vector2f(pos.x + m_rooms.at(i).get().get_size() / 2,
// pos.y + m_rooms.at(i).get().get_size() / 2), config::GAME_COLOR_TELEPORT}
// });
// break;
//
// default:
// throw std::runtime_error("Invalid side in the room!");
// }
// }
//}
void Teleport::enter(IEntity* entity) { void Teleport::enter(IEntity* entity) {
size_t number = m_rooms.size(); size_t number = m_rooms.size();
for (size_t i = 0; i < number; ++i) { for (size_t i = 0; i < number; ++i) {
...@@ -70,11 +24,6 @@ void Teleport::enter(IEntity* entity) { ...@@ -70,11 +24,6 @@ void Teleport::enter(IEntity* entity) {
} }
} }
//void Teleport::draw_into(sf::RenderWindow& window) const {
// for (const auto& line : lines)
// window.draw(line.data(), 2, sf::Lines);
//}
void Teleport::prepare_for_drawing() { void Teleport::prepare_for_drawing() {
rectangles.clear(); // Очищаем предыдущие фигуры rectangles.clear(); // Очищаем предыдущие фигуры
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment