资源描述:
《在linux下ubuntu的五子棋游戏c语言代码》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、#include#include//#include#include#include#include#include#defineFB_W1024#defineFB_H768#defineCHESSBOARD110#defineCHESSBOARD210#defineX_OFFSET400#defineY_OFFSET200#defineX_CAPASITY10#defineY_CAPASITY10#defineSPACE40#de
2、fineRED0x00ff0000#defineBLUE0x0000ff00#defineWHITE0xffffffff#defineBLACK0xff000000#defineNOKEY0#defineRADIO19#defineC_H17#defineC_W10#defineT___0x00ffffff#defineX___0xff00ffff#defineBORD0xeeff0000#defineu32_tunsignedintintarray[CHESSBOARD1][CHESSBOARD2][1];intboard[CHESSBOARD1][CHESSBOARD2];intp
3、lay1[CHESSBOARD1][CHESSBOARD2][4];intcom[CHESSBOARD1][CHESSBOARD2][4];intcursor_store[C_H][C_W];structfb_info{intw;inth;intbpp;int*mem;}fb;staticu32_tcursor_pixel[C_H][C_W]={{BORD,T___,T___,T___,T___,T___,T___,T___,T___,T___},{BORD,BORD,T___,T___,T___,T___,T___,T___,T___,T___},{BORD,X___,BORD,T_
4、__,T___,T___,T___,T___,T___,T___},{BORD,X___,X___,BORD,T___,T___,T___,T___,T___,T___},{BORD,X___,X___,X___,BORD,T___,T___,T___,T___,T___},{BORD,X___,X___,X___,X___,BORD,T___,T___,T___,T___},{BORD,X___,X___,X___,X___,X___,BORD,T___,T___,T___},{BORD,X___,X___,X___,X___,X___,X___,BORD,T___,T___},{B
5、ORD,X___,X___,X___,X___,X___,X___,X___,BORD,T___},{BORD,X___,X___,X___,X___,X___,X___,X___,X___,BORD},{BORD,X___,X___,X___,X___,X___,BORD,BORD,BORD,BORD},{BORD,X___,X___,BORD,X___,X___,BORD,T___,T___,T___},{BORD,X___,BORD,T___,BORD,X___,X___,BORD,T___,T___},{BORD,BORD,T___,T___,BORD,X___,X___,BO
6、RD,T___,T___},{T___,T___,T___,T___,T___,BORD,X___,X___,BORD,T___},{T___,T___,T___,T___,T___,BORD,X___,X___,BORD,T___},{T___,T___,T___,T___,T___,T___,BORD,BORD,T___,T___}};intfb_open(){intfd;int*mem;fd=open("/dev/fb0",O_RDWR);if(fd<0){printf("openfileerror!");return1;}structfb_var_screeninfofb_
7、var;ioctl(fd,FBIOGET_VSCREENINFO,&fb_var);fb.w=fb_var.xres;fb.h=fb_var.yres;fb.bpp=fb_var.bits_per_pixel;printf("w:%dh:%dbpp:%d",fb_var.xres,fb_var.yres,fb_var.bits_per_pixel);fb.mem=mmap(NULL,FB_H*FB_W*fb_var.bits_per_pix