diff --git a/include/game.h b/include/game.h index 2640c929..7ebac486 100644 --- a/include/game.h +++ b/include/game.h @@ -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 +//@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_ diff --git a/src/games/game.c b/src/games/game.c index 1a15526a..b751251a 100644 --- a/src/games/game.c +++ b/src/games/game.c @@ -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++; + } + } + +}