This repository has been archived on 2019-12-07. You can view files and clone it, but cannot push or open issues or pull requests.
dungeon-gunner/source/generator/Generator.h

43 lines
1.1 KiB
C
Raw Normal View History

2013-04-11 18:44:00 +00:00
/*
* Generator.h
*
* Created on: 07.04.2013
* Author: Felix
*/
#ifndef DG_GENERATOR_H_
#define DG_GENERATOR_H_
#include <SFML/Graphics.hpp>
2013-04-29 14:49:16 +00:00
#include "../sprites/Tile.h"
2013-04-29 14:49:16 +00:00
class World;
2013-04-28 16:11:39 +00:00
class Pathfinder;
2013-04-11 18:44:00 +00:00
class Generator {
public:
2013-04-29 14:49:16 +00:00
explicit Generator(World& world, Pathfinder& pathfinder);
void generateTiles(const sf::IntRect& area);
2013-04-11 18:44:00 +00:00
sf::Vector2f getPlayerSpawn() const;
private:
sf::Vector2i findClosestFloor(const sf::Vector2i& position) const;
2013-04-29 14:49:16 +00:00
static void fill(std::vector<std::vector<Tile::Type> >& image,
const sf::IntRect& area, Tile::Type value);
static void filterWalls(std::vector<std::vector<Tile::Type> >& in,
std::vector<std::vector<Tile::Type> >& out,
2013-04-11 18:44:00 +00:00
int x, int y, int longside, int shortside, int subtract);
2013-04-18 08:05:17 +00:00
static int countWalls(const sf::IntRect& area,
2013-04-29 14:49:16 +00:00
std::vector<std::vector<Tile::Type> >& tiles);
void generateAreas(std::vector<std::vector<Tile::Type> >& tiles,
const sf::IntRect& area, const sf::Vector2f& offset);
private:
2013-04-29 14:49:16 +00:00
World& mWorld;
Pathfinder& mPathfinder;
std::vector<std::vector<Tile::Type> > mGenerated;
2013-04-11 18:44:00 +00:00
};
#endif /* DG_GENERATOR_H_ */