forked from matijalukic/MummyMaze
-
Notifications
You must be signed in to change notification settings - Fork 0
/
picture.c
69 lines (63 loc) · 1.32 KB
/
picture.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#include <stdio.h>
#include "curses.h"
#define HEIGHT 27
#define WIDTH 35
void print_picture() {
WINDOW *picture_win;
FILE* picture;
int i, x, y;
initscr();
resize_term(27, 35);
start_color();
noecho();
curs_set(0);
init_pair(1, COLOR_RED, COLOR_BLACK);
init_pair(2, COLOR_WHITE, COLOR_BLACK);
for (i = 0; i < 790; i++) {
if (i % 2 == 1) {
picture = fopen("picture.txt", "r");
}
else
picture = fopen("picture2.txt", "r");
char c = fgetc(picture);
x = 0;
y = 0;
while (c != EOF) {
if (c == '\n') {
y = 0;
x++;
c = fgetc(picture);
}
if (c >= 48 && c <= 57) {
wattron(stdscr, COLOR_PAIR(1));
mvwprintw(stdscr, x, y, "%c", c);
wattroff(stdscr, COLOR_PAIR(1));
y++;
}
else {
wattron(stdscr, COLOR_PAIR(2));
mvwprintw(stdscr, x, y, "%c", c);
wattroff(stdscr, COLOR_PAIR(2));
y++;
}
c = fgetc(picture);
}
wattron(stdscr, COLOR_PAIR(1));
if (i % 3 == 0) {
mvwprintw(stdscr, 6, 13, "LOADING.");
}
else if (i % 3 == 1) {
mvwprintw(stdscr, 6, 13, "LOADING..");
}
else
mvwprintw(stdscr, 6, 13, "LOADING...");
wattroff(stdscr, COLOR_PAIR(1));
fclose(picture);
wrefresh(stdscr);
int i;
for (i = 0; i < 4000000; i++);
refresh();
}
clrtoeol();
endwin();
}