Pārlūkot izejas kodu

Fixed loadFrame (almost....)

Max Nuding 12 gadus atpakaļ
vecāks
revīzija
e45d75ed04
1 mainītis faili ar 19 papildinājumiem un 7 dzēšanām
  1. 19
    7
      Cube Control/AnimationUtility.java

+ 19
- 7
Cube Control/AnimationUtility.java Parādīt failu

131
   }
131
   }
132
 
132
 
133
   private static AFrame readFrame(Scanner sc, int index) {
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
   frame.setData(d);
143
   frame.setData(d);
142
   d = hexConvert(sc.nextLine());
144
   d = hexConvert(sc.nextLine());
143
   frame.setTime(d[0]);
145
   frame.setTime(d[0]);
144
   return frame;
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
   private static short[] concat(short[] a, short[] b) {
159
   private static short[] concat(short[] a, short[] b) {
148
   short[] c = new short[a.length + b.length];
160
   short[] c = new short[a.length + b.length];

Notiek ielāde…
Atcelt
Saglabāt