int main() { int rfbargc = 0; char **rfbargv = 0; int bpp = 4; rfbScreenInfoPtr server = rfbGetScreen(&rfbargc, rfbargv, FRAMEBUFFER_WIDTH, FRAMEBUFFER_HEIGHT, 8, 3, bpp); fb = new unsigned char[FRAMEBUFFER_WIDTH * FRAMEBUFFER_HEIGHT * bpp]; server->frameBuffer = (char *)fb; server->kbdAddEvent = handleKey; server->ptrAddEvent = handlePointer; rfbInitServer(server); touchscreen_init(); while(!quit) { int x, y; float z; TouchscreenEvent e; while((e = touchscreen_read(&x, &y, &z)) != TOUCHSCREEN_IDLE) { switch(e) { case TOUCHSCREEN_START: printf("start %d %d %f\n", x, y, z); draw_new_circle(server, x, y, z / 16.0); break; case TOUCHSCREEN_DRAG: printf("drag %d %d %f\n", x, y, z); draw_new_circle(server, x, y, z / 16.0); break; case TOUCHSCREEN_STOP: printf("stop\n"); break; case TOUCHSCREEN_IDLE: default: break; } } // usleep(100000); rfbProcessEvents(server, 10000); } }
void board_init() { pTouch = touchscreen_init(IMAGE_WIDTH, IMAGE_HEIGHT); }