-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexunicode.c
More file actions
42 lines (34 loc) · 1.24 KB
/
exunicode.c
File metadata and controls
42 lines (34 loc) · 1.24 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
// SPDX-License-Identifier: MIT
#define AMP_BUF_SIZE 2048 // Let's use the integrated buffer for convenience.
#include "../../amp.h"
int main(int, char **) {
struct amp_type amp;
if (amp_init(&, 16, 8, nullptr, 0) > sizeof(amp.buffer)) {
static const char message[] = "amp_init: not enough memory provided\n";
write(2, message, strlen(message));
return EXIT_FAILURE;
}
for (long y = 1; y < amp_get_height(&); ++y) {
for (long x = 1; x < amp_get_width(&); ++x) {
amp_print_glyph(&, x, y, AMP_BG_CHARCOAL, "▒");
}
}
amp_print_text(
&, 0, 0, AMP_BG_BLUE|AMP_FG_WHITE, 0, AMP_ALIGN_LEFT,
"╔═════════════╗\n"
"║ ║\n"
"║ ║\n"
"║ ║\n"
"║ ║\n"
"║ ║\n"
"╚═════════════╝\n"
""
);
amp_print_text(
&, 1, 1, AMP_FG_YELLOW|AMP_BG_NAVY, amp_get_width(&) - 3,
AMP_ALIGN_LEFT, "In this example, we also see text wrapping in action."
);
amp_to_ans(&, nullptr, 0); // Write to stdout.
amp_stdout("\n", 1);
return EXIT_SUCCESS;
}