12 atrybut const bombki[] = {
15 {A_BOLD, COLOR_YELLOW},
16 {A_BOLD, COLOR_MAGENTA},
18 {A_BOLD, COLOR_WHITE},
20 int const ile_b = sizeof bombki / sizeof *bombki;
22 atrybut const choinka = {0, COLOR_GREEN};
23 atrybut const podstawa = {0, COLOR_YELLOW};
24 atrybut const podpis = {A_BOLD, COLOR_RED};
25 atrybut const gwiazdka = {A_BOLD, COLOR_YELLOW};
30 FILE* f = fopen("/dev/urandom", "rb");
33 if (fread(&nowe_ziarno, sizeof nowe_ziarno, 1, f) == 1) {
44 char const rysunek[] =
55 void ustaw(atrybut const* attr)
57 static atrybut ostatni = {-1, -1};
58 if (ostatni.attr == attr->attr && ostatni.kolor == attr->kolor) return;
60 if (attr->attr & A_BOLD) {
61 putp(enter_bold_mode);
63 putp(exit_attribute_mode);
65 putp(tparm(set_a_foreground, attr->kolor));
71 setupterm(NULL, 1, NULL);
72 atrybut const* kolor = &choinka;
73 for (int i = 0; rysunek[i] != '\0'; i++) {
75 if (c == '[') kolor = &podstawa;
76 atrybut const* akt = kolor;
77 if (c >= 'a' && c <= 'z') akt = &podpis;
78 if (c == '.') akt = &bombki[rand() % ile_b];
79 if (c == '*') akt = &gwiazdka;
80 if (c == ']') kolor = &choinka;
84 putp(exit_attribute_mode);