First commit, world map creation
This commit is contained in:
commit
76306196c0
7 changed files with 176 additions and 0 deletions
36
World.h
Normal file
36
World.h
Normal file
|
@ -0,0 +1,36 @@
|
|||
//
|
||||
// Created by trotfunky on 27/05/19.
|
||||
//
|
||||
|
||||
#ifndef RAYCASTING_WORLD_H
|
||||
#define RAYCASTING_WORLD_H
|
||||
|
||||
#include <vector>
|
||||
#include <ostream>
|
||||
|
||||
enum class BlockType {
|
||||
AIR,
|
||||
WALL,
|
||||
DOOR,
|
||||
WINDOW,
|
||||
};
|
||||
|
||||
class World {
|
||||
public:
|
||||
World(int w, int h, std::vector<BlockType> worldMap = {});
|
||||
|
||||
int getW() const;
|
||||
int getH() const;
|
||||
|
||||
BlockType getBlock(float x, float y) const;
|
||||
void setBlock(BlockType block, int x, int y, int width = 1, int height = 1);
|
||||
|
||||
friend std::ostream& operator<<(std::ostream& ostream, World const & world);
|
||||
private:
|
||||
int w;
|
||||
int h;
|
||||
std::vector<BlockType> map;
|
||||
};
|
||||
|
||||
|
||||
#endif //RAYCASTING_WORLD_H
|
Loading…
Add table
Add a link
Reference in a new issue