2 * fbmngplay - fb console MNG player.
3 * (c) 2001-2002 by Stefan Reinauer, <stepan@suse.de>
5 * This program is based on mngplay, written and (C) by
6 * Ralph Giles <giles@ashlu.bc.ca>
8 * This program my be redistributed under the terms of the
9 * GNU General Public Licence, version 2, or at your preference,
20 #include <sys/ioctl.h>
25 #include "fbtruetype.h"
36 unsigned int fbbytes
, fbx
, fby
;
37 unsigned int fbypos
=100, fbxpos
=100;
38 unsigned int fblinelen
, alpha
=100;
39 unsigned char *framebuffer
, *font
=DEFAULT_FONTNAME
;
40 unsigned int fgcolor
=0xff0000;
41 unsigned int fontsize
=36;
43 int rendertext(char *text
, char *fontname
, unsigned int size
, unsigned int forecol
);
45 int main(int argc
, char *argv
[])
47 int fbdev
,c
,option_index
;
49 struct fb_var_screeninfo var
;
50 struct fb_fix_screeninfo fix
;
52 /* Check which console we're running on */
57 static struct option long_options
[] = {
59 {"verbose", 0, 0, 'v'},
61 {"version", 0, 0, 'V'},
62 {"start-console",0,0,'S'},
66 {"textcolor",1,0,'t'},
70 c
= getopt_long(argc
, argv
, "a:x:y:h?vVSc:f:t:s:",
71 long_options
, &option_index
);
83 fbxpos
= atoi(optarg
);
86 fbypos
= atoi(optarg
);
99 start_console
=atoi(optarg
)-1;
108 fgcolor
=strtol(optarg
, NULL
, 16);
111 fontsize
=strtol(optarg
, NULL
, 10);
118 if (optind
>= argc
) {
123 /* Initialize framebuffer */
124 fbdev
= open("/dev/fb/0", O_RDWR
);
126 fbdev
= open("/dev/fb0", O_RDWR
);
128 fprintf(stderr
, "error while opening framebuffer.\n");
133 ioctl(fbdev
, FBIOGET_VSCREENINFO
, &var
);
134 fbbytes
= var
.bits_per_pixel
>>3;
137 ioctl(fbdev
, FBIOGET_FSCREENINFO
, &fix
);
138 fblinelen
= fix
.line_length
;
140 framebuffer
= mmap(NULL
, fblinelen
* fby
,
141 PROT_WRITE
| PROT_READ
, MAP_SHARED
, fbdev
, var
.yoffset
* fblinelen
);
143 rendertext (argv
[optind
], font
, fontsize
, fgcolor
);