eobish

view src/fblibdos.c @ 7:6a350c554e46

started DOS port
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 19 Jan 2015 15:49:14 +0200
parents
children
line source
1 #ifdef FBLIB_DOS
2 #include "vbegfx.h"
4 static unsigned char *framebuf;
6 int fb_init(int width, int height, int bpp)
7 {
8 init_timer(128);
9 if(kb_init(32) == -1) {
10 fprintf(stderr, "failed to initialize keyboard driver\n");
11 return false;
12 }
14 if(!(framebuf = set_video_mode(width, height, bpp))) {
15 return -1;
16 }
17 fb_width = width;
18 fb_height = height;
19 fb_bpp = get_color_depth();
22 return 0;
23 }
25 void fb_shutdown(void)
26 {
27 framebuf = 0;
28 set_text_mode();
29 }
31 void *fb_begin_frame(void)
32 {
33 return framebuf;
34 }
36 void fb_end_frame(void)
37 {
38 wait_vsync(void);
39 }
41 void fb_set_palette_range(int start, int count, int *colors)
42 {
43 /* TODO: add a range-palette setter in vbegfx.c */
44 int i;
45 for(i=0; i<count; i++) {
46 set_palette(start + i, colors[0], colors[1], colors[2]);
47 colors += 3;
48 }
49 }
51 int fb_process_events(void)
52 {
53 if(handle_keyboard() == -1) {
54 return -1;
55 }
56 if(handle_mouse() == -1) {
57 return -1;
58 }
59 return 0;
60 }
62 #endif /* FBLIB_DOS */