int main(void) { openfb("/dev/fb0"); initGame(); SetTimer(1,alarm_handler); while(1) { char c; c = getch(); fflush(NULL); switch(c) { case 'w': rotate(); break; case 'a': moveLeft(); break; case 's': moveDown(); break; case 'd': moveRight(); break; case 'q': printf("Game Aborted!!!\n"); printf("Your score:%d\n",getScore()); exit(0); default: break; } } closefb(); return 0; }
main() { struct draw_widget hline; hline.sx = 30; hline.sy = 10; hline.ex = 300; hline.ey = 200; hline.color.red = 45; hline.color.green = 125; hline.color.blue = 200; hline.color.alphy = 100; // drawline(hline); // printf("Enter R,G,B Code (0-255):"); // scanf("$d,%d,%d",&hline.color.red,&hline.color.green,&hline.color.blue); openfb(); for (hline.sy == 0;hline.ey < 239;hline.sy++) { hline.ey++ ; // hline.color.green--; drawline(hline); } /* int i = 0; while(hline.color.alphy == 0) { if(i==0){ hline.ey++; }else if(i==1){ hline.ey--; } hline.ex++; hline.color.red--; hline.color.green=hline.color.green-hline.color.blue; hline.color.blue=hline.color.blue-hline.color.red+hline.color.green; if (hline.color.red==0){ hline.color.red=255; }else if (hline.color.green<2){ hline.color.green=255; }else if (hline.color.blue<3){ hline.color.blue=255; } drawline(hline); if(hline.ey == 239) { i=1; }else if(hline.ey == 120){ i=0; } if(hline.ex == 239){ hline.ex=0; } } */ closefb(); }
int main( int argc, char ** argv) { rfbClient* cl; if (openfb()) { fprintf(stderr, "%s: could not open frame buffer console\n", argv[0]); exit(1); } printf("%s: Starting\n", argv[0]); cl = rfbGetClient(5,3,2); cl->MallocFrameBuffer=allocate; cl->canHandleNewFBSize = FALSE; cl->format.depth = 16; cl->appData.requestedDepth = cl->format.depth; cl->format.redMax = (1 << 5) - 1; cl->format.greenMax = (1 << 6) - 1; cl->format.blueMax = (1 << 5) - 1; cl->format.redShift = 5 + 6; cl->format.greenShift = 5; cl->format.blueShift = 0; if (!rfbInitClient(cl, &argc, argv)) return 1; while(1) { int i = WaitForMessage(cl, 500); if (i < 0) return 0; if (i) if (!HandleRFBServerMessage(cl)) return 0; } return 0; }