Untitled
unknown
c_cpp
10 months ago
1.4 kB
4
Indexable
void Grid::UpdateInterface() const
{
if (UI.InterfaceMode == MODE_DESIGN)
{
// 1- Draw cells with or without waterpits or dangerzone
for (int i = NumVerticalCells-1; i >= 0 ; i--) // bottom up
{
for (int j = 0; j < NumHorizontalCells; j++) // left to right
{
CellList[i][j]->DrawCellOrWaterPitOrDangerZone(pOut);
}
}
// 2- Draw other game objects(excluding waterpit and dangerzone)
for (int i = NumVerticalCells-1; i >= 0 ; i--) // bottom up
{
for (int j = 0; j < NumHorizontalCells; j++) // left to right
{
CellList[i][j]->DrawGameObject(pOut);
}
}
// 3- Draw players
for (int i = 0; i < MaxPlayerCount; i++)
{
PlayerList[i]->Draw(pOut);
}
}
else // In PLAY Mode
{
// 1- Print Player's Info
string playersInfo = "";
for (int i = 0; i < MaxPlayerCount; i++)
{
PlayerList[i]->AppendPlayerInfo(playersInfo); // passed by reference
if (i < MaxPlayerCount-1) // except the last player
playersInfo += ", ";
}
playersInfo += " | Curr = " + to_string(currPlayerNumber);
pOut->PrintPlayersInfo(playersInfo);
// Note: UpdatePlayerCell() function --> already update drawing players in Play Mode
// so we do NOT need draw all players again in UpdateInterface() of the Play mode
// In addition, cgame objects do NOT change positions in Play Mode, so need to draw them here too
}
}Editor is loading...
Leave a Comment