1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

8x8を8倍角に変換して遊ぶ(if分版

Last updated at Posted at 2025-06-19

いろいろ、注意

  • arduinoでの予定は、未定

プログラム

オンラインコンパイラ paiza






#include <iostream>
using namespace std;

#define b_put(aa) for(int ii=8;ii!=0;ii--){if(aa & 0x80){printf("#");}else{printf(".");}aa=aa<<1;}
#define bit8_put(bb) for(int jj=0;jj<64;jj++){b_put(bb[jj*8]);b_put(bb[jj*8+1]);b_put(bb[jj*8+2]);b_put(bb[jj*8+3]);b_put(bb[jj*8+4]);b_put(bb[jj*8+5]);b_put(bb[jj*8+6]);b_put(bb[jj*8+7]);printf("\n");}

int main(void){
    // Your code here!

    unsigned char font[] = {
        0b00100000, //  #     
        0b01111100, // #####  
        0b00100000, //  #     
        0b01111100, // #####  
        0b10101010, //# # # # 
        0b10110010, //# ##  # 
        0b01100100, // ##  #  
        0b00000000  //
    };  
    
    unsigned char font2[8*64];


    int j = 0; //8倍角出力フォントのカウンター
    for (int i = 0; i < 8; i++) { //フォントの8倍角化ループ

      int al = font[i]; //入力フォントの読み出し
      int b1=0;int b2=0;int b3=0;int b4=0;
      int b5=0;int b6=0;int b7=0;int b8=0;


      //8bit
      if( (al & 0x80) != 0 ){
          b8 = 0xff;
      }

      //7bit
      if( (al & 0x40) != 0 ){
          b7 = 0xff;
      }

      //6bit
      if( (al & 0x20) != 0 ){
          b6 = 0xff;
      }

      //5bit
      if( (al & 0x10) != 0 ){
          b5 = 0xff;
      }


      //eeeeeeeeeeeeeeeeeeeeeeeeeeeeeee


      //4bit
      if( (al & 0x08) != 0 ){
          b4 = 0xff;
      }

      //3bit
      if( (al & 0x04) != 0 ){
          b3 = 0xff;
      }
      
      //2bit
      if( (al & 0x02) != 0 ){
          b2 = 0xff;
      }

      //1bit
      if( (al & 0x01) != 0 ){
          b1 = 0xff;
      }


      //1
      font2[j++] = b8;
      font2[j++] = b7;
      font2[j++] = b6;
      font2[j++] = b5;

      font2[j++] = b4;
      font2[j++] = b3;
      font2[j++] = b2;
      font2[j++] = b1;

      //2
      font2[j++] = b8;
      font2[j++] = b7;
      font2[j++] = b6;
      font2[j++] = b5;

      font2[j++] = b4;
      font2[j++] = b3;
      font2[j++] = b2;
      font2[j++] = b1;

      //3
      font2[j++] = b8;
      font2[j++] = b7;
      font2[j++] = b6;
      font2[j++] = b5;

      font2[j++] = b4;
      font2[j++] = b3;
      font2[j++] = b2;
      font2[j++] = b1;

      //4
      font2[j++] = b8;
      font2[j++] = b7;
      font2[j++] = b6;
      font2[j++] = b5;

      font2[j++] = b4;
      font2[j++] = b3;
      font2[j++] = b2;
      font2[j++] = b1;

      //5
      font2[j++] = b8;
      font2[j++] = b7;
      font2[j++] = b6;
      font2[j++] = b5;

      font2[j++] = b4;
      font2[j++] = b3;
      font2[j++] = b2;
      font2[j++] = b1;

      //6
      font2[j++] = b8;
      font2[j++] = b7;
      font2[j++] = b6;
      font2[j++] = b5;

      font2[j++] = b4;
      font2[j++] = b3;
      font2[j++] = b2;
      font2[j++] = b1;

      //7
      font2[j++] = b8;
      font2[j++] = b7;
      font2[j++] = b6;
      font2[j++] = b5;

      font2[j++] = b4;
      font2[j++] = b3;
      font2[j++] = b2;
      font2[j++] = b1;

      //8
      font2[j++] = b8;
      font2[j++] = b7;
      font2[j++] = b6;
      font2[j++] = b5;

      font2[j++] = b4;
      font2[j++] = b3;
      font2[j++] = b2;
      font2[j++] = b1;


    }  //for

     bit8_put(font2);

    
} //main







................########........................................
................########........................................
................########........................................
................########........................................
................########........................................
................########........................................
................########........................................
................########........................................
........########################################................
........########################################................
........########################################................
........########################################................
........########################################................
........########################################................
........########################################................
........########################################................
................########........................................
................########........................................
................########........................................
................########........................................
................########........................................
................########........................................
................########........................................
................########........................................
........########################################................
........########################################................
........########################################................
........########################################................
........########################################................
........########################################................
........########################################................
........########################################................
########........########........########........########........
########........########........########........########........
########........########........########........########........
########........########........########........########........
########........########........########........########........
########........########........########........########........
########........########........########........########........
########........########........########........########........
########........################................########........
########........################................########........
########........################................########........
########........################................########........
########........################................########........
########........################................########........
########........################................########........
########........################................########........
........################................########................
........################................########................
........################................########................
........################................########................
........################................########................
........################................########................
........################................########................
........################................########................
................................................................
................................................................
................................................................
................................................................
................................................................
................................................................
................................................................
................................................................


1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?