summaryrefslogtreecommitdiff
path: root/height-map-display
diff options
context:
space:
mode:
Diffstat (limited to 'height-map-display')
-rw-r--r--height-map-display/src/main.c40
-rw-r--r--height-map-display/src/map/node.h1
2 files changed, 30 insertions, 11 deletions
diff --git a/height-map-display/src/main.c b/height-map-display/src/main.c
index 648cae0..7e985d0 100644
--- a/height-map-display/src/main.c
+++ b/height-map-display/src/main.c
@@ -126,8 +126,8 @@ Square** initialize_squares(Node ***nodes, int X, int Y) {
for (int j = 0; j < Y - 1; j++) {
// Assign pointers to nodes to create the Square
squares[i][j].node_tl = nodes[i][j];
- squares[i][j].node_tr = nodes[i][j+1];
- squares[i][j].node_bl = nodes[i+1][j];
+ squares[i][j].node_tr = nodes[i+1][j];
+ squares[i][j].node_bl = nodes[i][j+1];
squares[i][j].node_br = nodes[i+1][j+1];
squares[i][j].terrain = TERRAIN_ROUGH;
}
@@ -196,19 +196,37 @@ int main(int argc, char *argv[]) {
// Debug stuff
squares[0][0].node_tl->elevation = 20.0f;
change_square_height(&squares[3][3], 5.0f);
+ change_square_terrain(&squares[2][5], TERRAIN_FAIRWAY);
change_square_terrain(&squares[3][5], TERRAIN_FAIRWAY);
change_square_height(&squares[5][5], -5.0f);
change_square_terrain(&squares[5][5], TERRAIN_FAIRWAY);
- printf("Node 34 tl height = %f\n", squares[3][4].node_tl->elevation);
- printf("Node 34 tr height = %f\n", squares[3][4].node_tr->elevation);
- printf("Node 34 bl height = %f\n", squares[3][4].node_tl->elevation);
- printf("Node 34 br height = %f\n", squares[3][4].node_br->elevation);
-
- printf("Node 33 tl height = %f\n", squares[3][3].node_tl->elevation);
- printf("Node 33 tr height = %f\n", squares[3][3].node_tr->elevation);
- printf("Node 33 bl height = %f\n", squares[3][3].node_tl->elevation);
- printf("Node 33 br height = %f\n", squares[3][3].node_br->elevation);
+ printf("Node 33 tl x = %i\n", squares[3][3].node_tr->x);
+ printf("Node 33 tl y = %i\n", squares[3][3].node_tr->y);
+ printf("Node 33 tr x = %i\n", squares[3][3].node_tl->x);
+ printf("Node 33 tr y = %i\n", squares[3][3].node_tl->y);
+ printf("Node 33 br x = %i\n", squares[3][3].node_br->x);
+ printf("Node 33 br y = %i\n", squares[3][3].node_br->y);
+ printf("Node 33 bl x = %i\n", squares[3][3].node_bl->x);
+ printf("Node 33 bl y = %i\n", squares[3][3].node_bl->y);
+
+ printf("Node 34 tl x = %i\n", squares[3][4].node_tr->x);
+ printf("Node 34 tl y = %i\n", squares[3][4].node_tr->y);
+ printf("Node 34 tr x = %i\n", squares[3][4].node_tl->x);
+ printf("Node 34 tr y = %i\n", squares[3][4].node_tl->y);
+ printf("Node 34 br x = %i\n", squares[3][4].node_br->x);
+ printf("Node 34 br y = %i\n", squares[3][4].node_br->y);
+ printf("Node 34 bl x = %i\n", squares[3][4].node_bl->x);
+ printf("Node 34 bl y = %i\n", squares[3][4].node_bl->y);
+
+ printf("Node 43 tl x = %i\n", squares[4][3].node_tr->x);
+ printf("Node 43 tl y = %i\n", squares[4][3].node_tr->y);
+ printf("Node 43 tr x = %i\n", squares[4][3].node_tl->x);
+ printf("Node 43 tr y = %i\n", squares[4][3].node_tl->y);
+ printf("Node 43 br x = %i\n", squares[4][3].node_br->x);
+ printf("Node 43 br y = %i\n", squares[4][3].node_br->y);
+ printf("Node 43 bl x = %i\n", squares[4][3].node_bl->x);
+ printf("Node 43 bl y = %i\n", squares[4][3].node_bl->y);
while (!glfwWindowShouldClose(window)) {
logger("Entering main loop...");
diff --git a/height-map-display/src/map/node.h b/height-map-display/src/map/node.h
index d12accf..07054f6 100644
--- a/height-map-display/src/map/node.h
+++ b/height-map-display/src/map/node.h
@@ -7,6 +7,7 @@ typedef struct Node {
float elevation;
} Node;
+// TODO: get (x, y) as int arr
void change_node_height(Node* node, float diff);
#endif