summaryrefslogtreecommitdiff
path: root/height-map-display/src/map
diff options
context:
space:
mode:
authorSchark <jordan@schark.online>2024-03-18 23:28:37 -0700
committerSchark <jordan@schark.online>2024-03-18 23:28:37 -0700
commitaf03f388cbcff795158ea8345b5c876470229e8b (patch)
tree18bfc9d2194c123a478f4792c326629113733089 /height-map-display/src/map
parentf113ca2e53e8a4403779d47bd162bc7a7f902ca1 (diff)
downloadgamedev-af03f388cbcff795158ea8345b5c876470229e8b.tar.gz
gamedev-af03f388cbcff795158ea8345b5c876470229e8b.zip
More granular square control
Diffstat (limited to 'height-map-display/src/map')
-rw-r--r--height-map-display/src/map/square.c12
-rw-r--r--height-map-display/src/map/square.h6
2 files changed, 17 insertions, 1 deletions
diff --git a/height-map-display/src/map/square.c b/height-map-display/src/map/square.c
index 54add55..9109123 100644
--- a/height-map-display/src/map/square.c
+++ b/height-map-display/src/map/square.c
@@ -40,3 +40,15 @@ Square* find_selected_square(Square*** squares, int x, int y) {
return NULL;
}
+
+float* get_terrain_color(Terrain_Type terrain) {
+ static float colors[6][3] = {
+ {0.0f, 0.0f, 0.0f}, // init
+ {0.0f, 0.5f, 0.0f}, // rough
+ {0.2f, 0.7f, 0.2f}, // fairway
+ {0.3f, 0.8f, 0.3f}, // green
+ {0.1f, 0.2f, 0.8f}, // water
+ {0.9f, 0.7f, 0.7f}, // sand
+ };
+ return colors[terrain];
+}
diff --git a/height-map-display/src/map/square.h b/height-map-display/src/map/square.h
index 132b43c..3852fc9 100644
--- a/height-map-display/src/map/square.h
+++ b/height-map-display/src/map/square.h
@@ -7,9 +7,12 @@
// Define the Terrain_Type enum
typedef enum {
- TERRAIN_FAIRWAY,
+ TERRAIN_INIT,
TERRAIN_ROUGH,
+ TERRAIN_FAIRWAY,
TERRAIN_GREEN,
+ TERRAIN_WATER,
+ TERRAIN_SAND,
} Terrain_Type;
// Define the Square struct
@@ -26,6 +29,7 @@ typedef struct Square {
Square* init_square(Node *tl, Node *tr, Node *bl, Node *br, Terrain_Type terrain, bool selected);
void change_square_height(Square* square, float diff);
void change_square_terrain(Square* square, Terrain_Type terrain);
+float* get_terrain_color(Terrain_Type terrain);
Square* find_selected_square(Square*** squares, int x, int y);
#endif