Advertisement
Kitomas

_font_tables.h

Nov 17th, 2023
760
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 9.20 KB | None | 0 0
  1. //(this is just to separate the font lookup tables from font.cpp.
  2.  //as such, this should only be included by font.cpp)
  3. #ifdef _UTILS_FONT_CPP
  4.  
  5.  
  6. //a modified version of https://github.com/dhepper/font8x8/blob/master/font8x8_basic.h
  7.  //here, i changed its formatting, and made 31 chars between $01-$1F
  8. /*
  9. for an example of how chars are encoded,
  10. this is what the bits for char '3' look like in big endian:
  11.   0b00011110 (0x1E)
  12.   0b00110011 (0x33)
  13.   0b00110000 (0x30)
  14.   0b00011100 (0x1C)
  15.   0b00110000 (0x30)
  16.   0b00110011 (0x33)
  17.   0b00011110 (0x1E)
  18.   0b00000000 (0x00)
  19. */
  20. const Uint8 _font8x8_default[1024] = { //128 chars of 8 bytes each = 1024 bytes
  21.   0x53, 0x55, 0x65, 0x00, 0x11, 0x11, 0x11, 0x77,  //$00      (null)
  22.   0x3E, 0x41, 0x55, 0x41, 0x5D, 0x41, 0x3E, 0x00,  //$01      (human)
  23.   0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66,  //$02      (box vertical)
  24.   0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00,  //$03      (box horizontal)
  25.   0x7E, 0xFF, 0xE7, 0xC3, 0xC3, 0xE7, 0xFF, 0x7E,  //$04      (box intersection)
  26.   0x3C, 0x18, 0x18, 0x3C, 0x5E, 0x7E, 0x3C, 0x00,  //$05      (potion)
  27.   0x03, 0x07, 0x4E, 0x3C, 0x18, 0x28, 0x44, 0x00,  //$06      (sword)
  28.   0x63, 0x77, 0x3E, 0x3E, 0x3E, 0x3E, 0x1C, 0x00,  //$07 '\a' (armor)
  29.   0x71, 0x52, 0x32, 0x52, 0x74, 0x00, 0x00, 0x00,  //$08 '\b' ('move 1 char back')
  30.   0x36, 0x7F, 0x7F, 0x7F, 0x3E, 0x1C, 0x08, 0x00,  //$09 '\t' (heart)
  31.   0x31, 0x52, 0x52, 0x52, 0x54, 0x00, 0x00, 0x00,  //$0A '\n' (new line)
  32.   0x00, 0x6E, 0x3B, 0x00, 0x6E, 0x3B, 0x00, 0x00,  //$0B '\v' (about equal to)
  33.   0x71, 0x12, 0x32, 0x12, 0x14, 0x00, 0x00, 0x00,  //$0C '\f' ('move 1 char down')
  34.   0x71, 0x52, 0x32, 0x52, 0x54, 0x00, 0x00, 0x00,  //$0D '\r' ('move 1 char up')
  35.   0x1E, 0x27, 0x03, 0x03, 0x43, 0x67, 0x3E, 0x00,  //$0E      (moon)
  36.   0x49, 0x3E, 0x22, 0x63, 0x22, 0x3E, 0x49, 0x00,  //$0F      (sun)
  37.   0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,  //$10      (gradient value 16)
  38.   0xFF, 0xFF, 0xEE, 0xFF, 0xFF, 0xFF, 0xEE, 0xFF,  //$11      (gradient value 15)
  39.   0xBB, 0xFF, 0xEE, 0xFF, 0xBB, 0xFF, 0xEE, 0xFF,  //$12      (gradient value 14)
  40.   0xAA, 0xFF, 0xEE, 0xFF, 0xAA, 0xFF, 0xEE, 0xFF,  //$13      (gradient value 13)
  41.   0xAA, 0xFF, 0xAA, 0xFF, 0xAA, 0xFF, 0xAA, 0xFF,  //$14      (gradient value 12)
  42.   0xAA, 0xDD, 0xAA, 0xDD, 0xAA, 0xDD, 0xAA, 0xDD,  //$15      (gradient value 11)
  43.   0xAA, 0xDD, 0xAA, 0x77, 0xAA, 0xDD, 0xAA, 0x77,  //$16      (gradient value 10)
  44.   0xAA, 0xDD, 0xAA, 0x55, 0xAA, 0xDD, 0xAA, 0x55,  //$17      (gradient value  9)
  45.   0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55,  //$18      (gradient value  8)
  46.   0xAA, 0x44, 0xAA, 0x55, 0xAA, 0x44, 0xAA, 0x55,  //$19      (gradient value  7)
  47.   0xAA, 0x44, 0xAA, 0x11, 0xAA, 0x44, 0xAA, 0x11,  //$1A      (gradient value  6)
  48.   0xAA, 0x44, 0xAA, 0x00, 0xAA, 0x44, 0xAA, 0x00,  //$1B      (gradient value  5)
  49.   0xAA, 0x00, 0xAA, 0x00, 0xAA, 0x00, 0xAA, 0x00,  //$1C      (gradient value  4)
  50.   0xAA, 0x00, 0x88, 0x00, 0xAA, 0x00, 0x88, 0x00,  //$1D      (gradient value  3)
  51.   0x22, 0x00, 0x88, 0x00, 0x22, 0x00, 0x88, 0x00,  //$1E      (gradient value  2)
  52.   0x00, 0x00, 0x88, 0x00, 0x00, 0x00, 0x88, 0x00,  //$1F      (gradient value  1)
  53.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  //$20  ' ' (gradient value  0)
  54.   0x18, 0x3C, 0x3C, 0x18, 0x18, 0x00, 0x18, 0x00,  //$21  '!'
  55.   0x36, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  //$22  '"' (use \" if inside string)
  56.   0x36, 0x36, 0x7F, 0x36, 0x7F, 0x36, 0x36, 0x00,  //$23  '#'
  57.   0x0C, 0x3E, 0x03, 0x1E, 0x30, 0x1F, 0x0C, 0x00,  //$24  '$'
  58.   0x00, 0x63, 0x33, 0x18, 0x0C, 0x66, 0x63, 0x00,  //$25  '%'
  59.   0x1C, 0x36, 0x1C, 0x6E, 0x3B, 0x33, 0x6E, 0x00,  //$26  '&'
  60.   0x06, 0x06, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,  //$27 '\'' (use ' if outside char literal)
  61.   0x18, 0x0C, 0x06, 0x06, 0x06, 0x0C, 0x18, 0x00,  //$28  '('
  62.   0x06, 0x0C, 0x18, 0x18, 0x18, 0x0C, 0x06, 0x00,  //$29  ')'
  63.   0x00, 0x66, 0x3C, 0xFF, 0x3C, 0x66, 0x00, 0x00,  //$2A  '*'
  64.   0x00, 0x0C, 0x0C, 0x3F, 0x0C, 0x0C, 0x00, 0x00,  //$2B  '+'
  65.   0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x0C, 0x06,  //$2C  ','
  66.   0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x00,  //$2D  '-'
  67.   0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x0C, 0x00,  //$2E  '.'
  68.   0x60, 0x30, 0x18, 0x0C, 0x06, 0x03, 0x01, 0x00,  //$2F  '/'
  69.   0x3E, 0x63, 0x73, 0x7B, 0x6F, 0x67, 0x3E, 0x00,  //$30  '0'
  70.   0x0C, 0x0E, 0x0C, 0x0C, 0x0C, 0x0C, 0x3F, 0x00,  //$31  '1'
  71.   0x1E, 0x33, 0x30, 0x1C, 0x06, 0x33, 0x3F, 0x00,  //$32  '2'
  72.   0x1E, 0x33, 0x30, 0x1C, 0x30, 0x33, 0x1E, 0x00,  //$33  '3'
  73.   0x38, 0x3C, 0x36, 0x33, 0x7F, 0x30, 0x78, 0x00,  //$34  '4'
  74.   0x3F, 0x03, 0x1F, 0x30, 0x30, 0x33, 0x1E, 0x00,  //$35  '5'
  75.   0x1C, 0x06, 0x03, 0x1F, 0x33, 0x33, 0x1E, 0x00,  //$36  '6'
  76.   0x3F, 0x33, 0x30, 0x18, 0x0C, 0x0C, 0x0C, 0x00,  //$37  '7'
  77.   0x1E, 0x33, 0x33, 0x1E, 0x33, 0x33, 0x1E, 0x00,  //$38  '8'
  78.   0x1E, 0x33, 0x33, 0x3E, 0x30, 0x18, 0x0E, 0x00,  //$39  '9'
  79.   0x00, 0x0C, 0x0C, 0x00, 0x00, 0x0C, 0x0C, 0x00,  //$3A  ':'
  80.   0x00, 0x0C, 0x0C, 0x00, 0x00, 0x0C, 0x0C, 0x06,  //$3B  ';'
  81.   0x18, 0x0C, 0x06, 0x03, 0x06, 0x0C, 0x18, 0x00,  //$3C  '<'
  82.   0x00, 0x00, 0x3F, 0x00, 0x00, 0x3F, 0x00, 0x00,  //$3D  '='
  83.   0x06, 0x0C, 0x18, 0x30, 0x18, 0x0C, 0x06, 0x00,  //$3E  '>'
  84.   0x1E, 0x33, 0x30, 0x18, 0x0C, 0x00, 0x0C, 0x00,  //$3F  '?' (or \? to avoid trigraphs)
  85.   0x3E, 0x63, 0x7B, 0x7B, 0x7B, 0x03, 0x1E, 0x00,  //$40  '@'
  86.   0x0C, 0x1E, 0x33, 0x33, 0x3F, 0x33, 0x33, 0x00,  //$41  'A'
  87.   0x3F, 0x66, 0x66, 0x3E, 0x66, 0x66, 0x3F, 0x00,  //$42  'B'
  88.   0x3C, 0x66, 0x03, 0x03, 0x03, 0x66, 0x3C, 0x00,  //$43  'C'
  89.   0x1F, 0x36, 0x66, 0x66, 0x66, 0x36, 0x1F, 0x00,  //$44  'D'
  90.   0x7F, 0x46, 0x16, 0x1E, 0x16, 0x46, 0x7F, 0x00,  //$45  'E'
  91.   0x7F, 0x46, 0x16, 0x1E, 0x16, 0x06, 0x0F, 0x00,  //$46  'F'
  92.   0x3C, 0x66, 0x03, 0x03, 0x73, 0x66, 0x7C, 0x00,  //$47  'G'
  93.   0x33, 0x33, 0x33, 0x3F, 0x33, 0x33, 0x33, 0x00,  //$48  'H'
  94.   0x1E, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x1E, 0x00,  //$49  'I'
  95.   0x78, 0x30, 0x30, 0x30, 0x33, 0x33, 0x1E, 0x00,  //$4A  'J'
  96.   0x67, 0x66, 0x36, 0x1E, 0x36, 0x66, 0x67, 0x00,  //$4B  'K'
  97.   0x0F, 0x06, 0x06, 0x06, 0x46, 0x66, 0x7F, 0x00,  //$4C  'L'
  98.   0x63, 0x77, 0x7F, 0x7F, 0x6B, 0x63, 0x63, 0x00,  //$4D  'M'
  99.   0x63, 0x67, 0x6F, 0x7B, 0x73, 0x63, 0x63, 0x00,  //$4E  'N'
  100.   0x1C, 0x36, 0x63, 0x63, 0x63, 0x36, 0x1C, 0x00,  //$4F  'O'
  101.   0x3F, 0x66, 0x66, 0x3E, 0x06, 0x06, 0x0F, 0x00,  //$50  'P'
  102.   0x1E, 0x33, 0x33, 0x33, 0x3B, 0x1E, 0x38, 0x00,  //$51  'Q'
  103.   0x3F, 0x66, 0x66, 0x3E, 0x36, 0x66, 0x67, 0x00,  //$52  'R'
  104.   0x1E, 0x33, 0x07, 0x0E, 0x38, 0x33, 0x1E, 0x00,  //$53  'S'
  105.   0x3F, 0x2D, 0x0C, 0x0C, 0x0C, 0x0C, 0x1E, 0x00,  //$54  'T'
  106.   0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x3F, 0x00,  //$55  'U'
  107.   0x33, 0x33, 0x33, 0x33, 0x33, 0x1E, 0x0C, 0x00,  //$56  'V'
  108.   0x63, 0x63, 0x63, 0x6B, 0x7F, 0x77, 0x63, 0x00,  //$57  'W'
  109.   0x63, 0x63, 0x36, 0x1C, 0x1C, 0x36, 0x63, 0x00,  //$58  'X'
  110.   0x33, 0x33, 0x33, 0x1E, 0x0C, 0x0C, 0x1E, 0x00,  //$59  'Y'
  111.   0x7F, 0x63, 0x31, 0x18, 0x4C, 0x66, 0x7F, 0x00,  //$5A  'Z'
  112.   0x1E, 0x06, 0x06, 0x06, 0x06, 0x06, 0x1E, 0x00,  //$5B  '['
  113.   0x03, 0x06, 0x0C, 0x18, 0x30, 0x60, 0x40, 0x00,  //$5C '\\'
  114.   0x1E, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1E, 0x00,  //$5D  ']'
  115.   0x08, 0x1C, 0x36, 0x63, 0x00, 0x00, 0x00, 0x00,  //$5E  '^'
  116.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF,  //$5F  '_'
  117.   0x0C, 0x0C, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00,  //$60  '`'
  118.   0x00, 0x00, 0x1E, 0x30, 0x3E, 0x33, 0x6E, 0x00,  //$61  'a'
  119.   0x07, 0x06, 0x06, 0x3E, 0x66, 0x66, 0x3B, 0x00,  //$62  'b'
  120.   0x00, 0x00, 0x1E, 0x33, 0x03, 0x33, 0x1E, 0x00,  //$63  'c'
  121.   0x38, 0x30, 0x30, 0x3e, 0x33, 0x33, 0x6E, 0x00,  //$64  'd'
  122.   0x00, 0x00, 0x1E, 0x33, 0x3f, 0x03, 0x1E, 0x00,  //$65  'e'
  123.   0x1C, 0x36, 0x06, 0x0f, 0x06, 0x06, 0x0F, 0x00,  //$66  'f'
  124.   0x00, 0x00, 0x6E, 0x33, 0x33, 0x3E, 0x30, 0x1F,  //$67  'g'
  125.   0x07, 0x06, 0x36, 0x6E, 0x66, 0x66, 0x67, 0x00,  //$68  'h'
  126.   0x0C, 0x00, 0x0E, 0x0C, 0x0C, 0x0C, 0x1E, 0x00,  //$69  'i'
  127.   0x30, 0x00, 0x30, 0x30, 0x30, 0x33, 0x33, 0x1E,  //$6A  'j'
  128.   0x07, 0x06, 0x66, 0x36, 0x1E, 0x36, 0x67, 0x00,  //$6B  'k'
  129.   0x0E, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x1E, 0x00,  //$6C  'l'
  130.   0x00, 0x00, 0x33, 0x7F, 0x7F, 0x6B, 0x63, 0x00,  //$6D  'm'
  131.   0x00, 0x00, 0x1F, 0x33, 0x33, 0x33, 0x33, 0x00,  //$6E  'n'
  132.   0x00, 0x00, 0x1E, 0x33, 0x33, 0x33, 0x1E, 0x00,  //$6F  'o'
  133.   0x00, 0x00, 0x3B, 0x66, 0x66, 0x3E, 0x06, 0x0F,  //$70  'p'
  134.   0x00, 0x00, 0x6E, 0x33, 0x33, 0x3E, 0x30, 0x78,  //$71  'q'
  135.   0x00, 0x00, 0x3B, 0x6E, 0x66, 0x06, 0x0F, 0x00,  //$72  'r'
  136.   0x00, 0x00, 0x3E, 0x03, 0x1E, 0x30, 0x1F, 0x00,  //$73  's'
  137.   0x08, 0x0C, 0x3E, 0x0C, 0x0C, 0x2C, 0x18, 0x00,  //$74  't'
  138.   0x00, 0x00, 0x33, 0x33, 0x33, 0x33, 0x6E, 0x00,  //$75  'u'
  139.   0x00, 0x00, 0x33, 0x33, 0x33, 0x1E, 0x0C, 0x00,  //$76  'v'
  140.   0x00, 0x00, 0x63, 0x6B, 0x7F, 0x7F, 0x36, 0x00,  //$77  'w'
  141.   0x00, 0x00, 0x63, 0x36, 0x1C, 0x36, 0x63, 0x00,  //$78  'x'
  142.   0x00, 0x00, 0x33, 0x33, 0x33, 0x3E, 0x30, 0x1F,  //$79  'y'
  143.   0x00, 0x00, 0x3F, 0x19, 0x0C, 0x26, 0x3F, 0x00,  //$7A  'z'
  144.   0x38, 0x0C, 0x0C, 0x07, 0x0C, 0x0C, 0x38, 0x00,  //$7B  '{'
  145.   0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x00,  //$7C  '|'
  146.   0x07, 0x0C, 0x0C, 0x38, 0x0C, 0x0C, 0x07, 0x00,  //$7D  '}'
  147.   0x6E, 0x3B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  //$7E  '~'
  148.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00   //$7F      (indicates transparency)
  149. };
  150.  
  151.  
  152. #endif /* _UTILS_FONT_CPP */
  153.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement