@@ -18,6 +18,35 @@ Cell::Cell(Game *game, Game::GameState gameState, Grid *grid)
18
18
mNumOfMines = 0 ;
19
19
}
20
20
21
+ void Cell::SetupComponents ()
22
+ {
23
+ // Add rectangle mesh component for the color of the cells
24
+ auto mesh = new RectangleMeshComponent (" RectangleMeshComponent" , this , 1 );
25
+ mesh->SetColor (DARKGRAY);
26
+ mesh->SetBorderColor (BLACK);
27
+ mesh->SetBorderThickness (3 .f );
28
+ mesh->SetWidth (Cell::LENGTH);
29
+ mesh->SetHeight (Cell::LENGTH);
30
+
31
+ auto textComp = new TextComponent (" TextComponent" , this , 2 );
32
+ textComp->SetColor (RAYWHITE);
33
+ textComp->SetFont (GetFontDefault ());
34
+ textComp->SetFontSize (50 .f );
35
+ textComp->SetSpacing (0 .f );
36
+ textComp->SetText (std::to_string (this ->GetNumOfMines ()));
37
+ textComp->SetIsShow (false );
38
+
39
+ // Add line mesh component for the sealed state of cells
40
+ auto lineMesh = new LineMeshComponent (" LineMeshComponent" , this , 2 );
41
+ lineMesh->SetThickness (3 .f );
42
+ lineMesh->SetColor (BLACK);
43
+ lineMesh->SetLinePair ({ this ->GetPosition ().x - (Cell::LENGTH / 2 ), this ->GetPosition ().y - (Cell::LENGTH / 2 ) },
44
+ { this ->GetPosition ().x + (Cell::LENGTH / 2 ), this ->GetPosition ().y + (Cell::LENGTH / 2 ) });
45
+ lineMesh->SetLinePair ({ this ->GetPosition ().x + (Cell::LENGTH / 2 ), this ->GetPosition ().y - (Cell::LENGTH / 2 ) },
46
+ { this ->GetPosition ().x - (Cell::LENGTH / 2 ), this ->GetPosition ().y + (Cell::LENGTH / 2 ) });
47
+
48
+ }
49
+
21
50
void Cell::UpdateActor (float deltaTime)
22
51
{
23
52
auto mesh = (RectangleMeshComponent*)(GetComponent (" RectangleMeshComponent" ));
0 commit comments