Skip to content

Commit 44975c7

Browse files
Create WorldGenerator.hpp
1 parent 019de55 commit 44975c7

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

src/World/WorldGenerator.hpp

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#pragma once
2+
3+
#include "../Renderer/IRenderer.hpp"
4+
#include <vector>
5+
6+
class WorldGenerator {
7+
public:
8+
enum class TileType {
9+
Empty,
10+
Grass,
11+
Water,
12+
Mountain
13+
};
14+
15+
struct Tile {
16+
TileType type;
17+
Color color;
18+
19+
Tile() : type(TileType::Empty), color(0, 0, 0) {}
20+
};
21+
22+
WorldGenerator(int width = 100, int height = 100);
23+
~WorldGenerator();
24+
25+
void Generate();
26+
void Render(IRenderer* renderer);
27+
28+
float GetProgress() const { return m_Progress; }
29+
bool IsGenerating() const { return m_IsGenerating; }
30+
31+
private:
32+
std::vector<std::vector<Tile>> m_Tiles;
33+
int m_Width;
34+
int m_Height;
35+
float m_Progress;
36+
bool m_IsGenerating;
37+
38+
void GenerateHeightMap();
39+
void GenerateBiomes();
40+
Color GetTileColor(TileType type) const;
41+
};

0 commit comments

Comments
 (0)