Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

AndroidÔ­Éú(Native)C¿ª·¢Ö®¶þ framebufferƪ


Èç¶ÔAndroidÔ­Éú(Natvie)C¿ª·¢»¹ÈκÎÒÉÎÊ£¬Çë²ÎÔÄhttp://emck.avaw.com/?p=205
ËäÈ»ÏÖÔÚÄÜͨ¹ý½»²æ»·¾³±àÒë³ÌÐò£¬²¢pushµ½AndroidÉÏÖ´ÐУ¬µ«ÄÇÖ»ÊÇconsolę³ÌÐò£¬ÊDz»ÊÇÓÐЩµ¥µ÷ÄØ£¿ÏÂÃæ¾ÍÒª¿´ÈçºÎͨ¹ýLinuxµÄ framebuffer ¼¼ÊõÔÚAndroidÉÏ»­Í¼ÐΣ¬¹ØÓÚLinuxµÄframebuffer¼¼Êõ£¬ÕâÀï¾Í²»ÔÙÏêϸ½²½âÁË£¬Çë´ó¼Ògoogleһϡ£
²Ù×÷framebufferµÄÖ÷Òª²½ÖèÈçÏ£º
1¡¢´ò¿ªÒ»¸ö¿ÉÓõÄFrameBufferÉ豸£»
2¡¢Í¨¹ýmmapµ÷ÓðÑÏÔ¿¨µÄÎïÀíÄÚ´æ¿Õ¼äÓ³Éäµ½Óû§¿Õ¼ä£»
3¡¢¸ü¸ÄÄÚ´æ¿Õ¼äÀïµÄÏñËØÊý¾Ý²¢ÏÔʾ£»
4¡¢Í˳öʱ¹Ø±ÕframebufferÉ豸¡£
ÏÂÃæµÄÕâ¸öÀý×Ó¼òµ¥µØÓÃframebuffer»­ÁËÒ»¸ö½¥±äµÄ½ø¶ÈÌõ£¬´úÂë framebuf.c ÈçÏ£º
#include <unistd.h>
#include <stdio.h>
#include <fcntl.h>
#include <linux/fb.h>
#include <sys/mman.h>
inline static unsigned short int make16color(unsigned char r, unsigned char g, unsigned char b)
{
return (
(((r >> 3) & 31) << 11) |
(((g >> 2) & 63) << 5)  |
((b >> 3) & 31)        );
}
int main() {
int fbfd = 0;
struct fb_var_screeninfo vinfo;
struct fb_fix_screeninfo finfo;
long int screensize = 0;
char *fbp = 0;
int x = 0, y = 0;
int guage_height = 20, step = 10;
long int location = 0;
// Open the file for reading and writing
fbfd = open(”/dev/graphics/fb0″, O_RDWR);
if (!fbfd) {
printf(”Error: cannot open framebuffer device.\n”);
exit(1);
}
printf(”The framebuffer device was opened successfully.\n”);
// Get fixed screen information
if (ioctl(fbfd, FBIOGET_FSCREENINFO, &finfo)) {
printf(”Error reading fixed information.\n”);
exit(2);
}
// Get variable screen information
if (ioctl(fbfd, FBIOGET_VSCREENINFO, &vinfo)) {
printf(”Error reading variable information.\n”);
exit(3);
}
printf(”sizeof(unsigned short) = %d\n”, sizeof(unsigned short));
printf(”%dx%d, %dbpp\n”, vinfo.xres, vinfo.yres, vinfo.bits_per_pixel );
printf(”xoffset:%d, yoffset:%d, line_length


Ïà¹ØÎĵµ£º

extern "C"


1.ÒýÑÔ
C++ÓïÑԵĴ´½¨³õÖÔÊÇ“a better
C”£¬µ«ÊÇÕâ²¢²»Òâζ×ÅC++ÖÐÀàËÆCÓïÑÔµÄÈ«¾Ö±äÁ¿ºÍº¯ÊýËù²ÉÓõıàÒëºÍÁ¬½Ó·½Ê½ÓëCÓïÑÔÍêÈ«Ïàͬ¡£×÷ΪһÖÖÓûÓëC¼æÈݵÄÓïÑÔ£¬C++±£ÁôÁËÒ»²¿·Ö¹ý³ÌʽÓïÑÔµÄÌØµã£¨±»ÊÀÈ˳ÆÎª“²»³¹µ×µØÃæÏò¶ÔÏ󔣩£¬Òò¶øËü¿ÉÒÔ¶¨Òå²»ÊôÓÚÈκÎÀàµÄÈ«¾Ö±äÁ¿ºÍº¯Êý¡£µ«ÊÇ£¬C++±Ï¾ ......

¡¶CºÍÖ¸Õë¡·±Ê¼Ç1

1.scanf¸ñʽ·û        p9
ld    long
lf    double
2.Èý×Öĸ´Ê        p22
    ΪÁ˱íÊ¾Ò»Ð©ÌØÊâµÄ×Ö·û£¬ÔÚÀÏʽµÄ»úÆ÷¼üÅÌÖпÉÄÜûÓеÄ×Ö·û£¬ÌرðÔ¼¶¨ÁËÒ»ÖÖÈý×Öĸ´Ê£¬Èý×Öĸ´Ê¶¼ÒÔ??¿ªÊ¼£¬ÈçÏ£º
??( &nb ......

realview MDK C/C++ »ìºÏ±à³ÌÎÊÌâ

ǰ¼¸Ìì¸ãÒ»¸öÏîÄ¿Éæ¼°µ½C/C++»ìºÏ±à³Ì£¬ÔÚKeilϱàÒëʱÌáʾ£º
error: #800:this declaration may not have extern "C" linkage
error: At end of source : #67:expected a "}"
µ±Ê±Á¢ÂíÏëµ½ÊÇCºÍC++±à³ÌʱÐèÒªextern "C"£¬ÂíÉÏÊÔÁËÊÔ£¬È»ºóÐû¸æÊ§°Ü¡£
ÒòΪ˫»÷ºóÌáʾ³ö´íµÄµØ·½ÊÇtemplate<clase T>,ÒÔΪÊÇkeil²»Ö ......

¹ØÓÚ¡¶0 bug C/C++ÉÌÓù¤³ÌÖ®µÀ¡·µÄÒ»µã˵Ã÷

ÎÒÕâÁ½ÌìÔÚCSDNÂÛ̳¿ªÁËÒ»¸öÉ¢·ÖÌù£¬ÏëÐû´«Ò»ÏÂÎÒµÄÊé¡£´ó¶àÊýÅóÓÑ»¹ÊǺÜÓѺõ쬶ÔÎÒµÄÖ§³ÖºÍ¹ÄÀøºÜ¶à£¬ÎÒÒ²ºÜ¸Ð¼¤¡£
ÍøÖ·ÔÚÕâÀhttp://topic.csdn.net/u/20091216/22/5a6594be-21e6-459e-ab41-57755273f465.html
µ±È»£¬Ò²ÓÐÅóÓÑÈÏΪФijÈË´µÅ££¬Ëµ0bug²»¿ÉÄÜ£¬²¢ÇÒÒþÒþÓÐPKµÄÒâ˼£¬ÎÒÄØÃ»°ì·¨£¬Ð´Á˸ö˵Ã÷¡£
ÕâÀïÏëÁ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ