aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/game.h1
-rw-r--r--include/testscreen.h13
-rw-r--r--include/world/map.h48
-rw-r--r--include/world/tectonicphase.h22
4 files changed, 84 insertions, 0 deletions
diff --git a/include/game.h b/include/game.h
index 4e00bb8..0ee63aa 100644
--- a/include/game.h
+++ b/include/game.h
@@ -29,6 +29,7 @@ public:
static bool popScreen();
static bool popUpto(const std::string &key);
static bool popUptoIncluding(const std::string &key);
+ static void popAll();
static void stop() { m_running = false; }
};
diff --git a/include/testscreen.h b/include/testscreen.h
index 67d98dc..a517700 100644
--- a/include/testscreen.h
+++ b/include/testscreen.h
@@ -1,15 +1,28 @@
#ifndef POSTMODERN_TESTSCREEN_H
#define POSTMODERN_TESTSCREEN_H 1
+#include "boxii/window.h"
+#include "boxii/textwindow.h"
+
#include "screen.h"
class TestScreen : public Screen {
private:
+ std::shared_ptr<Boxii::Window> m_canvasWindow;
+ std::shared_ptr<Boxii::TextWindow> m_infoWindow;
+
+ int m_option;
+ int *m_optionValues;
protected:
public:
TestScreen();
~TestScreen();
+ void activate() override;
+ void deactivate() override;
+
+ void refresh();
+
void update() override;
};
diff --git a/include/world/map.h b/include/world/map.h
new file mode 100644
index 0000000..7729ecf
--- /dev/null
+++ b/include/world/map.h
@@ -0,0 +1,48 @@
+#ifndef POSTMODERN_WORLD_MAP_H
+#define POSTMODERN_WORLD_MAP_H 1
+
+#include <memory>
+#include <random>
+
+#include "boxii/window.h"
+
+class WorldMap;
+
+class GenerationPhase {
+private:
+public:
+ GenerationPhase(std::shared_ptr<GenerationPhase> prev, std::shared_ptr<WorldMap> map) {}
+ ~GenerationPhase() {}
+};
+
+//1.024 km tile resolution
+class WorldMap {
+private:
+ int m_width;
+ int m_height;
+ int m_seed;
+
+ float *m_landElevation;
+ float *m_waterElevation;
+ float *m_vegetation;
+
+ std::mt19937 m_random;
+
+public:
+ WorldMap(int w, int h, int seed);
+ ~WorldMap();
+
+ void begin(std::shared_ptr<WorldMap> self);
+ void draw(std::shared_ptr<Boxii::Window> window, int zoom);
+
+ void getProperties(int x, int y, float &le, float &we, float &v);
+ void setProperties(int x, int y, float le, float we, float v);
+
+ int getWidth() { return m_width; }
+ int getHeight() { return m_height; }
+ int getSeed() { return m_seed; }
+
+ std::mt19937 &getRandom() { return m_random; }
+};
+
+#endif
diff --git a/include/world/tectonicphase.h b/include/world/tectonicphase.h
new file mode 100644
index 0000000..62a6455
--- /dev/null
+++ b/include/world/tectonicphase.h
@@ -0,0 +1,22 @@
+#include "map.h"
+
+struct Plate
+{
+ Plate() { x = 0; y = 0; continental = false; }
+ float x, y;
+ bool continental;
+};
+
+class TectonicPhase : public GenerationPhase
+{
+private:
+ std::vector<Plate> m_plates;
+ static int m_plateCount;
+public:
+ TectonicPhase(std::shared_ptr<GenerationPhase> prev, std::shared_ptr<WorldMap> map);
+ ~TectonicPhase() {}
+
+ void rasterize(std::shared_ptr<WorldMap> map);
+
+ static void setPlateCount(int c) { m_plateCount = c; }
+};