Advertisement
Guest User

Untitled

a guest
Aug 16th, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. public void update() throws Exception{
  2.  
  3. previousPositions[pointIndex] = filteredPositions;
  4.  
  5. ledCount = 0;
  6.  
  7. receivedBytes = Arrays.copyOfRange(wiimote.getBytes(), 7, 19);
  8.  
  9. for(int i = 0; i < 12; i++){
  10.  
  11. System.out.print(receivedBytes[i] + " ");
  12. }
  13. System.out.println();
  14.  
  15. for(int i = 0; i < 4; i++){
  16.  
  17. if(receivedBytes[i * 3] != -1 || receivedBytes[i * 3 + 1] != -1 || receivedBytes[i * 3 + 2] != -1){
  18.  
  19. int x = 1024 - (((receivedBytes[i * 3 + 2] & 48) >> 4) * 256 + (receivedBytes[i * 3 + 0] + 256) % 256);
  20. int y = 768 - (((receivedBytes[i * 3 + 2] & 192) >> 6) * 256 + (receivedBytes[i * 3 + 1] + 256) % 256);
  21.  
  22. filteredPositions[i].x = x * screenSize.width / 824 - 100;
  23. filteredPositions[i].y = y * screenSize.height / 568 - 100;
  24.  
  25. ledCount++;
  26. }
  27. }
  28.  
  29. pointIndex = (pointIndex + 1) % 5;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement