Bladeren bron

utf8 single-char cards

master
gtheler 5 jaren geleden
bovenliggende
commit
3e45183b4f
2 gewijzigde bestanden met toevoegingen van 66 en 2 verwijderingen
  1. +3
    -2
      src/base.h
  2. +63
    -0
      src/cards.cpp

+ 3
- 2
src/base.h Bestand weergeven

@@ -100,8 +100,8 @@ class Card {
std::string ascii() {
return numberASCII + suitASCII;
}
std::string utf8() {
return numberASCII + suitUTF8;
std::string utf8(bool single = false) {
return single ? singleUTF8 : numberASCII + suitUTF8;
}
std::string text();
@@ -110,6 +110,7 @@ class Card {
std::string suitASCII;
std::string suitUTF8;
std::string suitName;
std::string singleUTF8;
};



+ 63
- 0
src/cards.cpp Bestand weergeven

@@ -31,6 +31,69 @@ Card::Card(unsigned int tag) {
suitUTF8 = "โ™ ";
break;
}
// https://en.wikipedia.org/wiki/Playing_cards_in_Unicode
// yes, I could loop and compute the code for each card and
// it would be hacky but hard to understand for humans
// UNIX rule of representation!
switch(tag) {
case 0: singleUTF8 = "๐Ÿƒ‘"; break;
case 1: singleUTF8 = "๐Ÿƒ’"; break;
case 2: singleUTF8 = "๐Ÿƒ“"; break;
case 3: singleUTF8 = "๐Ÿƒ”"; break;
case 4: singleUTF8 = "๐Ÿƒ•"; break;
case 5: singleUTF8 = "๐Ÿƒ–"; break;
case 6: singleUTF8 = "๐Ÿƒ—"; break;
case 7: singleUTF8 = "๐Ÿƒ˜"; break;
case 8: singleUTF8 = "๐Ÿƒ™"; break;
case 9: singleUTF8 = "๐Ÿƒš"; break;
case 10: singleUTF8 = "๐Ÿƒ›"; break;
case 11: singleUTF8 = "๐Ÿƒ"; break;
case 12: singleUTF8 = "๐Ÿƒž"; break;

case 13: singleUTF8 = "๐Ÿƒ"; break;
case 14: singleUTF8 = "๐Ÿƒ‚"; break;
case 15: singleUTF8 = "๐Ÿƒƒ"; break;
case 16: singleUTF8 = "๐Ÿƒ„"; break;
case 17: singleUTF8 = "๐Ÿƒ…"; break;
case 18: singleUTF8 = "๐Ÿƒ†"; break;
case 19: singleUTF8 = "๐Ÿƒ‡"; break;
case 20: singleUTF8 = "๐Ÿƒˆ"; break;
case 21: singleUTF8 = "๐Ÿƒ‰"; break;
case 22: singleUTF8 = "๐ŸƒŠ"; break;
case 23: singleUTF8 = "๐Ÿƒ‹"; break;
case 24: singleUTF8 = "๐Ÿƒ"; break;
case 25: singleUTF8 = "๐Ÿƒ"; break;
case 26: singleUTF8 = "๐Ÿ‚ฑ"; break;
case 27: singleUTF8 = "๐Ÿ‚ฒ"; break;
case 28: singleUTF8 = "๐Ÿ‚ณ"; break;
case 29: singleUTF8 = "๐Ÿ‚ด"; break;
case 30: singleUTF8 = "๐Ÿ‚ต"; break;
case 31: singleUTF8 = "๐Ÿ‚ถ"; break;
case 32: singleUTF8 = "๐Ÿ‚ท"; break;
case 33: singleUTF8 = "๐Ÿ‚ธ"; break;
case 34: singleUTF8 = "๐Ÿ‚น"; break;
case 35: singleUTF8 = "๐Ÿ‚บ"; break;
case 36: singleUTF8 = "๐Ÿ‚ป"; break;
case 37: singleUTF8 = "๐Ÿ‚ฝ"; break;
case 38: singleUTF8 = "๐Ÿ‚พ"; break;
case 39: singleUTF8 = "๐Ÿ‚ก"; break;
case 40: singleUTF8 = "๐Ÿ‚ข"; break;
case 41: singleUTF8 = "๐Ÿ‚ฃ"; break;
case 42: singleUTF8 = "๐Ÿ‚ค"; break;
case 43: singleUTF8 = "๐Ÿ‚ฅ"; break;
case 44: singleUTF8 = "๐Ÿ‚ฆ"; break;
case 45: singleUTF8 = "๐Ÿ‚ง"; break;
case 46: singleUTF8 = "๐Ÿ‚จ"; break;
case 47: singleUTF8 = "๐Ÿ‚ฉ"; break;
case 48: singleUTF8 = "๐Ÿ‚ช"; break;
case 49: singleUTF8 = "๐Ÿ‚ซ"; break;
case 50: singleUTF8 = "๐Ÿ‚ญ"; break;
case 51: singleUTF8 = "๐Ÿ‚ฎ"; break;
}
};

std::string Card::text() {

Ladenโ€ฆ
Annuleren
Opslaan