-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgraphics-fb.c
More file actions
63 lines (54 loc) · 934 Bytes
/
graphics-fb.c
File metadata and controls
63 lines (54 loc) · 934 Bytes
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
#include <stdio.h>
#include <stdint.h>
#define FB_IMP
#include "fb.h"
#include "globals.h"
#include "graphics.h"
#include "graphics-fb.h"
#define fb ((FB*)disp)
static void
fb_clear(void) {
BITMAP_CLEAR(fb);
}
static void
fb_draw_error(void) {
BITMAP_ERR(fb);
fb_flush(fb);
}
static void
fb_draw_info(void) {
printf("%d/%d", page->n + 1, book->page_count);
fflush(stdout);
}
static void
fb_clear_info(void) {
printf("\033[1K\r");
fflush(stdout);
}
static void
fb_draw_image(Page *pg) {
BITMAP_COPY(fb, pg);
fb_flush(fb);
}
static void
fb_quit(void) {
fb_clear();
fflush(stdout);
fb_free(fb);
}
void
fb_main(void) {
int c;
int mult;
double max_w, max_h;
disp = (void*)fb_init();
fclose(stderr);
printf("\033[H");
fflush(stdout);
HANDLE_KEY_INIT(fb->w, fb->h)
goto draw;
for(;;) {
c = getchar();
HANDLE_KEY(c, fb_)
}
}