diff options
author | June McEnroe <june@causal.agency> | 2018-08-21 22:46:18 -0400 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2018-08-21 22:46:18 -0400 |
commit | 0c8fb2b9fe779bdb7ba85c8458d4efc0034fb77b (patch) | |
tree | 1e7409bc2d986627d507cb697f9cc6cc8d36ad49 /torus.h | |
parent | Use alignas rather than attributes (diff) | |
download | torus-0c8fb2b9fe779bdb7ba85c8458d4efc0034fb77b.tar.gz torus-0c8fb2b9fe779bdb7ba85c8458d4efc0034fb77b.zip |
Replace client with rudimentary CP437 support
Diffstat (limited to '')
-rw-r--r-- | torus.h | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/torus.h b/torus.h index 775670c..53e469c 100644 --- a/torus.h +++ b/torus.h @@ -21,6 +21,7 @@ #include <stdint.h> #include <stdlib.h> #include <time.h> +#include <wchar.h> #define ARRAY_LEN(a) (sizeof(a) / sizeof((a)[0])) @@ -45,11 +46,30 @@ enum { COLOR_BRIGHT, }; +static const wchar_t CP437[256] = ( + L" ☺☻♥♦♣♠•◘○◙♂♀♪♫☼" + L"►◄↕‼¶§▬↨↑↓→←∟↔▲▼" + L" !\"#$%&'()*+,-./" + L"0123456789:;<=>?" + L"@ABCDEFGHIJKLMNO" + L"PQRSTUVWXYZ[\\]^_" + L"`abcdefghijklmno" + L"pqrstuvwxyz{|}~⌂" + L"ÇüéâäàåçêëèïîìÄÅ" + L"ÉæÆôöòûùÿÖÜ¢£¥₧ƒ" + L"áíóúñѪº¿⌐¬½¼¡«»" + L"░▒▓│┤╡╢╖╕╣║╗╝╜╛┐" + L"└┴┬├─┼╞╟╚╔╩╦╠═╬╧" + L"╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀" + L"αßΓπΣσµτΦΘΩδ∞φε∩" + L"≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ " +); + enum { CELL_ROWS = 24, CELL_COLS = 80, }; -static const size_t CELLS_SIZE = sizeof(char[CELL_ROWS][CELL_COLS]); +static const size_t CELLS_SIZE = sizeof(uint8_t[CELL_ROWS][CELL_COLS]); static const uint8_t CELL_INIT_X = CELL_COLS / 2; static const uint8_t CELL_INIT_Y = CELL_ROWS / 2; @@ -63,7 +83,7 @@ struct Meta { }; struct Tile { - alignas(4096) char cells[CELL_ROWS][CELL_COLS]; + alignas(4096) uint8_t cells[CELL_ROWS][CELL_COLS]; uint8_t colors[CELL_ROWS][CELL_COLS]; struct Meta meta; }; @@ -104,7 +124,7 @@ struct ServerMessage { uint8_t cellX; uint8_t cellY; uint8_t color; - char cell; + uint8_t cell; } put; struct { uint8_t oldCellX; @@ -130,7 +150,7 @@ struct ClientMessage { } move; struct { uint8_t color; - char cell; + uint8_t cell; } put; }; }; |