Added ability to print month and day numbers, but printing ALL of them prior to overlaying.

This commit is contained in:
David Vereb 2023-04-04 22:10:13 -04:00
parent 3a9f4dac20
commit d2b0e8fb29

View File

@ -12,6 +12,7 @@ static void finish(int sig);
void init_colors();
void PlacePiece(Piece piece, const std::vector<Flip> &flips, Rotation rotation, int y, int x);
std::string PlaceName(unsigned int position);
void GetPosition(unsigned long position, int &y, int &x);
int main(int argc, char *argv[])
@ -32,6 +33,16 @@ int main(int argc, char *argv[])
finish(0);
}
// DEBUG: Draw Grid
for(auto row = 0; row < 2; ++row)
for(auto col = 0; col < 6; ++col)
mvaddstr(row, col * 2, PlaceName((6 * row) + col).c_str());
for(auto row = 2; row < 6; ++row)
for(auto col = 0; col < 7; ++col)
mvaddstr(row, col * 2, PlaceName(12 + (7 * (row - 2) + col)).c_str());
for(auto col = 0; col < 3; ++col)
mvaddstr(6, col * 2, PlaceName(40 + col).c_str());
// for each piece passed in, render it:
{
int x = 1;
@ -117,6 +128,20 @@ void PlacePiece(Piece piece, const std::vector<Flip> &flips, Rotation rotation,
PD_DrawPiece(data, y, x, piece);
}
std::string PlaceName(unsigned int position)
{
static const std::vector<std::string> months =
{ "JA", "FE", "MR", "AP", "MY", "JN", "JL", "AU", "SE", "OC", "NO", "DE", };
if(position < 12)
return months[position];
auto rtn = std::to_string(position - 11);
if(rtn.size() == 1)
rtn = "0" + rtn;
return rtn;
}
void GetPosition(unsigned long position, int &y, int &x)
{
if(position < 6)