summary refs log tree commit diff
path: root/src/World/Generator.cpp
diff options
context:
space:
mode:
authorMel <einebeere@gmail.com>2022-10-18 18:44:54 +0200
committerMel <einebeere@gmail.com>2022-10-18 18:44:54 +0200
commitebad1227aaafbd962756155732f0ec39085f7d51 (patch)
treeec88d18e0d1b5bdcee1527332666f93f8bfb7534 /src/World/Generator.cpp
parent63ecb48a75f0b7df491b00e9048ebb38d923089a (diff)
downloadmeowcraft-ebad1227aaafbd962756155732f0ec39085f7d51.tar.zst
meowcraft-ebad1227aaafbd962756155732f0ec39085f7d51.zip
Basic Chunk
Diffstat (limited to 'src/World/Generator.cpp')
-rw-r--r--src/World/Generator.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/World/Generator.cpp b/src/World/Generator.cpp
new file mode 100644
index 0000000..5b8b9b5
--- /dev/null
+++ b/src/World/Generator.cpp
@@ -0,0 +1,26 @@
+#include "Generator.hpp"
+
+namespace MC {
+
+Chunk Generator::generate(uint32_t _x, uint32_t _y) {
+    Chunk chunk;
+
+    for (int y = 0; y < CHUNK_HEIGHT; y++) {
+        BlockType type = BlockType::Air;
+        if (y < CHUNK_HEIGHT / 2) {
+            type = BlockType::Dirt;
+        } else if (y == CHUNK_HEIGHT / 2) {
+            type = BlockType::Grass;
+        }
+
+        for (int x = 0; x < CHUNK_WIDTH; x++) {
+            for (int z = 0; z < CHUNK_WIDTH; z++) {
+                chunk.set(x, y, z, type);
+            }
+        }
+    }
+
+    return chunk;
+}
+
+}
\ No newline at end of file