21Fermer23
SasumeLe 12/08/2007 à 17:14
Bah alors ça devrait être assez simple :
const char *prefix = " dc.b ";
char str[strlen(prefix)+4*8*2]; // strlen("$ff,") = 4
char str_row[9];

strcpy(str,prefix);

for(int ligne = 0 ; ligne < 8 ; ligne++)
{
  unsigned char dark = 0, light = 0;

  for(int col = 0 ; col < 8 ; col++)
  {
    Couleur pixel = ecran[col][ligne];

    if(pixel == noir || pixel == fonce)
      dark |= 0x80>>col;

    if(pixel == noir || pixel == clair)
      light |= 0x80>>col;
  }

 sprintf(str_row, "$%F,$%F", dark, light);
 strcat(str,str_row);
}

strcat(str, "\n");

// Et ensuite on copie tout dans le fichier texte