Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Map::Map(sf::RenderWindow &app)
- {
- Object *monsterdwa = new Object(app, 532, 164, "boss.png", "Mac");
- Object *monstertrzy = new Object(app, 364, 164, "King.png", "Hack");
- this->Mobki.push_back(*monsterdwa);
- this->Mobki.push_back(*monstertrzy);
- for(int i = 0, y = 0; y < 2500; y+= 750, i+= 750)
- //Konstruktor uzywa metody tej klasy
- populate(this->Area, i, y);
- }
- //Metoda updatująca mape
- void Map::Update(sf::RenderWindow &app)
- {
- for (std::list<sf::RectangleShape>::const_iterator it = Area.begin(); it != Area.end(); ++it)
- {
- app.draw(*it);
- }
- for(int index = Mobki.size()-1; index >= 0; index = index - 1)
- {
- app.draw(this->Mobki[index].sprite);
- }
- }
- void Map::populate(std::list<sf::RectangleShape>& Area, float x, float y)
- {
- /*wrzuca do listy kwadraty o rozmiarze 512, 512
- setposition() ustala pozycje, argumenty x i y wpisujemy do metody
- setFillColor() nadaje obiektowi klasy rectangle kolor bialy
- */
- sf::RectangleShape s(sf::Vector2f(512, 512));
- s.setPosition(x, y);
- s.setFillColor(sf::Color::White);
- Area.push_back(s);//Wrzuca do listy, ktora jest zadeklarowana w klasie.
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement