summaryrefslogtreecommitdiff
path: root/src/main/game/cell.c
diff options
context:
space:
mode:
authorAlessandro Iezzi <aiezzi@alessandroiezzi.it>2025-05-21 23:48:24 +0200
committerAlessandro Iezzi <aiezzi@alessandroiezzi.it>2025-05-21 23:48:24 +0200
commit8d3d0a98d71181d5f65b4f08d40976a9824ba68a (patch)
tree873ba3b2f23225e4b0e456d10ee66d8eafd03271 /src/main/game/cell.c
parent8ab83a9a30b3e04cc270f3c7322b105374905a75 (diff)
downloadtris-8d3d0a98d71181d5f65b4f08d40976a9824ba68a.tar.gz
tris-8d3d0a98d71181d5f65b4f08d40976a9824ba68a.zip
Add the logic for the Cell if filled
When the user click on a box, a sign appears and that cell will be set as filled.
Diffstat (limited to 'src/main/game/cell.c')
-rw-r--r--src/main/game/cell.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/main/game/cell.c b/src/main/game/cell.c
index 53d051a..c8151b2 100644
--- a/src/main/game/cell.c
+++ b/src/main/game/cell.c
@@ -45,6 +45,7 @@ cell_new(float left, float right, float top, float bottom)
cell->right = right;
cell->top = top;
cell->bottom = bottom;
+ cell->filled = false;
return cell;
}
@@ -54,3 +55,16 @@ cell_within_bounds(Cell *cell, float x, float y)
{
return x >= cell->left && x <= cell->right && y <= cell->top && y >= cell->bottom;
}
+
+void
+cell_set_filled(Cell *cell, bool filled)
+{
+ if (cell == NULL) return;
+ cell->filled = filled;
+}
+
+bool
+cell_is_filled(Cell *cell) {
+ if (cell == NULL) return false;
+ return cell->filled;
+}