How to get pixels of char C++ -


i'm making tetris game , , while displaying shapes on console faced problem; @ first displaying shapes shifted left ignoring space made condition move cursor space display characters @ right place , seems destroy shape because don't know size of pixels of character.

void animation(int box[8][8]) {     char ▊ = 219;     double x = 20,y=30;      (int = 0; < 8; i++)     {         gotoxy(x,y);         (int j = 0; j < 8; j++)         {             if (box[i][j] == 1)             {                  cout << ▊;             }              else                 gotoxy((x+=0.35), y);         }         y++;         cout << endl;     }     x = 20;     y = 30;     sleep(1000);      (int = 0; < 8; i++)     {         gotoxy(x, y);         (int j = 0; j < 8; j++)         {             if (box[i][j] == 1)             {                  cout << ' ';             }             else                  gotoxy((x += 0.35), y);          }         y++;         cout << endl;     }     cout << endl;     system("pause>null"); } 

this depends on os using:

in windows can find character size using getconsolefontsize function.

in linux may want @ freetype


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -