void update(void){ f.update(); razer_convert_keycode_to_pos(keys_history[0],&pos); if (last_pos.x!=pos.x || last_pos.y!=pos.y){ last_pos.x=pos.x; last_pos.y=pos.y; //cout <<"key pos = "<<(pos).x<<","<<(pos).y<<endl; } direction_t d=LEFT; if(pos.x == 16 && pos.y == 4) d=UP; else if(pos.x == 16 && pos.y == 5) d=DOWN; else if(pos.x == 15 && pos.y == 5) d=LEFT; else if(pos.x == 17 && pos.y == 5) d=RIGHT; s.move(d); g.update(); s.update(); razer_update_keys(chroma,chroma->keys); usleep(400000); Cord sc = s.getFront(); Cord fc = g.getPosition(); if(sc.x==fc.x && sc.y==fc.y){ Food tmp = Food(); s.grow(); s.grow(); g = tmp; } razer_update(chroma); razer_frame_limiter(chroma,13); }