summaryrefslogtreecommitdiff
path: root/height-map-display/src/map/square.h
blob: 3852fc9a1c41fe54ef138b4aa556762495143349 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#ifndef SQUARE_H
#define SQUARE_H

#include <stdbool.h>

#include "node.h" // Include node.h to use Node type.

// Define the Terrain_Type enum
typedef enum {
    TERRAIN_INIT,
    TERRAIN_ROUGH,
    TERRAIN_FAIRWAY,
    TERRAIN_GREEN,
    TERRAIN_WATER,
    TERRAIN_SAND,
} Terrain_Type;

// Define the Square struct
typedef struct Square {
    Terrain_Type terrain;
    Node *node_tl;
    Node *node_tr;
    Node *node_bl;
    Node *node_br;
    bool selected;
} Square;

// Function prototypes
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