Browse Source

Fixed loadFrame (almost....)

Max Nuding 12 years ago
parent
commit
e45d75ed04
1 changed files with 19 additions and 7 deletions
  1. 19
    7
      Cube Control/AnimationUtility.java

+ 19
- 7
Cube Control/AnimationUtility.java View File

@@ -131,18 +131,30 @@ public class AnimationUtility {
131 131
   }
132 132
 
133 133
   private static AFrame readFrame(Scanner sc, int index) {
134
-  AFrame frame = new AFrame();
135
-  frame.setName(sc.nextLine());
136
-  short[] d = {};
137
-  for (int i = 0; i < 8; i++) {
138
-    short[] data = hexConvert(sc.nextLine());
139
-    d = concat(data, d);
140
-  }
134
+    AFrame frame = new AFrame();
135
+    frame.setName(sc.nextLine());
136
+    short[] d = {};
137
+    for (int i = 0; i < 8; i++) {
138
+      short[] data = hexConvert(sc.nextLine());
139
+      d = concat(data, d);
140
+    }
141
+  
142
+  d = invert(d);
141 143
   frame.setData(d);
142 144
   d = hexConvert(sc.nextLine());
143 145
   frame.setTime(d[0]);
144 146
   return frame;
145 147
   }
148
+  
149
+  private static short[] invert(short[] a){
150
+    short[] tmp = new short[a.length];
151
+    int j = 0;
152
+    for(int i = a.length-1; i >= 0; i--){
153
+      tmp[j] = a[i];
154
+      j++;
155
+    }
156
+    return tmp;
157
+  }
146 158
 
147 159
   private static short[] concat(short[] a, short[] b) {
148 160
   short[] c = new short[a.length + b.length];

Loading…
Cancel
Save