Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void update() throws Exception{
- previousPositions[pointIndex] = filteredPositions;
- ledCount = 0;
- receivedBytes = Arrays.copyOfRange(wiimote.getBytes(), 7, 19);
- for(int i = 0; i < 12; i++){
- System.out.print(receivedBytes[i] + " ");
- }
- System.out.println();
- for(int i = 0; i < 4; i++){
- if(receivedBytes[i * 3] != -1 || receivedBytes[i * 3 + 1] != -1 || receivedBytes[i * 3 + 2] != -1){
- int x = 1024 - (((receivedBytes[i * 3 + 2] & 48) >> 4) * 256 + (receivedBytes[i * 3 + 0] + 256) % 256);
- int y = 768 - (((receivedBytes[i * 3 + 2] & 192) >> 6) * 256 + (receivedBytes[i * 3 + 1] + 256) % 256);
- filteredPositions[i].x = x * screenSize.width / 824 - 100;
- filteredPositions[i].y = y * screenSize.height / 568 - 100;
- ledCount++;
- }
- }
- pointIndex = (pointIndex + 1) % 5;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement