-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathart.c
More file actions
70 lines (63 loc) · 2.12 KB
/
art.c
File metadata and controls
70 lines (63 loc) · 2.12 KB
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
70
#include "art.h"
// the title screen!
ART title = {
.art = {
" :::::::: ::: ::: :::::::: :::::::: ::::::::::: :::",
":+: :+: :+: :+: :+: :+: :+: :+: :+: :+:",
"+:+ +:+ +:+ +:+ +:+ +:+ +:+ +:+ +:+",
"+#++:++#++ +#++:++#++ +#+ +:+ +#+ +:+ +#+ +#+",
" +#+ +#+ +#+ +#+ +#+ +#+ +#+ +#+ +#+",
"#+# #+# #+# #+# #+# #+# #+# #+# #+# ",
" ######## ### ### ######## ######## ### ###",
},
.rows = 7,
.cols = 58
};
// and game over one!
ART over = {
.art = {
" #### ## # # ###### #### # # ###### ##### ",
"# # # # ## ## # # # # # # # #",
"# # # # ## # ##### # # # # ##### # #",
"# ### ###### # # # # # # # # ##### ",
"# # # # # # # # # # # # # # ",
" #### # # # # ###### #### ## ###### # #",
},
.rows = 6,
.cols = 58
};
// and the ending one!
ART won = {
.art = {
"# # # # ###",
" # # #### # # # # # #### # # ###",
" # # # # # # # # # # # ## # ###",
" # # # # # # # # # # # # # # ",
" # # # # # # # # # # # # # ",
" # # # # # # # # # # # ## ###",
" # #### #### ## ## #### # # ###",
},
.rows = 7,
.cols = 49
};
// and a function for how they'll be displayed
void printart(ART* art, int y, int x) {
// default position: the game window's center
if (y < 1) y = (50-art->rows)/2;
if (x < 1) x = (80-art->cols)/2;
// a window might not be necessary for now
// but in case i ever decide to implement
// colors it'll end up being useful
art->win = derwin(game, art->rows, art->cols, y, x);
// write each row into the screen with a little
// (.05-second) delay so that it's animated
for (int i = 0; i <= art->rows; ++i) {
mvwprintw(art->win, i, 0, "%s", art->art[i]);
touchwin(game);
wrefresh(art->win);
napms(50);
}
// and delete it while leaving its
// contents onscreen
delwin(art->win);
}