Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions include/game.h
Original file line number Diff line number Diff line change
Expand Up @@ -474,5 +474,14 @@ void Game_NetworkInit(nrf24_t * nrf_ptr);

#endif

void Game_DrawDiamond(char c, uint8_t x, uint8_t y, uint8_t w, uint8_t h);
//@param x: x coordinate of top corner of invisible square that bounds the diamond
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doxygen documentation blocks should start with /** and go before the thing being documented.

//@param y: y coordinate of top corner of invisible square that bounds the diamond
//@param w: width of diamond that only 1/2 of the full diamond in order for the diamond to look symmetrical
//@param h: height of diamond from top to bottom
//intx, inty; //used for the looping and used as starting points



///@}
#endif // _GAME_H_
17 changes: 17 additions & 0 deletions src/games/game.c
Original file line number Diff line number Diff line change
Expand Up @@ -818,3 +818,20 @@ void Game_AllStart(game_network_payload_t * input) {
}

#endif
void Game_DrawDiamond(char c, uint8_t x, uint8_t y, uint8_t w, uint8_t h){
uint8_t xPos, yPos;

for(xPos = x; xPos <= x + w*2; xPos++){
for(yPos = 0; yPos <= y + h / 2; (xPos > x + w) ? yPos--: yPos++){
//draws the matching pairs of each point
Game_CharXY(c, xPos, yPos + y + h / 2);
Game_CharXY(c, xPos, (h + y) - (yPos + h / 2));
xPos++;
//draws the second x point to make it equal to 1 'y' point = 2 'x' points
Game_CharXY(c, xPos, yPos+ y + h / 2);
Game_CharXY(c, xPos, (h+ y) - (yPos + h / 2));
xPos++;
}
}

}