uint8_t get_field_from_uart(int* m){ uint8_t retVal; while(TRUE){ mouse_read_input(); //Test int x = global_mouse_position.x; int y = global_mouse_position.y; bool_t mouseclick = is_mouse_clicked(); draw_curser(x,y,m); if(mouseclick == TRUE){ if(x >= 10 && x <= 610 && y >= 10 && y <= 610){ retVal = ((y - 10) / 200) * 3 + (x - 10) / 200; return retVal; } } } /*while(TRUE) { device_read(global_device_manager,handle,buffer,messagelength); for (i = 0; i < messagelength; i++){ message[i] = ((char*)buffer)[i]; } }*/ }
int mouse_doing(void) { int fd; mouse_event m_event; fd = open ("/dev/input/mice", O_RDWR|O_NONBLOCK); if (-1 == fd) { perror ("mice"); exit(0); } mx = fb_v.w/2; my = fb_v.h/2; int press_flag = 0; int end_flag = 0; draw_curser(mx ,my); while(1) { if (get_m_info(fd, &m_event)>0) { restore(mx, my); mx += m_event.dx; my += m_event.dy; mx = ((mx<0) ? 0 : mx); my = ((my<0) ? 0 : my); if (mx > (fb_v.w-C_W)) { mx = fb_v.w-C_W; } if (my >(fb_v.h-C_H)) { my = fb_v.h-C_H; } switch(m_event.button) { case 0: if (1 == press_flag) { press_flag = 0; if (0 == end_flag) { end_flag = chess_do(); } else { print_board(); end_flag = 0; } } break; case 1: press_flag = 1; break; case 2: break; case 4: break; default: break; } draw_curser(mx, my); } usleep(100); } return 0; }